@@ -4,22 +4,25 @@ import Prelude
44
55import Bridge as Bridge
66import Data.Argonaut (class DecodeJson, class EncodeJson)
7+import Data.Either (Either)
8+import Data.Either as Either
9+import Data.Int as Int
710import Data.JNullable (JNullable)
811import Data.JOpt (JOpt)
912import Data.Maybe (Maybe(..))
13+import Data.Nullable (Nullable)
1014import Data.ShowableJson (ShowableJson)
1115import Data.Timestamp (Timestamp)
12−import Data.Traversable (traverse)
13−import Foreign (Foreign)
16+import Data.Traversable (for)
17+import Data.Tuple.Nested ((/\))
1418import Foreign as Foreign
15−import Foreign.Object (Object)
1619import Literals.Undefined (Undefined)
1720import Type.Prelude (Proxy(..))
18−import Untagged.TypeCheck (class HasRuntimeType, hasRuntimeType)
21+import Untagged.TypeCheck (class HasRuntimeType)
1922import Untagged.Union (type (|+|))
23+import Untagged.Union as Union
2024
21−newtype EncryptedString
22− = EncryptedString String
25+newtype EncryptedString = EncryptedString String
2326
2427derive newtype instance Show EncryptedString
2528derive newtype instance Ord EncryptedString
@@ -28,78 +31,86 @@ derive newtype instance EncodeJson EncryptedString
2831derive newtype instance DecodeJson EncryptedString
2932
3033kdfPBKDF2_SHA256 = 0 :: KDF
34+kdfArgon2id = 1 :: KDF
3135
32−type KDF
33− = Int
34−
35−type PreloginResponse
36− = { kdf :: KDF
37− , kdfIterations :: Int
38− }
39−
40−type PreloginRequest
41− = { email :: Email
42− }
43−
44−type ProfileResponse
45− = { id :: String
46− , name :: JNullable String
47− , email :: String
48− , emailVerified :: Boolean
49− , masterPasswordHint :: JNullable String
50− , premiumPersonally :: Boolean
51− -- , premiumFromOrganization :: Boolean
52− , culture :: JNullable String
53− , twoFactorEnabled :: Boolean
54− , key :: EncryptedString
55− , privateKey :: EncryptedString
56− , securityStamp :: JNullable String
57− , forcePasswordReset :: Boolean
58− , usesKeyConnector :: Boolean
59− , organizations :: Array ProfileOrganizationResponse
60− , providers :: Array ProfileProviderResponse
61− , providerOrganizations :: Array ProfileProviderOrganizationResponse
62− }
63−
64−type ProfileOrganizationResponse
65− = { id :: String
66− , name :: JNullable String
67− , usePolicies :: JNullable Boolean
68− , useGroups :: JNullable Boolean
69− , useDirectory :: JNullable Boolean
70− , useEvents :: JNullable Boolean
71− , useTotp :: JNullable Boolean
72− , use2fa :: JNullable Boolean
73− , useApi :: JNullable Boolean
74− , useSso :: JNullable Boolean
75− , useKeyConnector :: JNullable Boolean
76− , useResetPassword :: JNullable Boolean
77− , selfHost :: JNullable Boolean
78− , usersGetPremium :: JNullable Boolean
79− , seats :: JNullable Int
80− , maxCollections :: JNullable Int
81− , maxStorageGb :: JNullable Int
82− , key :: JNullable String
83− , hasPublicAndPrivateKeys :: JNullable Boolean
84− , status :: JNullable OrganizationUserStatusType
85− , type :: JNullable OrganizationUserType
86− , enabled :: JNullable Boolean
87− , ssoBound :: JNullable Boolean
88− , identifier :: JNullable String
89− , permissions :: JNullable PermissionsApi
90− , resetPasswordEnrolled :: JNullable Boolean
91− , userId :: JNullable String
92− , providerId :: JNullable String
93− , providerName :: JNullable String
94− , familySponsorshipFriendlyName :: JNullable String
95− , familySponsorshipAvailable :: JNullable Boolean
96− , planProductType :: JNullable ProductType
97− , keyConnectorEnabled :: JNullable Boolean
98− , keyConnectorUrl :: JNullable String
99− , familySponsorshipLastSyncDate :: JNullable Timestamp
100− , familySponsorshipValidUntil :: JNullable Timestamp
101− , familySponsorshipToDelete :: JNullable Boolean
102− }
36+type KDF = Int
37+
38+type PreloginResponse =
39+ { kdf :: KDF
40+ , kdfIterations :: Int
41+ , kdfMemory :: JNullable Int
42+ , kdfParallelism :: JNullable Int
43+ }
44+
45+type KdfConfig =
46+ { iterations :: Int
47+ , memory :: JNullable Int
48+ , parallelism :: JNullable Int
49+ }
50+
51+type PreloginRequest =
52+ { email :: Email
53+ }
54+
55+type ProfileResponse =
56+ { id :: String
57+ , name :: JNullable String
58+ , email :: String
59+ , emailVerified :: Boolean
60+ , masterPasswordHint :: JNullable String
61+ -- , premiumPersonally :: Boolean
62+ -- , premiumFromOrganization :: Boolean
63+ , culture :: JNullable String
64+ , twoFactorEnabled :: Boolean
65+ , key :: EncryptedString
66+ , privateKey :: EncryptedString
67+ , securityStamp :: JNullable String
68+ , forcePasswordReset :: Boolean
69+ , usesKeyConnector :: Boolean
70+ -- , organizations :: Array ProfileOrganizationResponse
71+ , providers :: Array ProfileProviderResponse
72+ , providerOrganizations :: Array ProfileProviderOrganizationResponse
73+ }
74+
75+type ProfileOrganizationResponse =
76+ { id :: String
77+ , name :: JNullable String
78+ , usePolicies :: JNullable Boolean
79+ , useGroups :: JNullable Boolean
80+ , useDirectory :: JNullable Boolean
81+ , useEvents :: JNullable Boolean
82+ , useTotp :: JNullable Boolean
83+ , use2fa :: JNullable Boolean
84+ , useApi :: JNullable Boolean
85+ , useSso :: JNullable Boolean
86+ , useKeyConnector :: JNullable Boolean
87+ , useResetPassword :: JNullable Boolean
88+ , selfHost :: JNullable Boolean
89+ , usersGetPremium :: JNullable Boolean
90+ , seats :: JNullable Int
91+ , maxCollections :: JNullable Int
92+ , maxStorageGb :: JNullable Int
93+ , key :: JNullable String
94+ , hasPublicAndPrivateKeys :: JNullable Boolean
95+ , status :: JNullable OrganizationUserStatusType
96+ , type :: JNullable OrganizationUserType
97+ , enabled :: JNullable Boolean
98+ , ssoBound :: JNullable Boolean
99+ , identifier :: JNullable String
100+ , permissions :: JNullable PermissionsApi
101+ , resetPasswordEnrolled :: JNullable Boolean
102+ , userId :: JNullable String
103+ , providerId :: JNullable String
104+ , providerName :: JNullable String
105+ , familySponsorshipFriendlyName :: JNullable String
106+ , familySponsorshipAvailable :: JNullable Boolean
107+ , planProductType :: JNullable ProductType
108+ , keyConnectorEnabled :: JNullable Boolean
109+ , keyConnectorUrl :: JNullable String
110+ , familySponsorshipLastSyncDate :: JNullable Timestamp
111+ , familySponsorshipValidUntil :: JNullable Timestamp
112+ , familySponsorshipToDelete :: JNullable Boolean
113+ }
103114
104115organizationUserStatusTypeInvited = 0 :: OrganizationUserStatusType
105116
@@ -107,8 +118,7 @@ organizationUserStatusTypeAccepted = 0 :: OrganizationUserStatusType
107118
108119organizationUserStatusTypeConfirmed = 0 :: OrganizationUserStatusType
109120
110−type OrganizationUserStatusType
111− = Int
121+type OrganizationUserStatusType = Int
112122
113123organizationUserTypeOwner = 0 :: OrganizationUserType
114124
@@ -120,27 +130,26 @@ organizationUserTypeManager = 3 :: OrganizationUserType
120130
121131organizationUserTypeCustom = 4 :: OrganizationUserType
122132
123−type OrganizationUserType
124− = Int
125−
126−type PermissionsApi
127− = { accessEventLogs :: Boolean
128− , accessImportExport :: Boolean
129− , accessReports :: Boolean
130− , manageAllCollections :: Boolean
131− , createNewCollections :: Boolean
132− , editAnyCollection :: Boolean
133− , deleteAnyCollection :: Boolean
134− , manageAssignedCollections :: Boolean
135− , editAssignedCollections :: Boolean
136− , deleteAssignedCollections :: Boolean
137− , manageCiphers :: Boolean
138− , manageGroups :: Boolean
139− , manageSso :: Boolean
140− , managePolicies :: Boolean
141− , manageUsers :: Boolean
142− , manageResetPassword :: Boolean
143− }
133+type OrganizationUserType = Int
134+
135+type PermissionsApi =
136+ { accessEventLogs :: Boolean
137+ , accessImportExport :: Boolean
138+ , accessReports :: Boolean
139+ , manageAllCollections :: Boolean
140+ , createNewCollections :: Boolean
141+ , editAnyCollection :: Boolean
142+ , deleteAnyCollection :: Boolean
143+ , manageAssignedCollections :: Boolean
144+ , editAssignedCollections :: Boolean
145+ , deleteAssignedCollections :: Boolean
146+ , manageCiphers :: Boolean
147+ , manageGroups :: Boolean
148+ , manageSso :: Boolean
149+ , managePolicies :: Boolean
150+ , manageUsers :: Boolean
151+ , manageResetPassword :: Boolean
152+ }
144153
145154productTypeFree = 0 :: ProductType
146155
@@ -150,20 +159,19 @@ productTypeTeams = 2 :: ProductType
150159
151160productTypeEnterprise = 3 :: ProductType
152161
153−type ProductType
154− = Int
155−
156−type ProfileProviderResponse
157− = { id :: String
158− , name :: JNullable String
159− , key :: JNullable String
160− , status :: JNullable ProviderUserStatusType
161− , type :: JNullable ProviderUserType
162− , enabled :: Boolean
163− , permissions :: PermissionsApi
164− , userId :: JNullable String
165− , useEvents :: Boolean
166− }
162+type ProductType = Int
163+
164+type ProfileProviderResponse =
165+ { id :: String
166+ , name :: JNullable String
167+ , key :: JNullable String
168+ , status :: JNullable ProviderUserStatusType
169+ , type :: JNullable ProviderUserType
170+ , enabled :: Boolean
171+ , permissions :: PermissionsApi
172+ , userId :: JNullable String
173+ , useEvents :: Boolean
174+ }
167175
168176providerUserStatusTypeInvited = 0 :: ProviderUserStatusType
169177
@@ -171,81 +179,79 @@ providerUserStatusTypeAccepted = 1 :: ProviderUserStatusType
171179
172180providerUserStatusTypeConfirmed = 2 :: ProviderUserStatusType
173181
174−type ProviderUserStatusType
175− = Int
182+type ProviderUserStatusType = Int
176183
177184providerUserTypeProviderAdmin = 0 :: ProviderUserType
178185
179186providerUserTypeServiceUser = 1 :: ProviderUserType
180187
181−type ProviderUserType
182− = Int
183−
184−type ProfileProviderOrganizationResponse
185− = { id :: String
186− , name :: JNullable String
187− , usePolicies :: Boolean
188− , useGroups :: Boolean
189− , useDirectory :: Boolean
190− , useEvents :: Boolean
191− , useTotp :: Boolean
192− , use2fa :: Boolean
193− , useApi :: Boolean
194− , useSso :: Boolean
195− , useKeyConnector :: Boolean
196− , useResetPassword :: Boolean
197− , selfHost :: Boolean
198− , usersGetPremium :: Boolean
199− , seats :: Int
200− , maxCollections :: Int
201− , maxStorageGb :: JNullable Int
202− , key :: JNullable String
203− , hasPublicAndPrivateKeys :: Boolean
204− , status :: OrganizationUserStatusType
205− , type :: OrganizationUserType
206− , enabled :: Boolean
207− , ssoBound :: Boolean
208− , identifier :: JNullable String
209− , permissions :: PermissionsApi
210− , resetPasswordEnrolled :: Boolean
211− , userId :: JNullable String
212− , providerId :: JNullable String
213− , providerName :: JNullable String
214− , familySponsorshipFriendlyName :: JNullable String
215− , familySponsorshipAvailable :: Boolean
216− , planProductType :: ProductType
217− , keyConnectorEnabled :: Boolean
218− , keyConnectorUrl :: JNullable String
219− , familySponsorshipLastSyncDate :: JNullable Timestamp
220− , familySponsorshipValidUntil :: JNullable Timestamp
221− , familySponsorshipToDelete :: JNullable Boolean
222− }
223−
224−type Urls
225− = { base :: JNullable String
226− , webVault :: JNullable String
227− , api :: JNullable String
228− , identity :: JNullable String
229− , icons :: JNullable String
230− , notifications :: JNullable String
231− , events :: JNullable String
232− , keyConnector :: JNullable String
233− }
234−
235−type PasswordTokenRequest
236− = { email :: Email
237− , masterPasswordHash :: String
238− , captchaResponse :: String
239− , twoFactor :: TokenRequestTwoFactor
240− , device :: DeviceRequest
241− }
242−
243−type DeviceRequest
244− = { type :: DeviceType
245− , name :: String
246− , identifier :: String
247− , pushToken :: JNullable String
248− }
188+type ProviderUserType = Int
189+
190+type ProfileProviderOrganizationResponse =
191+ { id :: String
192+ , name :: JNullable String
193+ , usePolicies :: Boolean
194+ , useGroups :: Boolean
195+ , useDirectory :: Boolean
196+ , useEvents :: Boolean
197+ , useTotp :: Boolean
198+ , use2fa :: Boolean
199+ , useApi :: Boolean
200+ , useSso :: Boolean
201+ , useKeyConnector :: Boolean
202+ , useResetPassword :: Boolean
203+ , selfHost :: Boolean
204+ , usersGetPremium :: Boolean
205+ , seats :: Int
206+ , maxCollections :: Int
207+ , maxStorageGb :: JNullable Int
208+ , key :: JNullable String
209+ , hasPublicAndPrivateKeys :: Boolean
210+ , status :: OrganizationUserStatusType
211+ , type :: OrganizationUserType
212+ , enabled :: Boolean
213+ , ssoBound :: Boolean
214+ , identifier :: JNullable String
215+ , permissions :: PermissionsApi
216+ , resetPasswordEnrolled :: Boolean
217+ , userId :: JNullable String
218+ , providerId :: JNullable String
219+ , providerName :: JNullable String
220+ , familySponsorshipFriendlyName :: JNullable String
221+ , familySponsorshipAvailable :: Boolean
222+ , planProductType :: ProductType
223+ , keyConnectorEnabled :: Boolean
224+ , keyConnectorUrl :: JNullable String
225+ , familySponsorshipLastSyncDate :: JNullable Timestamp
226+ , familySponsorshipValidUntil :: JNullable Timestamp
227+ , familySponsorshipToDelete :: JNullable Boolean
228+ }
229+
230+type Urls =
231+ { base :: JNullable String
232+ , webVault :: JNullable String
233+ , api :: JNullable String
234+ , identity :: JNullable String
235+ , icons :: JNullable String
236+ , notifications :: JNullable String
237+ , events :: JNullable String
238+ , keyConnector :: JNullable String
239+ }
240+
241+type PasswordTokenRequest =
242+ { email :: Email
243+ , masterPasswordHash :: String
244+ , captchaResponse :: String
245+ , twoFactor :: TokenRequestTwoFactor
246+ , device :: DeviceRequest
247+ }
248+
249+type DeviceRequest =
250+ { type :: DeviceType
251+ , name :: String
252+ , identifier :: String
253+ , pushToken :: JNullable String
254+ }
249255
250256deviceTypeAndroid = 0 :: DeviceType
251257
@@ -289,14 +295,13 @@ deviceTypeVivaldiExtension = 19 :: DeviceType
289295
290296deviceTypeSafariExtension = 20 :: DeviceType
291297
292−type DeviceType
293− = Int
298+type DeviceType = Int
294299
295−type TokenRequestTwoFactor
296− = { provider :: TwoFactorProviderType
297− , token :: String
298− , remember :: Boolean
299− }
300+type TokenRequestTwoFactor =
301+ { provider :: TwoFactorProviderType
302+ , token :: String
303+ , remember :: Boolean
304+ }
300305
301306twoFactorProviderTypeAuthenticator = 0 :: TwoFactorProviderType
302307
@@ -314,12 +319,11 @@ twoFactorProviderTypeOrganizationDuo = 6 :: TwoFactorProviderType
314319
315320twoFactorProviderTypeWebAuthn = 7 :: TwoFactorProviderType
316321
317−type TwoFactorProviderType
318− = Int
322+type TwoFactorProviderType = Int
319323
320−secondFactorTypeToBridge ::
321− TwoFactorProviderType ->
322− Maybe Bridge.TwoFactorProviderType
324+secondFactorTypeToBridge
325+ :: TwoFactorProviderType
326+ -> Maybe Bridge.TwoFactorProviderType
323327secondFactorTypeToBridge x = case x of
324328 n
325329 | n == twoFactorProviderTypeAuthenticator -> Just Bridge.Authenticator
@@ -349,21 +353,17 @@ bridgeToSecondFactorType Bridge.Remember = twoFactorProviderTypeRemember
349353bridgeToSecondFactorType Bridge.OrganizationDuo = twoFactorProviderTypeOrganizationDuo
350354bridgeToSecondFactorType Bridge.WebAuthn = twoFactorProviderTypeWebAuthn
351355
352−newtype Password
353− = Password String
356+newtype Password = Password String
354357
355358hashPurposeServerAuthorization = 1 :: HashPurpose
356359
357360hashPurposeLocalAuthorization = 2 :: HashPurpose
358361
359−type HashPurpose
360− = Int
362+type HashPurpose = Int
361363
362−newtype StringHash
363− = StringHash String
364+newtype StringHash = StringHash String
364365
365−newtype AccessToken
366− = AccessToken String
366+newtype AccessToken = AccessToken String
367367
368368derive newtype instance Show AccessToken
369369derive newtype instance Eq AccessToken
@@ -371,8 +371,7 @@ derive newtype instance Ord AccessToken
371371derive newtype instance EncodeJson AccessToken
372372derive newtype instance DecodeJson AccessToken
373373
374−newtype RefreshToken
375− = RefreshToken String
374+newtype RefreshToken = RefreshToken String
376375
377376derive newtype instance Show RefreshToken
378377derive newtype instance Eq RefreshToken
@@ -384,27 +383,33 @@ type IdentityCaptchaResponse =
384383 { siteKey :: String
385384 }
386385
387−type IdentityTokenResponse
388− = { accessToken :: AccessToken
389− , expiresIn :: Int
390− , refreshToken :: RefreshToken
391− , tokenType :: String
392− , resetMasterPassword :: Boolean
393− , privateKey :: EncryptedString
394− , key :: EncryptedString
395− , twoFactorToken :: JNullable String
396− , kdf :: KDF
397− , kdfIterations :: Int
398− , forcePasswordReset :: JNullable Boolean
399− , apiUseKeyConnector :: JNullable Boolean
400− , keyConnectorUrl :: JNullable String
401− }
402−
403−newtype TwoFactorProviderTypes = TwoFactorProviderTypes (Array TwoFactorProviderType)
386+type IdentityTokenResponse =
387+ { accessToken :: AccessToken
388+ , expiresIn :: Int
389+ , refreshToken :: RefreshToken
390+ , tokenType :: String
391+ , resetMasterPassword :: Boolean
392+ , privateKey :: EncryptedString
393+ , key :: EncryptedString
394+ , twoFactorToken :: JNullable String
395+ , kdf :: KDF
396+ , kdfIterations :: Int
397+ , forcePasswordReset :: JNullable Boolean
398+ , apiUseKeyConnector :: JNullable Boolean
399+ , keyConnectorUrl :: JNullable String
400+ }
401+
402+newtype TwoFactorProviderTypes = TwoFactorProviderTypes (Array (Int |+| String))
404403
405404instance HasRuntimeType TwoFactorProviderTypes where
406405 hasRuntimeType Proxy = Foreign.isArray
407406
407+fromTwoFactorProviderType :: TwoFactorProviderTypes -> Either String (Array Bridge.TwoFactorProviderType)
408+fromTwoFactorProviderType (TwoFactorProviderTypes xs) =
409+ for xs $ \rawProvider -> do
410+ providerInt <- Union.reduce (Either.Right /\ (\x -> Either.note x $ Int.fromString x)) rawProvider
411+ Either.note (show providerInt) $ secondFactorTypeToBridge providerInt
412+
408413type IdentityTwoFactorResponse =
409414 { twoFactorProviders :: TwoFactorProviderTypes
410415 -- it is a Map type and untaged unions gets confused
@@ -412,59 +417,57 @@ type IdentityTwoFactorResponse =
412417 , captchaToken :: String |+| Undefined
413418 }
414419
415−newtype Email
416− = Email String
417−
418−type SyncResponse
419− = { profile :: ProfileResponse
420− , folders :: Array FolderResponse
421− , collections :: Array CollectionDetailsResponse
422− , ciphers :: Array CipherResponse
423− , domains :: JNullable DomainsResponse
424− , policies :: JNullable (Array PolicyResponse)
425− , sends :: Array SendResponse
426− }
420+newtype Email = Email String
427421
428−type FolderResponse
429− = { id :: String
430− , name :: JNullable String
431− , revisionDate :: JNullable String
432− }
422+type SyncResponse =
423+ { profile :: ProfileResponse
424+ , folders :: Array FolderResponse
425+ , collections :: Array CollectionDetailsResponse
426+ , ciphers :: Array CipherResponse
427+ , domains :: JNullable DomainsResponse
428+ , policies :: JNullable (Array PolicyResponse)
429+ , sends :: Array SendResponse
430+ }
433431
434−type CollectionDetailsResponse
435− = { id :: String
436− , organizationId :: JNullable String
437− , name :: JNullable String
438− , externalId :: JNullable String
439− , readOnly :: Boolean
440− }
432+type FolderResponse =
433+ { id :: String
434+ , name :: JNullable String
435+ , revisionDate :: JNullable String
436+ }
441437
438+type CollectionDetailsResponse =
439+ { id :: String
440+ , organizationId :: JNullable String
441+ , name :: JNullable String
442+ , externalId :: JNullable String
443+ , readOnly :: Boolean
444+ }
442445
443446type CipherId = String
444447
445−type CipherResponse
446− = { id :: CipherId
447− , organizationId :: JNullable String
448− , folderId :: JNullable String
449− , type :: CipherType
450− , name :: EncryptedString
451− , notes :: JNullable EncryptedString
452− , fields :: JNullable (Array FieldApi)
453− , login :: JNullable LoginApi
454− , card :: JNullable CardApi
455− , identity :: JNullable IdentityApi
456− , secureNote :: JNullable SecureNoteApi
457− , favorite :: Boolean
458− , edit :: JNullable Boolean
459− , viewPassword :: JNullable Boolean
460− , organizationUseTotp :: JNullable Boolean
461− , revisionDate :: JNullable Timestamp
462− , attachments :: JNullable (Array AttachmentResponse)
463− , passwordHistory :: JNullable (Array PasswordHistoryResponse)
464− , collectionIds :: JNullable (Array String)
465− , deletedDate :: JNullable String
466− , reprompt :: CipherRepromptType
467− }
448+type CipherResponse =
449+ { id :: CipherId
450+ , organizationId :: JNullable String
451+ , folderId :: JNullable String
452+ , type :: CipherType
453+ , name :: EncryptedString
454+ , notes :: JNullable EncryptedString
455+ , fields :: JNullable (Array FieldApi)
456+ , login :: JNullable LoginApi
457+ , card :: JNullable CardApi
458+ , identity :: JNullable IdentityApi
459+ , secureNote :: JNullable SecureNoteApi
460+ , favorite :: Boolean
461+ , edit :: JNullable Boolean
462+ , viewPassword :: JNullable Boolean
463+ , organizationUseTotp :: JNullable Boolean
464+ , revisionDate :: JNullable Timestamp
465+ , attachments :: JNullable (Array AttachmentResponse)
466+ , passwordHistory :: JNullable (Array PasswordHistoryResponse)
467+ , collectionIds :: JNullable (Array String)
468+ , deletedDate :: JNullable String
469+ , reprompt :: CipherRepromptType
470+ }
468471
469472cipherTypeLogin = 1 :: CipherType
470473
@@ -474,15 +477,14 @@ cipherTypeCard = 3 :: CipherType
474477
475478cipherTypeIdentity = 4 :: CipherType
476479
477−type CipherType
478− = Int
480+type CipherType = Int
479481
480−type FieldApi
481− = { name :: JNullable String
482− , value :: JNullable String
483− , type :: FieldType
484− , linkedId :: JNullable LinkedIdType
485− }
482+type FieldApi =
483+ { name :: JNullable String
484+ , value :: JNullable String
485+ , type :: FieldType
486+ , linkedId :: JNullable LinkedIdType
487+ }
486488
487489fieldTypeText = 0 :: FieldType
488490
@@ -492,8 +494,7 @@ fieldTypeBoolean = 2 :: FieldType
492494
493495fieldTypeLinked = 3 :: FieldType
494496
495−type FieldType
496− = Int
497+type FieldType = Int
497498
498499linkedIdTypeLoginLinkedIdUsername = 100 :: LinkedIdType
499500
@@ -549,23 +550,22 @@ linkedIdTypeIdentityLinkedIdLastName = 417 :: LinkedIdType
549550
550551linkedIdTypeIdentityLinkedIdFullName = 418 :: LinkedIdType
551552
552−type LinkedIdType
553− = Int
553+type LinkedIdType = Int
554554
555−type LoginApi
556− = { uris :: JOpt (Array LoginUriApi)
557− , username :: JNullable EncryptedString
558− , password :: JNullable EncryptedString
559− , passwordRevisionDate :: JNullable String
560− , totp :: JNullable EncryptedString
561− -- This thing is undefined in some cases for some reson. Just ignoring it
562− , autofillOnPageLoad :: JOpt (JNullable Boolean)
563− }
555+type LoginApi =
556+ { uris :: JOpt (Array LoginUriApi)
557+ , username :: JNullable EncryptedString
558+ , password :: JNullable EncryptedString
559+ , passwordRevisionDate :: JNullable String
560+ , totp :: JNullable EncryptedString
561+ -- This thing is undefined in some cases for some reson. Just ignoring it
562+ , autofillOnPageLoad :: JOpt (JNullable Boolean)
563+ }
564564
565−type LoginUriApi
566− = { uri :: EncryptedString
567− , match :: JNullable UriMatchType
568− }
565+type LoginUriApi =
566+ { uri :: JNullable EncryptedString
567+ , match :: JNullable UriMatchType
568+ }
569569
570570uriMatchTypeDomain = 0 :: UriMatchType
571571
@@ -579,87 +579,85 @@ uriMatchTypeRegularExpression = 4 :: UriMatchType
579579
580580uriMatchTypeNever = 5 :: UriMatchType
581581
582−type UriMatchType
583− = Int
584−
585−type CardApi
586− = { cardholderName :: JNullable EncryptedString
587− , brand :: JNullable EncryptedString
588− , number :: JNullable EncryptedString
589− , expMonth :: JNullable EncryptedString
590− , expYear :: JNullable EncryptedString
591− , code :: JNullable EncryptedString
592− }
593−
594−type IdentityApi
595− = { title :: JNullable EncryptedString
596− , firstName :: JNullable EncryptedString
597− , middleName :: JNullable EncryptedString
598− , lastName :: JNullable EncryptedString
599− , address1 :: JNullable EncryptedString
600− , address2 :: JNullable EncryptedString
601− , address3 :: JNullable EncryptedString
602− , city :: JNullable EncryptedString
603− , state :: JNullable EncryptedString
604− , postalCode :: JNullable EncryptedString
605− , country :: JNullable EncryptedString
606− , company :: JNullable EncryptedString
607− , email :: JNullable EncryptedString
608− , phone :: JNullable EncryptedString
609− , ssn :: JNullable EncryptedString
610− , username :: JNullable EncryptedString
611− , passportNumber :: JNullable EncryptedString
612− , licenseNumber :: JNullable EncryptedString
613− }
582+type UriMatchType = Int
583+
584+type CardApi =
585+ { cardholderName :: JNullable EncryptedString
586+ , brand :: JNullable EncryptedString
587+ , number :: JNullable EncryptedString
588+ , expMonth :: JNullable EncryptedString
589+ , expYear :: JNullable EncryptedString
590+ , code :: JNullable EncryptedString
591+ }
592+
593+type IdentityApi =
594+ { title :: JNullable EncryptedString
595+ , firstName :: JNullable EncryptedString
596+ , middleName :: JNullable EncryptedString
597+ , lastName :: JNullable EncryptedString
598+ , address1 :: JNullable EncryptedString
599+ , address2 :: JNullable EncryptedString
600+ , address3 :: JNullable EncryptedString
601+ , city :: JNullable EncryptedString
602+ , state :: JNullable EncryptedString
603+ , postalCode :: JNullable EncryptedString
604+ , country :: JNullable EncryptedString
605+ , company :: JNullable EncryptedString
606+ , email :: JNullable EncryptedString
607+ , phone :: JNullable EncryptedString
608+ , ssn :: JNullable EncryptedString
609+ , username :: JNullable EncryptedString
610+ , passportNumber :: JNullable EncryptedString
611+ , licenseNumber :: JNullable EncryptedString
612+ }
614613
615614secureNoteTypeGeneric = 0 :: SecureNoteType
616615
617−type SecureNoteType
618− = Int
616+type SecureNoteType = Int
619617
620−type SecureNoteApi = {
618+type SecureNoteApi =
619+ {
621620 -- type :: SecureNoteType
622−}
623−
624−type AttachmentResponse
625− = { id :: String
626− , url :: JNullable String
627− , fileName :: JNullable String
628− , key :: JNullable String
629− , size :: JNullable String
630− , sizeName :: JNullable String
631− }
632−
633−type PasswordHistoryResponse
634− = { password :: String
635− , lastUsedDate :: JNullable String
636− }
621+ }
622+
623+type AttachmentResponse =
624+ { id :: String
625+ , url :: JNullable String
626+ , fileName :: JNullable String
627+ , key :: JNullable String
628+ , size :: JNullable String
629+ , sizeName :: JNullable String
630+ }
631+
632+type PasswordHistoryResponse =
633+ { password :: String
634+ , lastUsedDate :: JNullable String
635+ }
637636
638637cipherRepromptTypeNone = 0 :: CipherRepromptType
639638
640639cipherRepromptTypePassword = 1 :: CipherRepromptType
641640
642−type CipherRepromptType
643− = Int
641+type CipherRepromptType = Int
644642
645−type DomainsResponse
646− = { equivalentDomains :: Array (Array String)
647− , globalEquivalentDomains :: Array GlobalDomainResponse
648− }
643+type DomainsResponse =
644+ { equivalentDomains :: Array (Array String)
645+ , globalEquivalentDomains :: Array GlobalDomainResponse
646+ }
649647
650−type GlobalDomainResponse
651− = { type :: Int
652− , domains :: Array String
653− , excluded :: Boolean
654− }
648+type GlobalDomainResponse =
649+ { type :: Int
650+ , domains :: Array String
651+ , excluded :: Boolean
652+ }
655653
656−type PolicyResponse
657− = { id :: String
658− , organizationId :: JNullable String
659− , type :: PolicyType
660− , data :: ShowableJson
661− , enabled :: Boolean
662− }
654+type PolicyResponse =
655+ { id :: String
656+ , organizationId :: JNullable String
657+ , type :: PolicyType
658+ , data :: ShowableJson
659+ , enabled :: Boolean
660+ }
663661
664662policyTypeTwoFactorAuthentication = 0 :: PolicyType -- Requires users to have 2fa enabled
665663
@@ -683,46 +681,44 @@ policyTypeMaximumVaultTimeout = 9 :: PolicyType -- Sets the maximum allowed vaul
683681
684682policyTypeDisablePersonalVaultExport = 10 :: PolicyType -- Disable personal vault export
685683
686−type PolicyType
687− = Int
688−
689−type SendResponse
690− = { id :: String
691− , accessId :: JNullable String
692− , type :: SendType
693− , name :: JNullable String
694− , notes :: JNullable String
695− , file :: JNullable SendFileApi
696− , text :: JNullable SendTextApi
697− , key :: JNullable String
698− , maxAccessCount :: JNullable Int
699− , accessCount :: JNullable Int
700− , revisionDate :: JNullable String
701− , expirationDate :: JNullable String
702− , deletionDate :: JNullable String
703− , password :: JNullable String
704− , disable :: Boolean
705− , hideEmail :: Boolean
706− }
684+type PolicyType = Int
685+
686+type SendResponse =
687+ { id :: String
688+ , accessId :: JNullable String
689+ , type :: SendType
690+ , name :: JNullable String
691+ , notes :: JNullable String
692+ , file :: JNullable SendFileApi
693+ , text :: JNullable SendTextApi
694+ , key :: JNullable String
695+ , maxAccessCount :: JNullable Int
696+ , accessCount :: JNullable Int
697+ , revisionDate :: JNullable String
698+ , expirationDate :: JNullable String
699+ , deletionDate :: JNullable String
700+ , password :: JNullable String
701+ , disable :: Boolean
702+ , hideEmail :: Boolean
703+ }
707704
708705sendTypeText = 0 :: SendType
709706
710707sendTypeFile = 1 :: SendType
711708
712−type SendType
713− = Int
709+type SendType = Int
714710
715−type SendFileApi
716− = { id :: String
717− , fileName :: JNullable String
718− , size :: JNullable String
719− , sizeName :: JNullable String
720− }
711+type SendFileApi =
712+ { id :: String
713+ , fileName :: JNullable String
714+ , size :: JNullable String
715+ , sizeName :: JNullable String
716+ }
721717
722−type SendTextApi
723− = { text :: JNullable String
724− , hidden :: Boolean
725− }
718+type SendTextApi =
719+ { text :: JNullable String
720+ , hidden :: Boolean
721+ }
726722
727723type TwoFactorEmailRequest =
728724 { email :: Email