Skip to main content

bitwarden_api_api/models/
cipher_request_model.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CipherRequestModel {
17    /// The Id of the user that encrypted the cipher. It should always represent a UserId.
18    #[serde(
19        rename = "encryptedFor",
20        alias = "EncryptedFor",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub encrypted_for: Option<uuid::Uuid>,
24    /// Hex-encoded key id of the user key the client held when it encrypted this cipher. Absent
25    /// for clients that predate the field. When present, it must match the acting user's current
26    /// user key id.
27    #[serde(
28        rename = "encryptedByKeyId",
29        alias = "EncryptedByKeyId",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub encrypted_by_key_id: Option<String>,
33    #[serde(
34        rename = "type",
35        alias = "R#type",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub r#type: Option<models::CipherType>,
39    #[serde(
40        rename = "organizationId",
41        alias = "OrganizationId",
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub organization_id: Option<String>,
45    #[serde(
46        rename = "folderId",
47        alias = "FolderId",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub folder_id: Option<String>,
51    #[serde(
52        rename = "favorite",
53        alias = "Favorite",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub favorite: Option<bool>,
57    #[serde(
58        rename = "reprompt",
59        alias = "Reprompt",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub reprompt: Option<models::CipherRepromptType>,
63    #[serde(rename = "key", alias = "Key", skip_serializing_if = "Option::is_none")]
64    pub key: Option<String>,
65    #[serde(rename = "name", alias = "Name")]
66    pub name: String,
67    #[serde(
68        rename = "notes",
69        alias = "Notes",
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub notes: Option<String>,
73    #[serde(
74        rename = "fields",
75        alias = "Fields",
76        skip_serializing_if = "Option::is_none"
77    )]
78    pub fields: Option<Vec<models::CipherFieldModel>>,
79    #[serde(
80        rename = "passwordHistory",
81        alias = "PasswordHistory",
82        skip_serializing_if = "Option::is_none"
83    )]
84    pub password_history: Option<Vec<models::CipherPasswordHistoryModel>>,
85    #[serde(
86        rename = "attachments",
87        alias = "Attachments",
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub attachments: Option<std::collections::HashMap<String, String>>,
91    #[serde(
92        rename = "attachments2",
93        alias = "Attachments2",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub attachments2: Option<std::collections::HashMap<String, models::CipherAttachmentModel>>,
97    #[serde(
98        rename = "login",
99        alias = "Login",
100        skip_serializing_if = "Option::is_none"
101    )]
102    pub login: Option<Box<models::CipherLoginModel>>,
103    #[serde(
104        rename = "card",
105        alias = "Card",
106        skip_serializing_if = "Option::is_none"
107    )]
108    pub card: Option<Box<models::CipherCardModel>>,
109    #[serde(
110        rename = "identity",
111        alias = "Identity",
112        skip_serializing_if = "Option::is_none"
113    )]
114    pub identity: Option<Box<models::CipherIdentityModel>>,
115    #[serde(
116        rename = "secureNote",
117        alias = "SecureNote",
118        skip_serializing_if = "Option::is_none"
119    )]
120    pub secure_note: Option<Box<models::CipherSecureNoteModel>>,
121    #[serde(
122        rename = "sshKey",
123        alias = "SshKey",
124        skip_serializing_if = "Option::is_none"
125    )]
126    pub ssh_key: Option<Box<models::CipherSshKeyModel>>,
127    #[serde(
128        rename = "bankAccount",
129        alias = "BankAccount",
130        skip_serializing_if = "Option::is_none"
131    )]
132    pub bank_account: Option<Box<models::CipherBankAccountModel>>,
133    #[serde(
134        rename = "driversLicense",
135        alias = "DriversLicense",
136        skip_serializing_if = "Option::is_none"
137    )]
138    pub drivers_license: Option<Box<models::CipherDriversLicenseModel>>,
139    #[serde(
140        rename = "passport",
141        alias = "Passport",
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub passport: Option<Box<models::CipherPassportModel>>,
145    /// JSON string containing cipher-specific data
146    #[serde(
147        rename = "data",
148        alias = "Data",
149        skip_serializing_if = "Option::is_none"
150    )]
151    pub data: Option<String>,
152    #[serde(
153        rename = "lastKnownRevisionDate",
154        alias = "LastKnownRevisionDate",
155        skip_serializing_if = "Option::is_none"
156    )]
157    pub last_known_revision_date: Option<String>,
158    #[serde(
159        rename = "archivedDate",
160        alias = "ArchivedDate",
161        skip_serializing_if = "Option::is_none"
162    )]
163    pub archived_date: Option<String>,
164}
165
166impl CipherRequestModel {
167    pub fn new(name: String) -> CipherRequestModel {
168        CipherRequestModel {
169            encrypted_for: None,
170            encrypted_by_key_id: None,
171            r#type: None,
172            organization_id: None,
173            folder_id: None,
174            favorite: None,
175            reprompt: None,
176            key: None,
177            name,
178            notes: None,
179            fields: None,
180            password_history: None,
181            attachments: None,
182            attachments2: None,
183            login: None,
184            card: None,
185            identity: None,
186            secure_note: None,
187            ssh_key: None,
188            bank_account: None,
189            drivers_license: None,
190            passport: None,
191            data: None,
192            last_known_revision_date: None,
193            archived_date: None,
194        }
195    }
196}