Skip to main content

bitwarden_api_api/models/
cipher_with_id_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 CipherWithIdRequestModel {
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 key the client held when it encrypted this cipher: the user key
25    /// for a user-owned cipher, the organization key for an organization cipher. Absent for
26    /// clients that predate the field. For a user-owned cipher it must match the acting user's
27    /// current user key id; for an organization cipher it is not validated, because organizations
28    /// carry no key id yet.
29    #[serde(
30        rename = "encryptedByKeyId",
31        alias = "EncryptedByKeyId",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub encrypted_by_key_id: Option<String>,
35    #[serde(
36        rename = "type",
37        alias = "R#type",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub r#type: Option<models::CipherType>,
41    #[serde(
42        rename = "organizationId",
43        alias = "OrganizationId",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub organization_id: Option<String>,
47    #[serde(
48        rename = "folderId",
49        alias = "FolderId",
50        skip_serializing_if = "Option::is_none"
51    )]
52    pub folder_id: Option<String>,
53    #[serde(
54        rename = "favorite",
55        alias = "Favorite",
56        skip_serializing_if = "Option::is_none"
57    )]
58    pub favorite: Option<bool>,
59    #[serde(
60        rename = "reprompt",
61        alias = "Reprompt",
62        skip_serializing_if = "Option::is_none"
63    )]
64    pub reprompt: Option<models::CipherRepromptType>,
65    #[serde(rename = "key", alias = "Key", skip_serializing_if = "Option::is_none")]
66    pub key: Option<String>,
67    #[serde(
68        rename = "name",
69        alias = "Name",
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub name: Option<String>,
73    #[serde(
74        rename = "notes",
75        alias = "Notes",
76        skip_serializing_if = "Option::is_none"
77    )]
78    pub notes: Option<String>,
79    #[serde(
80        rename = "fields",
81        alias = "Fields",
82        skip_serializing_if = "Option::is_none"
83    )]
84    pub fields: Option<Vec<models::CipherFieldModel>>,
85    #[serde(
86        rename = "passwordHistory",
87        alias = "PasswordHistory",
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub password_history: Option<Vec<models::CipherPasswordHistoryModel>>,
91    #[serde(
92        rename = "attachments",
93        alias = "Attachments",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub attachments: Option<std::collections::HashMap<String, String>>,
97    #[serde(
98        rename = "attachments2",
99        alias = "Attachments2",
100        skip_serializing_if = "Option::is_none"
101    )]
102    pub attachments2: Option<std::collections::HashMap<String, models::CipherAttachmentModel>>,
103    #[serde(
104        rename = "login",
105        alias = "Login",
106        skip_serializing_if = "Option::is_none"
107    )]
108    pub login: Option<Box<models::CipherLoginModel>>,
109    #[serde(
110        rename = "card",
111        alias = "Card",
112        skip_serializing_if = "Option::is_none"
113    )]
114    pub card: Option<Box<models::CipherCardModel>>,
115    #[serde(
116        rename = "identity",
117        alias = "Identity",
118        skip_serializing_if = "Option::is_none"
119    )]
120    pub identity: Option<Box<models::CipherIdentityModel>>,
121    #[serde(
122        rename = "secureNote",
123        alias = "SecureNote",
124        skip_serializing_if = "Option::is_none"
125    )]
126    pub secure_note: Option<Box<models::CipherSecureNoteModel>>,
127    #[serde(
128        rename = "sshKey",
129        alias = "SshKey",
130        skip_serializing_if = "Option::is_none"
131    )]
132    pub ssh_key: Option<Box<models::CipherSshKeyModel>>,
133    #[serde(
134        rename = "bankAccount",
135        alias = "BankAccount",
136        skip_serializing_if = "Option::is_none"
137    )]
138    pub bank_account: Option<Box<models::CipherBankAccountModel>>,
139    #[serde(
140        rename = "driversLicense",
141        alias = "DriversLicense",
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub drivers_license: Option<Box<models::CipherDriversLicenseModel>>,
145    #[serde(
146        rename = "passport",
147        alias = "Passport",
148        skip_serializing_if = "Option::is_none"
149    )]
150    pub passport: Option<Box<models::CipherPassportModel>>,
151    /// JSON string containing cipher-specific data
152    #[serde(
153        rename = "data",
154        alias = "Data",
155        skip_serializing_if = "Option::is_none"
156    )]
157    pub data: Option<String>,
158    #[serde(
159        rename = "lastKnownRevisionDate",
160        alias = "LastKnownRevisionDate",
161        skip_serializing_if = "Option::is_none"
162    )]
163    pub last_known_revision_date: Option<String>,
164    #[serde(
165        rename = "archivedDate",
166        alias = "ArchivedDate",
167        skip_serializing_if = "Option::is_none"
168    )]
169    pub archived_date: Option<String>,
170    /// True when this cipher is owned by an organization, and so is encrypted with the
171    /// organization key rather than the acting user's key.
172    #[serde(
173        rename = "isOrganizationCipher",
174        alias = "IsOrganizationCipher",
175        skip_serializing_if = "Option::is_none"
176    )]
177    pub is_organization_cipher: Option<bool>,
178    #[serde(rename = "id", alias = "Id")]
179    pub id: uuid::Uuid,
180}
181
182impl CipherWithIdRequestModel {
183    pub fn new(id: uuid::Uuid) -> CipherWithIdRequestModel {
184        CipherWithIdRequestModel {
185            encrypted_for: None,
186            encrypted_by_key_id: None,
187            r#type: None,
188            organization_id: None,
189            folder_id: None,
190            favorite: None,
191            reprompt: None,
192            key: None,
193            name: None,
194            notes: None,
195            fields: None,
196            password_history: None,
197            attachments: None,
198            attachments2: None,
199            login: None,
200            card: None,
201            identity: None,
202            secure_note: None,
203            ssh_key: None,
204            bank_account: None,
205            drivers_license: None,
206            passport: None,
207            data: None,
208            last_known_revision_date: None,
209            archived_date: None,
210            is_organization_cipher: None,
211            id,
212        }
213    }
214}