bitwarden-api-api 3.0.0

Api bindings for the Bitwarden API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
/*
 * Bitwarden Internal API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: latest
 *
 * Generated by: https://openapi-generator.tech
 */

use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Visitor};

use crate::models;
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum EventType {
    User_LoggedIn,
    User_ChangedPassword,
    User_Updated2fa,
    User_Disabled2fa,
    User_Recovered2fa,
    User_FailedLogIn,
    User_FailedLogIn2fa,
    User_ClientExportedVault,
    User_UpdatedTempPassword,
    User_MigratedKeyToKeyConnector,
    User_RequestedDeviceApproval,
    User_TdeOffboardingPasswordSet,
    Cipher_Created,
    Cipher_Updated,
    Cipher_Deleted,
    Cipher_AttachmentCreated,
    Cipher_AttachmentDeleted,
    Cipher_Shared,
    Cipher_UpdatedCollections,
    Cipher_ClientViewed,
    Cipher_ClientToggledPasswordVisible,
    Cipher_ClientToggledHiddenFieldVisible,
    Cipher_ClientToggledCardCodeVisible,
    Cipher_ClientCopiedPassword,
    Cipher_ClientCopiedHiddenField,
    Cipher_ClientCopiedCardCode,
    Cipher_ClientAutofilled,
    Cipher_SoftDeleted,
    Cipher_Restored,
    Cipher_ClientToggledCardNumberVisible,
    Cipher_ClientToggledTOTPSeedVisible,
    Cipher_ClientCopiedBankAccountNumber,
    Cipher_ClientCopiedBankAccountPin,
    Cipher_ClientToggledBankAccountNumberVisible,
    Cipher_ClientToggledBankAccountPinVisible,
    Cipher_ClientCopiedLicenseNumber,
    Cipher_ClientToggledLicenseNumberVisible,
    Cipher_ClientCopiedPassportNumber,
    Cipher_ClientToggledPassportNumberVisible,
    Collection_Created,
    Collection_Updated,
    Collection_Deleted,
    Group_Created,
    Group_Updated,
    Group_Deleted,
    OrganizationUser_Invited,
    OrganizationUser_Confirmed,
    OrganizationUser_Updated,
    OrganizationUser_Removed,
    OrganizationUser_UpdatedGroups,
    OrganizationUser_UnlinkedSso,
    OrganizationUser_ResetPassword_Enroll,
    OrganizationUser_ResetPassword_Withdraw,
    OrganizationUser_AdminResetPassword,
    OrganizationUser_ResetSsoLink,
    OrganizationUser_FirstSsoLogin,
    OrganizationUser_Revoked,
    OrganizationUser_Restored,
    OrganizationUser_ApprovedAuthRequest,
    OrganizationUser_RejectedAuthRequest,
    OrganizationUser_Deleted,
    OrganizationUser_Left,
    OrganizationUser_AutomaticallyConfirmed,
    OrganizationUser_SelfRevoked,
    OrganizationUser_AdminResetTwoFactor,
    OrganizationUser_Revoked_TwoFactorNonCompliance,
    OrganizationUser_Revoked_SingleOrganizationNonCompliance,
    Organization_Updated,
    Organization_PurgedVault,
    Organization_ClientExportedVault,
    Organization_VaultAccessed,
    Organization_EnabledSso,
    Organization_DisabledSso,
    Organization_EnabledKeyConnector,
    Organization_DisabledKeyConnector,
    Organization_SponsorshipsSynced,
    Organization_CollectionManagement_Updated,
    Organization_CollectionManagement_LimitCollectionCreationEnabled,
    Organization_CollectionManagement_LimitCollectionCreationDisabled,
    Organization_CollectionManagement_LimitCollectionDeletionEnabled,
    Organization_CollectionManagement_LimitCollectionDeletionDisabled,
    Organization_CollectionManagement_LimitItemDeletionEnabled,
    Organization_CollectionManagement_LimitItemDeletionDisabled,
    Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled,
    Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled,
    Organization_ItemOrganization_Accepted,
    Organization_ItemOrganization_Declined,
    Organization_AutoConfirmEnabled_Admin,
    Organization_AutoConfirmDisabled_Admin,
    Organization_AutoConfirmEnabled_Portal,
    Organization_AutoConfirmDisabled_Portal,
    Policy_Updated,
    ProviderUser_Invited,
    ProviderUser_Confirmed,
    ProviderUser_Updated,
    ProviderUser_Removed,
    ProviderOrganization_Created,
    ProviderOrganization_Added,
    ProviderOrganization_Removed,
    ProviderOrganization_VaultAccessed,
    OrganizationDomain_Added,
    OrganizationDomain_Removed,
    OrganizationDomain_Verified,
    OrganizationDomain_NotVerified,
    Secret_Retrieved,
    Secret_Created,
    Secret_Edited,
    Secret_Deleted,
    Secret_Permanently_Deleted,
    Secret_Restored,
    Project_Retrieved,
    Project_Created,
    Project_Edited,
    Project_Deleted,
    ServiceAccount_UserAdded,
    ServiceAccount_UserRemoved,
    ServiceAccount_GroupAdded,
    ServiceAccount_GroupRemoved,
    ServiceAccount_Created,
    ServiceAccount_Deleted,
    PhishingBlocker_SiteAccessed,
    PhishingBlocker_SiteExited,
    PhishingBlocker_Bypassed,

    /// Unknown value returned from the server. This is used to handle forward compatibility.
    __Unknown(i64),
}

impl EventType {
    pub fn as_i64(&self) -> i64 {
        match self {
            Self::User_LoggedIn => 1000,
            Self::User_ChangedPassword => 1001,
            Self::User_Updated2fa => 1002,
            Self::User_Disabled2fa => 1003,
            Self::User_Recovered2fa => 1004,
            Self::User_FailedLogIn => 1005,
            Self::User_FailedLogIn2fa => 1006,
            Self::User_ClientExportedVault => 1007,
            Self::User_UpdatedTempPassword => 1008,
            Self::User_MigratedKeyToKeyConnector => 1009,
            Self::User_RequestedDeviceApproval => 1010,
            Self::User_TdeOffboardingPasswordSet => 1011,
            Self::Cipher_Created => 1100,
            Self::Cipher_Updated => 1101,
            Self::Cipher_Deleted => 1102,
            Self::Cipher_AttachmentCreated => 1103,
            Self::Cipher_AttachmentDeleted => 1104,
            Self::Cipher_Shared => 1105,
            Self::Cipher_UpdatedCollections => 1106,
            Self::Cipher_ClientViewed => 1107,
            Self::Cipher_ClientToggledPasswordVisible => 1108,
            Self::Cipher_ClientToggledHiddenFieldVisible => 1109,
            Self::Cipher_ClientToggledCardCodeVisible => 1110,
            Self::Cipher_ClientCopiedPassword => 1111,
            Self::Cipher_ClientCopiedHiddenField => 1112,
            Self::Cipher_ClientCopiedCardCode => 1113,
            Self::Cipher_ClientAutofilled => 1114,
            Self::Cipher_SoftDeleted => 1115,
            Self::Cipher_Restored => 1116,
            Self::Cipher_ClientToggledCardNumberVisible => 1117,
            Self::Cipher_ClientToggledTOTPSeedVisible => 1118,
            Self::Cipher_ClientCopiedBankAccountNumber => 1119,
            Self::Cipher_ClientCopiedBankAccountPin => 1120,
            Self::Cipher_ClientToggledBankAccountNumberVisible => 1121,
            Self::Cipher_ClientToggledBankAccountPinVisible => 1122,
            Self::Cipher_ClientCopiedLicenseNumber => 1123,
            Self::Cipher_ClientToggledLicenseNumberVisible => 1124,
            Self::Cipher_ClientCopiedPassportNumber => 1125,
            Self::Cipher_ClientToggledPassportNumberVisible => 1126,
            Self::Collection_Created => 1300,
            Self::Collection_Updated => 1301,
            Self::Collection_Deleted => 1302,
            Self::Group_Created => 1400,
            Self::Group_Updated => 1401,
            Self::Group_Deleted => 1402,
            Self::OrganizationUser_Invited => 1500,
            Self::OrganizationUser_Confirmed => 1501,
            Self::OrganizationUser_Updated => 1502,
            Self::OrganizationUser_Removed => 1503,
            Self::OrganizationUser_UpdatedGroups => 1504,
            Self::OrganizationUser_UnlinkedSso => 1505,
            Self::OrganizationUser_ResetPassword_Enroll => 1506,
            Self::OrganizationUser_ResetPassword_Withdraw => 1507,
            Self::OrganizationUser_AdminResetPassword => 1508,
            Self::OrganizationUser_ResetSsoLink => 1509,
            Self::OrganizationUser_FirstSsoLogin => 1510,
            Self::OrganizationUser_Revoked => 1511,
            Self::OrganizationUser_Restored => 1512,
            Self::OrganizationUser_ApprovedAuthRequest => 1513,
            Self::OrganizationUser_RejectedAuthRequest => 1514,
            Self::OrganizationUser_Deleted => 1515,
            Self::OrganizationUser_Left => 1516,
            Self::OrganizationUser_AutomaticallyConfirmed => 1517,
            Self::OrganizationUser_SelfRevoked => 1518,
            Self::OrganizationUser_AdminResetTwoFactor => 1519,
            Self::OrganizationUser_Revoked_TwoFactorNonCompliance => 1520,
            Self::OrganizationUser_Revoked_SingleOrganizationNonCompliance => 1521,
            Self::Organization_Updated => 1600,
            Self::Organization_PurgedVault => 1601,
            Self::Organization_ClientExportedVault => 1602,
            Self::Organization_VaultAccessed => 1603,
            Self::Organization_EnabledSso => 1604,
            Self::Organization_DisabledSso => 1605,
            Self::Organization_EnabledKeyConnector => 1606,
            Self::Organization_DisabledKeyConnector => 1607,
            Self::Organization_SponsorshipsSynced => 1608,
            Self::Organization_CollectionManagement_Updated => 1609,
            Self::Organization_CollectionManagement_LimitCollectionCreationEnabled => 1610,
            Self::Organization_CollectionManagement_LimitCollectionCreationDisabled => 1611,
            Self::Organization_CollectionManagement_LimitCollectionDeletionEnabled => 1612,
            Self::Organization_CollectionManagement_LimitCollectionDeletionDisabled => 1613,
            Self::Organization_CollectionManagement_LimitItemDeletionEnabled => 1614,
            Self::Organization_CollectionManagement_LimitItemDeletionDisabled => 1615,
            Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled => 1616,
            Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled => 1617,
            Self::Organization_ItemOrganization_Accepted => 1618,
            Self::Organization_ItemOrganization_Declined => 1619,
            Self::Organization_AutoConfirmEnabled_Admin => 1620,
            Self::Organization_AutoConfirmDisabled_Admin => 1621,
            Self::Organization_AutoConfirmEnabled_Portal => 1622,
            Self::Organization_AutoConfirmDisabled_Portal => 1623,
            Self::Policy_Updated => 1700,
            Self::ProviderUser_Invited => 1800,
            Self::ProviderUser_Confirmed => 1801,
            Self::ProviderUser_Updated => 1802,
            Self::ProviderUser_Removed => 1803,
            Self::ProviderOrganization_Created => 1900,
            Self::ProviderOrganization_Added => 1901,
            Self::ProviderOrganization_Removed => 1902,
            Self::ProviderOrganization_VaultAccessed => 1903,
            Self::OrganizationDomain_Added => 2000,
            Self::OrganizationDomain_Removed => 2001,
            Self::OrganizationDomain_Verified => 2002,
            Self::OrganizationDomain_NotVerified => 2003,
            Self::Secret_Retrieved => 2100,
            Self::Secret_Created => 2101,
            Self::Secret_Edited => 2102,
            Self::Secret_Deleted => 2103,
            Self::Secret_Permanently_Deleted => 2104,
            Self::Secret_Restored => 2105,
            Self::Project_Retrieved => 2200,
            Self::Project_Created => 2201,
            Self::Project_Edited => 2202,
            Self::Project_Deleted => 2203,
            Self::ServiceAccount_UserAdded => 2300,
            Self::ServiceAccount_UserRemoved => 2301,
            Self::ServiceAccount_GroupAdded => 2302,
            Self::ServiceAccount_GroupRemoved => 2303,
            Self::ServiceAccount_Created => 2304,
            Self::ServiceAccount_Deleted => 2305,
            Self::PhishingBlocker_SiteAccessed => 2400,
            Self::PhishingBlocker_SiteExited => 2401,
            Self::PhishingBlocker_Bypassed => 2402,
            Self::__Unknown(v) => *v,
        }
    }

    pub fn from_i64(value: i64) -> Self {
        match value {
            1000 => Self::User_LoggedIn,
            1001 => Self::User_ChangedPassword,
            1002 => Self::User_Updated2fa,
            1003 => Self::User_Disabled2fa,
            1004 => Self::User_Recovered2fa,
            1005 => Self::User_FailedLogIn,
            1006 => Self::User_FailedLogIn2fa,
            1007 => Self::User_ClientExportedVault,
            1008 => Self::User_UpdatedTempPassword,
            1009 => Self::User_MigratedKeyToKeyConnector,
            1010 => Self::User_RequestedDeviceApproval,
            1011 => Self::User_TdeOffboardingPasswordSet,
            1100 => Self::Cipher_Created,
            1101 => Self::Cipher_Updated,
            1102 => Self::Cipher_Deleted,
            1103 => Self::Cipher_AttachmentCreated,
            1104 => Self::Cipher_AttachmentDeleted,
            1105 => Self::Cipher_Shared,
            1106 => Self::Cipher_UpdatedCollections,
            1107 => Self::Cipher_ClientViewed,
            1108 => Self::Cipher_ClientToggledPasswordVisible,
            1109 => Self::Cipher_ClientToggledHiddenFieldVisible,
            1110 => Self::Cipher_ClientToggledCardCodeVisible,
            1111 => Self::Cipher_ClientCopiedPassword,
            1112 => Self::Cipher_ClientCopiedHiddenField,
            1113 => Self::Cipher_ClientCopiedCardCode,
            1114 => Self::Cipher_ClientAutofilled,
            1115 => Self::Cipher_SoftDeleted,
            1116 => Self::Cipher_Restored,
            1117 => Self::Cipher_ClientToggledCardNumberVisible,
            1118 => Self::Cipher_ClientToggledTOTPSeedVisible,
            1119 => Self::Cipher_ClientCopiedBankAccountNumber,
            1120 => Self::Cipher_ClientCopiedBankAccountPin,
            1121 => Self::Cipher_ClientToggledBankAccountNumberVisible,
            1122 => Self::Cipher_ClientToggledBankAccountPinVisible,
            1123 => Self::Cipher_ClientCopiedLicenseNumber,
            1124 => Self::Cipher_ClientToggledLicenseNumberVisible,
            1125 => Self::Cipher_ClientCopiedPassportNumber,
            1126 => Self::Cipher_ClientToggledPassportNumberVisible,
            1300 => Self::Collection_Created,
            1301 => Self::Collection_Updated,
            1302 => Self::Collection_Deleted,
            1400 => Self::Group_Created,
            1401 => Self::Group_Updated,
            1402 => Self::Group_Deleted,
            1500 => Self::OrganizationUser_Invited,
            1501 => Self::OrganizationUser_Confirmed,
            1502 => Self::OrganizationUser_Updated,
            1503 => Self::OrganizationUser_Removed,
            1504 => Self::OrganizationUser_UpdatedGroups,
            1505 => Self::OrganizationUser_UnlinkedSso,
            1506 => Self::OrganizationUser_ResetPassword_Enroll,
            1507 => Self::OrganizationUser_ResetPassword_Withdraw,
            1508 => Self::OrganizationUser_AdminResetPassword,
            1509 => Self::OrganizationUser_ResetSsoLink,
            1510 => Self::OrganizationUser_FirstSsoLogin,
            1511 => Self::OrganizationUser_Revoked,
            1512 => Self::OrganizationUser_Restored,
            1513 => Self::OrganizationUser_ApprovedAuthRequest,
            1514 => Self::OrganizationUser_RejectedAuthRequest,
            1515 => Self::OrganizationUser_Deleted,
            1516 => Self::OrganizationUser_Left,
            1517 => Self::OrganizationUser_AutomaticallyConfirmed,
            1518 => Self::OrganizationUser_SelfRevoked,
            1519 => Self::OrganizationUser_AdminResetTwoFactor,
            1520 => Self::OrganizationUser_Revoked_TwoFactorNonCompliance,
            1521 => Self::OrganizationUser_Revoked_SingleOrganizationNonCompliance,
            1600 => Self::Organization_Updated,
            1601 => Self::Organization_PurgedVault,
            1602 => Self::Organization_ClientExportedVault,
            1603 => Self::Organization_VaultAccessed,
            1604 => Self::Organization_EnabledSso,
            1605 => Self::Organization_DisabledSso,
            1606 => Self::Organization_EnabledKeyConnector,
            1607 => Self::Organization_DisabledKeyConnector,
            1608 => Self::Organization_SponsorshipsSynced,
            1609 => Self::Organization_CollectionManagement_Updated,
            1610 => Self::Organization_CollectionManagement_LimitCollectionCreationEnabled,
            1611 => Self::Organization_CollectionManagement_LimitCollectionCreationDisabled,
            1612 => Self::Organization_CollectionManagement_LimitCollectionDeletionEnabled,
            1613 => Self::Organization_CollectionManagement_LimitCollectionDeletionDisabled,
            1614 => Self::Organization_CollectionManagement_LimitItemDeletionEnabled,
            1615 => Self::Organization_CollectionManagement_LimitItemDeletionDisabled,
            1616 => {
                Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled
            }
            1617 => {
                Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled
            }
            1618 => Self::Organization_ItemOrganization_Accepted,
            1619 => Self::Organization_ItemOrganization_Declined,
            1620 => Self::Organization_AutoConfirmEnabled_Admin,
            1621 => Self::Organization_AutoConfirmDisabled_Admin,
            1622 => Self::Organization_AutoConfirmEnabled_Portal,
            1623 => Self::Organization_AutoConfirmDisabled_Portal,
            1700 => Self::Policy_Updated,
            1800 => Self::ProviderUser_Invited,
            1801 => Self::ProviderUser_Confirmed,
            1802 => Self::ProviderUser_Updated,
            1803 => Self::ProviderUser_Removed,
            1900 => Self::ProviderOrganization_Created,
            1901 => Self::ProviderOrganization_Added,
            1902 => Self::ProviderOrganization_Removed,
            1903 => Self::ProviderOrganization_VaultAccessed,
            2000 => Self::OrganizationDomain_Added,
            2001 => Self::OrganizationDomain_Removed,
            2002 => Self::OrganizationDomain_Verified,
            2003 => Self::OrganizationDomain_NotVerified,
            2100 => Self::Secret_Retrieved,
            2101 => Self::Secret_Created,
            2102 => Self::Secret_Edited,
            2103 => Self::Secret_Deleted,
            2104 => Self::Secret_Permanently_Deleted,
            2105 => Self::Secret_Restored,
            2200 => Self::Project_Retrieved,
            2201 => Self::Project_Created,
            2202 => Self::Project_Edited,
            2203 => Self::Project_Deleted,
            2300 => Self::ServiceAccount_UserAdded,
            2301 => Self::ServiceAccount_UserRemoved,
            2302 => Self::ServiceAccount_GroupAdded,
            2303 => Self::ServiceAccount_GroupRemoved,
            2304 => Self::ServiceAccount_Created,
            2305 => Self::ServiceAccount_Deleted,
            2400 => Self::PhishingBlocker_SiteAccessed,
            2401 => Self::PhishingBlocker_SiteExited,
            2402 => Self::PhishingBlocker_Bypassed,
            v => Self::__Unknown(v),
        }
    }
}

impl serde::Serialize for EventType {
    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        serializer.serialize_i64(self.as_i64())
    }
}

impl<'de> serde::Deserialize<'de> for EventType {
    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        struct EventTypeVisitor;

        impl Visitor<'_> for EventTypeVisitor {
            type Value = EventType;

            fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
                f.write_str("an integer")
            }

            fn visit_i64<E: serde::de::Error>(self, v: i64) -> Result<Self::Value, E> {
                Ok(EventType::from_i64(v))
            }

            fn visit_u64<E: serde::de::Error>(self, v: u64) -> Result<Self::Value, E> {
                Ok(EventType::from_i64(v as i64))
            }
        }

        deserializer.deserialize_i64(EventTypeVisitor)
    }
}

impl std::fmt::Display for EventType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.as_i64())
    }
}
impl Default for EventType {
    fn default() -> EventType {
        Self::User_LoggedIn
    }
}