@djangocfg/api 2.1.327 → 2.1.331

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.
Files changed (170) hide show
  1. package/dist/auth-server.cjs +185 -3471
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +185 -3471
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +952 -3305
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +35 -35
  8. package/dist/auth.d.ts +35 -35
  9. package/dist/auth.mjs +952 -3305
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +90 -3396
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +4 -2508
  14. package/dist/clients.d.ts +4 -2508
  15. package/dist/clients.mjs +90 -3396
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/index.cjs +985 -3052
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1544 -1938
  20. package/dist/index.d.ts +1544 -1938
  21. package/dist/index.mjs +985 -3052
  22. package/dist/index.mjs.map +1 -1
  23. package/package.json +2 -2
  24. package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/api.ts +11 -55
  25. package/src/_api/generated/{cfg_totp → _cfg_accounts}/events.ts +3 -3
  26. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/index.ts +1 -1
  27. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthConnectionsList.ts +5 -6
  28. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthDisconnectCreate.ts +3 -3
  29. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +3 -3
  30. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +3 -3
  31. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthProvidersRetrieve.ts +5 -6
  32. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpRequestCreate.ts +3 -3
  33. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpVerifyCreate.ts +3 -3
  34. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileAvatarCreate.ts +3 -3
  35. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileDeleteCreate.ts +3 -3
  36. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +3 -3
  37. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialUpdate.ts +3 -3
  38. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileRetrieve.ts +5 -6
  39. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +3 -3
  40. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdateUpdate.ts +3 -3
  41. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsTokenRefreshCreate.ts +3 -3
  42. package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/index.ts +3 -3
  43. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/AccountDeleteResponse.ts +3 -3
  44. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CentrifugoToken.ts +4 -4
  45. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CfgUserUpdateRequest.ts +4 -4
  46. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeRequestRequest.ts +2 -2
  47. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeResponse.ts +2 -2
  48. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthCallbackRequestRequest.ts +3 -3
  49. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthConnection.ts +6 -6
  50. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthDisconnectRequestRequest.ts +2 -2
  51. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthError.ts +2 -2
  52. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthProvidersResponse.ts +3 -3
  53. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthTokenResponse.ts +7 -7
  54. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPErrorResponse.ts +2 -2
  55. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestRequest.ts +2 -2
  56. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestResponse.ts +2 -2
  57. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyRequest.ts +2 -2
  58. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyResponse.ts +6 -6
  59. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/PatchedCfgUserUpdateRequest.ts +4 -4
  60. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/ProviderEnum.ts +2 -2
  61. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefresh.ts +2 -2
  62. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefreshRequest.ts +2 -2
  63. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/User.ts +13 -13
  64. package/src/_api/generated/_cfg_accounts/sdk.gen.ts +5 -0
  65. package/src/_api/generated/_cfg_accounts/types.gen.ts +5 -0
  66. package/src/_api/generated/{cfg_totp → _cfg_centrifugo}/api.ts +11 -72
  67. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/events.ts +3 -3
  68. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/index.ts +1 -1
  69. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +5 -6
  70. package/src/_api/generated/{cfg_accounts → _cfg_centrifugo}/index.ts +3 -3
  71. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/ConnectionTokenResponse.ts +4 -4
  72. package/src/_api/generated/_cfg_centrifugo/sdk.gen.ts +5 -0
  73. package/src/_api/generated/_cfg_centrifugo/types.gen.ts +5 -0
  74. package/src/_api/generated/{cfg_accounts → _cfg_totp}/api.ts +11 -78
  75. package/src/_api/generated/{cfg_accounts → _cfg_totp}/events.ts +3 -3
  76. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/index.ts +1 -1
  77. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +3 -3
  78. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRetrieve.ts +5 -6
  79. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesDestroy.ts +3 -3
  80. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesRetrieve.ts +5 -6
  81. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDisableCreate.ts +3 -3
  82. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupConfirmCreate.ts +3 -3
  83. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupCreate.ts +3 -3
  84. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyBackupCreate.ts +3 -3
  85. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyCreate.ts +3 -3
  86. package/src/_api/generated/{cfg_totp → _cfg_totp}/index.ts +3 -3
  87. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateRequest.ts +2 -2
  88. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateResponse.ts +2 -2
  89. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesStatus.ts +2 -2
  90. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupRequest.ts +3 -3
  91. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupResponse.ts +3 -3
  92. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceList.ts +6 -6
  93. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListResponse.ts +2 -2
  94. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListStatusEnum.ts +2 -2
  95. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DisableRequest.ts +2 -2
  96. package/src/_api/generated/_cfg_totp/schemas/SetupRequest.ts +11 -0
  97. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/SetupResponse.ts +4 -4
  98. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/TotpVerifyUser.ts +12 -12
  99. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyBackupRequest.ts +3 -3
  100. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyRequest.ts +3 -3
  101. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyResponse.ts +4 -4
  102. package/src/_api/generated/_cfg_totp/sdk.gen.ts +5 -0
  103. package/src/_api/generated/_cfg_totp/types.gen.ts +5 -0
  104. package/src/_api/generated/index.ts +11 -13
  105. package/src/_api/generated/{cfg_accounts/sdk.gen.ts → sdk.gen.ts} +455 -1
  106. package/src/_api/generated/{cfg_accounts/types.gen.ts → types.gen.ts} +607 -77
  107. package/src/auth/context/AccountsContext.tsx +10 -10
  108. package/src/auth/context/AuthContext.tsx +1 -1
  109. package/src/auth/hooks/useDeleteAccount.ts +2 -1
  110. package/src/auth/hooks/useGithubAuth.ts +3 -2
  111. package/src/auth/hooks/useTokenRefresh.ts +2 -1
  112. package/src/auth/hooks/useTwoFactor.ts +4 -3
  113. package/src/auth/hooks/useTwoFactorSetup.ts +3 -2
  114. package/src/auth/hooks/useTwoFactorStatus.ts +4 -3
  115. package/src/auth/middlewares/tokenRefresh.ts +2 -1
  116. package/src/clients.ts +3 -3
  117. package/src/index.ts +22 -5
  118. package/src/server.ts +9 -9
  119. package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +0 -280
  120. package/src/_api/generated/cfg_centrifugo/client/index.ts +0 -25
  121. package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +0 -217
  122. package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +0 -318
  123. package/src/_api/generated/cfg_centrifugo/client.gen.ts +0 -16
  124. package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +0 -41
  125. package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +0 -82
  126. package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +0 -169
  127. package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +0 -171
  128. package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +0 -117
  129. package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +0 -242
  130. package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +0 -104
  131. package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +0 -140
  132. package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +0 -64
  133. package/src/_api/generated/cfg_centrifugo/types.gen.ts +0 -61
  134. package/src/_api/generated/cfg_totp/client/client.gen.ts +0 -280
  135. package/src/_api/generated/cfg_totp/client/index.ts +0 -25
  136. package/src/_api/generated/cfg_totp/client/types.gen.ts +0 -217
  137. package/src/_api/generated/cfg_totp/client/utils.gen.ts +0 -318
  138. package/src/_api/generated/cfg_totp/client.gen.ts +0 -16
  139. package/src/_api/generated/cfg_totp/core/auth.gen.ts +0 -41
  140. package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +0 -82
  141. package/src/_api/generated/cfg_totp/core/params.gen.ts +0 -169
  142. package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +0 -171
  143. package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +0 -117
  144. package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +0 -242
  145. package/src/_api/generated/cfg_totp/core/types.gen.ts +0 -104
  146. package/src/_api/generated/cfg_totp/core/utils.gen.ts +0 -140
  147. package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +0 -11
  148. package/src/_api/generated/cfg_totp/sdk.gen.ts +0 -432
  149. package/src/_api/generated/cfg_totp/types.gen.ts +0 -479
  150. /package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/index.ts +0 -0
  151. /package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/index.ts +0 -0
  152. /package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/index.ts +0 -0
  153. /package/src/_api/generated/{cfg_accounts/client → client}/client.gen.ts +0 -0
  154. /package/src/_api/generated/{cfg_accounts/client → client}/index.ts +0 -0
  155. /package/src/_api/generated/{cfg_accounts/client → client}/types.gen.ts +0 -0
  156. /package/src/_api/generated/{cfg_accounts/client → client}/utils.gen.ts +0 -0
  157. /package/src/_api/generated/{cfg_accounts/client.gen.ts → client.gen.ts} +0 -0
  158. /package/src/_api/generated/{cfg_accounts/core → core}/auth.gen.ts +0 -0
  159. /package/src/_api/generated/{cfg_accounts/core → core}/bodySerializer.gen.ts +0 -0
  160. /package/src/_api/generated/{cfg_accounts/core → core}/params.gen.ts +0 -0
  161. /package/src/_api/generated/{cfg_accounts/core → core}/pathSerializer.gen.ts +0 -0
  162. /package/src/_api/generated/{cfg_accounts/core → core}/queryKeySerializer.gen.ts +0 -0
  163. /package/src/_api/generated/{cfg_accounts/core → core}/serverSentEvents.gen.ts +0 -0
  164. /package/src/_api/generated/{cfg_accounts/core → core}/types.gen.ts +0 -0
  165. /package/src/_api/generated/{cfg_accounts/core → core}/utils.gen.ts +0 -0
  166. /package/src/_api/generated/{_shared → helpers}/errors.ts +0 -0
  167. /package/src/_api/generated/{_shared → helpers}/index.ts +0 -0
  168. /package/src/_api/generated/{_shared → helpers}/logger.ts +0 -0
  169. /package/src/_api/generated/{_shared → helpers}/storage.ts +0 -0
  170. /package/src/_api/generated/{_shared → helpers}/validation-events.ts +0 -0
@@ -8,48 +8,205 @@ export type ClientOptions = {
8
8
  * Response serializer for account deletion.
9
9
  */
10
10
  export type AccountDeleteResponse = {
11
+ /**
12
+ * Human-readable message about the deletion
13
+ */
14
+ message: string;
11
15
  /**
12
16
  * Whether the account was successfully deleted
13
17
  */
14
18
  success: boolean;
19
+ };
20
+
21
+ /**
22
+ * Serializer for regenerating backup codes.
23
+ */
24
+ export type BackupCodesRegenerateRequest = {
15
25
  /**
16
- * Human-readable message about the deletion
26
+ * TOTP code for verification
17
27
  */
18
- message: string;
28
+ code: string;
19
29
  };
20
30
 
21
31
  /**
22
- * Nested serializer for Centrifugo WebSocket connection token.
32
+ * Response serializer for backup codes regeneration.
23
33
  */
24
- export type CentrifugoToken = {
34
+ export type BackupCodesRegenerateResponse = {
25
35
  /**
26
- * JWT token for Centrifugo WebSocket connection
36
+ * List of new backup codes (save these!)
27
37
  */
28
- token: string;
38
+ backup_codes: Array<string>;
39
+ /**
40
+ * Warning about previous codes being invalidated
41
+ */
42
+ warning: string;
43
+ };
44
+
45
+ /**
46
+ * Serializer for backup codes status.
47
+ */
48
+ export type BackupCodesStatus = {
49
+ /**
50
+ * Number of unused backup codes
51
+ */
52
+ remaining_count: number;
53
+ /**
54
+ * Total number of codes generated
55
+ */
56
+ total_generated: number;
57
+ /**
58
+ * Warning if running low on codes
59
+ */
60
+ warning?: string | null;
61
+ };
62
+
63
+ /**
64
+ * Nested serializer for Centrifugo WebSocket connection token.
65
+ */
66
+ export type CentrifugoToken = {
29
67
  /**
30
68
  * Centrifugo WebSocket URL
31
69
  */
32
70
  centrifugo_url: string;
71
+ /**
72
+ * List of allowed channels for this user
73
+ */
74
+ channels: Array<string>;
33
75
  /**
34
76
  * Token expiration time (ISO 8601)
35
77
  */
36
78
  expires_at: string;
37
79
  /**
38
- * List of allowed channels for this user
80
+ * JWT token for Centrifugo WebSocket connection
39
81
  */
40
- channels: Array<string>;
82
+ token: string;
41
83
  };
42
84
 
43
85
  /**
44
86
  * Serializer for updating user profile.
45
87
  */
46
88
  export type CfgUserUpdateRequest = {
89
+ company?: string;
47
90
  first_name?: string;
91
+ language?: string;
48
92
  last_name?: string;
49
- company?: string;
50
93
  phone?: string;
51
94
  position?: string;
52
- language?: string;
95
+ };
96
+
97
+ /**
98
+ * Serializer for confirming 2FA setup with first code.
99
+ */
100
+ export type ConfirmSetupRequest = {
101
+ /**
102
+ * 6-digit TOTP code from authenticator app
103
+ */
104
+ code: string;
105
+ /**
106
+ * Device ID from setup response
107
+ */
108
+ device_id: string;
109
+ };
110
+
111
+ /**
112
+ * Response serializer for setup confirmation.
113
+ */
114
+ export type ConfirmSetupResponse = {
115
+ /**
116
+ * List of backup recovery codes (save these!)
117
+ */
118
+ backup_codes: Array<string>;
119
+ /**
120
+ * Warning message about backup codes
121
+ */
122
+ backup_codes_warning: string;
123
+ message: string;
124
+ };
125
+
126
+ /**
127
+ * ConnectionTokenResponse
128
+ *
129
+ * Response model for Centrifugo connection token.
130
+ */
131
+ export type ConnectionTokenResponse = {
132
+ /**
133
+ * Centrifugo Url
134
+ *
135
+ * Centrifugo WebSocket URL
136
+ */
137
+ centrifugo_url: string;
138
+ /**
139
+ * Channels
140
+ *
141
+ * List of allowed channels
142
+ */
143
+ channels: Array<string>;
144
+ /**
145
+ * Expires At
146
+ *
147
+ * Token expiration time (ISO 8601)
148
+ */
149
+ expires_at: string;
150
+ /**
151
+ * Token
152
+ *
153
+ * JWT token for Centrifugo connection
154
+ */
155
+ token: string;
156
+ };
157
+
158
+ /**
159
+ * Serializer for listing TOTP devices.
160
+ */
161
+ export type DeviceList = {
162
+ /**
163
+ * When device setup was confirmed
164
+ */
165
+ readonly confirmed_at: string | null;
166
+ readonly created_at: string;
167
+ readonly id: string;
168
+ /**
169
+ * Primary device used for verification
170
+ */
171
+ readonly is_primary: boolean;
172
+ /**
173
+ * Last successful verification
174
+ */
175
+ readonly last_used_at: string | null;
176
+ /**
177
+ * Device name for identification
178
+ */
179
+ readonly name: string;
180
+ readonly status: DeviceListStatusEnum;
181
+ };
182
+
183
+ /**
184
+ * Response serializer for device list endpoint.
185
+ */
186
+ export type DeviceListResponse = {
187
+ devices: Array<DeviceList>;
188
+ has_2fa_enabled: boolean;
189
+ };
190
+
191
+ /**
192
+ * * `pending` - Pending Confirmation
193
+ * * `active` - Active
194
+ * * `disabled` - Disabled
195
+ */
196
+ export enum DeviceListStatusEnum {
197
+ PENDING = 'pending',
198
+ ACTIVE = 'active',
199
+ DISABLED = 'disabled'
200
+ }
201
+
202
+ /**
203
+ * Serializer for completely disabling 2FA.
204
+ */
205
+ export type DisableRequest = {
206
+ /**
207
+ * TOTP code for verification
208
+ */
209
+ code: string;
53
210
  };
54
211
 
55
212
  /**
@@ -88,48 +245,48 @@ export type OAuthCallbackRequestRequest = {
88
245
  * Authorization code from OAuth provider callback
89
246
  */
90
247
  code: string;
91
- /**
92
- * State token for CSRF verification (from authorize response)
93
- */
94
- state: string;
95
248
  /**
96
249
  * Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path
97
250
  */
98
251
  redirect_uri?: string;
252
+ /**
253
+ * State token for CSRF verification (from authorize response)
254
+ */
255
+ state: string;
99
256
  };
100
257
 
101
258
  /**
102
259
  * Serializer for OAuth connection info (user-facing).
103
260
  */
104
261
  export type OAuthConnection = {
262
+ /**
263
+ * When this OAuth connection was created
264
+ */
265
+ readonly connected_at: string;
105
266
  readonly id: number;
267
+ /**
268
+ * Last time this OAuth connection was used for login
269
+ */
270
+ readonly last_login_at: string;
106
271
  /**
107
272
  * OAuth provider name (github, google, etc.)
108
273
  *
109
274
  * * `github` - GitHub
110
275
  */
111
276
  readonly provider: ProviderEnum;
112
- readonly provider_display: string;
113
- /**
114
- * Username on the OAuth provider platform
115
- */
116
- readonly provider_username: string;
117
- /**
118
- * Email from OAuth provider (may differ from user.email)
119
- */
120
- readonly provider_email: string;
121
277
  /**
122
278
  * Avatar URL from OAuth provider
123
279
  */
124
280
  readonly provider_avatar_url: string;
281
+ readonly provider_display: string;
125
282
  /**
126
- * When this OAuth connection was created
283
+ * Email from OAuth provider (may differ from user.email)
127
284
  */
128
- readonly connected_at: string;
285
+ readonly provider_email: string;
129
286
  /**
130
- * Last time this OAuth connection was used for login
287
+ * Username on the OAuth provider platform
131
288
  */
132
- readonly last_login_at: string;
289
+ readonly provider_username: string;
133
290
  };
134
291
 
135
292
  /**
@@ -185,39 +342,39 @@ export type OAuthProvidersResponse = {
185
342
  */
186
343
  export type OAuthTokenResponse = {
187
344
  /**
188
- * True if 2FA verification is required
345
+ * JWT access token (null when requires_2fa=True)
189
346
  */
190
- requires_2fa?: boolean;
347
+ access?: string | null;
191
348
  /**
192
- * 2FA session ID (only when requires_2fa=True)
349
+ * True if a new OAuth connection was created
193
350
  */
194
- session_id?: string | null;
351
+ is_new_connection: boolean;
195
352
  /**
196
- * JWT access token (null when requires_2fa=True)
353
+ * True if a new user was created during this OAuth flow
197
354
  */
198
- access?: string | null;
355
+ is_new_user: boolean;
199
356
  /**
200
357
  * JWT refresh token (null when requires_2fa=True)
201
358
  */
202
359
  refresh?: string | null;
203
360
  /**
204
- * Authenticated user info (null when requires_2fa=True)
205
- */
206
- user?: {
207
- [key: string]: unknown;
208
- } | null;
209
- /**
210
- * True if a new user was created during this OAuth flow
361
+ * True if 2FA verification is required
211
362
  */
212
- is_new_user: boolean;
363
+ requires_2fa?: boolean;
213
364
  /**
214
- * True if a new OAuth connection was created
365
+ * 2FA session ID (only when requires_2fa=True)
215
366
  */
216
- is_new_connection: boolean;
367
+ session_id?: string | null;
217
368
  /**
218
369
  * True if user should be prompted to enable 2FA
219
370
  */
220
371
  should_prompt_2fa?: boolean;
372
+ /**
373
+ * Authenticated user info (null when requires_2fa=True)
374
+ */
375
+ user?: {
376
+ [key: string]: unknown;
377
+ } | null;
221
378
  };
222
379
 
223
380
  /**
@@ -302,41 +459,41 @@ export type OtpVerifyRequest = {
302
459
  */
303
460
  export type OtpVerifyResponse = {
304
461
  /**
305
- * Whether 2FA verification is required
306
- */
307
- requires_2fa?: boolean;
308
- /**
309
- * 2FA session ID (if requires_2fa is True)
462
+ * JWT access token (if requires_2fa is False)
310
463
  */
311
- session_id?: string | null;
464
+ access?: string | null;
312
465
  /**
313
466
  * JWT refresh token (if requires_2fa is False)
314
467
  */
315
468
  refresh?: string | null;
316
469
  /**
317
- * JWT access token (if requires_2fa is False)
470
+ * Whether 2FA verification is required
318
471
  */
319
- access?: string | null;
472
+ requires_2fa?: boolean;
320
473
  /**
321
- * User information (if requires_2fa is False)
474
+ * 2FA session ID (if requires_2fa is True)
322
475
  */
323
- user?: User | null;
476
+ session_id?: string | null;
324
477
  /**
325
478
  * Whether user should be prompted to enable 2FA
326
479
  */
327
480
  should_prompt_2fa?: boolean;
481
+ /**
482
+ * User information (if requires_2fa is False)
483
+ */
484
+ user?: User | null;
328
485
  };
329
486
 
330
487
  /**
331
488
  * Serializer for updating user profile.
332
489
  */
333
490
  export type PatchedCfgUserUpdateRequest = {
491
+ company?: string;
334
492
  first_name?: string;
493
+ language?: string;
335
494
  last_name?: string;
336
- company?: string;
337
495
  phone?: string;
338
496
  position?: string;
339
- language?: string;
340
497
  };
341
498
 
342
499
  /**
@@ -346,6 +503,42 @@ export enum ProviderEnum {
346
503
  GITHUB = 'github'
347
504
  }
348
505
 
506
+ /**
507
+ * Serializer for starting 2FA setup.
508
+ */
509
+ export type SetupRequest = {
510
+ /**
511
+ * Device name for identification (e.g., 'My iPhone')
512
+ */
513
+ device_name?: string;
514
+ };
515
+
516
+ /**
517
+ * Response serializer for setup initiation.
518
+ */
519
+ export type SetupResponse = {
520
+ /**
521
+ * Device ID to use for confirmation
522
+ */
523
+ device_id: string;
524
+ /**
525
+ * Seconds until setup expires (typically 600 = 10 minutes)
526
+ */
527
+ expires_in: number;
528
+ /**
529
+ * otpauth:// URI for QR code generation
530
+ */
531
+ provisioning_uri: string;
532
+ /**
533
+ * Base64-encoded QR code image (data URI)
534
+ */
535
+ qr_code_base64: string;
536
+ /**
537
+ * Base32-encoded TOTP secret (for manual entry)
538
+ */
539
+ secret: string;
540
+ };
541
+
349
542
  export type TokenRefresh = {
350
543
  readonly access: string;
351
544
  refresh: string;
@@ -356,30 +549,70 @@ export type TokenRefreshRequest = {
356
549
  };
357
550
 
358
551
  /**
359
- * Serializer for user details.
552
+ * User data returned after 2FA verification.
360
553
  */
361
- export type User = {
362
- readonly id: number;
554
+ export type TotpVerifyUser = {
555
+ readonly avatar: string | null;
556
+ company?: string;
557
+ readonly date_joined: string;
558
+ /**
559
+ * Get formatted username for display.
560
+ */
561
+ readonly display_username: string;
363
562
  readonly email: string;
364
563
  first_name?: string;
365
- last_name?: string;
366
564
  /**
367
565
  * Get user's full name.
368
566
  */
369
567
  readonly full_name: string;
568
+ readonly id: number;
370
569
  /**
371
570
  * Get user's initials for avatar fallback.
372
571
  */
373
572
  readonly initials: string;
374
573
  /**
375
- * Get formatted username for display.
574
+ * Staff status
575
+ *
576
+ * Designates whether the user can log into this admin site.
376
577
  */
377
- readonly display_username: string;
378
- company?: string;
578
+ readonly is_staff: boolean;
579
+ /**
580
+ * Superuser status
581
+ *
582
+ * Designates that this user has all permissions without explicitly assigning them.
583
+ */
584
+ readonly is_superuser: boolean;
585
+ language?: string;
586
+ readonly last_login: string | null;
587
+ last_name?: string;
379
588
  phone?: string;
380
589
  position?: string;
381
- language?: string;
590
+ readonly unanswered_messages_count: number;
591
+ };
592
+
593
+ /**
594
+ * Serializer for user details.
595
+ */
596
+ export type User = {
382
597
  readonly avatar: string | null;
598
+ readonly centrifugo: CentrifugoToken | null;
599
+ company?: string;
600
+ readonly date_joined: string;
601
+ /**
602
+ * Get formatted username for display.
603
+ */
604
+ readonly display_username: string;
605
+ readonly email: string;
606
+ first_name?: string;
607
+ /**
608
+ * Get user's full name.
609
+ */
610
+ readonly full_name: string;
611
+ readonly id: number;
612
+ /**
613
+ * Get user's initials for avatar fallback.
614
+ */
615
+ readonly initials: string;
383
616
  /**
384
617
  * Staff status
385
618
  *
@@ -392,10 +625,75 @@ export type User = {
392
625
  * Designates that this user has all permissions without explicitly assigning them.
393
626
  */
394
627
  readonly is_superuser: boolean;
395
- readonly date_joined: string;
628
+ language?: string;
396
629
  readonly last_login: string | null;
630
+ last_name?: string;
631
+ phone?: string;
632
+ position?: string;
397
633
  readonly unanswered_messages_count: number;
398
- readonly centrifugo: CentrifugoToken | null;
634
+ };
635
+
636
+ /**
637
+ * Serializer for backup code verification during login.
638
+ */
639
+ export type VerifyBackupRequest = {
640
+ /**
641
+ * 8-character backup recovery code
642
+ */
643
+ backup_code: string;
644
+ /**
645
+ * 2FA session ID from login response
646
+ */
647
+ session_id: string;
648
+ };
649
+
650
+ /**
651
+ * Serializer for TOTP code verification during login.
652
+ */
653
+ export type VerifyRequest = {
654
+ /**
655
+ * 6-digit TOTP code from authenticator app
656
+ */
657
+ code: string;
658
+ /**
659
+ * 2FA session ID from login response
660
+ */
661
+ session_id: string;
662
+ };
663
+
664
+ /**
665
+ * Response serializer for successful 2FA verification.
666
+ */
667
+ export type VerifyResponse = {
668
+ /**
669
+ * JWT access token
670
+ */
671
+ access_token: string;
672
+ message: string;
673
+ /**
674
+ * JWT refresh token
675
+ */
676
+ refresh_token: string;
677
+ /**
678
+ * Number of remaining backup codes (if backup code was used)
679
+ */
680
+ remaining_backup_codes?: number;
681
+ /**
682
+ * User profile data
683
+ */
684
+ user: TotpVerifyUser;
685
+ /**
686
+ * Warning message (e.g., low backup codes)
687
+ */
688
+ warning?: string;
689
+ };
690
+
691
+ /**
692
+ * Response serializer for device list endpoint.
693
+ */
694
+ export type DeviceListResponseWritable = {
695
+ devices: Array<unknown>;
696
+ has_2fa_enabled: boolean;
399
697
  };
400
698
 
401
699
  /**
@@ -413,45 +711,84 @@ export type User = {
413
711
  */
414
712
  export type OtpVerifyResponseWritable = {
415
713
  /**
416
- * Whether 2FA verification is required
417
- */
418
- requires_2fa?: boolean;
419
- /**
420
- * 2FA session ID (if requires_2fa is True)
714
+ * JWT access token (if requires_2fa is False)
421
715
  */
422
- session_id?: string | null;
716
+ access?: string | null;
423
717
  /**
424
718
  * JWT refresh token (if requires_2fa is False)
425
719
  */
426
720
  refresh?: string | null;
427
721
  /**
428
- * JWT access token (if requires_2fa is False)
722
+ * Whether 2FA verification is required
429
723
  */
430
- access?: string | null;
724
+ requires_2fa?: boolean;
431
725
  /**
432
- * User information (if requires_2fa is False)
726
+ * 2FA session ID (if requires_2fa is True)
433
727
  */
434
- user?: UserWritable | null;
728
+ session_id?: string | null;
435
729
  /**
436
730
  * Whether user should be prompted to enable 2FA
437
731
  */
438
732
  should_prompt_2fa?: boolean;
733
+ /**
734
+ * User information (if requires_2fa is False)
735
+ */
736
+ user?: UserWritable | null;
439
737
  };
440
738
 
441
739
  export type TokenRefreshWritable = {
442
740
  refresh: string;
443
741
  };
444
742
 
743
+ /**
744
+ * User data returned after 2FA verification.
745
+ */
746
+ export type TotpVerifyUserWritable = {
747
+ company?: string;
748
+ first_name?: string;
749
+ language?: string;
750
+ last_name?: string;
751
+ phone?: string;
752
+ position?: string;
753
+ };
754
+
445
755
  /**
446
756
  * Serializer for user details.
447
757
  */
448
758
  export type UserWritable = {
759
+ company?: string;
449
760
  first_name?: string;
761
+ language?: string;
450
762
  last_name?: string;
451
- company?: string;
452
763
  phone?: string;
453
764
  position?: string;
454
- language?: string;
765
+ };
766
+
767
+ /**
768
+ * Response serializer for successful 2FA verification.
769
+ */
770
+ export type VerifyResponseWritable = {
771
+ /**
772
+ * JWT access token
773
+ */
774
+ access_token: string;
775
+ message: string;
776
+ /**
777
+ * JWT refresh token
778
+ */
779
+ refresh_token: string;
780
+ /**
781
+ * Number of remaining backup codes (if backup code was used)
782
+ */
783
+ remaining_backup_codes?: number;
784
+ /**
785
+ * User profile data
786
+ */
787
+ user: TotpVerifyUserWritable;
788
+ /**
789
+ * Warning message (e.g., low backup codes)
790
+ */
791
+ warning?: string;
455
792
  };
456
793
 
457
794
  export type CfgAccountsOauthConnectionsListData = {
@@ -762,3 +1099,196 @@ export type CfgAccountsTokenRefreshCreateResponses = {
762
1099
  };
763
1100
 
764
1101
  export type CfgAccountsTokenRefreshCreateResponse = CfgAccountsTokenRefreshCreateResponses[keyof CfgAccountsTokenRefreshCreateResponses];
1102
+
1103
+ export type CfgCentrifugoAuthTokenRetrieveData = {
1104
+ body?: never;
1105
+ path?: never;
1106
+ query?: never;
1107
+ url: '/cfg/centrifugo/auth/token/';
1108
+ };
1109
+
1110
+ export type CfgCentrifugoAuthTokenRetrieveErrors = {
1111
+ /**
1112
+ * Unauthorized - authentication required
1113
+ */
1114
+ 401: unknown;
1115
+ /**
1116
+ * Server error
1117
+ */
1118
+ 500: unknown;
1119
+ };
1120
+
1121
+ export type CfgCentrifugoAuthTokenRetrieveResponses = {
1122
+ 200: ConnectionTokenResponse;
1123
+ };
1124
+
1125
+ export type CfgCentrifugoAuthTokenRetrieveResponse = CfgCentrifugoAuthTokenRetrieveResponses[keyof CfgCentrifugoAuthTokenRetrieveResponses];
1126
+
1127
+ export type CfgTotpBackupCodesRetrieveData = {
1128
+ body?: never;
1129
+ path?: never;
1130
+ query?: never;
1131
+ url: '/cfg/totp/backup-codes/';
1132
+ };
1133
+
1134
+ export type CfgTotpBackupCodesRetrieveResponses = {
1135
+ 200: BackupCodesStatus;
1136
+ };
1137
+
1138
+ export type CfgTotpBackupCodesRetrieveResponse = CfgTotpBackupCodesRetrieveResponses[keyof CfgTotpBackupCodesRetrieveResponses];
1139
+
1140
+ export type CfgTotpBackupCodesRegenerateCreateData = {
1141
+ body: BackupCodesRegenerateRequest;
1142
+ path?: never;
1143
+ query?: never;
1144
+ url: '/cfg/totp/backup-codes/regenerate/';
1145
+ };
1146
+
1147
+ export type CfgTotpBackupCodesRegenerateCreateErrors = {
1148
+ /**
1149
+ * Invalid code or 2FA not enabled
1150
+ */
1151
+ 400: unknown;
1152
+ };
1153
+
1154
+ export type CfgTotpBackupCodesRegenerateCreateResponses = {
1155
+ 200: BackupCodesRegenerateResponse;
1156
+ };
1157
+
1158
+ export type CfgTotpBackupCodesRegenerateCreateResponse = CfgTotpBackupCodesRegenerateCreateResponses[keyof CfgTotpBackupCodesRegenerateCreateResponses];
1159
+
1160
+ export type CfgTotpDevicesRetrieveData = {
1161
+ body?: never;
1162
+ path?: never;
1163
+ query?: never;
1164
+ url: '/cfg/totp/devices/';
1165
+ };
1166
+
1167
+ export type CfgTotpDevicesRetrieveResponses = {
1168
+ 200: DeviceListResponse;
1169
+ };
1170
+
1171
+ export type CfgTotpDevicesRetrieveResponse = CfgTotpDevicesRetrieveResponses[keyof CfgTotpDevicesRetrieveResponses];
1172
+
1173
+ export type CfgTotpDevicesDestroyData = {
1174
+ body?: never;
1175
+ path: {
1176
+ id: string;
1177
+ };
1178
+ query?: never;
1179
+ url: '/cfg/totp/devices/{id}/';
1180
+ };
1181
+
1182
+ export type CfgTotpDevicesDestroyResponses = {
1183
+ /**
1184
+ * No response body
1185
+ */
1186
+ 204: void;
1187
+ };
1188
+
1189
+ export type CfgTotpDevicesDestroyResponse = CfgTotpDevicesDestroyResponses[keyof CfgTotpDevicesDestroyResponses];
1190
+
1191
+ export type CfgTotpDisableCreateData = {
1192
+ body: DisableRequest;
1193
+ path?: never;
1194
+ query?: never;
1195
+ url: '/cfg/totp/disable/';
1196
+ };
1197
+
1198
+ export type CfgTotpDisableCreateErrors = {
1199
+ /**
1200
+ * Invalid code
1201
+ */
1202
+ 400: unknown;
1203
+ };
1204
+
1205
+ export type CfgTotpDisableCreateResponses = {
1206
+ /**
1207
+ * 2FA disabled successfully
1208
+ */
1209
+ 200: unknown;
1210
+ };
1211
+
1212
+ export type CfgTotpSetupCreateData = {
1213
+ body?: SetupRequest;
1214
+ path?: never;
1215
+ query?: never;
1216
+ url: '/cfg/totp/setup/';
1217
+ };
1218
+
1219
+ export type CfgTotpSetupCreateErrors = {
1220
+ /**
1221
+ * 2FA already enabled or invalid request
1222
+ */
1223
+ 400: unknown;
1224
+ };
1225
+
1226
+ export type CfgTotpSetupCreateResponses = {
1227
+ 200: SetupResponse;
1228
+ };
1229
+
1230
+ export type CfgTotpSetupCreateResponse = CfgTotpSetupCreateResponses[keyof CfgTotpSetupCreateResponses];
1231
+
1232
+ export type CfgTotpSetupConfirmCreateData = {
1233
+ body: ConfirmSetupRequest;
1234
+ path?: never;
1235
+ query?: never;
1236
+ url: '/cfg/totp/setup/confirm/';
1237
+ };
1238
+
1239
+ export type CfgTotpSetupConfirmCreateErrors = {
1240
+ /**
1241
+ * Invalid code or setup expired
1242
+ */
1243
+ 400: unknown;
1244
+ };
1245
+
1246
+ export type CfgTotpSetupConfirmCreateResponses = {
1247
+ 200: ConfirmSetupResponse;
1248
+ };
1249
+
1250
+ export type CfgTotpSetupConfirmCreateResponse = CfgTotpSetupConfirmCreateResponses[keyof CfgTotpSetupConfirmCreateResponses];
1251
+
1252
+ export type CfgTotpVerifyCreateData = {
1253
+ body: VerifyRequest;
1254
+ path?: never;
1255
+ query?: never;
1256
+ url: '/cfg/totp/verify/';
1257
+ };
1258
+
1259
+ export type CfgTotpVerifyCreateErrors = {
1260
+ /**
1261
+ * Invalid code or session
1262
+ */
1263
+ 400: unknown;
1264
+ /**
1265
+ * Too many attempts
1266
+ */
1267
+ 403: unknown;
1268
+ };
1269
+
1270
+ export type CfgTotpVerifyCreateResponses = {
1271
+ 200: VerifyResponse;
1272
+ };
1273
+
1274
+ export type CfgTotpVerifyCreateResponse = CfgTotpVerifyCreateResponses[keyof CfgTotpVerifyCreateResponses];
1275
+
1276
+ export type CfgTotpVerifyBackupCreateData = {
1277
+ body: VerifyBackupRequest;
1278
+ path?: never;
1279
+ query?: never;
1280
+ url: '/cfg/totp/verify/backup/';
1281
+ };
1282
+
1283
+ export type CfgTotpVerifyBackupCreateErrors = {
1284
+ /**
1285
+ * Invalid backup code or session
1286
+ */
1287
+ 400: unknown;
1288
+ };
1289
+
1290
+ export type CfgTotpVerifyBackupCreateResponses = {
1291
+ 200: VerifyResponse;
1292
+ };
1293
+
1294
+ export type CfgTotpVerifyBackupCreateResponse = CfgTotpVerifyBackupCreateResponses[keyof CfgTotpVerifyBackupCreateResponses];