bitwarden-sdk-secrets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +11 -0
- data/bitwarden-sdk-secrets.gemspec +47 -0
- data/lib/bitwarden-sdk-secrets.rb +56 -0
- data/lib/bitwarden_error.rb +9 -0
- data/lib/bitwarden_lib.rb +35 -0
- data/lib/command_runner.rb +15 -0
- data/lib/extended_schemas/schemas.rb +64 -0
- data/lib/linux-x64/libbitwarden_c.so +0 -0
- data/lib/macos-arm64/libbitwarden_c.dylib +0 -0
- data/lib/macos-x64/libbitwarden_c.dylib +0 -0
- data/lib/projects.rb +116 -0
- data/lib/schemas.rb +3450 -0
- data/lib/secrets.rb +124 -0
- data/lib/version.rb +5 -0
- data/lib/windows-x64/bitwarden_c.dll +0 -0
- data/sig/bitwarden-sdk.rbs +13 -0
- data/sig/bitwarden_settings.rbs +8 -0
- data/sig/command_runner.rbs +4 -0
- data/sig/projects_client.rbs +17 -0
- data/sig/sdk.rbs +3 -0
- data/sig/secrets_client.rbs +18 -0
- metadata +150 -0
data/lib/schemas.rb
ADDED
@@ -0,0 +1,3450 @@
|
|
1
|
+
# This code may look unusually verbose for Ruby (and it is), but
|
2
|
+
# it performs some subtle and complex validation of JSON data.
|
3
|
+
#
|
4
|
+
# To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do:
|
5
|
+
#
|
6
|
+
# client_settings = ClientSettings.from_json! "{…}"
|
7
|
+
# puts client_settings.api_url
|
8
|
+
#
|
9
|
+
# device_type = DeviceType.from_json! "…"
|
10
|
+
# puts device_type == DeviceType::Android
|
11
|
+
#
|
12
|
+
# command = Command.from_json! "{…}"
|
13
|
+
# puts command.projects&.delete&.ids.first
|
14
|
+
#
|
15
|
+
# password_login_request = PasswordLoginRequest.from_json! "{…}"
|
16
|
+
# puts password_login_request.kdf.argon2_id&.iterations.even?
|
17
|
+
#
|
18
|
+
# two_factor_request = TwoFactorRequest.from_json! "{…}"
|
19
|
+
# puts two_factor_request.provider == TwoFactorProvider::Authenticator
|
20
|
+
#
|
21
|
+
# two_factor_provider = TwoFactorProvider.from_json! "…"
|
22
|
+
# puts two_factor_provider == TwoFactorProvider::Authenticator
|
23
|
+
#
|
24
|
+
# kdf = Kdf.from_json! "{…}"
|
25
|
+
# puts kdf.argon2_id&.iterations.even?
|
26
|
+
#
|
27
|
+
# api_key_login_request = APIKeyLoginRequest.from_json! "{…}"
|
28
|
+
# puts api_key_login_request.client_id
|
29
|
+
#
|
30
|
+
# access_token_login_request = AccessTokenLoginRequest.from_json! "{…}"
|
31
|
+
# puts access_token_login_request.access_token
|
32
|
+
#
|
33
|
+
# secret_verification_request = SecretVerificationRequest.from_json! "{…}"
|
34
|
+
# puts secret_verification_request.master_password.nil?
|
35
|
+
#
|
36
|
+
# fingerprint_request = FingerprintRequest.from_json! "{…}"
|
37
|
+
# puts fingerprint_request.fingerprint_material
|
38
|
+
#
|
39
|
+
# sync_request = SyncRequest.from_json! "{…}"
|
40
|
+
# puts sync_request.exclude_subdomains.nil?
|
41
|
+
#
|
42
|
+
# secrets_command = SecretsCommand.from_json! "{…}"
|
43
|
+
# puts secrets_command.delete&.ids.first
|
44
|
+
#
|
45
|
+
# secret_get_request = SecretGetRequest.from_json! "{…}"
|
46
|
+
# puts secret_get_request.id
|
47
|
+
#
|
48
|
+
# secrets_get_request = SecretsGetRequest.from_json! "{…}"
|
49
|
+
# puts secrets_get_request.ids.first
|
50
|
+
#
|
51
|
+
# secret_create_request = SecretCreateRequest.from_json! "{…}"
|
52
|
+
# puts secret_create_request.key
|
53
|
+
#
|
54
|
+
# secret_identifiers_request = SecretIdentifiersRequest.from_json! "{…}"
|
55
|
+
# puts secret_identifiers_request.organization_id
|
56
|
+
#
|
57
|
+
# secret_put_request = SecretPutRequest.from_json! "{…}"
|
58
|
+
# puts secret_put_request.id
|
59
|
+
#
|
60
|
+
# secrets_delete_request = SecretsDeleteRequest.from_json! "{…}"
|
61
|
+
# puts secrets_delete_request.ids.first
|
62
|
+
#
|
63
|
+
# projects_command = ProjectsCommand.from_json! "{…}"
|
64
|
+
# puts projects_command.delete&.ids.first
|
65
|
+
#
|
66
|
+
# project_get_request = ProjectGetRequest.from_json! "{…}"
|
67
|
+
# puts project_get_request.id
|
68
|
+
#
|
69
|
+
# project_create_request = ProjectCreateRequest.from_json! "{…}"
|
70
|
+
# puts project_create_request.project_create_request_name
|
71
|
+
#
|
72
|
+
# projects_list_request = ProjectsListRequest.from_json! "{…}"
|
73
|
+
# puts projects_list_request.organization_id
|
74
|
+
#
|
75
|
+
# project_put_request = ProjectPutRequest.from_json! "{…}"
|
76
|
+
# puts project_put_request.id
|
77
|
+
#
|
78
|
+
# projects_delete_request = ProjectsDeleteRequest.from_json! "{…}"
|
79
|
+
# puts projects_delete_request.ids.first
|
80
|
+
#
|
81
|
+
# response_for_api_key_login_response = ResponseForAPIKeyLoginResponse.from_json! "{…}"
|
82
|
+
# puts response_for_api_key_login_response.data&.authenticated
|
83
|
+
#
|
84
|
+
# api_key_login_response = APIKeyLoginResponse.from_json! "{…}"
|
85
|
+
# puts api_key_login_response.authenticated
|
86
|
+
#
|
87
|
+
# two_factor_providers = TwoFactorProviders.from_json! "{…}"
|
88
|
+
# puts two_factor_providers.authenticator
|
89
|
+
#
|
90
|
+
# authenticator = Authenticator.from_json! "{…}"
|
91
|
+
# puts authenticator
|
92
|
+
#
|
93
|
+
# email = Email.from_json! "{…}"
|
94
|
+
# puts email.email
|
95
|
+
#
|
96
|
+
# duo = Duo.from_json! "{…}"
|
97
|
+
# puts duo.host
|
98
|
+
#
|
99
|
+
# yubi_key = YubiKey.from_json! "{…}"
|
100
|
+
# puts yubi_key.nfc
|
101
|
+
#
|
102
|
+
# remember = Remember.from_json! "{…}"
|
103
|
+
# puts remember
|
104
|
+
#
|
105
|
+
# web_authn = WebAuthn.from_json! "{…}"
|
106
|
+
# puts web_authn
|
107
|
+
#
|
108
|
+
# response_for_password_login_response = ResponseForPasswordLoginResponse.from_json! "{…}"
|
109
|
+
# puts response_for_password_login_response.data&.authenticated
|
110
|
+
#
|
111
|
+
# password_login_response = PasswordLoginResponse.from_json! "{…}"
|
112
|
+
# puts password_login_response.authenticated
|
113
|
+
#
|
114
|
+
# captcha_response = CAPTCHAResponse.from_json! "{…}"
|
115
|
+
# puts captcha_response.site_key
|
116
|
+
#
|
117
|
+
# response_for_access_token_login_response = ResponseForAccessTokenLoginResponse.from_json! "{…}"
|
118
|
+
# puts response_for_access_token_login_response.data&.authenticated
|
119
|
+
#
|
120
|
+
# access_token_login_response = AccessTokenLoginResponse.from_json! "{…}"
|
121
|
+
# puts access_token_login_response.authenticated
|
122
|
+
#
|
123
|
+
# response_for_secret_identifiers_response = ResponseForSecretIdentifiersResponse.from_json! "{…}"
|
124
|
+
# puts response_for_secret_identifiers_response.data&.data.first.id
|
125
|
+
#
|
126
|
+
# secret_identifiers_response = SecretIdentifiersResponse.from_json! "{…}"
|
127
|
+
# puts secret_identifiers_response.data.first.id
|
128
|
+
#
|
129
|
+
# secret_identifier_response = SecretIdentifierResponse.from_json! "{…}"
|
130
|
+
# puts secret_identifier_response.id
|
131
|
+
#
|
132
|
+
# response_for_secret_response = ResponseForSecretResponse.from_json! "{…}"
|
133
|
+
# puts response_for_secret_response.data&.creation_date
|
134
|
+
#
|
135
|
+
# secret_response = SecretResponse.from_json! "{…}"
|
136
|
+
# puts secret_response.creation_date
|
137
|
+
#
|
138
|
+
# response_for_secrets_response = ResponseForSecretsResponse.from_json! "{…}"
|
139
|
+
# puts response_for_secrets_response.data&.data.first.creation_date
|
140
|
+
#
|
141
|
+
# secrets_response = SecretsResponse.from_json! "{…}"
|
142
|
+
# puts secrets_response.data.first.creation_date
|
143
|
+
#
|
144
|
+
# response_for_secrets_delete_response = ResponseForSecretsDeleteResponse.from_json! "{…}"
|
145
|
+
# puts response_for_secrets_delete_response.data&.data.first.error.nil?
|
146
|
+
#
|
147
|
+
# secrets_delete_response = SecretsDeleteResponse.from_json! "{…}"
|
148
|
+
# puts secrets_delete_response.data.first.error.nil?
|
149
|
+
#
|
150
|
+
# secret_delete_response = SecretDeleteResponse.from_json! "{…}"
|
151
|
+
# puts secret_delete_response.error.nil?
|
152
|
+
#
|
153
|
+
# response_for_project_response = ResponseForProjectResponse.from_json! "{…}"
|
154
|
+
# puts response_for_project_response.data&.creation_date
|
155
|
+
#
|
156
|
+
# project_response = ProjectResponse.from_json! "{…}"
|
157
|
+
# puts project_response.creation_date
|
158
|
+
#
|
159
|
+
# response_for_projects_response = ResponseForProjectsResponse.from_json! "{…}"
|
160
|
+
# puts response_for_projects_response.data&.data.first.creation_date
|
161
|
+
#
|
162
|
+
# projects_response = ProjectsResponse.from_json! "{…}"
|
163
|
+
# puts projects_response.data.first.creation_date
|
164
|
+
#
|
165
|
+
# response_for_projects_delete_response = ResponseForProjectsDeleteResponse.from_json! "{…}"
|
166
|
+
# puts response_for_projects_delete_response.data&.data.first.error.nil?
|
167
|
+
#
|
168
|
+
# projects_delete_response = ProjectsDeleteResponse.from_json! "{…}"
|
169
|
+
# puts projects_delete_response.data.first.error.nil?
|
170
|
+
#
|
171
|
+
# project_delete_response = ProjectDeleteResponse.from_json! "{…}"
|
172
|
+
# puts project_delete_response.error.nil?
|
173
|
+
#
|
174
|
+
# response_for_fingerprint_response = ResponseForFingerprintResponse.from_json! "{…}"
|
175
|
+
# puts response_for_fingerprint_response.data&.fingerprint
|
176
|
+
#
|
177
|
+
# fingerprint_response = FingerprintResponse.from_json! "{…}"
|
178
|
+
# puts fingerprint_response.fingerprint
|
179
|
+
#
|
180
|
+
# response_for_sync_response = ResponseForSyncResponse.from_json! "{…}"
|
181
|
+
# puts response_for_sync_response.data&.sends.first.access_count.even?
|
182
|
+
#
|
183
|
+
# sync_response = SyncResponse.from_json! "{…}"
|
184
|
+
# puts sync_response.sends.first.access_count.even?
|
185
|
+
#
|
186
|
+
# profile_response = ProfileResponse.from_json! "{…}"
|
187
|
+
# puts profile_response.organizations.first.id
|
188
|
+
#
|
189
|
+
# profile_organization_response = ProfileOrganizationResponse.from_json! "{…}"
|
190
|
+
# puts profile_organization_response.id
|
191
|
+
#
|
192
|
+
# folder = Folder.from_json! "{…}"
|
193
|
+
# puts folder.id.nil?
|
194
|
+
#
|
195
|
+
# enc_string = EncString.from_json! "…"
|
196
|
+
# puts enc_string
|
197
|
+
#
|
198
|
+
# collection = Collection.from_json! "{…}"
|
199
|
+
# puts collection.external_id.nil?
|
200
|
+
#
|
201
|
+
# cipher = Cipher.from_json! "{…}"
|
202
|
+
# puts cipher.collection_ids.first
|
203
|
+
#
|
204
|
+
# cipher_type = CipherType.from_json! "…"
|
205
|
+
# puts cipher_type == CipherType::Card
|
206
|
+
#
|
207
|
+
# login = Login.from_json! "{…}"
|
208
|
+
# puts login.autofill_on_page_load.nil?
|
209
|
+
#
|
210
|
+
# login_uri = LoginURI.from_json! "{…}"
|
211
|
+
# puts login_uri.match.nil?
|
212
|
+
#
|
213
|
+
# uri_match_type = URIMatchType.from_json! "…"
|
214
|
+
# puts uri_match_type == URIMatchType::Domain
|
215
|
+
#
|
216
|
+
# identity = Identity.from_json! "{…}"
|
217
|
+
# puts identity.address1.nil?
|
218
|
+
#
|
219
|
+
# card = Card.from_json! "{…}"
|
220
|
+
# puts card.brand.nil?
|
221
|
+
#
|
222
|
+
# secure_note = SecureNote.from_json! "{…}"
|
223
|
+
# puts secure_note.secure_note_type == SecureNoteType::Generic
|
224
|
+
#
|
225
|
+
# secure_note_type = SecureNoteType.from_json! "…"
|
226
|
+
# puts secure_note_type == SecureNoteType::Generic
|
227
|
+
#
|
228
|
+
# cipher_reprompt_type = CipherRepromptType.from_json! "…"
|
229
|
+
# puts cipher_reprompt_type == CipherRepromptType::None
|
230
|
+
#
|
231
|
+
# local_data = LocalData.from_json! "{…}"
|
232
|
+
# puts local_data.last_launched.nil?
|
233
|
+
#
|
234
|
+
# attachment = Attachment.from_json! "{…}"
|
235
|
+
# puts attachment.file_name.nil?
|
236
|
+
#
|
237
|
+
# field = Field.from_json! "{…}"
|
238
|
+
# puts field.linked_id.nil?
|
239
|
+
#
|
240
|
+
# field_type = FieldType.from_json! "…"
|
241
|
+
# puts field_type == FieldType::Boolean
|
242
|
+
#
|
243
|
+
# linked_id_type = LinkedIDType.from_json! "…"
|
244
|
+
# puts linked_id_type == LinkedIDType::Address1
|
245
|
+
#
|
246
|
+
# login_linked_id_type = LoginLinkedIDType.from_json! "…"
|
247
|
+
# puts login_linked_id_type == LoginLinkedIDType::Password
|
248
|
+
#
|
249
|
+
# card_linked_id_type = CardLinkedIDType.from_json! "…"
|
250
|
+
# puts card_linked_id_type == CardLinkedIDType::Brand
|
251
|
+
#
|
252
|
+
# identity_linked_id_type = IdentityLinkedIDType.from_json! "…"
|
253
|
+
# puts identity_linked_id_type == IdentityLinkedIDType::Address1
|
254
|
+
#
|
255
|
+
# password_history = PasswordHistory.from_json! "{…}"
|
256
|
+
# puts password_history.last_used_date
|
257
|
+
#
|
258
|
+
# domain_response = DomainResponse.from_json! "{…}"
|
259
|
+
# puts domain_response.global_equivalent_domains.first.domains.first
|
260
|
+
#
|
261
|
+
# global_domains = GlobalDomains.from_json! "{…}"
|
262
|
+
# puts global_domains.domains.first
|
263
|
+
#
|
264
|
+
# policy = Policy.from_json! "{…}"
|
265
|
+
# puts policy.data&["…"]
|
266
|
+
#
|
267
|
+
# policy_type = PolicyType.from_json! "…"
|
268
|
+
# puts policy_type == PolicyType::ActivateAutofill
|
269
|
+
#
|
270
|
+
# send = Send.from_json! "{…}"
|
271
|
+
# puts send.access_count.even?
|
272
|
+
#
|
273
|
+
# send_type = SendType.from_json! "…"
|
274
|
+
# puts send_type == SendType::File
|
275
|
+
#
|
276
|
+
# send_file = SendFile.from_json! "{…}"
|
277
|
+
# puts send_file.file_name
|
278
|
+
#
|
279
|
+
# send_text = SendText.from_json! "{…}"
|
280
|
+
# puts send_text.hidden
|
281
|
+
#
|
282
|
+
# response_for_user_api_key_response = ResponseForUserAPIKeyResponse.from_json! "{…}"
|
283
|
+
# puts response_for_user_api_key_response.data&.api_key
|
284
|
+
#
|
285
|
+
# user_api_key_response = UserAPIKeyResponse.from_json! "{…}"
|
286
|
+
# puts user_api_key_response.api_key
|
287
|
+
#
|
288
|
+
# If from_json! succeeds, the value returned matches the schema.
|
289
|
+
|
290
|
+
require 'json'
|
291
|
+
require 'dry-types'
|
292
|
+
require 'dry-struct'
|
293
|
+
|
294
|
+
module Types
|
295
|
+
include Dry.Types(default: :nominal)
|
296
|
+
|
297
|
+
Integer = Strict::Integer
|
298
|
+
Nil = Strict::Nil
|
299
|
+
Bool = Strict::Bool
|
300
|
+
Hash = Strict::Hash
|
301
|
+
String = Strict::String
|
302
|
+
DeviceType = Strict::String.enum("Android", "AndroidAmazon", "ChromeBrowser", "ChromeExtension", "EdgeBrowser", "EdgeExtension", "FirefoxBrowser", "FirefoxExtension", "IEBrowser", "iOS", "LinuxDesktop", "MacOsDesktop", "OperaBrowser", "OperaExtension", "SDK", "SafariBrowser", "SafariExtension", "UWP", "UnknownBrowser", "VivaldiBrowser", "VivaldiExtension", "WindowsDesktop")
|
303
|
+
TwoFactorProvider = Strict::String.enum("Authenticator", "Duo", "Email", "OrganizationDuo", "Remember", "U2f", "WebAuthn", "Yubikey")
|
304
|
+
CipherType = Strict::String.enum("Card", "Identity", "Login", "SecureNote")
|
305
|
+
FieldType = Strict::String.enum("Boolean", "Hidden", "Linked", "Text")
|
306
|
+
LinkedIDType = Strict::String.enum("Address1", "Address2", "Address3", "Brand", "CardholderName", "City", "Code", "Company", "Country", "Email", "ExpMonth", "ExpYear", "FirstName", "FullName", "LastName", "LicenseNumber", "MiddleName", "Number", "PassportNumber", "Password", "Phone", "PostalCode", "Ssn", "State", "Title", "Username")
|
307
|
+
URIMatchType = Strict::String.enum("domain", "exact", "host", "never", "regularExpression", "startsWith")
|
308
|
+
CipherRepromptType = Strict::String.enum("None", "Password")
|
309
|
+
SecureNoteType = Strict::String.enum("Generic")
|
310
|
+
PolicyType = Strict::String.enum("ActivateAutofill", "DisablePersonalVaultExport", "DisableSend", "MasterPassword", "MaximumVaultTimeout", "PasswordGenerator", "PersonalOwnership", "RequireSso", "ResetPassword", "SendOptions", "SingleOrg", "TwoFactorAuthentication")
|
311
|
+
SendType = Strict::String.enum("File", "Text")
|
312
|
+
LoginLinkedIDType = Strict::String.enum("Password", "Username")
|
313
|
+
CardLinkedIDType = Strict::String.enum("Brand", "CardholderName", "Code", "ExpMonth", "ExpYear", "Number")
|
314
|
+
IdentityLinkedIDType = Strict::String.enum("Address1", "Address2", "Address3", "City", "Company", "Country", "Email", "FirstName", "FullName", "LastName", "LicenseNumber", "MiddleName", "PassportNumber", "Phone", "PostalCode", "Ssn", "State", "Title", "Username")
|
315
|
+
end
|
316
|
+
|
317
|
+
# Device type to send to Bitwarden. Defaults to SDK
|
318
|
+
module DeviceType
|
319
|
+
Android = "Android"
|
320
|
+
AndroidAmazon = "AndroidAmazon"
|
321
|
+
ChromeBrowser = "ChromeBrowser"
|
322
|
+
ChromeExtension = "ChromeExtension"
|
323
|
+
EdgeBrowser = "EdgeBrowser"
|
324
|
+
EdgeExtension = "EdgeExtension"
|
325
|
+
FirefoxBrowser = "FirefoxBrowser"
|
326
|
+
FirefoxExtension = "FirefoxExtension"
|
327
|
+
IEBrowser = "IEBrowser"
|
328
|
+
IOS = "iOS"
|
329
|
+
LinuxDesktop = "LinuxDesktop"
|
330
|
+
MACOSDesktop = "MacOsDesktop"
|
331
|
+
OperaBrowser = "OperaBrowser"
|
332
|
+
OperaExtension = "OperaExtension"
|
333
|
+
SDK = "SDK"
|
334
|
+
SafariBrowser = "SafariBrowser"
|
335
|
+
SafariExtension = "SafariExtension"
|
336
|
+
UWP = "UWP"
|
337
|
+
UnknownBrowser = "UnknownBrowser"
|
338
|
+
VivaldiBrowser = "VivaldiBrowser"
|
339
|
+
VivaldiExtension = "VivaldiExtension"
|
340
|
+
WindowsDesktop = "WindowsDesktop"
|
341
|
+
end
|
342
|
+
|
343
|
+
# Basic client behavior settings. These settings specify the various targets and behavior
|
344
|
+
# of the Bitwarden Client. They are optional and uneditable once the client is
|
345
|
+
# initialized.
|
346
|
+
#
|
347
|
+
# Defaults to
|
348
|
+
#
|
349
|
+
# ``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; let settings
|
350
|
+
# = ClientSettings { identity_url: "https://identity.bitwarden.com".to_string(), api_url:
|
351
|
+
# "https://api.bitwarden.com".to_string(), user_agent: "Bitwarden Rust-SDK".to_string(),
|
352
|
+
# device_type: DeviceType::SDK, }; let default = ClientSettings::default(); ```
|
353
|
+
class ClientSettings < Dry::Struct
|
354
|
+
|
355
|
+
# The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com`
|
356
|
+
attribute :api_url, Types::String.optional
|
357
|
+
|
358
|
+
# Device type to send to Bitwarden. Defaults to SDK
|
359
|
+
attribute :device_type, Types::DeviceType.optional
|
360
|
+
|
361
|
+
# The identity url of the targeted Bitwarden instance. Defaults to
|
362
|
+
# `https://identity.bitwarden.com`
|
363
|
+
attribute :identity_url, Types::String.optional
|
364
|
+
|
365
|
+
# The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`
|
366
|
+
attribute :user_agent, Types::String.optional
|
367
|
+
|
368
|
+
def self.from_dynamic!(d)
|
369
|
+
d = Types::Hash[d]
|
370
|
+
new(
|
371
|
+
api_url: d["apiUrl"],
|
372
|
+
device_type: d["deviceType"],
|
373
|
+
identity_url: d["identityUrl"],
|
374
|
+
user_agent: d["userAgent"],
|
375
|
+
)
|
376
|
+
end
|
377
|
+
|
378
|
+
def self.from_json!(json)
|
379
|
+
from_dynamic!(JSON.parse(json))
|
380
|
+
end
|
381
|
+
|
382
|
+
def to_dynamic
|
383
|
+
{
|
384
|
+
"apiUrl" => api_url,
|
385
|
+
"deviceType" => device_type,
|
386
|
+
"identityUrl" => identity_url,
|
387
|
+
"userAgent" => user_agent,
|
388
|
+
}
|
389
|
+
end
|
390
|
+
|
391
|
+
def to_json(options = nil)
|
392
|
+
JSON.generate(to_dynamic, options)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
# Login to Bitwarden with access token
|
397
|
+
class AccessTokenLoginRequest < Dry::Struct
|
398
|
+
|
399
|
+
# Bitwarden service API access token
|
400
|
+
attribute :access_token, Types::String
|
401
|
+
|
402
|
+
attribute :state_file, Types::String.optional.optional
|
403
|
+
|
404
|
+
def self.from_dynamic!(d)
|
405
|
+
d = Types::Hash[d]
|
406
|
+
new(
|
407
|
+
access_token: d.fetch("accessToken"),
|
408
|
+
state_file: d["stateFile"],
|
409
|
+
)
|
410
|
+
end
|
411
|
+
|
412
|
+
def self.from_json!(json)
|
413
|
+
from_dynamic!(JSON.parse(json))
|
414
|
+
end
|
415
|
+
|
416
|
+
def to_dynamic
|
417
|
+
{
|
418
|
+
"accessToken" => access_token,
|
419
|
+
"stateFile" => state_file,
|
420
|
+
}
|
421
|
+
end
|
422
|
+
|
423
|
+
def to_json(options = nil)
|
424
|
+
JSON.generate(to_dynamic, options)
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
# Login to Bitwarden with Api Key
|
429
|
+
class APIKeyLoginRequest < Dry::Struct
|
430
|
+
|
431
|
+
# Bitwarden account client_id
|
432
|
+
attribute :client_id, Types::String
|
433
|
+
|
434
|
+
# Bitwarden account client_secret
|
435
|
+
attribute :client_secret, Types::String
|
436
|
+
|
437
|
+
# Bitwarden account master password
|
438
|
+
attribute :password, Types::String
|
439
|
+
|
440
|
+
def self.from_dynamic!(d)
|
441
|
+
d = Types::Hash[d]
|
442
|
+
new(
|
443
|
+
client_id: d.fetch("clientId"),
|
444
|
+
client_secret: d.fetch("clientSecret"),
|
445
|
+
password: d.fetch("password"),
|
446
|
+
)
|
447
|
+
end
|
448
|
+
|
449
|
+
def self.from_json!(json)
|
450
|
+
from_dynamic!(JSON.parse(json))
|
451
|
+
end
|
452
|
+
|
453
|
+
def to_dynamic
|
454
|
+
{
|
455
|
+
"clientId" => client_id,
|
456
|
+
"clientSecret" => client_secret,
|
457
|
+
"password" => password,
|
458
|
+
}
|
459
|
+
end
|
460
|
+
|
461
|
+
def to_json(options = nil)
|
462
|
+
JSON.generate(to_dynamic, options)
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
class FingerprintRequest < Dry::Struct
|
467
|
+
|
468
|
+
# The input material, used in the fingerprint generation process.
|
469
|
+
attribute :fingerprint_material, Types::String
|
470
|
+
|
471
|
+
# The user's public key encoded with base64.
|
472
|
+
attribute :public_key, Types::String
|
473
|
+
|
474
|
+
def self.from_dynamic!(d)
|
475
|
+
d = Types::Hash[d]
|
476
|
+
new(
|
477
|
+
fingerprint_material: d.fetch("fingerprintMaterial"),
|
478
|
+
public_key: d.fetch("publicKey"),
|
479
|
+
)
|
480
|
+
end
|
481
|
+
|
482
|
+
def self.from_json!(json)
|
483
|
+
from_dynamic!(JSON.parse(json))
|
484
|
+
end
|
485
|
+
|
486
|
+
def to_dynamic
|
487
|
+
{
|
488
|
+
"fingerprintMaterial" => fingerprint_material,
|
489
|
+
"publicKey" => public_key,
|
490
|
+
}
|
491
|
+
end
|
492
|
+
|
493
|
+
def to_json(options = nil)
|
494
|
+
JSON.generate(to_dynamic, options)
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
class SecretVerificationRequest < Dry::Struct
|
499
|
+
|
500
|
+
# The user's master password to use for user verification. If supplied, this will be used
|
501
|
+
# for verification purposes.
|
502
|
+
attribute :master_password, Types::String.optional.optional
|
503
|
+
|
504
|
+
# Alternate user verification method through OTP. This is provided for users who have no
|
505
|
+
# master password due to use of Customer Managed Encryption. Must be present and valid if
|
506
|
+
# master_password is absent.
|
507
|
+
attribute :otp, Types::String.optional.optional
|
508
|
+
|
509
|
+
def self.from_dynamic!(d)
|
510
|
+
d = Types::Hash[d]
|
511
|
+
new(
|
512
|
+
master_password: d["masterPassword"],
|
513
|
+
otp: d["otp"],
|
514
|
+
)
|
515
|
+
end
|
516
|
+
|
517
|
+
def self.from_json!(json)
|
518
|
+
from_dynamic!(JSON.parse(json))
|
519
|
+
end
|
520
|
+
|
521
|
+
def to_dynamic
|
522
|
+
{
|
523
|
+
"masterPassword" => master_password,
|
524
|
+
"otp" => otp,
|
525
|
+
}
|
526
|
+
end
|
527
|
+
|
528
|
+
def to_json(options = nil)
|
529
|
+
JSON.generate(to_dynamic, options)
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
class Argon2ID < Dry::Struct
|
534
|
+
attribute :iterations, Types::Integer
|
535
|
+
attribute :memory, Types::Integer
|
536
|
+
attribute :parallelism, Types::Integer
|
537
|
+
|
538
|
+
def self.from_dynamic!(d)
|
539
|
+
d = Types::Hash[d]
|
540
|
+
new(
|
541
|
+
iterations: d.fetch("iterations"),
|
542
|
+
memory: d.fetch("memory"),
|
543
|
+
parallelism: d.fetch("parallelism"),
|
544
|
+
)
|
545
|
+
end
|
546
|
+
|
547
|
+
def self.from_json!(json)
|
548
|
+
from_dynamic!(JSON.parse(json))
|
549
|
+
end
|
550
|
+
|
551
|
+
def to_dynamic
|
552
|
+
{
|
553
|
+
"iterations" => iterations,
|
554
|
+
"memory" => memory,
|
555
|
+
"parallelism" => parallelism,
|
556
|
+
}
|
557
|
+
end
|
558
|
+
|
559
|
+
def to_json(options = nil)
|
560
|
+
JSON.generate(to_dynamic, options)
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
class PBKDF2 < Dry::Struct
|
565
|
+
attribute :iterations, Types::Integer
|
566
|
+
|
567
|
+
def self.from_dynamic!(d)
|
568
|
+
d = Types::Hash[d]
|
569
|
+
new(
|
570
|
+
iterations: d.fetch("iterations"),
|
571
|
+
)
|
572
|
+
end
|
573
|
+
|
574
|
+
def self.from_json!(json)
|
575
|
+
from_dynamic!(JSON.parse(json))
|
576
|
+
end
|
577
|
+
|
578
|
+
def to_dynamic
|
579
|
+
{
|
580
|
+
"iterations" => iterations,
|
581
|
+
}
|
582
|
+
end
|
583
|
+
|
584
|
+
def to_json(options = nil)
|
585
|
+
JSON.generate(to_dynamic, options)
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
# Kdf from prelogin
|
590
|
+
class Kdf < Dry::Struct
|
591
|
+
attribute :p_bkdf2, PBKDF2.optional
|
592
|
+
attribute :argon2_id, Argon2ID.optional
|
593
|
+
|
594
|
+
def self.from_dynamic!(d)
|
595
|
+
d = Types::Hash[d]
|
596
|
+
new(
|
597
|
+
p_bkdf2: d["pBKDF2"] ? PBKDF2.from_dynamic!(d["pBKDF2"]) : nil,
|
598
|
+
argon2_id: d["argon2id"] ? Argon2ID.from_dynamic!(d["argon2id"]) : nil,
|
599
|
+
)
|
600
|
+
end
|
601
|
+
|
602
|
+
def self.from_json!(json)
|
603
|
+
from_dynamic!(JSON.parse(json))
|
604
|
+
end
|
605
|
+
|
606
|
+
def to_dynamic
|
607
|
+
{
|
608
|
+
"pBKDF2" => p_bkdf2&.to_dynamic,
|
609
|
+
"argon2id" => argon2_id&.to_dynamic,
|
610
|
+
}
|
611
|
+
end
|
612
|
+
|
613
|
+
def to_json(options = nil)
|
614
|
+
JSON.generate(to_dynamic, options)
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
# Two-factor provider
|
619
|
+
module TwoFactorProvider
|
620
|
+
Authenticator = "Authenticator"
|
621
|
+
Duo = "Duo"
|
622
|
+
Email = "Email"
|
623
|
+
OrganizationDuo = "OrganizationDuo"
|
624
|
+
Remember = "Remember"
|
625
|
+
U2F = "U2f"
|
626
|
+
WebAuthn = "WebAuthn"
|
627
|
+
Yubikey = "Yubikey"
|
628
|
+
end
|
629
|
+
|
630
|
+
class TwoFactorRequest < Dry::Struct
|
631
|
+
|
632
|
+
# Two-factor provider
|
633
|
+
attribute :provider, Types::TwoFactorProvider
|
634
|
+
|
635
|
+
# Two-factor remember
|
636
|
+
attribute :remember, Types::Bool
|
637
|
+
|
638
|
+
# Two-factor Token
|
639
|
+
attribute :token, Types::String
|
640
|
+
|
641
|
+
def self.from_dynamic!(d)
|
642
|
+
d = Types::Hash[d]
|
643
|
+
new(
|
644
|
+
provider: d.fetch("provider"),
|
645
|
+
remember: d.fetch("remember"),
|
646
|
+
token: d.fetch("token"),
|
647
|
+
)
|
648
|
+
end
|
649
|
+
|
650
|
+
def self.from_json!(json)
|
651
|
+
from_dynamic!(JSON.parse(json))
|
652
|
+
end
|
653
|
+
|
654
|
+
def to_dynamic
|
655
|
+
{
|
656
|
+
"provider" => provider,
|
657
|
+
"remember" => remember,
|
658
|
+
"token" => token,
|
659
|
+
}
|
660
|
+
end
|
661
|
+
|
662
|
+
def to_json(options = nil)
|
663
|
+
JSON.generate(to_dynamic, options)
|
664
|
+
end
|
665
|
+
end
|
666
|
+
|
667
|
+
# Login to Bitwarden with Username and Password
|
668
|
+
class PasswordLoginRequest < Dry::Struct
|
669
|
+
|
670
|
+
# Bitwarden account email address
|
671
|
+
attribute :email, Types::String
|
672
|
+
|
673
|
+
# Kdf from prelogin
|
674
|
+
attribute :kdf, Kdf
|
675
|
+
|
676
|
+
# Bitwarden account master password
|
677
|
+
attribute :password, Types::String
|
678
|
+
|
679
|
+
attribute :two_factor, TwoFactorRequest.optional.optional
|
680
|
+
|
681
|
+
def self.from_dynamic!(d)
|
682
|
+
d = Types::Hash[d]
|
683
|
+
new(
|
684
|
+
email: d.fetch("email"),
|
685
|
+
kdf: Kdf.from_dynamic!(d.fetch("kdf")),
|
686
|
+
password: d.fetch("password"),
|
687
|
+
two_factor: d["twoFactor"] ? TwoFactorRequest.from_dynamic!(d["twoFactor"]) : nil,
|
688
|
+
)
|
689
|
+
end
|
690
|
+
|
691
|
+
def self.from_json!(json)
|
692
|
+
from_dynamic!(JSON.parse(json))
|
693
|
+
end
|
694
|
+
|
695
|
+
def to_dynamic
|
696
|
+
{
|
697
|
+
"email" => email,
|
698
|
+
"kdf" => kdf.to_dynamic,
|
699
|
+
"password" => password,
|
700
|
+
"twoFactor" => two_factor&.to_dynamic,
|
701
|
+
}
|
702
|
+
end
|
703
|
+
|
704
|
+
def to_json(options = nil)
|
705
|
+
JSON.generate(to_dynamic, options)
|
706
|
+
end
|
707
|
+
end
|
708
|
+
|
709
|
+
class ProjectCreateRequest < Dry::Struct
|
710
|
+
attribute :project_create_request_name, Types::String
|
711
|
+
|
712
|
+
# Organization where the project will be created
|
713
|
+
attribute :organization_id, Types::String
|
714
|
+
|
715
|
+
def self.from_dynamic!(d)
|
716
|
+
d = Types::Hash[d]
|
717
|
+
new(
|
718
|
+
project_create_request_name: d.fetch("name"),
|
719
|
+
organization_id: d.fetch("organizationId"),
|
720
|
+
)
|
721
|
+
end
|
722
|
+
|
723
|
+
def self.from_json!(json)
|
724
|
+
from_dynamic!(JSON.parse(json))
|
725
|
+
end
|
726
|
+
|
727
|
+
def to_dynamic
|
728
|
+
{
|
729
|
+
"name" => project_create_request_name,
|
730
|
+
"organizationId" => organization_id,
|
731
|
+
}
|
732
|
+
end
|
733
|
+
|
734
|
+
def to_json(options = nil)
|
735
|
+
JSON.generate(to_dynamic, options)
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
739
|
+
class ProjectsDeleteRequest < Dry::Struct
|
740
|
+
|
741
|
+
# IDs of the projects to delete
|
742
|
+
attribute :ids, Types.Array(Types::String)
|
743
|
+
|
744
|
+
def self.from_dynamic!(d)
|
745
|
+
d = Types::Hash[d]
|
746
|
+
new(
|
747
|
+
ids: d.fetch("ids"),
|
748
|
+
)
|
749
|
+
end
|
750
|
+
|
751
|
+
def self.from_json!(json)
|
752
|
+
from_dynamic!(JSON.parse(json))
|
753
|
+
end
|
754
|
+
|
755
|
+
def to_dynamic
|
756
|
+
{
|
757
|
+
"ids" => ids,
|
758
|
+
}
|
759
|
+
end
|
760
|
+
|
761
|
+
def to_json(options = nil)
|
762
|
+
JSON.generate(to_dynamic, options)
|
763
|
+
end
|
764
|
+
end
|
765
|
+
|
766
|
+
class ProjectGetRequest < Dry::Struct
|
767
|
+
|
768
|
+
# ID of the project to retrieve
|
769
|
+
attribute :id, Types::String
|
770
|
+
|
771
|
+
def self.from_dynamic!(d)
|
772
|
+
d = Types::Hash[d]
|
773
|
+
new(
|
774
|
+
id: d.fetch("id"),
|
775
|
+
)
|
776
|
+
end
|
777
|
+
|
778
|
+
def self.from_json!(json)
|
779
|
+
from_dynamic!(JSON.parse(json))
|
780
|
+
end
|
781
|
+
|
782
|
+
def to_dynamic
|
783
|
+
{
|
784
|
+
"id" => id,
|
785
|
+
}
|
786
|
+
end
|
787
|
+
|
788
|
+
def to_json(options = nil)
|
789
|
+
JSON.generate(to_dynamic, options)
|
790
|
+
end
|
791
|
+
end
|
792
|
+
|
793
|
+
class ProjectsListRequest < Dry::Struct
|
794
|
+
|
795
|
+
# Organization to retrieve all the projects from
|
796
|
+
attribute :organization_id, Types::String
|
797
|
+
|
798
|
+
def self.from_dynamic!(d)
|
799
|
+
d = Types::Hash[d]
|
800
|
+
new(
|
801
|
+
organization_id: d.fetch("organizationId"),
|
802
|
+
)
|
803
|
+
end
|
804
|
+
|
805
|
+
def self.from_json!(json)
|
806
|
+
from_dynamic!(JSON.parse(json))
|
807
|
+
end
|
808
|
+
|
809
|
+
def to_dynamic
|
810
|
+
{
|
811
|
+
"organizationId" => organization_id,
|
812
|
+
}
|
813
|
+
end
|
814
|
+
|
815
|
+
def to_json(options = nil)
|
816
|
+
JSON.generate(to_dynamic, options)
|
817
|
+
end
|
818
|
+
end
|
819
|
+
|
820
|
+
class ProjectPutRequest < Dry::Struct
|
821
|
+
|
822
|
+
# ID of the project to modify
|
823
|
+
attribute :id, Types::String
|
824
|
+
|
825
|
+
attribute :project_put_request_name, Types::String
|
826
|
+
|
827
|
+
# Organization ID of the project to modify
|
828
|
+
attribute :organization_id, Types::String
|
829
|
+
|
830
|
+
def self.from_dynamic!(d)
|
831
|
+
d = Types::Hash[d]
|
832
|
+
new(
|
833
|
+
id: d.fetch("id"),
|
834
|
+
project_put_request_name: d.fetch("name"),
|
835
|
+
organization_id: d.fetch("organizationId"),
|
836
|
+
)
|
837
|
+
end
|
838
|
+
|
839
|
+
def self.from_json!(json)
|
840
|
+
from_dynamic!(JSON.parse(json))
|
841
|
+
end
|
842
|
+
|
843
|
+
def to_dynamic
|
844
|
+
{
|
845
|
+
"id" => id,
|
846
|
+
"name" => project_put_request_name,
|
847
|
+
"organizationId" => organization_id,
|
848
|
+
}
|
849
|
+
end
|
850
|
+
|
851
|
+
def to_json(options = nil)
|
852
|
+
JSON.generate(to_dynamic, options)
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
856
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
857
|
+
# least once Retrieve a project by the provided identifier
|
858
|
+
#
|
859
|
+
# Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)
|
860
|
+
#
|
861
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
862
|
+
# least once Creates a new project in the provided organization using the given data
|
863
|
+
#
|
864
|
+
# Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)
|
865
|
+
#
|
866
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
867
|
+
# least once Lists all projects of the given organization
|
868
|
+
#
|
869
|
+
# Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse)
|
870
|
+
#
|
871
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
872
|
+
# least once Updates an existing project with the provided ID using the given data
|
873
|
+
#
|
874
|
+
# Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)
|
875
|
+
#
|
876
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
877
|
+
# least once Deletes all the projects whose IDs match the provided ones
|
878
|
+
#
|
879
|
+
# Returns:
|
880
|
+
# [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse)
|
881
|
+
class ProjectsCommand < Dry::Struct
|
882
|
+
attribute :get, ProjectGetRequest.optional
|
883
|
+
attribute :create, ProjectCreateRequest.optional
|
884
|
+
attribute :list, ProjectsListRequest.optional
|
885
|
+
attribute :update, ProjectPutRequest.optional
|
886
|
+
attribute :delete, ProjectsDeleteRequest.optional
|
887
|
+
|
888
|
+
def self.from_dynamic!(d)
|
889
|
+
d = Types::Hash[d]
|
890
|
+
new(
|
891
|
+
get: d["get"] ? ProjectGetRequest.from_dynamic!(d["get"]) : nil,
|
892
|
+
create: d["create"] ? ProjectCreateRequest.from_dynamic!(d["create"]) : nil,
|
893
|
+
list: d["list"] ? ProjectsListRequest.from_dynamic!(d["list"]) : nil,
|
894
|
+
update: d["update"] ? ProjectPutRequest.from_dynamic!(d["update"]) : nil,
|
895
|
+
delete: d["delete"] ? ProjectsDeleteRequest.from_dynamic!(d["delete"]) : nil,
|
896
|
+
)
|
897
|
+
end
|
898
|
+
|
899
|
+
def self.from_json!(json)
|
900
|
+
from_dynamic!(JSON.parse(json))
|
901
|
+
end
|
902
|
+
|
903
|
+
def to_dynamic
|
904
|
+
{
|
905
|
+
"get" => get&.to_dynamic,
|
906
|
+
"create" => create&.to_dynamic,
|
907
|
+
"list" => list&.to_dynamic,
|
908
|
+
"update" => update&.to_dynamic,
|
909
|
+
"delete" => delete&.to_dynamic,
|
910
|
+
}
|
911
|
+
end
|
912
|
+
|
913
|
+
def to_json(options = nil)
|
914
|
+
JSON.generate(to_dynamic, options)
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
class SecretCreateRequest < Dry::Struct
|
919
|
+
attribute :key, Types::String
|
920
|
+
attribute :note, Types::String
|
921
|
+
|
922
|
+
# Organization where the secret will be created
|
923
|
+
attribute :organization_id, Types::String
|
924
|
+
|
925
|
+
# IDs of the projects that this secret will belong to
|
926
|
+
attribute :project_ids, Types.Array(Types::String).optional.optional
|
927
|
+
|
928
|
+
attribute :value, Types::String
|
929
|
+
|
930
|
+
def self.from_dynamic!(d)
|
931
|
+
d = Types::Hash[d]
|
932
|
+
new(
|
933
|
+
key: d.fetch("key"),
|
934
|
+
note: d.fetch("note"),
|
935
|
+
organization_id: d.fetch("organizationId"),
|
936
|
+
project_ids: d["projectIds"],
|
937
|
+
value: d.fetch("value"),
|
938
|
+
)
|
939
|
+
end
|
940
|
+
|
941
|
+
def self.from_json!(json)
|
942
|
+
from_dynamic!(JSON.parse(json))
|
943
|
+
end
|
944
|
+
|
945
|
+
def to_dynamic
|
946
|
+
{
|
947
|
+
"key" => key,
|
948
|
+
"note" => note,
|
949
|
+
"organizationId" => organization_id,
|
950
|
+
"projectIds" => project_ids,
|
951
|
+
"value" => value,
|
952
|
+
}
|
953
|
+
end
|
954
|
+
|
955
|
+
def to_json(options = nil)
|
956
|
+
JSON.generate(to_dynamic, options)
|
957
|
+
end
|
958
|
+
end
|
959
|
+
|
960
|
+
class SecretsDeleteRequest < Dry::Struct
|
961
|
+
|
962
|
+
# IDs of the secrets to delete
|
963
|
+
attribute :ids, Types.Array(Types::String)
|
964
|
+
|
965
|
+
def self.from_dynamic!(d)
|
966
|
+
d = Types::Hash[d]
|
967
|
+
new(
|
968
|
+
ids: d.fetch("ids"),
|
969
|
+
)
|
970
|
+
end
|
971
|
+
|
972
|
+
def self.from_json!(json)
|
973
|
+
from_dynamic!(JSON.parse(json))
|
974
|
+
end
|
975
|
+
|
976
|
+
def to_dynamic
|
977
|
+
{
|
978
|
+
"ids" => ids,
|
979
|
+
}
|
980
|
+
end
|
981
|
+
|
982
|
+
def to_json(options = nil)
|
983
|
+
JSON.generate(to_dynamic, options)
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
class SecretGetRequest < Dry::Struct
|
988
|
+
|
989
|
+
# ID of the secret to retrieve
|
990
|
+
attribute :id, Types::String
|
991
|
+
|
992
|
+
def self.from_dynamic!(d)
|
993
|
+
d = Types::Hash[d]
|
994
|
+
new(
|
995
|
+
id: d.fetch("id"),
|
996
|
+
)
|
997
|
+
end
|
998
|
+
|
999
|
+
def self.from_json!(json)
|
1000
|
+
from_dynamic!(JSON.parse(json))
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
def to_dynamic
|
1004
|
+
{
|
1005
|
+
"id" => id,
|
1006
|
+
}
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
def to_json(options = nil)
|
1010
|
+
JSON.generate(to_dynamic, options)
|
1011
|
+
end
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
class SecretsGetRequest < Dry::Struct
|
1015
|
+
|
1016
|
+
# IDs of the secrets to retrieve
|
1017
|
+
attribute :ids, Types.Array(Types::String)
|
1018
|
+
|
1019
|
+
def self.from_dynamic!(d)
|
1020
|
+
d = Types::Hash[d]
|
1021
|
+
new(
|
1022
|
+
ids: d.fetch("ids"),
|
1023
|
+
)
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
def self.from_json!(json)
|
1027
|
+
from_dynamic!(JSON.parse(json))
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
def to_dynamic
|
1031
|
+
{
|
1032
|
+
"ids" => ids,
|
1033
|
+
}
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
def to_json(options = nil)
|
1037
|
+
JSON.generate(to_dynamic, options)
|
1038
|
+
end
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
class SecretIdentifiersRequest < Dry::Struct
|
1042
|
+
|
1043
|
+
# Organization to retrieve all the secrets from
|
1044
|
+
attribute :organization_id, Types::String
|
1045
|
+
|
1046
|
+
def self.from_dynamic!(d)
|
1047
|
+
d = Types::Hash[d]
|
1048
|
+
new(
|
1049
|
+
organization_id: d.fetch("organizationId"),
|
1050
|
+
)
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
def self.from_json!(json)
|
1054
|
+
from_dynamic!(JSON.parse(json))
|
1055
|
+
end
|
1056
|
+
|
1057
|
+
def to_dynamic
|
1058
|
+
{
|
1059
|
+
"organizationId" => organization_id,
|
1060
|
+
}
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
def to_json(options = nil)
|
1064
|
+
JSON.generate(to_dynamic, options)
|
1065
|
+
end
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
class SecretPutRequest < Dry::Struct
|
1069
|
+
|
1070
|
+
# ID of the secret to modify
|
1071
|
+
attribute :id, Types::String
|
1072
|
+
|
1073
|
+
attribute :key, Types::String
|
1074
|
+
attribute :note, Types::String
|
1075
|
+
|
1076
|
+
# Organization ID of the secret to modify
|
1077
|
+
attribute :organization_id, Types::String
|
1078
|
+
|
1079
|
+
attribute :project_ids, Types.Array(Types::String).optional.optional
|
1080
|
+
attribute :value, Types::String
|
1081
|
+
|
1082
|
+
def self.from_dynamic!(d)
|
1083
|
+
d = Types::Hash[d]
|
1084
|
+
new(
|
1085
|
+
id: d.fetch("id"),
|
1086
|
+
key: d.fetch("key"),
|
1087
|
+
note: d.fetch("note"),
|
1088
|
+
organization_id: d.fetch("organizationId"),
|
1089
|
+
project_ids: d["projectIds"],
|
1090
|
+
value: d.fetch("value"),
|
1091
|
+
)
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
def self.from_json!(json)
|
1095
|
+
from_dynamic!(JSON.parse(json))
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
def to_dynamic
|
1099
|
+
{
|
1100
|
+
"id" => id,
|
1101
|
+
"key" => key,
|
1102
|
+
"note" => note,
|
1103
|
+
"organizationId" => organization_id,
|
1104
|
+
"projectIds" => project_ids,
|
1105
|
+
"value" => value,
|
1106
|
+
}
|
1107
|
+
end
|
1108
|
+
|
1109
|
+
def to_json(options = nil)
|
1110
|
+
JSON.generate(to_dynamic, options)
|
1111
|
+
end
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
1115
|
+
# least once Retrieve a secret by the provided identifier
|
1116
|
+
#
|
1117
|
+
# Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)
|
1118
|
+
#
|
1119
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
1120
|
+
# least once Retrieve secrets by the provided identifiers
|
1121
|
+
#
|
1122
|
+
# Returns: [SecretsResponse](bitwarden::secrets_manager::secrets::SecretsResponse)
|
1123
|
+
#
|
1124
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
1125
|
+
# least once Creates a new secret in the provided organization using the given data
|
1126
|
+
#
|
1127
|
+
# Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)
|
1128
|
+
#
|
1129
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
1130
|
+
# least once Lists all secret identifiers of the given organization, to then retrieve each
|
1131
|
+
# secret, use `CreateSecret`
|
1132
|
+
#
|
1133
|
+
# Returns:
|
1134
|
+
# [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse)
|
1135
|
+
#
|
1136
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
1137
|
+
# least once Updates an existing secret with the provided ID using the given data
|
1138
|
+
#
|
1139
|
+
# Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)
|
1140
|
+
#
|
1141
|
+
# > Requires Authentication > Requires using an Access Token for login or calling Sync at
|
1142
|
+
# least once Deletes all the secrets whose IDs match the provided ones
|
1143
|
+
#
|
1144
|
+
# Returns:
|
1145
|
+
# [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse)
|
1146
|
+
class SecretsCommand < Dry::Struct
|
1147
|
+
attribute :get, SecretGetRequest.optional
|
1148
|
+
attribute :get_by_ids, SecretsGetRequest.optional
|
1149
|
+
attribute :create, SecretCreateRequest.optional
|
1150
|
+
attribute :list, SecretIdentifiersRequest.optional
|
1151
|
+
attribute :update, SecretPutRequest.optional
|
1152
|
+
attribute :delete, SecretsDeleteRequest.optional
|
1153
|
+
|
1154
|
+
def self.from_dynamic!(d)
|
1155
|
+
d = Types::Hash[d]
|
1156
|
+
new(
|
1157
|
+
get: d["get"] ? SecretGetRequest.from_dynamic!(d["get"]) : nil,
|
1158
|
+
get_by_ids: d["getByIds"] ? SecretsGetRequest.from_dynamic!(d["getByIds"]) : nil,
|
1159
|
+
create: d["create"] ? SecretCreateRequest.from_dynamic!(d["create"]) : nil,
|
1160
|
+
list: d["list"] ? SecretIdentifiersRequest.from_dynamic!(d["list"]) : nil,
|
1161
|
+
update: d["update"] ? SecretPutRequest.from_dynamic!(d["update"]) : nil,
|
1162
|
+
delete: d["delete"] ? SecretsDeleteRequest.from_dynamic!(d["delete"]) : nil,
|
1163
|
+
)
|
1164
|
+
end
|
1165
|
+
|
1166
|
+
def self.from_json!(json)
|
1167
|
+
from_dynamic!(JSON.parse(json))
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
def to_dynamic
|
1171
|
+
{
|
1172
|
+
"get" => get&.to_dynamic,
|
1173
|
+
"getByIds" => get_by_ids&.to_dynamic,
|
1174
|
+
"create" => create&.to_dynamic,
|
1175
|
+
"list" => list&.to_dynamic,
|
1176
|
+
"update" => update&.to_dynamic,
|
1177
|
+
"delete" => delete&.to_dynamic,
|
1178
|
+
}
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
def to_json(options = nil)
|
1182
|
+
JSON.generate(to_dynamic, options)
|
1183
|
+
end
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
class SyncRequest < Dry::Struct
|
1187
|
+
|
1188
|
+
# Exclude the subdomains from the response, defaults to false
|
1189
|
+
attribute :exclude_subdomains, Types::Bool.optional.optional
|
1190
|
+
|
1191
|
+
def self.from_dynamic!(d)
|
1192
|
+
d = Types::Hash[d]
|
1193
|
+
new(
|
1194
|
+
exclude_subdomains: d["excludeSubdomains"],
|
1195
|
+
)
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
def self.from_json!(json)
|
1199
|
+
from_dynamic!(JSON.parse(json))
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
def to_dynamic
|
1203
|
+
{
|
1204
|
+
"excludeSubdomains" => exclude_subdomains,
|
1205
|
+
}
|
1206
|
+
end
|
1207
|
+
|
1208
|
+
def to_json(options = nil)
|
1209
|
+
JSON.generate(to_dynamic, options)
|
1210
|
+
end
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
# Login with username and password
|
1214
|
+
#
|
1215
|
+
# This command is for initiating an authentication handshake with Bitwarden. Authorization
|
1216
|
+
# may fail due to requiring 2fa or captcha challenge completion despite accurate
|
1217
|
+
# credentials.
|
1218
|
+
#
|
1219
|
+
# This command is not capable of handling authentication requiring 2fa or captcha.
|
1220
|
+
#
|
1221
|
+
# Returns: [PasswordLoginResponse](bitwarden::auth::login::PasswordLoginResponse)
|
1222
|
+
#
|
1223
|
+
# Login with API Key
|
1224
|
+
#
|
1225
|
+
# This command is for initiating an authentication handshake with Bitwarden.
|
1226
|
+
#
|
1227
|
+
# Returns: [ApiKeyLoginResponse](bitwarden::auth::login::ApiKeyLoginResponse)
|
1228
|
+
#
|
1229
|
+
# Login with Secrets Manager Access Token
|
1230
|
+
#
|
1231
|
+
# This command is for initiating an authentication handshake with Bitwarden.
|
1232
|
+
#
|
1233
|
+
# Returns: [ApiKeyLoginResponse](bitwarden::auth::login::ApiKeyLoginResponse)
|
1234
|
+
#
|
1235
|
+
# > Requires Authentication Get the API key of the currently authenticated user
|
1236
|
+
#
|
1237
|
+
# Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse)
|
1238
|
+
#
|
1239
|
+
# Get the user's passphrase
|
1240
|
+
#
|
1241
|
+
# Returns: String
|
1242
|
+
#
|
1243
|
+
# > Requires Authentication Retrieve all user data, ciphers and organizations the user is a
|
1244
|
+
# part of
|
1245
|
+
#
|
1246
|
+
# Returns: [SyncResponse](bitwarden::platform::SyncResponse)
|
1247
|
+
class Command < Dry::Struct
|
1248
|
+
attribute :password_login, PasswordLoginRequest.optional
|
1249
|
+
attribute :api_key_login, APIKeyLoginRequest.optional
|
1250
|
+
attribute :access_token_login, AccessTokenLoginRequest.optional
|
1251
|
+
attribute :get_user_api_key, SecretVerificationRequest.optional
|
1252
|
+
attribute :fingerprint, FingerprintRequest.optional
|
1253
|
+
attribute :sync, SyncRequest.optional
|
1254
|
+
attribute :secrets, SecretsCommand.optional
|
1255
|
+
attribute :projects, ProjectsCommand.optional
|
1256
|
+
|
1257
|
+
def self.from_dynamic!(d)
|
1258
|
+
d = Types::Hash[d]
|
1259
|
+
new(
|
1260
|
+
password_login: d["passwordLogin"] ? PasswordLoginRequest.from_dynamic!(d["passwordLogin"]) : nil,
|
1261
|
+
api_key_login: d["apiKeyLogin"] ? APIKeyLoginRequest.from_dynamic!(d["apiKeyLogin"]) : nil,
|
1262
|
+
access_token_login: d["accessTokenLogin"] ? AccessTokenLoginRequest.from_dynamic!(d["accessTokenLogin"]) : nil,
|
1263
|
+
get_user_api_key: d["getUserApiKey"] ? SecretVerificationRequest.from_dynamic!(d["getUserApiKey"]) : nil,
|
1264
|
+
fingerprint: d["fingerprint"] ? FingerprintRequest.from_dynamic!(d["fingerprint"]) : nil,
|
1265
|
+
sync: d["sync"] ? SyncRequest.from_dynamic!(d["sync"]) : nil,
|
1266
|
+
secrets: d["secrets"] ? SecretsCommand.from_dynamic!(d["secrets"]) : nil,
|
1267
|
+
projects: d["projects"] ? ProjectsCommand.from_dynamic!(d["projects"]) : nil,
|
1268
|
+
)
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
def self.from_json!(json)
|
1272
|
+
from_dynamic!(JSON.parse(json))
|
1273
|
+
end
|
1274
|
+
|
1275
|
+
def to_dynamic
|
1276
|
+
{
|
1277
|
+
"passwordLogin" => password_login&.to_dynamic,
|
1278
|
+
"apiKeyLogin" => api_key_login&.to_dynamic,
|
1279
|
+
"accessTokenLogin" => access_token_login&.to_dynamic,
|
1280
|
+
"getUserApiKey" => get_user_api_key&.to_dynamic,
|
1281
|
+
"fingerprint" => fingerprint&.to_dynamic,
|
1282
|
+
"sync" => sync&.to_dynamic,
|
1283
|
+
"secrets" => secrets&.to_dynamic,
|
1284
|
+
"projects" => projects&.to_dynamic,
|
1285
|
+
}
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
def to_json(options = nil)
|
1289
|
+
JSON.generate(to_dynamic, options)
|
1290
|
+
end
|
1291
|
+
end
|
1292
|
+
|
1293
|
+
class Authenticator < Dry::Struct
|
1294
|
+
|
1295
|
+
def self.from_dynamic!(d)
|
1296
|
+
d = Types::Hash[d]
|
1297
|
+
new(
|
1298
|
+
)
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
def self.from_json!(json)
|
1302
|
+
from_dynamic!(JSON.parse(json))
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
def to_dynamic
|
1306
|
+
{
|
1307
|
+
}
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
def to_json(options = nil)
|
1311
|
+
JSON.generate(to_dynamic, options)
|
1312
|
+
end
|
1313
|
+
end
|
1314
|
+
|
1315
|
+
class Duo < Dry::Struct
|
1316
|
+
attribute :host, Types::String
|
1317
|
+
attribute :signature, Types::String
|
1318
|
+
|
1319
|
+
def self.from_dynamic!(d)
|
1320
|
+
d = Types::Hash[d]
|
1321
|
+
new(
|
1322
|
+
host: d.fetch("host"),
|
1323
|
+
signature: d.fetch("signature"),
|
1324
|
+
)
|
1325
|
+
end
|
1326
|
+
|
1327
|
+
def self.from_json!(json)
|
1328
|
+
from_dynamic!(JSON.parse(json))
|
1329
|
+
end
|
1330
|
+
|
1331
|
+
def to_dynamic
|
1332
|
+
{
|
1333
|
+
"host" => host,
|
1334
|
+
"signature" => signature,
|
1335
|
+
}
|
1336
|
+
end
|
1337
|
+
|
1338
|
+
def to_json(options = nil)
|
1339
|
+
JSON.generate(to_dynamic, options)
|
1340
|
+
end
|
1341
|
+
end
|
1342
|
+
|
1343
|
+
class Email < Dry::Struct
|
1344
|
+
|
1345
|
+
# The email to request a 2fa TOTP for
|
1346
|
+
attribute :email, Types::String
|
1347
|
+
|
1348
|
+
def self.from_dynamic!(d)
|
1349
|
+
d = Types::Hash[d]
|
1350
|
+
new(
|
1351
|
+
email: d.fetch("email"),
|
1352
|
+
)
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
def self.from_json!(json)
|
1356
|
+
from_dynamic!(JSON.parse(json))
|
1357
|
+
end
|
1358
|
+
|
1359
|
+
def to_dynamic
|
1360
|
+
{
|
1361
|
+
"email" => email,
|
1362
|
+
}
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
def to_json(options = nil)
|
1366
|
+
JSON.generate(to_dynamic, options)
|
1367
|
+
end
|
1368
|
+
end
|
1369
|
+
|
1370
|
+
class Remember < Dry::Struct
|
1371
|
+
|
1372
|
+
def self.from_dynamic!(d)
|
1373
|
+
d = Types::Hash[d]
|
1374
|
+
new(
|
1375
|
+
)
|
1376
|
+
end
|
1377
|
+
|
1378
|
+
def self.from_json!(json)
|
1379
|
+
from_dynamic!(JSON.parse(json))
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
def to_dynamic
|
1383
|
+
{
|
1384
|
+
}
|
1385
|
+
end
|
1386
|
+
|
1387
|
+
def to_json(options = nil)
|
1388
|
+
JSON.generate(to_dynamic, options)
|
1389
|
+
end
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
class WebAuthn < Dry::Struct
|
1393
|
+
|
1394
|
+
def self.from_dynamic!(d)
|
1395
|
+
d = Types::Hash[d]
|
1396
|
+
new(
|
1397
|
+
)
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
def self.from_json!(json)
|
1401
|
+
from_dynamic!(JSON.parse(json))
|
1402
|
+
end
|
1403
|
+
|
1404
|
+
def to_dynamic
|
1405
|
+
{
|
1406
|
+
}
|
1407
|
+
end
|
1408
|
+
|
1409
|
+
def to_json(options = nil)
|
1410
|
+
JSON.generate(to_dynamic, options)
|
1411
|
+
end
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
class YubiKey < Dry::Struct
|
1415
|
+
|
1416
|
+
# Whether the stored yubikey supports near field communication
|
1417
|
+
attribute :nfc, Types::Bool
|
1418
|
+
|
1419
|
+
def self.from_dynamic!(d)
|
1420
|
+
d = Types::Hash[d]
|
1421
|
+
new(
|
1422
|
+
nfc: d.fetch("nfc"),
|
1423
|
+
)
|
1424
|
+
end
|
1425
|
+
|
1426
|
+
def self.from_json!(json)
|
1427
|
+
from_dynamic!(JSON.parse(json))
|
1428
|
+
end
|
1429
|
+
|
1430
|
+
def to_dynamic
|
1431
|
+
{
|
1432
|
+
"nfc" => nfc,
|
1433
|
+
}
|
1434
|
+
end
|
1435
|
+
|
1436
|
+
def to_json(options = nil)
|
1437
|
+
JSON.generate(to_dynamic, options)
|
1438
|
+
end
|
1439
|
+
end
|
1440
|
+
|
1441
|
+
class TwoFactorProviders < Dry::Struct
|
1442
|
+
attribute :authenticator, Authenticator.optional.optional
|
1443
|
+
|
1444
|
+
# Duo-backed 2fa
|
1445
|
+
attribute :duo, Duo.optional.optional
|
1446
|
+
|
1447
|
+
# Email 2fa
|
1448
|
+
attribute :email, Email.optional.optional
|
1449
|
+
|
1450
|
+
# Duo-backed 2fa operated by an organization the user is a member of
|
1451
|
+
attribute :organization_duo, Duo.optional.optional
|
1452
|
+
|
1453
|
+
# Presence indicates the user has stored this device as bypassing 2fa
|
1454
|
+
attribute :remember, Remember.optional.optional
|
1455
|
+
|
1456
|
+
# WebAuthn-backed 2fa
|
1457
|
+
attribute :web_authn, WebAuthn.optional.optional
|
1458
|
+
|
1459
|
+
# Yubikey-backed 2fa
|
1460
|
+
attribute :yubi_key, YubiKey.optional.optional
|
1461
|
+
|
1462
|
+
def self.from_dynamic!(d)
|
1463
|
+
d = Types::Hash[d]
|
1464
|
+
new(
|
1465
|
+
authenticator: d["authenticator"] ? Authenticator.from_dynamic!(d["authenticator"]) : nil,
|
1466
|
+
duo: d["duo"] ? Duo.from_dynamic!(d["duo"]) : nil,
|
1467
|
+
email: d["email"] ? Email.from_dynamic!(d["email"]) : nil,
|
1468
|
+
organization_duo: d["organizationDuo"] ? Duo.from_dynamic!(d["organizationDuo"]) : nil,
|
1469
|
+
remember: d["remember"] ? Remember.from_dynamic!(d["remember"]) : nil,
|
1470
|
+
web_authn: d["webAuthn"] ? WebAuthn.from_dynamic!(d["webAuthn"]) : nil,
|
1471
|
+
yubi_key: d["yubiKey"] ? YubiKey.from_dynamic!(d["yubiKey"]) : nil,
|
1472
|
+
)
|
1473
|
+
end
|
1474
|
+
|
1475
|
+
def self.from_json!(json)
|
1476
|
+
from_dynamic!(JSON.parse(json))
|
1477
|
+
end
|
1478
|
+
|
1479
|
+
def to_dynamic
|
1480
|
+
{
|
1481
|
+
"authenticator" => authenticator&.to_dynamic,
|
1482
|
+
"duo" => duo&.to_dynamic,
|
1483
|
+
"email" => email&.to_dynamic,
|
1484
|
+
"organizationDuo" => organization_duo&.to_dynamic,
|
1485
|
+
"remember" => remember&.to_dynamic,
|
1486
|
+
"webAuthn" => web_authn&.to_dynamic,
|
1487
|
+
"yubiKey" => yubi_key&.to_dynamic,
|
1488
|
+
}
|
1489
|
+
end
|
1490
|
+
|
1491
|
+
def to_json(options = nil)
|
1492
|
+
JSON.generate(to_dynamic, options)
|
1493
|
+
end
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
class APIKeyLoginResponse < Dry::Struct
|
1497
|
+
attribute :authenticated, Types::Bool
|
1498
|
+
|
1499
|
+
# Whether or not the user is required to update their master password
|
1500
|
+
attribute :force_password_reset, Types::Bool
|
1501
|
+
|
1502
|
+
# TODO: What does this do?
|
1503
|
+
attribute :reset_master_password, Types::Bool
|
1504
|
+
|
1505
|
+
attribute :two_factor, TwoFactorProviders.optional.optional
|
1506
|
+
|
1507
|
+
def self.from_dynamic!(d)
|
1508
|
+
d = Types::Hash[d]
|
1509
|
+
new(
|
1510
|
+
authenticated: d.fetch("authenticated"),
|
1511
|
+
force_password_reset: d.fetch("forcePasswordReset"),
|
1512
|
+
reset_master_password: d.fetch("resetMasterPassword"),
|
1513
|
+
two_factor: d["twoFactor"] ? TwoFactorProviders.from_dynamic!(d["twoFactor"]) : nil,
|
1514
|
+
)
|
1515
|
+
end
|
1516
|
+
|
1517
|
+
def self.from_json!(json)
|
1518
|
+
from_dynamic!(JSON.parse(json))
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
def to_dynamic
|
1522
|
+
{
|
1523
|
+
"authenticated" => authenticated,
|
1524
|
+
"forcePasswordReset" => force_password_reset,
|
1525
|
+
"resetMasterPassword" => reset_master_password,
|
1526
|
+
"twoFactor" => two_factor&.to_dynamic,
|
1527
|
+
}
|
1528
|
+
end
|
1529
|
+
|
1530
|
+
def to_json(options = nil)
|
1531
|
+
JSON.generate(to_dynamic, options)
|
1532
|
+
end
|
1533
|
+
end
|
1534
|
+
|
1535
|
+
class ResponseForAPIKeyLoginResponse < Dry::Struct
|
1536
|
+
|
1537
|
+
# The response data. Populated if `success` is true.
|
1538
|
+
attribute :data, APIKeyLoginResponse.optional.optional
|
1539
|
+
|
1540
|
+
# A message for any error that may occur. Populated if `success` is false.
|
1541
|
+
attribute :error_message, Types::String.optional.optional
|
1542
|
+
|
1543
|
+
# Whether or not the SDK request succeeded.
|
1544
|
+
attribute :success, Types::Bool
|
1545
|
+
|
1546
|
+
def self.from_dynamic!(d)
|
1547
|
+
d = Types::Hash[d]
|
1548
|
+
new(
|
1549
|
+
data: d["data"] ? APIKeyLoginResponse.from_dynamic!(d["data"]) : nil,
|
1550
|
+
error_message: d["errorMessage"],
|
1551
|
+
success: d.fetch("success"),
|
1552
|
+
)
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
def self.from_json!(json)
|
1556
|
+
from_dynamic!(JSON.parse(json))
|
1557
|
+
end
|
1558
|
+
|
1559
|
+
def to_dynamic
|
1560
|
+
{
|
1561
|
+
"data" => data&.to_dynamic,
|
1562
|
+
"errorMessage" => error_message,
|
1563
|
+
"success" => success,
|
1564
|
+
}
|
1565
|
+
end
|
1566
|
+
|
1567
|
+
def to_json(options = nil)
|
1568
|
+
JSON.generate(to_dynamic, options)
|
1569
|
+
end
|
1570
|
+
end
|
1571
|
+
|
1572
|
+
class CAPTCHAResponse < Dry::Struct
|
1573
|
+
|
1574
|
+
# hcaptcha site key
|
1575
|
+
attribute :site_key, Types::String
|
1576
|
+
|
1577
|
+
def self.from_dynamic!(d)
|
1578
|
+
d = Types::Hash[d]
|
1579
|
+
new(
|
1580
|
+
site_key: d.fetch("siteKey"),
|
1581
|
+
)
|
1582
|
+
end
|
1583
|
+
|
1584
|
+
def self.from_json!(json)
|
1585
|
+
from_dynamic!(JSON.parse(json))
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
def to_dynamic
|
1589
|
+
{
|
1590
|
+
"siteKey" => site_key,
|
1591
|
+
}
|
1592
|
+
end
|
1593
|
+
|
1594
|
+
def to_json(options = nil)
|
1595
|
+
JSON.generate(to_dynamic, options)
|
1596
|
+
end
|
1597
|
+
end
|
1598
|
+
|
1599
|
+
class PasswordLoginResponse < Dry::Struct
|
1600
|
+
attribute :authenticated, Types::Bool
|
1601
|
+
|
1602
|
+
# The information required to present the user with a captcha challenge. Only present when
|
1603
|
+
# authentication fails due to requiring validation of a captcha challenge.
|
1604
|
+
attribute :captcha, CAPTCHAResponse.optional.optional
|
1605
|
+
|
1606
|
+
# Whether or not the user is required to update their master password
|
1607
|
+
attribute :force_password_reset, Types::Bool
|
1608
|
+
|
1609
|
+
# TODO: What does this do?
|
1610
|
+
attribute :reset_master_password, Types::Bool
|
1611
|
+
|
1612
|
+
# The available two factor authentication options. Present only when authentication fails
|
1613
|
+
# due to requiring a second authentication factor.
|
1614
|
+
attribute :two_factor, TwoFactorProviders.optional.optional
|
1615
|
+
|
1616
|
+
def self.from_dynamic!(d)
|
1617
|
+
d = Types::Hash[d]
|
1618
|
+
new(
|
1619
|
+
authenticated: d.fetch("authenticated"),
|
1620
|
+
captcha: d["captcha"] ? CAPTCHAResponse.from_dynamic!(d["captcha"]) : nil,
|
1621
|
+
force_password_reset: d.fetch("forcePasswordReset"),
|
1622
|
+
reset_master_password: d.fetch("resetMasterPassword"),
|
1623
|
+
two_factor: d["twoFactor"] ? TwoFactorProviders.from_dynamic!(d["twoFactor"]) : nil,
|
1624
|
+
)
|
1625
|
+
end
|
1626
|
+
|
1627
|
+
def self.from_json!(json)
|
1628
|
+
from_dynamic!(JSON.parse(json))
|
1629
|
+
end
|
1630
|
+
|
1631
|
+
def to_dynamic
|
1632
|
+
{
|
1633
|
+
"authenticated" => authenticated,
|
1634
|
+
"captcha" => captcha&.to_dynamic,
|
1635
|
+
"forcePasswordReset" => force_password_reset,
|
1636
|
+
"resetMasterPassword" => reset_master_password,
|
1637
|
+
"twoFactor" => two_factor&.to_dynamic,
|
1638
|
+
}
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
def to_json(options = nil)
|
1642
|
+
JSON.generate(to_dynamic, options)
|
1643
|
+
end
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
class ResponseForPasswordLoginResponse < Dry::Struct
|
1647
|
+
|
1648
|
+
# The response data. Populated if `success` is true.
|
1649
|
+
attribute :data, PasswordLoginResponse.optional.optional
|
1650
|
+
|
1651
|
+
# A message for any error that may occur. Populated if `success` is false.
|
1652
|
+
attribute :error_message, Types::String.optional.optional
|
1653
|
+
|
1654
|
+
# Whether or not the SDK request succeeded.
|
1655
|
+
attribute :success, Types::Bool
|
1656
|
+
|
1657
|
+
def self.from_dynamic!(d)
|
1658
|
+
d = Types::Hash[d]
|
1659
|
+
new(
|
1660
|
+
data: d["data"] ? PasswordLoginResponse.from_dynamic!(d["data"]) : nil,
|
1661
|
+
error_message: d["errorMessage"],
|
1662
|
+
success: d.fetch("success"),
|
1663
|
+
)
|
1664
|
+
end
|
1665
|
+
|
1666
|
+
def self.from_json!(json)
|
1667
|
+
from_dynamic!(JSON.parse(json))
|
1668
|
+
end
|
1669
|
+
|
1670
|
+
def to_dynamic
|
1671
|
+
{
|
1672
|
+
"data" => data&.to_dynamic,
|
1673
|
+
"errorMessage" => error_message,
|
1674
|
+
"success" => success,
|
1675
|
+
}
|
1676
|
+
end
|
1677
|
+
|
1678
|
+
def to_json(options = nil)
|
1679
|
+
JSON.generate(to_dynamic, options)
|
1680
|
+
end
|
1681
|
+
end
|
1682
|
+
|
1683
|
+
class AccessTokenLoginResponse < Dry::Struct
|
1684
|
+
attribute :authenticated, Types::Bool
|
1685
|
+
|
1686
|
+
# Whether or not the user is required to update their master password
|
1687
|
+
attribute :force_password_reset, Types::Bool
|
1688
|
+
|
1689
|
+
# TODO: What does this do?
|
1690
|
+
attribute :reset_master_password, Types::Bool
|
1691
|
+
|
1692
|
+
attribute :two_factor, TwoFactorProviders.optional.optional
|
1693
|
+
|
1694
|
+
def self.from_dynamic!(d)
|
1695
|
+
d = Types::Hash[d]
|
1696
|
+
new(
|
1697
|
+
authenticated: d.fetch("authenticated"),
|
1698
|
+
force_password_reset: d.fetch("forcePasswordReset"),
|
1699
|
+
reset_master_password: d.fetch("resetMasterPassword"),
|
1700
|
+
two_factor: d["twoFactor"] ? TwoFactorProviders.from_dynamic!(d["twoFactor"]) : nil,
|
1701
|
+
)
|
1702
|
+
end
|
1703
|
+
|
1704
|
+
def self.from_json!(json)
|
1705
|
+
from_dynamic!(JSON.parse(json))
|
1706
|
+
end
|
1707
|
+
|
1708
|
+
def to_dynamic
|
1709
|
+
{
|
1710
|
+
"authenticated" => authenticated,
|
1711
|
+
"forcePasswordReset" => force_password_reset,
|
1712
|
+
"resetMasterPassword" => reset_master_password,
|
1713
|
+
"twoFactor" => two_factor&.to_dynamic,
|
1714
|
+
}
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
def to_json(options = nil)
|
1718
|
+
JSON.generate(to_dynamic, options)
|
1719
|
+
end
|
1720
|
+
end
|
1721
|
+
|
1722
|
+
class ResponseForAccessTokenLoginResponse < Dry::Struct
|
1723
|
+
|
1724
|
+
# The response data. Populated if `success` is true.
|
1725
|
+
attribute :data, AccessTokenLoginResponse.optional.optional
|
1726
|
+
|
1727
|
+
# A message for any error that may occur. Populated if `success` is false.
|
1728
|
+
attribute :error_message, Types::String.optional.optional
|
1729
|
+
|
1730
|
+
# Whether or not the SDK request succeeded.
|
1731
|
+
attribute :success, Types::Bool
|
1732
|
+
|
1733
|
+
def self.from_dynamic!(d)
|
1734
|
+
d = Types::Hash[d]
|
1735
|
+
new(
|
1736
|
+
data: d["data"] ? AccessTokenLoginResponse.from_dynamic!(d["data"]) : nil,
|
1737
|
+
error_message: d["errorMessage"],
|
1738
|
+
success: d.fetch("success"),
|
1739
|
+
)
|
1740
|
+
end
|
1741
|
+
|
1742
|
+
def self.from_json!(json)
|
1743
|
+
from_dynamic!(JSON.parse(json))
|
1744
|
+
end
|
1745
|
+
|
1746
|
+
def to_dynamic
|
1747
|
+
{
|
1748
|
+
"data" => data&.to_dynamic,
|
1749
|
+
"errorMessage" => error_message,
|
1750
|
+
"success" => success,
|
1751
|
+
}
|
1752
|
+
end
|
1753
|
+
|
1754
|
+
def to_json(options = nil)
|
1755
|
+
JSON.generate(to_dynamic, options)
|
1756
|
+
end
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
class SecretIdentifierResponse < Dry::Struct
|
1760
|
+
attribute :id, Types::String
|
1761
|
+
attribute :key, Types::String
|
1762
|
+
attribute :organization_id, Types::String
|
1763
|
+
|
1764
|
+
def self.from_dynamic!(d)
|
1765
|
+
d = Types::Hash[d]
|
1766
|
+
new(
|
1767
|
+
id: d.fetch("id"),
|
1768
|
+
key: d.fetch("key"),
|
1769
|
+
organization_id: d.fetch("organizationId"),
|
1770
|
+
)
|
1771
|
+
end
|
1772
|
+
|
1773
|
+
def self.from_json!(json)
|
1774
|
+
from_dynamic!(JSON.parse(json))
|
1775
|
+
end
|
1776
|
+
|
1777
|
+
def to_dynamic
|
1778
|
+
{
|
1779
|
+
"id" => id,
|
1780
|
+
"key" => key,
|
1781
|
+
"organizationId" => organization_id,
|
1782
|
+
}
|
1783
|
+
end
|
1784
|
+
|
1785
|
+
def to_json(options = nil)
|
1786
|
+
JSON.generate(to_dynamic, options)
|
1787
|
+
end
|
1788
|
+
end
|
1789
|
+
|
1790
|
+
class SecretIdentifiersResponse < Dry::Struct
|
1791
|
+
attribute :data, Types.Array(SecretIdentifierResponse)
|
1792
|
+
|
1793
|
+
def self.from_dynamic!(d)
|
1794
|
+
d = Types::Hash[d]
|
1795
|
+
new(
|
1796
|
+
data: d.fetch("data").map { |x| SecretIdentifierResponse.from_dynamic!(x) },
|
1797
|
+
)
|
1798
|
+
end
|
1799
|
+
|
1800
|
+
def self.from_json!(json)
|
1801
|
+
from_dynamic!(JSON.parse(json))
|
1802
|
+
end
|
1803
|
+
|
1804
|
+
def to_dynamic
|
1805
|
+
{
|
1806
|
+
"data" => data.map { |x| x.to_dynamic },
|
1807
|
+
}
|
1808
|
+
end
|
1809
|
+
|
1810
|
+
def to_json(options = nil)
|
1811
|
+
JSON.generate(to_dynamic, options)
|
1812
|
+
end
|
1813
|
+
end
|
1814
|
+
|
1815
|
+
class ResponseForSecretIdentifiersResponse < Dry::Struct
|
1816
|
+
|
1817
|
+
# The response data. Populated if `success` is true.
|
1818
|
+
attribute :data, SecretIdentifiersResponse.optional.optional
|
1819
|
+
|
1820
|
+
# A message for any error that may occur. Populated if `success` is false.
|
1821
|
+
attribute :error_message, Types::String.optional.optional
|
1822
|
+
|
1823
|
+
# Whether or not the SDK request succeeded.
|
1824
|
+
attribute :success, Types::Bool
|
1825
|
+
|
1826
|
+
def self.from_dynamic!(d)
|
1827
|
+
d = Types::Hash[d]
|
1828
|
+
new(
|
1829
|
+
data: d["data"] ? SecretIdentifiersResponse.from_dynamic!(d["data"]) : nil,
|
1830
|
+
error_message: d["errorMessage"],
|
1831
|
+
success: d.fetch("success"),
|
1832
|
+
)
|
1833
|
+
end
|
1834
|
+
|
1835
|
+
def self.from_json!(json)
|
1836
|
+
from_dynamic!(JSON.parse(json))
|
1837
|
+
end
|
1838
|
+
|
1839
|
+
def to_dynamic
|
1840
|
+
{
|
1841
|
+
"data" => data&.to_dynamic,
|
1842
|
+
"errorMessage" => error_message,
|
1843
|
+
"success" => success,
|
1844
|
+
}
|
1845
|
+
end
|
1846
|
+
|
1847
|
+
def to_json(options = nil)
|
1848
|
+
JSON.generate(to_dynamic, options)
|
1849
|
+
end
|
1850
|
+
end
|
1851
|
+
|
1852
|
+
class SecretResponse < Dry::Struct
|
1853
|
+
attribute :creation_date, Types::String
|
1854
|
+
attribute :id, Types::String
|
1855
|
+
attribute :key, Types::String
|
1856
|
+
attribute :note, Types::String
|
1857
|
+
attribute :organization_id, Types::String
|
1858
|
+
attribute :project_id, Types::String.optional.optional
|
1859
|
+
attribute :revision_date, Types::String
|
1860
|
+
attribute :value, Types::String
|
1861
|
+
|
1862
|
+
def self.from_dynamic!(d)
|
1863
|
+
d = Types::Hash[d]
|
1864
|
+
new(
|
1865
|
+
creation_date: d.fetch("creationDate"),
|
1866
|
+
id: d.fetch("id"),
|
1867
|
+
key: d.fetch("key"),
|
1868
|
+
note: d.fetch("note"),
|
1869
|
+
organization_id: d.fetch("organizationId"),
|
1870
|
+
project_id: d["projectId"],
|
1871
|
+
revision_date: d.fetch("revisionDate"),
|
1872
|
+
value: d.fetch("value"),
|
1873
|
+
)
|
1874
|
+
end
|
1875
|
+
|
1876
|
+
def self.from_json!(json)
|
1877
|
+
from_dynamic!(JSON.parse(json))
|
1878
|
+
end
|
1879
|
+
|
1880
|
+
def to_dynamic
|
1881
|
+
{
|
1882
|
+
"creationDate" => creation_date,
|
1883
|
+
"id" => id,
|
1884
|
+
"key" => key,
|
1885
|
+
"note" => note,
|
1886
|
+
"organizationId" => organization_id,
|
1887
|
+
"projectId" => project_id,
|
1888
|
+
"revisionDate" => revision_date,
|
1889
|
+
"value" => value,
|
1890
|
+
}
|
1891
|
+
end
|
1892
|
+
|
1893
|
+
def to_json(options = nil)
|
1894
|
+
JSON.generate(to_dynamic, options)
|
1895
|
+
end
|
1896
|
+
end
|
1897
|
+
|
1898
|
+
class ResponseForSecretResponse < Dry::Struct
|
1899
|
+
|
1900
|
+
# The response data. Populated if `success` is true.
|
1901
|
+
attribute :data, SecretResponse.optional.optional
|
1902
|
+
|
1903
|
+
# A message for any error that may occur. Populated if `success` is false.
|
1904
|
+
attribute :error_message, Types::String.optional.optional
|
1905
|
+
|
1906
|
+
# Whether or not the SDK request succeeded.
|
1907
|
+
attribute :success, Types::Bool
|
1908
|
+
|
1909
|
+
def self.from_dynamic!(d)
|
1910
|
+
d = Types::Hash[d]
|
1911
|
+
new(
|
1912
|
+
data: d["data"] ? SecretResponse.from_dynamic!(d["data"]) : nil,
|
1913
|
+
error_message: d["errorMessage"],
|
1914
|
+
success: d.fetch("success"),
|
1915
|
+
)
|
1916
|
+
end
|
1917
|
+
|
1918
|
+
def self.from_json!(json)
|
1919
|
+
from_dynamic!(JSON.parse(json))
|
1920
|
+
end
|
1921
|
+
|
1922
|
+
def to_dynamic
|
1923
|
+
{
|
1924
|
+
"data" => data&.to_dynamic,
|
1925
|
+
"errorMessage" => error_message,
|
1926
|
+
"success" => success,
|
1927
|
+
}
|
1928
|
+
end
|
1929
|
+
|
1930
|
+
def to_json(options = nil)
|
1931
|
+
JSON.generate(to_dynamic, options)
|
1932
|
+
end
|
1933
|
+
end
|
1934
|
+
|
1935
|
+
class SecretsResponse < Dry::Struct
|
1936
|
+
attribute :data, Types.Array(SecretResponse)
|
1937
|
+
|
1938
|
+
def self.from_dynamic!(d)
|
1939
|
+
d = Types::Hash[d]
|
1940
|
+
new(
|
1941
|
+
data: d.fetch("data").map { |x| SecretResponse.from_dynamic!(x) },
|
1942
|
+
)
|
1943
|
+
end
|
1944
|
+
|
1945
|
+
def self.from_json!(json)
|
1946
|
+
from_dynamic!(JSON.parse(json))
|
1947
|
+
end
|
1948
|
+
|
1949
|
+
def to_dynamic
|
1950
|
+
{
|
1951
|
+
"data" => data.map { |x| x.to_dynamic },
|
1952
|
+
}
|
1953
|
+
end
|
1954
|
+
|
1955
|
+
def to_json(options = nil)
|
1956
|
+
JSON.generate(to_dynamic, options)
|
1957
|
+
end
|
1958
|
+
end
|
1959
|
+
|
1960
|
+
class ResponseForSecretsResponse < Dry::Struct
|
1961
|
+
|
1962
|
+
# The response data. Populated if `success` is true.
|
1963
|
+
attribute :data, SecretsResponse.optional.optional
|
1964
|
+
|
1965
|
+
# A message for any error that may occur. Populated if `success` is false.
|
1966
|
+
attribute :error_message, Types::String.optional.optional
|
1967
|
+
|
1968
|
+
# Whether or not the SDK request succeeded.
|
1969
|
+
attribute :success, Types::Bool
|
1970
|
+
|
1971
|
+
def self.from_dynamic!(d)
|
1972
|
+
d = Types::Hash[d]
|
1973
|
+
new(
|
1974
|
+
data: d["data"] ? SecretsResponse.from_dynamic!(d["data"]) : nil,
|
1975
|
+
error_message: d["errorMessage"],
|
1976
|
+
success: d.fetch("success"),
|
1977
|
+
)
|
1978
|
+
end
|
1979
|
+
|
1980
|
+
def self.from_json!(json)
|
1981
|
+
from_dynamic!(JSON.parse(json))
|
1982
|
+
end
|
1983
|
+
|
1984
|
+
def to_dynamic
|
1985
|
+
{
|
1986
|
+
"data" => data&.to_dynamic,
|
1987
|
+
"errorMessage" => error_message,
|
1988
|
+
"success" => success,
|
1989
|
+
}
|
1990
|
+
end
|
1991
|
+
|
1992
|
+
def to_json(options = nil)
|
1993
|
+
JSON.generate(to_dynamic, options)
|
1994
|
+
end
|
1995
|
+
end
|
1996
|
+
|
1997
|
+
class SecretDeleteResponse < Dry::Struct
|
1998
|
+
attribute :error, Types::String.optional.optional
|
1999
|
+
attribute :id, Types::String
|
2000
|
+
|
2001
|
+
def self.from_dynamic!(d)
|
2002
|
+
d = Types::Hash[d]
|
2003
|
+
new(
|
2004
|
+
error: d["error"],
|
2005
|
+
id: d.fetch("id"),
|
2006
|
+
)
|
2007
|
+
end
|
2008
|
+
|
2009
|
+
def self.from_json!(json)
|
2010
|
+
from_dynamic!(JSON.parse(json))
|
2011
|
+
end
|
2012
|
+
|
2013
|
+
def to_dynamic
|
2014
|
+
{
|
2015
|
+
"error" => error,
|
2016
|
+
"id" => id,
|
2017
|
+
}
|
2018
|
+
end
|
2019
|
+
|
2020
|
+
def to_json(options = nil)
|
2021
|
+
JSON.generate(to_dynamic, options)
|
2022
|
+
end
|
2023
|
+
end
|
2024
|
+
|
2025
|
+
class SecretsDeleteResponse < Dry::Struct
|
2026
|
+
attribute :data, Types.Array(SecretDeleteResponse)
|
2027
|
+
|
2028
|
+
def self.from_dynamic!(d)
|
2029
|
+
d = Types::Hash[d]
|
2030
|
+
new(
|
2031
|
+
data: d.fetch("data").map { |x| SecretDeleteResponse.from_dynamic!(x) },
|
2032
|
+
)
|
2033
|
+
end
|
2034
|
+
|
2035
|
+
def self.from_json!(json)
|
2036
|
+
from_dynamic!(JSON.parse(json))
|
2037
|
+
end
|
2038
|
+
|
2039
|
+
def to_dynamic
|
2040
|
+
{
|
2041
|
+
"data" => data.map { |x| x.to_dynamic },
|
2042
|
+
}
|
2043
|
+
end
|
2044
|
+
|
2045
|
+
def to_json(options = nil)
|
2046
|
+
JSON.generate(to_dynamic, options)
|
2047
|
+
end
|
2048
|
+
end
|
2049
|
+
|
2050
|
+
class ResponseForSecretsDeleteResponse < Dry::Struct
|
2051
|
+
|
2052
|
+
# The response data. Populated if `success` is true.
|
2053
|
+
attribute :data, SecretsDeleteResponse.optional.optional
|
2054
|
+
|
2055
|
+
# A message for any error that may occur. Populated if `success` is false.
|
2056
|
+
attribute :error_message, Types::String.optional.optional
|
2057
|
+
|
2058
|
+
# Whether or not the SDK request succeeded.
|
2059
|
+
attribute :success, Types::Bool
|
2060
|
+
|
2061
|
+
def self.from_dynamic!(d)
|
2062
|
+
d = Types::Hash[d]
|
2063
|
+
new(
|
2064
|
+
data: d["data"] ? SecretsDeleteResponse.from_dynamic!(d["data"]) : nil,
|
2065
|
+
error_message: d["errorMessage"],
|
2066
|
+
success: d.fetch("success"),
|
2067
|
+
)
|
2068
|
+
end
|
2069
|
+
|
2070
|
+
def self.from_json!(json)
|
2071
|
+
from_dynamic!(JSON.parse(json))
|
2072
|
+
end
|
2073
|
+
|
2074
|
+
def to_dynamic
|
2075
|
+
{
|
2076
|
+
"data" => data&.to_dynamic,
|
2077
|
+
"errorMessage" => error_message,
|
2078
|
+
"success" => success,
|
2079
|
+
}
|
2080
|
+
end
|
2081
|
+
|
2082
|
+
def to_json(options = nil)
|
2083
|
+
JSON.generate(to_dynamic, options)
|
2084
|
+
end
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
class ProjectResponse < Dry::Struct
|
2088
|
+
attribute :creation_date, Types::String
|
2089
|
+
attribute :id, Types::String
|
2090
|
+
attribute :project_response_name, Types::String
|
2091
|
+
attribute :organization_id, Types::String
|
2092
|
+
attribute :revision_date, Types::String
|
2093
|
+
|
2094
|
+
def self.from_dynamic!(d)
|
2095
|
+
d = Types::Hash[d]
|
2096
|
+
new(
|
2097
|
+
creation_date: d.fetch("creationDate"),
|
2098
|
+
id: d.fetch("id"),
|
2099
|
+
project_response_name: d.fetch("name"),
|
2100
|
+
organization_id: d.fetch("organizationId"),
|
2101
|
+
revision_date: d.fetch("revisionDate"),
|
2102
|
+
)
|
2103
|
+
end
|
2104
|
+
|
2105
|
+
def self.from_json!(json)
|
2106
|
+
from_dynamic!(JSON.parse(json))
|
2107
|
+
end
|
2108
|
+
|
2109
|
+
def to_dynamic
|
2110
|
+
{
|
2111
|
+
"creationDate" => creation_date,
|
2112
|
+
"id" => id,
|
2113
|
+
"name" => project_response_name,
|
2114
|
+
"organizationId" => organization_id,
|
2115
|
+
"revisionDate" => revision_date,
|
2116
|
+
}
|
2117
|
+
end
|
2118
|
+
|
2119
|
+
def to_json(options = nil)
|
2120
|
+
JSON.generate(to_dynamic, options)
|
2121
|
+
end
|
2122
|
+
end
|
2123
|
+
|
2124
|
+
class ResponseForProjectResponse < Dry::Struct
|
2125
|
+
|
2126
|
+
# The response data. Populated if `success` is true.
|
2127
|
+
attribute :data, ProjectResponse.optional.optional
|
2128
|
+
|
2129
|
+
# A message for any error that may occur. Populated if `success` is false.
|
2130
|
+
attribute :error_message, Types::String.optional.optional
|
2131
|
+
|
2132
|
+
# Whether or not the SDK request succeeded.
|
2133
|
+
attribute :success, Types::Bool
|
2134
|
+
|
2135
|
+
def self.from_dynamic!(d)
|
2136
|
+
d = Types::Hash[d]
|
2137
|
+
new(
|
2138
|
+
data: d["data"] ? ProjectResponse.from_dynamic!(d["data"]) : nil,
|
2139
|
+
error_message: d["errorMessage"],
|
2140
|
+
success: d.fetch("success"),
|
2141
|
+
)
|
2142
|
+
end
|
2143
|
+
|
2144
|
+
def self.from_json!(json)
|
2145
|
+
from_dynamic!(JSON.parse(json))
|
2146
|
+
end
|
2147
|
+
|
2148
|
+
def to_dynamic
|
2149
|
+
{
|
2150
|
+
"data" => data&.to_dynamic,
|
2151
|
+
"errorMessage" => error_message,
|
2152
|
+
"success" => success,
|
2153
|
+
}
|
2154
|
+
end
|
2155
|
+
|
2156
|
+
def to_json(options = nil)
|
2157
|
+
JSON.generate(to_dynamic, options)
|
2158
|
+
end
|
2159
|
+
end
|
2160
|
+
|
2161
|
+
class ProjectsResponse < Dry::Struct
|
2162
|
+
attribute :data, Types.Array(ProjectResponse)
|
2163
|
+
|
2164
|
+
def self.from_dynamic!(d)
|
2165
|
+
d = Types::Hash[d]
|
2166
|
+
new(
|
2167
|
+
data: d.fetch("data").map { |x| ProjectResponse.from_dynamic!(x) },
|
2168
|
+
)
|
2169
|
+
end
|
2170
|
+
|
2171
|
+
def self.from_json!(json)
|
2172
|
+
from_dynamic!(JSON.parse(json))
|
2173
|
+
end
|
2174
|
+
|
2175
|
+
def to_dynamic
|
2176
|
+
{
|
2177
|
+
"data" => data.map { |x| x.to_dynamic },
|
2178
|
+
}
|
2179
|
+
end
|
2180
|
+
|
2181
|
+
def to_json(options = nil)
|
2182
|
+
JSON.generate(to_dynamic, options)
|
2183
|
+
end
|
2184
|
+
end
|
2185
|
+
|
2186
|
+
class ResponseForProjectsResponse < Dry::Struct
|
2187
|
+
|
2188
|
+
# The response data. Populated if `success` is true.
|
2189
|
+
attribute :data, ProjectsResponse.optional.optional
|
2190
|
+
|
2191
|
+
# A message for any error that may occur. Populated if `success` is false.
|
2192
|
+
attribute :error_message, Types::String.optional.optional
|
2193
|
+
|
2194
|
+
# Whether or not the SDK request succeeded.
|
2195
|
+
attribute :success, Types::Bool
|
2196
|
+
|
2197
|
+
def self.from_dynamic!(d)
|
2198
|
+
d = Types::Hash[d]
|
2199
|
+
new(
|
2200
|
+
data: d["data"] ? ProjectsResponse.from_dynamic!(d["data"]) : nil,
|
2201
|
+
error_message: d["errorMessage"],
|
2202
|
+
success: d.fetch("success"),
|
2203
|
+
)
|
2204
|
+
end
|
2205
|
+
|
2206
|
+
def self.from_json!(json)
|
2207
|
+
from_dynamic!(JSON.parse(json))
|
2208
|
+
end
|
2209
|
+
|
2210
|
+
def to_dynamic
|
2211
|
+
{
|
2212
|
+
"data" => data&.to_dynamic,
|
2213
|
+
"errorMessage" => error_message,
|
2214
|
+
"success" => success,
|
2215
|
+
}
|
2216
|
+
end
|
2217
|
+
|
2218
|
+
def to_json(options = nil)
|
2219
|
+
JSON.generate(to_dynamic, options)
|
2220
|
+
end
|
2221
|
+
end
|
2222
|
+
|
2223
|
+
class ProjectDeleteResponse < Dry::Struct
|
2224
|
+
attribute :error, Types::String.optional.optional
|
2225
|
+
attribute :id, Types::String
|
2226
|
+
|
2227
|
+
def self.from_dynamic!(d)
|
2228
|
+
d = Types::Hash[d]
|
2229
|
+
new(
|
2230
|
+
error: d["error"],
|
2231
|
+
id: d.fetch("id"),
|
2232
|
+
)
|
2233
|
+
end
|
2234
|
+
|
2235
|
+
def self.from_json!(json)
|
2236
|
+
from_dynamic!(JSON.parse(json))
|
2237
|
+
end
|
2238
|
+
|
2239
|
+
def to_dynamic
|
2240
|
+
{
|
2241
|
+
"error" => error,
|
2242
|
+
"id" => id,
|
2243
|
+
}
|
2244
|
+
end
|
2245
|
+
|
2246
|
+
def to_json(options = nil)
|
2247
|
+
JSON.generate(to_dynamic, options)
|
2248
|
+
end
|
2249
|
+
end
|
2250
|
+
|
2251
|
+
class ProjectsDeleteResponse < Dry::Struct
|
2252
|
+
attribute :data, Types.Array(ProjectDeleteResponse)
|
2253
|
+
|
2254
|
+
def self.from_dynamic!(d)
|
2255
|
+
d = Types::Hash[d]
|
2256
|
+
new(
|
2257
|
+
data: d.fetch("data").map { |x| ProjectDeleteResponse.from_dynamic!(x) },
|
2258
|
+
)
|
2259
|
+
end
|
2260
|
+
|
2261
|
+
def self.from_json!(json)
|
2262
|
+
from_dynamic!(JSON.parse(json))
|
2263
|
+
end
|
2264
|
+
|
2265
|
+
def to_dynamic
|
2266
|
+
{
|
2267
|
+
"data" => data.map { |x| x.to_dynamic },
|
2268
|
+
}
|
2269
|
+
end
|
2270
|
+
|
2271
|
+
def to_json(options = nil)
|
2272
|
+
JSON.generate(to_dynamic, options)
|
2273
|
+
end
|
2274
|
+
end
|
2275
|
+
|
2276
|
+
class ResponseForProjectsDeleteResponse < Dry::Struct
|
2277
|
+
|
2278
|
+
# The response data. Populated if `success` is true.
|
2279
|
+
attribute :data, ProjectsDeleteResponse.optional.optional
|
2280
|
+
|
2281
|
+
# A message for any error that may occur. Populated if `success` is false.
|
2282
|
+
attribute :error_message, Types::String.optional.optional
|
2283
|
+
|
2284
|
+
# Whether or not the SDK request succeeded.
|
2285
|
+
attribute :success, Types::Bool
|
2286
|
+
|
2287
|
+
def self.from_dynamic!(d)
|
2288
|
+
d = Types::Hash[d]
|
2289
|
+
new(
|
2290
|
+
data: d["data"] ? ProjectsDeleteResponse.from_dynamic!(d["data"]) : nil,
|
2291
|
+
error_message: d["errorMessage"],
|
2292
|
+
success: d.fetch("success"),
|
2293
|
+
)
|
2294
|
+
end
|
2295
|
+
|
2296
|
+
def self.from_json!(json)
|
2297
|
+
from_dynamic!(JSON.parse(json))
|
2298
|
+
end
|
2299
|
+
|
2300
|
+
def to_dynamic
|
2301
|
+
{
|
2302
|
+
"data" => data&.to_dynamic,
|
2303
|
+
"errorMessage" => error_message,
|
2304
|
+
"success" => success,
|
2305
|
+
}
|
2306
|
+
end
|
2307
|
+
|
2308
|
+
def to_json(options = nil)
|
2309
|
+
JSON.generate(to_dynamic, options)
|
2310
|
+
end
|
2311
|
+
end
|
2312
|
+
|
2313
|
+
class FingerprintResponse < Dry::Struct
|
2314
|
+
attribute :fingerprint, Types::String
|
2315
|
+
|
2316
|
+
def self.from_dynamic!(d)
|
2317
|
+
d = Types::Hash[d]
|
2318
|
+
new(
|
2319
|
+
fingerprint: d.fetch("fingerprint"),
|
2320
|
+
)
|
2321
|
+
end
|
2322
|
+
|
2323
|
+
def self.from_json!(json)
|
2324
|
+
from_dynamic!(JSON.parse(json))
|
2325
|
+
end
|
2326
|
+
|
2327
|
+
def to_dynamic
|
2328
|
+
{
|
2329
|
+
"fingerprint" => fingerprint,
|
2330
|
+
}
|
2331
|
+
end
|
2332
|
+
|
2333
|
+
def to_json(options = nil)
|
2334
|
+
JSON.generate(to_dynamic, options)
|
2335
|
+
end
|
2336
|
+
end
|
2337
|
+
|
2338
|
+
class ResponseForFingerprintResponse < Dry::Struct
|
2339
|
+
|
2340
|
+
# The response data. Populated if `success` is true.
|
2341
|
+
attribute :data, FingerprintResponse.optional.optional
|
2342
|
+
|
2343
|
+
# A message for any error that may occur. Populated if `success` is false.
|
2344
|
+
attribute :error_message, Types::String.optional.optional
|
2345
|
+
|
2346
|
+
# Whether or not the SDK request succeeded.
|
2347
|
+
attribute :success, Types::Bool
|
2348
|
+
|
2349
|
+
def self.from_dynamic!(d)
|
2350
|
+
d = Types::Hash[d]
|
2351
|
+
new(
|
2352
|
+
data: d["data"] ? FingerprintResponse.from_dynamic!(d["data"]) : nil,
|
2353
|
+
error_message: d["errorMessage"],
|
2354
|
+
success: d.fetch("success"),
|
2355
|
+
)
|
2356
|
+
end
|
2357
|
+
|
2358
|
+
def self.from_json!(json)
|
2359
|
+
from_dynamic!(JSON.parse(json))
|
2360
|
+
end
|
2361
|
+
|
2362
|
+
def to_dynamic
|
2363
|
+
{
|
2364
|
+
"data" => data&.to_dynamic,
|
2365
|
+
"errorMessage" => error_message,
|
2366
|
+
"success" => success,
|
2367
|
+
}
|
2368
|
+
end
|
2369
|
+
|
2370
|
+
def to_json(options = nil)
|
2371
|
+
JSON.generate(to_dynamic, options)
|
2372
|
+
end
|
2373
|
+
end
|
2374
|
+
|
2375
|
+
class Attachment < Dry::Struct
|
2376
|
+
attribute :file_name, Types::String.optional.optional
|
2377
|
+
attribute :id, Types::String.optional.optional
|
2378
|
+
attribute :key, Types::String.optional.optional
|
2379
|
+
attribute :size, Types::String.optional.optional
|
2380
|
+
|
2381
|
+
# Readable size, ex: "4.2 KB" or "1.43 GB"
|
2382
|
+
attribute :size_name, Types::String.optional.optional
|
2383
|
+
|
2384
|
+
attribute :url, Types::String.optional.optional
|
2385
|
+
|
2386
|
+
def self.from_dynamic!(d)
|
2387
|
+
d = Types::Hash[d]
|
2388
|
+
new(
|
2389
|
+
file_name: d["fileName"],
|
2390
|
+
id: d["id"],
|
2391
|
+
key: d["key"],
|
2392
|
+
size: d["size"],
|
2393
|
+
size_name: d["sizeName"],
|
2394
|
+
url: d["url"],
|
2395
|
+
)
|
2396
|
+
end
|
2397
|
+
|
2398
|
+
def self.from_json!(json)
|
2399
|
+
from_dynamic!(JSON.parse(json))
|
2400
|
+
end
|
2401
|
+
|
2402
|
+
def to_dynamic
|
2403
|
+
{
|
2404
|
+
"fileName" => file_name,
|
2405
|
+
"id" => id,
|
2406
|
+
"key" => key,
|
2407
|
+
"size" => size,
|
2408
|
+
"sizeName" => size_name,
|
2409
|
+
"url" => url,
|
2410
|
+
}
|
2411
|
+
end
|
2412
|
+
|
2413
|
+
def to_json(options = nil)
|
2414
|
+
JSON.generate(to_dynamic, options)
|
2415
|
+
end
|
2416
|
+
end
|
2417
|
+
|
2418
|
+
class Card < Dry::Struct
|
2419
|
+
attribute :brand, Types::String.optional.optional
|
2420
|
+
attribute :cardholder_name, Types::String.optional.optional
|
2421
|
+
attribute :code, Types::String.optional.optional
|
2422
|
+
attribute :exp_month, Types::String.optional.optional
|
2423
|
+
attribute :exp_year, Types::String.optional.optional
|
2424
|
+
attribute :number, Types::String.optional.optional
|
2425
|
+
|
2426
|
+
def self.from_dynamic!(d)
|
2427
|
+
d = Types::Hash[d]
|
2428
|
+
new(
|
2429
|
+
brand: d["brand"],
|
2430
|
+
cardholder_name: d["cardholderName"],
|
2431
|
+
code: d["code"],
|
2432
|
+
exp_month: d["expMonth"],
|
2433
|
+
exp_year: d["expYear"],
|
2434
|
+
number: d["number"],
|
2435
|
+
)
|
2436
|
+
end
|
2437
|
+
|
2438
|
+
def self.from_json!(json)
|
2439
|
+
from_dynamic!(JSON.parse(json))
|
2440
|
+
end
|
2441
|
+
|
2442
|
+
def to_dynamic
|
2443
|
+
{
|
2444
|
+
"brand" => brand,
|
2445
|
+
"cardholderName" => cardholder_name,
|
2446
|
+
"code" => code,
|
2447
|
+
"expMonth" => exp_month,
|
2448
|
+
"expYear" => exp_year,
|
2449
|
+
"number" => number,
|
2450
|
+
}
|
2451
|
+
end
|
2452
|
+
|
2453
|
+
def to_json(options = nil)
|
2454
|
+
JSON.generate(to_dynamic, options)
|
2455
|
+
end
|
2456
|
+
end
|
2457
|
+
|
2458
|
+
module CipherType
|
2459
|
+
Card = "Card"
|
2460
|
+
Identity = "Identity"
|
2461
|
+
Login = "Login"
|
2462
|
+
SecureNote = "SecureNote"
|
2463
|
+
end
|
2464
|
+
|
2465
|
+
module FieldType
|
2466
|
+
Boolean = "Boolean"
|
2467
|
+
Hidden = "Hidden"
|
2468
|
+
Linked = "Linked"
|
2469
|
+
Text = "Text"
|
2470
|
+
end
|
2471
|
+
|
2472
|
+
module LinkedIDType
|
2473
|
+
Address1 = "Address1"
|
2474
|
+
Address2 = "Address2"
|
2475
|
+
Address3 = "Address3"
|
2476
|
+
Brand = "Brand"
|
2477
|
+
CardholderName = "CardholderName"
|
2478
|
+
City = "City"
|
2479
|
+
Code = "Code"
|
2480
|
+
Company = "Company"
|
2481
|
+
Country = "Country"
|
2482
|
+
Email = "Email"
|
2483
|
+
ExpMonth = "ExpMonth"
|
2484
|
+
ExpYear = "ExpYear"
|
2485
|
+
FirstName = "FirstName"
|
2486
|
+
FullName = "FullName"
|
2487
|
+
LastName = "LastName"
|
2488
|
+
LicenseNumber = "LicenseNumber"
|
2489
|
+
MiddleName = "MiddleName"
|
2490
|
+
Number = "Number"
|
2491
|
+
PassportNumber = "PassportNumber"
|
2492
|
+
Password = "Password"
|
2493
|
+
Phone = "Phone"
|
2494
|
+
PostalCode = "PostalCode"
|
2495
|
+
Ssn = "Ssn"
|
2496
|
+
State = "State"
|
2497
|
+
Title = "Title"
|
2498
|
+
Username = "Username"
|
2499
|
+
end
|
2500
|
+
|
2501
|
+
class Field < Dry::Struct
|
2502
|
+
attribute :linked_id, Types::LinkedIDType.optional.optional
|
2503
|
+
attribute :field_name, Types::String.optional.optional
|
2504
|
+
attribute :field_type, Types::FieldType
|
2505
|
+
attribute :value, Types::String.optional.optional
|
2506
|
+
|
2507
|
+
def self.from_dynamic!(d)
|
2508
|
+
d = Types::Hash[d]
|
2509
|
+
new(
|
2510
|
+
linked_id: d["linkedId"],
|
2511
|
+
field_name: d["name"],
|
2512
|
+
field_type: d.fetch("type"),
|
2513
|
+
value: d["value"],
|
2514
|
+
)
|
2515
|
+
end
|
2516
|
+
|
2517
|
+
def self.from_json!(json)
|
2518
|
+
from_dynamic!(JSON.parse(json))
|
2519
|
+
end
|
2520
|
+
|
2521
|
+
def to_dynamic
|
2522
|
+
{
|
2523
|
+
"linkedId" => linked_id,
|
2524
|
+
"name" => field_name,
|
2525
|
+
"type" => field_type,
|
2526
|
+
"value" => value,
|
2527
|
+
}
|
2528
|
+
end
|
2529
|
+
|
2530
|
+
def to_json(options = nil)
|
2531
|
+
JSON.generate(to_dynamic, options)
|
2532
|
+
end
|
2533
|
+
end
|
2534
|
+
|
2535
|
+
class Identity < Dry::Struct
|
2536
|
+
attribute :address1, Types::String.optional.optional
|
2537
|
+
attribute :address2, Types::String.optional.optional
|
2538
|
+
attribute :address3, Types::String.optional.optional
|
2539
|
+
attribute :city, Types::String.optional.optional
|
2540
|
+
attribute :company, Types::String.optional.optional
|
2541
|
+
attribute :country, Types::String.optional.optional
|
2542
|
+
attribute :email, Types::String.optional.optional
|
2543
|
+
attribute :first_name, Types::String.optional.optional
|
2544
|
+
attribute :last_name, Types::String.optional.optional
|
2545
|
+
attribute :license_number, Types::String.optional.optional
|
2546
|
+
attribute :middle_name, Types::String.optional.optional
|
2547
|
+
attribute :passport_number, Types::String.optional.optional
|
2548
|
+
attribute :phone, Types::String.optional.optional
|
2549
|
+
attribute :postal_code, Types::String.optional.optional
|
2550
|
+
attribute :ssn, Types::String.optional.optional
|
2551
|
+
attribute :state, Types::String.optional.optional
|
2552
|
+
attribute :title, Types::String.optional.optional
|
2553
|
+
attribute :username, Types::String.optional.optional
|
2554
|
+
|
2555
|
+
def self.from_dynamic!(d)
|
2556
|
+
d = Types::Hash[d]
|
2557
|
+
new(
|
2558
|
+
address1: d["address1"],
|
2559
|
+
address2: d["address2"],
|
2560
|
+
address3: d["address3"],
|
2561
|
+
city: d["city"],
|
2562
|
+
company: d["company"],
|
2563
|
+
country: d["country"],
|
2564
|
+
email: d["email"],
|
2565
|
+
first_name: d["firstName"],
|
2566
|
+
last_name: d["lastName"],
|
2567
|
+
license_number: d["licenseNumber"],
|
2568
|
+
middle_name: d["middleName"],
|
2569
|
+
passport_number: d["passportNumber"],
|
2570
|
+
phone: d["phone"],
|
2571
|
+
postal_code: d["postalCode"],
|
2572
|
+
ssn: d["ssn"],
|
2573
|
+
state: d["state"],
|
2574
|
+
title: d["title"],
|
2575
|
+
username: d["username"],
|
2576
|
+
)
|
2577
|
+
end
|
2578
|
+
|
2579
|
+
def self.from_json!(json)
|
2580
|
+
from_dynamic!(JSON.parse(json))
|
2581
|
+
end
|
2582
|
+
|
2583
|
+
def to_dynamic
|
2584
|
+
{
|
2585
|
+
"address1" => address1,
|
2586
|
+
"address2" => address2,
|
2587
|
+
"address3" => address3,
|
2588
|
+
"city" => city,
|
2589
|
+
"company" => company,
|
2590
|
+
"country" => country,
|
2591
|
+
"email" => email,
|
2592
|
+
"firstName" => first_name,
|
2593
|
+
"lastName" => last_name,
|
2594
|
+
"licenseNumber" => license_number,
|
2595
|
+
"middleName" => middle_name,
|
2596
|
+
"passportNumber" => passport_number,
|
2597
|
+
"phone" => phone,
|
2598
|
+
"postalCode" => postal_code,
|
2599
|
+
"ssn" => ssn,
|
2600
|
+
"state" => state,
|
2601
|
+
"title" => title,
|
2602
|
+
"username" => username,
|
2603
|
+
}
|
2604
|
+
end
|
2605
|
+
|
2606
|
+
def to_json(options = nil)
|
2607
|
+
JSON.generate(to_dynamic, options)
|
2608
|
+
end
|
2609
|
+
end
|
2610
|
+
|
2611
|
+
class LocalData < Dry::Struct
|
2612
|
+
attribute :last_launched, Types::Integer.optional.optional
|
2613
|
+
attribute :last_used_date, Types::Integer.optional.optional
|
2614
|
+
|
2615
|
+
def self.from_dynamic!(d)
|
2616
|
+
d = Types::Hash[d]
|
2617
|
+
new(
|
2618
|
+
last_launched: d["lastLaunched"],
|
2619
|
+
last_used_date: d["lastUsedDate"],
|
2620
|
+
)
|
2621
|
+
end
|
2622
|
+
|
2623
|
+
def self.from_json!(json)
|
2624
|
+
from_dynamic!(JSON.parse(json))
|
2625
|
+
end
|
2626
|
+
|
2627
|
+
def to_dynamic
|
2628
|
+
{
|
2629
|
+
"lastLaunched" => last_launched,
|
2630
|
+
"lastUsedDate" => last_used_date,
|
2631
|
+
}
|
2632
|
+
end
|
2633
|
+
|
2634
|
+
def to_json(options = nil)
|
2635
|
+
JSON.generate(to_dynamic, options)
|
2636
|
+
end
|
2637
|
+
end
|
2638
|
+
|
2639
|
+
module URIMatchType
|
2640
|
+
Domain = "domain"
|
2641
|
+
Exact = "exact"
|
2642
|
+
Host = "host"
|
2643
|
+
Never = "never"
|
2644
|
+
RegularExpression = "regularExpression"
|
2645
|
+
StartsWith = "startsWith"
|
2646
|
+
end
|
2647
|
+
|
2648
|
+
class LoginURI < Dry::Struct
|
2649
|
+
attribute :match, Types::URIMatchType.optional.optional
|
2650
|
+
attribute :uri, Types::String.optional.optional
|
2651
|
+
|
2652
|
+
def self.from_dynamic!(d)
|
2653
|
+
d = Types::Hash[d]
|
2654
|
+
new(
|
2655
|
+
match: d["match"],
|
2656
|
+
uri: d["uri"],
|
2657
|
+
)
|
2658
|
+
end
|
2659
|
+
|
2660
|
+
def self.from_json!(json)
|
2661
|
+
from_dynamic!(JSON.parse(json))
|
2662
|
+
end
|
2663
|
+
|
2664
|
+
def to_dynamic
|
2665
|
+
{
|
2666
|
+
"match" => match,
|
2667
|
+
"uri" => uri,
|
2668
|
+
}
|
2669
|
+
end
|
2670
|
+
|
2671
|
+
def to_json(options = nil)
|
2672
|
+
JSON.generate(to_dynamic, options)
|
2673
|
+
end
|
2674
|
+
end
|
2675
|
+
|
2676
|
+
class Login < Dry::Struct
|
2677
|
+
attribute :autofill_on_page_load, Types::Bool.optional.optional
|
2678
|
+
attribute :password, Types::String.optional.optional
|
2679
|
+
attribute :password_revision_date, Types::String.optional.optional
|
2680
|
+
attribute :totp, Types::String.optional.optional
|
2681
|
+
attribute :uris, Types.Array(LoginURI).optional.optional
|
2682
|
+
attribute :username, Types::String.optional.optional
|
2683
|
+
|
2684
|
+
def self.from_dynamic!(d)
|
2685
|
+
d = Types::Hash[d]
|
2686
|
+
new(
|
2687
|
+
autofill_on_page_load: d["autofillOnPageLoad"],
|
2688
|
+
password: d["password"],
|
2689
|
+
password_revision_date: d["passwordRevisionDate"],
|
2690
|
+
totp: d["totp"],
|
2691
|
+
uris: d["uris"]&.map { |x| LoginURI.from_dynamic!(x) },
|
2692
|
+
username: d["username"],
|
2693
|
+
)
|
2694
|
+
end
|
2695
|
+
|
2696
|
+
def self.from_json!(json)
|
2697
|
+
from_dynamic!(JSON.parse(json))
|
2698
|
+
end
|
2699
|
+
|
2700
|
+
def to_dynamic
|
2701
|
+
{
|
2702
|
+
"autofillOnPageLoad" => autofill_on_page_load,
|
2703
|
+
"password" => password,
|
2704
|
+
"passwordRevisionDate" => password_revision_date,
|
2705
|
+
"totp" => totp,
|
2706
|
+
"uris" => uris&.map { |x| x.to_dynamic },
|
2707
|
+
"username" => username,
|
2708
|
+
}
|
2709
|
+
end
|
2710
|
+
|
2711
|
+
def to_json(options = nil)
|
2712
|
+
JSON.generate(to_dynamic, options)
|
2713
|
+
end
|
2714
|
+
end
|
2715
|
+
|
2716
|
+
class PasswordHistory < Dry::Struct
|
2717
|
+
attribute :last_used_date, Types::String
|
2718
|
+
attribute :password, Types::String
|
2719
|
+
|
2720
|
+
def self.from_dynamic!(d)
|
2721
|
+
d = Types::Hash[d]
|
2722
|
+
new(
|
2723
|
+
last_used_date: d.fetch("lastUsedDate"),
|
2724
|
+
password: d.fetch("password"),
|
2725
|
+
)
|
2726
|
+
end
|
2727
|
+
|
2728
|
+
def self.from_json!(json)
|
2729
|
+
from_dynamic!(JSON.parse(json))
|
2730
|
+
end
|
2731
|
+
|
2732
|
+
def to_dynamic
|
2733
|
+
{
|
2734
|
+
"lastUsedDate" => last_used_date,
|
2735
|
+
"password" => password,
|
2736
|
+
}
|
2737
|
+
end
|
2738
|
+
|
2739
|
+
def to_json(options = nil)
|
2740
|
+
JSON.generate(to_dynamic, options)
|
2741
|
+
end
|
2742
|
+
end
|
2743
|
+
|
2744
|
+
module CipherRepromptType
|
2745
|
+
None = "None"
|
2746
|
+
Password = "Password"
|
2747
|
+
end
|
2748
|
+
|
2749
|
+
module SecureNoteType
|
2750
|
+
Generic = "Generic"
|
2751
|
+
end
|
2752
|
+
|
2753
|
+
class SecureNote < Dry::Struct
|
2754
|
+
attribute :secure_note_type, Types::SecureNoteType
|
2755
|
+
|
2756
|
+
def self.from_dynamic!(d)
|
2757
|
+
d = Types::Hash[d]
|
2758
|
+
new(
|
2759
|
+
secure_note_type: d.fetch("type"),
|
2760
|
+
)
|
2761
|
+
end
|
2762
|
+
|
2763
|
+
def self.from_json!(json)
|
2764
|
+
from_dynamic!(JSON.parse(json))
|
2765
|
+
end
|
2766
|
+
|
2767
|
+
def to_dynamic
|
2768
|
+
{
|
2769
|
+
"type" => secure_note_type,
|
2770
|
+
}
|
2771
|
+
end
|
2772
|
+
|
2773
|
+
def to_json(options = nil)
|
2774
|
+
JSON.generate(to_dynamic, options)
|
2775
|
+
end
|
2776
|
+
end
|
2777
|
+
|
2778
|
+
class Cipher < Dry::Struct
|
2779
|
+
attribute :attachments, Types.Array(Attachment).optional.optional
|
2780
|
+
attribute :card, Card.optional.optional
|
2781
|
+
attribute :collection_ids, Types.Array(Types::String)
|
2782
|
+
attribute :creation_date, Types::String
|
2783
|
+
attribute :deleted_date, Types::String.optional.optional
|
2784
|
+
attribute :edit, Types::Bool
|
2785
|
+
attribute :favorite, Types::Bool
|
2786
|
+
attribute :fields, Types.Array(Field).optional.optional
|
2787
|
+
attribute :folder_id, Types::String.optional.optional
|
2788
|
+
attribute :id, Types::String.optional.optional
|
2789
|
+
attribute :identity, Identity.optional.optional
|
2790
|
+
|
2791
|
+
# More recent ciphers uses individual encryption keys to encrypt the other fields of the
|
2792
|
+
# Cipher.
|
2793
|
+
attribute :key, Types::String.optional.optional
|
2794
|
+
|
2795
|
+
attribute :local_data, LocalData.optional.optional
|
2796
|
+
attribute :login, Login.optional.optional
|
2797
|
+
attribute :cipher_name, Types::String
|
2798
|
+
attribute :notes, Types::String.optional.optional
|
2799
|
+
attribute :organization_id, Types::String.optional.optional
|
2800
|
+
attribute :organization_use_totp, Types::Bool
|
2801
|
+
attribute :password_history, Types.Array(PasswordHistory).optional.optional
|
2802
|
+
attribute :reprompt, Types::CipherRepromptType
|
2803
|
+
attribute :revision_date, Types::String
|
2804
|
+
attribute :secure_note, SecureNote.optional.optional
|
2805
|
+
attribute :cipher_type, Types::CipherType
|
2806
|
+
attribute :view_password, Types::Bool
|
2807
|
+
|
2808
|
+
def self.from_dynamic!(d)
|
2809
|
+
d = Types::Hash[d]
|
2810
|
+
new(
|
2811
|
+
attachments: d["attachments"]&.map { |x| Attachment.from_dynamic!(x) },
|
2812
|
+
card: d["card"] ? Card.from_dynamic!(d["card"]) : nil,
|
2813
|
+
collection_ids: d.fetch("collectionIds"),
|
2814
|
+
creation_date: d.fetch("creationDate"),
|
2815
|
+
deleted_date: d["deletedDate"],
|
2816
|
+
edit: d.fetch("edit"),
|
2817
|
+
favorite: d.fetch("favorite"),
|
2818
|
+
fields: d["fields"]&.map { |x| Field.from_dynamic!(x) },
|
2819
|
+
folder_id: d["folderId"],
|
2820
|
+
id: d["id"],
|
2821
|
+
identity: d["identity"] ? Identity.from_dynamic!(d["identity"]) : nil,
|
2822
|
+
key: d["key"],
|
2823
|
+
local_data: d["localData"] ? LocalData.from_dynamic!(d["localData"]) : nil,
|
2824
|
+
login: d["login"] ? Login.from_dynamic!(d["login"]) : nil,
|
2825
|
+
cipher_name: d.fetch("name"),
|
2826
|
+
notes: d["notes"],
|
2827
|
+
organization_id: d["organizationId"],
|
2828
|
+
organization_use_totp: d.fetch("organizationUseTotp"),
|
2829
|
+
password_history: d["passwordHistory"]&.map { |x| PasswordHistory.from_dynamic!(x) },
|
2830
|
+
reprompt: d.fetch("reprompt"),
|
2831
|
+
revision_date: d.fetch("revisionDate"),
|
2832
|
+
secure_note: d["secureNote"] ? SecureNote.from_dynamic!(d["secureNote"]) : nil,
|
2833
|
+
cipher_type: d.fetch("type"),
|
2834
|
+
view_password: d.fetch("viewPassword"),
|
2835
|
+
)
|
2836
|
+
end
|
2837
|
+
|
2838
|
+
def self.from_json!(json)
|
2839
|
+
from_dynamic!(JSON.parse(json))
|
2840
|
+
end
|
2841
|
+
|
2842
|
+
def to_dynamic
|
2843
|
+
{
|
2844
|
+
"attachments" => attachments&.map { |x| x.to_dynamic },
|
2845
|
+
"card" => card&.to_dynamic,
|
2846
|
+
"collectionIds" => collection_ids,
|
2847
|
+
"creationDate" => creation_date,
|
2848
|
+
"deletedDate" => deleted_date,
|
2849
|
+
"edit" => edit,
|
2850
|
+
"favorite" => favorite,
|
2851
|
+
"fields" => fields&.map { |x| x.to_dynamic },
|
2852
|
+
"folderId" => folder_id,
|
2853
|
+
"id" => id,
|
2854
|
+
"identity" => identity&.to_dynamic,
|
2855
|
+
"key" => key,
|
2856
|
+
"localData" => local_data&.to_dynamic,
|
2857
|
+
"login" => login&.to_dynamic,
|
2858
|
+
"name" => cipher_name,
|
2859
|
+
"notes" => notes,
|
2860
|
+
"organizationId" => organization_id,
|
2861
|
+
"organizationUseTotp" => organization_use_totp,
|
2862
|
+
"passwordHistory" => password_history&.map { |x| x.to_dynamic },
|
2863
|
+
"reprompt" => reprompt,
|
2864
|
+
"revisionDate" => revision_date,
|
2865
|
+
"secureNote" => secure_note&.to_dynamic,
|
2866
|
+
"type" => cipher_type,
|
2867
|
+
"viewPassword" => view_password,
|
2868
|
+
}
|
2869
|
+
end
|
2870
|
+
|
2871
|
+
def to_json(options = nil)
|
2872
|
+
JSON.generate(to_dynamic, options)
|
2873
|
+
end
|
2874
|
+
end
|
2875
|
+
|
2876
|
+
class Collection < Dry::Struct
|
2877
|
+
attribute :external_id, Types::String.optional.optional
|
2878
|
+
attribute :hide_passwords, Types::Bool
|
2879
|
+
attribute :id, Types::String.optional.optional
|
2880
|
+
attribute :collection_name, Types::String
|
2881
|
+
attribute :organization_id, Types::String
|
2882
|
+
attribute :read_only, Types::Bool
|
2883
|
+
|
2884
|
+
def self.from_dynamic!(d)
|
2885
|
+
d = Types::Hash[d]
|
2886
|
+
new(
|
2887
|
+
external_id: d["externalId"],
|
2888
|
+
hide_passwords: d.fetch("hidePasswords"),
|
2889
|
+
id: d["id"],
|
2890
|
+
collection_name: d.fetch("name"),
|
2891
|
+
organization_id: d.fetch("organizationId"),
|
2892
|
+
read_only: d.fetch("readOnly"),
|
2893
|
+
)
|
2894
|
+
end
|
2895
|
+
|
2896
|
+
def self.from_json!(json)
|
2897
|
+
from_dynamic!(JSON.parse(json))
|
2898
|
+
end
|
2899
|
+
|
2900
|
+
def to_dynamic
|
2901
|
+
{
|
2902
|
+
"externalId" => external_id,
|
2903
|
+
"hidePasswords" => hide_passwords,
|
2904
|
+
"id" => id,
|
2905
|
+
"name" => collection_name,
|
2906
|
+
"organizationId" => organization_id,
|
2907
|
+
"readOnly" => read_only,
|
2908
|
+
}
|
2909
|
+
end
|
2910
|
+
|
2911
|
+
def to_json(options = nil)
|
2912
|
+
JSON.generate(to_dynamic, options)
|
2913
|
+
end
|
2914
|
+
end
|
2915
|
+
|
2916
|
+
class GlobalDomains < Dry::Struct
|
2917
|
+
attribute :domains, Types.Array(Types::String)
|
2918
|
+
attribute :excluded, Types::Bool
|
2919
|
+
attribute :global_domains_type, Types::Integer
|
2920
|
+
|
2921
|
+
def self.from_dynamic!(d)
|
2922
|
+
d = Types::Hash[d]
|
2923
|
+
new(
|
2924
|
+
domains: d.fetch("domains"),
|
2925
|
+
excluded: d.fetch("excluded"),
|
2926
|
+
global_domains_type: d.fetch("type"),
|
2927
|
+
)
|
2928
|
+
end
|
2929
|
+
|
2930
|
+
def self.from_json!(json)
|
2931
|
+
from_dynamic!(JSON.parse(json))
|
2932
|
+
end
|
2933
|
+
|
2934
|
+
def to_dynamic
|
2935
|
+
{
|
2936
|
+
"domains" => domains,
|
2937
|
+
"excluded" => excluded,
|
2938
|
+
"type" => global_domains_type,
|
2939
|
+
}
|
2940
|
+
end
|
2941
|
+
|
2942
|
+
def to_json(options = nil)
|
2943
|
+
JSON.generate(to_dynamic, options)
|
2944
|
+
end
|
2945
|
+
end
|
2946
|
+
|
2947
|
+
class DomainResponse < Dry::Struct
|
2948
|
+
attribute :equivalent_domains, Types.Array(Types.Array(Types::String))
|
2949
|
+
attribute :global_equivalent_domains, Types.Array(GlobalDomains)
|
2950
|
+
|
2951
|
+
def self.from_dynamic!(d)
|
2952
|
+
d = Types::Hash[d]
|
2953
|
+
new(
|
2954
|
+
equivalent_domains: d.fetch("equivalentDomains"),
|
2955
|
+
global_equivalent_domains: d.fetch("globalEquivalentDomains").map { |x| GlobalDomains.from_dynamic!(x) },
|
2956
|
+
)
|
2957
|
+
end
|
2958
|
+
|
2959
|
+
def self.from_json!(json)
|
2960
|
+
from_dynamic!(JSON.parse(json))
|
2961
|
+
end
|
2962
|
+
|
2963
|
+
def to_dynamic
|
2964
|
+
{
|
2965
|
+
"equivalentDomains" => equivalent_domains,
|
2966
|
+
"globalEquivalentDomains" => global_equivalent_domains.map { |x| x.to_dynamic },
|
2967
|
+
}
|
2968
|
+
end
|
2969
|
+
|
2970
|
+
def to_json(options = nil)
|
2971
|
+
JSON.generate(to_dynamic, options)
|
2972
|
+
end
|
2973
|
+
end
|
2974
|
+
|
2975
|
+
class Folder < Dry::Struct
|
2976
|
+
attribute :id, Types::String.optional.optional
|
2977
|
+
attribute :folder_name, Types::String
|
2978
|
+
attribute :revision_date, Types::String
|
2979
|
+
|
2980
|
+
def self.from_dynamic!(d)
|
2981
|
+
d = Types::Hash[d]
|
2982
|
+
new(
|
2983
|
+
id: d["id"],
|
2984
|
+
folder_name: d.fetch("name"),
|
2985
|
+
revision_date: d.fetch("revisionDate"),
|
2986
|
+
)
|
2987
|
+
end
|
2988
|
+
|
2989
|
+
def self.from_json!(json)
|
2990
|
+
from_dynamic!(JSON.parse(json))
|
2991
|
+
end
|
2992
|
+
|
2993
|
+
def to_dynamic
|
2994
|
+
{
|
2995
|
+
"id" => id,
|
2996
|
+
"name" => folder_name,
|
2997
|
+
"revisionDate" => revision_date,
|
2998
|
+
}
|
2999
|
+
end
|
3000
|
+
|
3001
|
+
def to_json(options = nil)
|
3002
|
+
JSON.generate(to_dynamic, options)
|
3003
|
+
end
|
3004
|
+
end
|
3005
|
+
|
3006
|
+
module PolicyType
|
3007
|
+
ActivateAutofill = "ActivateAutofill"
|
3008
|
+
DisablePersonalVaultExport = "DisablePersonalVaultExport"
|
3009
|
+
DisableSend = "DisableSend"
|
3010
|
+
MasterPassword = "MasterPassword"
|
3011
|
+
MaximumVaultTimeout = "MaximumVaultTimeout"
|
3012
|
+
PasswordGenerator = "PasswordGenerator"
|
3013
|
+
PersonalOwnership = "PersonalOwnership"
|
3014
|
+
RequireSso = "RequireSso"
|
3015
|
+
ResetPassword = "ResetPassword"
|
3016
|
+
SendOptions = "SendOptions"
|
3017
|
+
SingleOrg = "SingleOrg"
|
3018
|
+
TwoFactorAuthentication = "TwoFactorAuthentication"
|
3019
|
+
end
|
3020
|
+
|
3021
|
+
class Policy < Dry::Struct
|
3022
|
+
attribute :data, Types::Hash.meta(of: Types::Any).optional.optional
|
3023
|
+
attribute :enabled, Types::Bool
|
3024
|
+
attribute :id, Types::String
|
3025
|
+
attribute :organization_id, Types::String
|
3026
|
+
attribute :policy_type, Types::PolicyType
|
3027
|
+
|
3028
|
+
def self.from_dynamic!(d)
|
3029
|
+
d = Types::Hash[d]
|
3030
|
+
new(
|
3031
|
+
data: Types::Hash.optional[d["data"]]&.map { |k, v| [k, Types::Any[v]] }&.to_h,
|
3032
|
+
enabled: d.fetch("enabled"),
|
3033
|
+
id: d.fetch("id"),
|
3034
|
+
organization_id: d.fetch("organization_id"),
|
3035
|
+
policy_type: d.fetch("type"),
|
3036
|
+
)
|
3037
|
+
end
|
3038
|
+
|
3039
|
+
def self.from_json!(json)
|
3040
|
+
from_dynamic!(JSON.parse(json))
|
3041
|
+
end
|
3042
|
+
|
3043
|
+
def to_dynamic
|
3044
|
+
{
|
3045
|
+
"data" => data,
|
3046
|
+
"enabled" => enabled,
|
3047
|
+
"id" => id,
|
3048
|
+
"organization_id" => organization_id,
|
3049
|
+
"type" => policy_type,
|
3050
|
+
}
|
3051
|
+
end
|
3052
|
+
|
3053
|
+
def to_json(options = nil)
|
3054
|
+
JSON.generate(to_dynamic, options)
|
3055
|
+
end
|
3056
|
+
end
|
3057
|
+
|
3058
|
+
class ProfileOrganizationResponse < Dry::Struct
|
3059
|
+
attribute :id, Types::String
|
3060
|
+
|
3061
|
+
def self.from_dynamic!(d)
|
3062
|
+
d = Types::Hash[d]
|
3063
|
+
new(
|
3064
|
+
id: d.fetch("id"),
|
3065
|
+
)
|
3066
|
+
end
|
3067
|
+
|
3068
|
+
def self.from_json!(json)
|
3069
|
+
from_dynamic!(JSON.parse(json))
|
3070
|
+
end
|
3071
|
+
|
3072
|
+
def to_dynamic
|
3073
|
+
{
|
3074
|
+
"id" => id,
|
3075
|
+
}
|
3076
|
+
end
|
3077
|
+
|
3078
|
+
def to_json(options = nil)
|
3079
|
+
JSON.generate(to_dynamic, options)
|
3080
|
+
end
|
3081
|
+
end
|
3082
|
+
|
3083
|
+
# Data about the user, including their encryption keys and the organizations they are a
|
3084
|
+
# part of
|
3085
|
+
class ProfileResponse < Dry::Struct
|
3086
|
+
attribute :email, Types::String
|
3087
|
+
attribute :id, Types::String
|
3088
|
+
attribute :profile_response_name, Types::String
|
3089
|
+
attribute :organizations, Types.Array(ProfileOrganizationResponse)
|
3090
|
+
|
3091
|
+
def self.from_dynamic!(d)
|
3092
|
+
d = Types::Hash[d]
|
3093
|
+
new(
|
3094
|
+
email: d.fetch("email"),
|
3095
|
+
id: d.fetch("id"),
|
3096
|
+
profile_response_name: d.fetch("name"),
|
3097
|
+
organizations: d.fetch("organizations").map { |x| ProfileOrganizationResponse.from_dynamic!(x) },
|
3098
|
+
)
|
3099
|
+
end
|
3100
|
+
|
3101
|
+
def self.from_json!(json)
|
3102
|
+
from_dynamic!(JSON.parse(json))
|
3103
|
+
end
|
3104
|
+
|
3105
|
+
def to_dynamic
|
3106
|
+
{
|
3107
|
+
"email" => email,
|
3108
|
+
"id" => id,
|
3109
|
+
"name" => profile_response_name,
|
3110
|
+
"organizations" => organizations.map { |x| x.to_dynamic },
|
3111
|
+
}
|
3112
|
+
end
|
3113
|
+
|
3114
|
+
def to_json(options = nil)
|
3115
|
+
JSON.generate(to_dynamic, options)
|
3116
|
+
end
|
3117
|
+
end
|
3118
|
+
|
3119
|
+
class SendFile < Dry::Struct
|
3120
|
+
attribute :file_name, Types::String
|
3121
|
+
attribute :id, Types::String.optional.optional
|
3122
|
+
attribute :size, Types::String.optional.optional
|
3123
|
+
|
3124
|
+
# Readable size, ex: "4.2 KB" or "1.43 GB"
|
3125
|
+
attribute :size_name, Types::String.optional.optional
|
3126
|
+
|
3127
|
+
def self.from_dynamic!(d)
|
3128
|
+
d = Types::Hash[d]
|
3129
|
+
new(
|
3130
|
+
file_name: d.fetch("fileName"),
|
3131
|
+
id: d["id"],
|
3132
|
+
size: d["size"],
|
3133
|
+
size_name: d["sizeName"],
|
3134
|
+
)
|
3135
|
+
end
|
3136
|
+
|
3137
|
+
def self.from_json!(json)
|
3138
|
+
from_dynamic!(JSON.parse(json))
|
3139
|
+
end
|
3140
|
+
|
3141
|
+
def to_dynamic
|
3142
|
+
{
|
3143
|
+
"fileName" => file_name,
|
3144
|
+
"id" => id,
|
3145
|
+
"size" => size,
|
3146
|
+
"sizeName" => size_name,
|
3147
|
+
}
|
3148
|
+
end
|
3149
|
+
|
3150
|
+
def to_json(options = nil)
|
3151
|
+
JSON.generate(to_dynamic, options)
|
3152
|
+
end
|
3153
|
+
end
|
3154
|
+
|
3155
|
+
module SendType
|
3156
|
+
File = "File"
|
3157
|
+
Text = "Text"
|
3158
|
+
end
|
3159
|
+
|
3160
|
+
class SendText < Dry::Struct
|
3161
|
+
attribute :hidden, Types::Bool
|
3162
|
+
attribute :text, Types::String.optional.optional
|
3163
|
+
|
3164
|
+
def self.from_dynamic!(d)
|
3165
|
+
d = Types::Hash[d]
|
3166
|
+
new(
|
3167
|
+
hidden: d.fetch("hidden"),
|
3168
|
+
text: d["text"],
|
3169
|
+
)
|
3170
|
+
end
|
3171
|
+
|
3172
|
+
def self.from_json!(json)
|
3173
|
+
from_dynamic!(JSON.parse(json))
|
3174
|
+
end
|
3175
|
+
|
3176
|
+
def to_dynamic
|
3177
|
+
{
|
3178
|
+
"hidden" => hidden,
|
3179
|
+
"text" => text,
|
3180
|
+
}
|
3181
|
+
end
|
3182
|
+
|
3183
|
+
def to_json(options = nil)
|
3184
|
+
JSON.generate(to_dynamic, options)
|
3185
|
+
end
|
3186
|
+
end
|
3187
|
+
|
3188
|
+
class Send < Dry::Struct
|
3189
|
+
attribute :access_count, Types::Integer
|
3190
|
+
attribute :access_id, Types::String.optional.optional
|
3191
|
+
attribute :deletion_date, Types::String
|
3192
|
+
attribute :disabled, Types::Bool
|
3193
|
+
attribute :expiration_date, Types::String.optional.optional
|
3194
|
+
attribute :file, SendFile.optional.optional
|
3195
|
+
attribute :hide_email, Types::Bool
|
3196
|
+
attribute :id, Types::String.optional.optional
|
3197
|
+
attribute :key, Types::String
|
3198
|
+
attribute :max_access_count, Types::Integer.optional.optional
|
3199
|
+
attribute :send_name, Types::String
|
3200
|
+
attribute :notes, Types::String.optional.optional
|
3201
|
+
attribute :password, Types::String.optional.optional
|
3202
|
+
attribute :revision_date, Types::String
|
3203
|
+
attribute :text, SendText.optional.optional
|
3204
|
+
attribute :send_type, Types::SendType
|
3205
|
+
|
3206
|
+
def self.from_dynamic!(d)
|
3207
|
+
d = Types::Hash[d]
|
3208
|
+
new(
|
3209
|
+
access_count: d.fetch("accessCount"),
|
3210
|
+
access_id: d["accessId"],
|
3211
|
+
deletion_date: d.fetch("deletionDate"),
|
3212
|
+
disabled: d.fetch("disabled"),
|
3213
|
+
expiration_date: d["expirationDate"],
|
3214
|
+
file: d["file"] ? SendFile.from_dynamic!(d["file"]) : nil,
|
3215
|
+
hide_email: d.fetch("hideEmail"),
|
3216
|
+
id: d["id"],
|
3217
|
+
key: d.fetch("key"),
|
3218
|
+
max_access_count: d["maxAccessCount"],
|
3219
|
+
send_name: d.fetch("name"),
|
3220
|
+
notes: d["notes"],
|
3221
|
+
password: d["password"],
|
3222
|
+
revision_date: d.fetch("revisionDate"),
|
3223
|
+
text: d["text"] ? SendText.from_dynamic!(d["text"]) : nil,
|
3224
|
+
send_type: d.fetch("type"),
|
3225
|
+
)
|
3226
|
+
end
|
3227
|
+
|
3228
|
+
def self.from_json!(json)
|
3229
|
+
from_dynamic!(JSON.parse(json))
|
3230
|
+
end
|
3231
|
+
|
3232
|
+
def to_dynamic
|
3233
|
+
{
|
3234
|
+
"accessCount" => access_count,
|
3235
|
+
"accessId" => access_id,
|
3236
|
+
"deletionDate" => deletion_date,
|
3237
|
+
"disabled" => disabled,
|
3238
|
+
"expirationDate" => expiration_date,
|
3239
|
+
"file" => file&.to_dynamic,
|
3240
|
+
"hideEmail" => hide_email,
|
3241
|
+
"id" => id,
|
3242
|
+
"key" => key,
|
3243
|
+
"maxAccessCount" => max_access_count,
|
3244
|
+
"name" => send_name,
|
3245
|
+
"notes" => notes,
|
3246
|
+
"password" => password,
|
3247
|
+
"revisionDate" => revision_date,
|
3248
|
+
"text" => text&.to_dynamic,
|
3249
|
+
"type" => send_type,
|
3250
|
+
}
|
3251
|
+
end
|
3252
|
+
|
3253
|
+
def to_json(options = nil)
|
3254
|
+
JSON.generate(to_dynamic, options)
|
3255
|
+
end
|
3256
|
+
end
|
3257
|
+
|
3258
|
+
class SyncResponse < Dry::Struct
|
3259
|
+
|
3260
|
+
# List of ciphers accessible by the user
|
3261
|
+
attribute :ciphers, Types.Array(Cipher)
|
3262
|
+
|
3263
|
+
attribute :collections, Types.Array(Collection)
|
3264
|
+
attribute :domains, DomainResponse.optional.optional
|
3265
|
+
attribute :folders, Types.Array(Folder)
|
3266
|
+
attribute :policies, Types.Array(Policy)
|
3267
|
+
|
3268
|
+
# Data about the user, including their encryption keys and the organizations they are a
|
3269
|
+
# part of
|
3270
|
+
attribute :profile, ProfileResponse
|
3271
|
+
|
3272
|
+
attribute :sends, Types.Array(Send)
|
3273
|
+
|
3274
|
+
def self.from_dynamic!(d)
|
3275
|
+
d = Types::Hash[d]
|
3276
|
+
new(
|
3277
|
+
ciphers: d.fetch("ciphers").map { |x| Cipher.from_dynamic!(x) },
|
3278
|
+
collections: d.fetch("collections").map { |x| Collection.from_dynamic!(x) },
|
3279
|
+
domains: d["domains"] ? DomainResponse.from_dynamic!(d["domains"]) : nil,
|
3280
|
+
folders: d.fetch("folders").map { |x| Folder.from_dynamic!(x) },
|
3281
|
+
policies: d.fetch("policies").map { |x| Policy.from_dynamic!(x) },
|
3282
|
+
profile: ProfileResponse.from_dynamic!(d.fetch("profile")),
|
3283
|
+
sends: d.fetch("sends").map { |x| Send.from_dynamic!(x) },
|
3284
|
+
)
|
3285
|
+
end
|
3286
|
+
|
3287
|
+
def self.from_json!(json)
|
3288
|
+
from_dynamic!(JSON.parse(json))
|
3289
|
+
end
|
3290
|
+
|
3291
|
+
def to_dynamic
|
3292
|
+
{
|
3293
|
+
"ciphers" => ciphers.map { |x| x.to_dynamic },
|
3294
|
+
"collections" => collections.map { |x| x.to_dynamic },
|
3295
|
+
"domains" => domains&.to_dynamic,
|
3296
|
+
"folders" => folders.map { |x| x.to_dynamic },
|
3297
|
+
"policies" => policies.map { |x| x.to_dynamic },
|
3298
|
+
"profile" => profile.to_dynamic,
|
3299
|
+
"sends" => sends.map { |x| x.to_dynamic },
|
3300
|
+
}
|
3301
|
+
end
|
3302
|
+
|
3303
|
+
def to_json(options = nil)
|
3304
|
+
JSON.generate(to_dynamic, options)
|
3305
|
+
end
|
3306
|
+
end
|
3307
|
+
|
3308
|
+
class ResponseForSyncResponse < Dry::Struct
|
3309
|
+
|
3310
|
+
# The response data. Populated if `success` is true.
|
3311
|
+
attribute :data, SyncResponse.optional.optional
|
3312
|
+
|
3313
|
+
# A message for any error that may occur. Populated if `success` is false.
|
3314
|
+
attribute :error_message, Types::String.optional.optional
|
3315
|
+
|
3316
|
+
# Whether or not the SDK request succeeded.
|
3317
|
+
attribute :success, Types::Bool
|
3318
|
+
|
3319
|
+
def self.from_dynamic!(d)
|
3320
|
+
d = Types::Hash[d]
|
3321
|
+
new(
|
3322
|
+
data: d["data"] ? SyncResponse.from_dynamic!(d["data"]) : nil,
|
3323
|
+
error_message: d["errorMessage"],
|
3324
|
+
success: d.fetch("success"),
|
3325
|
+
)
|
3326
|
+
end
|
3327
|
+
|
3328
|
+
def self.from_json!(json)
|
3329
|
+
from_dynamic!(JSON.parse(json))
|
3330
|
+
end
|
3331
|
+
|
3332
|
+
def to_dynamic
|
3333
|
+
{
|
3334
|
+
"data" => data&.to_dynamic,
|
3335
|
+
"errorMessage" => error_message,
|
3336
|
+
"success" => success,
|
3337
|
+
}
|
3338
|
+
end
|
3339
|
+
|
3340
|
+
def to_json(options = nil)
|
3341
|
+
JSON.generate(to_dynamic, options)
|
3342
|
+
end
|
3343
|
+
end
|
3344
|
+
|
3345
|
+
module LoginLinkedIDType
|
3346
|
+
Password = "Password"
|
3347
|
+
Username = "Username"
|
3348
|
+
end
|
3349
|
+
|
3350
|
+
module CardLinkedIDType
|
3351
|
+
Brand = "Brand"
|
3352
|
+
CardholderName = "CardholderName"
|
3353
|
+
Code = "Code"
|
3354
|
+
ExpMonth = "ExpMonth"
|
3355
|
+
ExpYear = "ExpYear"
|
3356
|
+
Number = "Number"
|
3357
|
+
end
|
3358
|
+
|
3359
|
+
module IdentityLinkedIDType
|
3360
|
+
Address1 = "Address1"
|
3361
|
+
Address2 = "Address2"
|
3362
|
+
Address3 = "Address3"
|
3363
|
+
City = "City"
|
3364
|
+
Company = "Company"
|
3365
|
+
Country = "Country"
|
3366
|
+
Email = "Email"
|
3367
|
+
FirstName = "FirstName"
|
3368
|
+
FullName = "FullName"
|
3369
|
+
LastName = "LastName"
|
3370
|
+
LicenseNumber = "LicenseNumber"
|
3371
|
+
MiddleName = "MiddleName"
|
3372
|
+
PassportNumber = "PassportNumber"
|
3373
|
+
Phone = "Phone"
|
3374
|
+
PostalCode = "PostalCode"
|
3375
|
+
Ssn = "Ssn"
|
3376
|
+
State = "State"
|
3377
|
+
Title = "Title"
|
3378
|
+
Username = "Username"
|
3379
|
+
end
|
3380
|
+
|
3381
|
+
class UserAPIKeyResponse < Dry::Struct
|
3382
|
+
|
3383
|
+
# The user's API key, which represents the client_secret portion of an oauth request.
|
3384
|
+
attribute :api_key, Types::String
|
3385
|
+
|
3386
|
+
def self.from_dynamic!(d)
|
3387
|
+
d = Types::Hash[d]
|
3388
|
+
new(
|
3389
|
+
api_key: d.fetch("apiKey"),
|
3390
|
+
)
|
3391
|
+
end
|
3392
|
+
|
3393
|
+
def self.from_json!(json)
|
3394
|
+
from_dynamic!(JSON.parse(json))
|
3395
|
+
end
|
3396
|
+
|
3397
|
+
def to_dynamic
|
3398
|
+
{
|
3399
|
+
"apiKey" => api_key,
|
3400
|
+
}
|
3401
|
+
end
|
3402
|
+
|
3403
|
+
def to_json(options = nil)
|
3404
|
+
JSON.generate(to_dynamic, options)
|
3405
|
+
end
|
3406
|
+
end
|
3407
|
+
|
3408
|
+
class ResponseForUserAPIKeyResponse < Dry::Struct
|
3409
|
+
|
3410
|
+
# The response data. Populated if `success` is true.
|
3411
|
+
attribute :data, UserAPIKeyResponse.optional.optional
|
3412
|
+
|
3413
|
+
# A message for any error that may occur. Populated if `success` is false.
|
3414
|
+
attribute :error_message, Types::String.optional.optional
|
3415
|
+
|
3416
|
+
# Whether or not the SDK request succeeded.
|
3417
|
+
attribute :success, Types::Bool
|
3418
|
+
|
3419
|
+
def self.from_dynamic!(d)
|
3420
|
+
d = Types::Hash[d]
|
3421
|
+
new(
|
3422
|
+
data: d["data"] ? UserAPIKeyResponse.from_dynamic!(d["data"]) : nil,
|
3423
|
+
error_message: d["errorMessage"],
|
3424
|
+
success: d.fetch("success"),
|
3425
|
+
)
|
3426
|
+
end
|
3427
|
+
|
3428
|
+
def self.from_json!(json)
|
3429
|
+
from_dynamic!(JSON.parse(json))
|
3430
|
+
end
|
3431
|
+
|
3432
|
+
def to_dynamic
|
3433
|
+
{
|
3434
|
+
"data" => data&.to_dynamic,
|
3435
|
+
"errorMessage" => error_message,
|
3436
|
+
"success" => success,
|
3437
|
+
}
|
3438
|
+
end
|
3439
|
+
|
3440
|
+
def to_json(options = nil)
|
3441
|
+
JSON.generate(to_dynamic, options)
|
3442
|
+
end
|
3443
|
+
end
|
3444
|
+
|
3445
|
+
class EncString
|
3446
|
+
def self.from_json!(json)
|
3447
|
+
JSON.parse(json, quirks_mode: true)
|
3448
|
+
end
|
3449
|
+
end
|
3450
|
+
|