@djangocfg/api 2.1.262 → 2.1.263

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 (43) hide show
  1. package/dist/auth-server.cjs +9 -0
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +9 -0
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +27 -0
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.mjs +27 -0
  8. package/dist/auth.mjs.map +1 -1
  9. package/dist/clients.cjs +65 -1
  10. package/dist/clients.cjs.map +1 -1
  11. package/dist/clients.d.cts +145 -122
  12. package/dist/clients.d.ts +145 -122
  13. package/dist/clients.mjs +65 -1
  14. package/dist/clients.mjs.map +1 -1
  15. package/dist/hooks.cjs +47 -1
  16. package/dist/hooks.cjs.map +1 -1
  17. package/dist/hooks.d.cts +91 -68
  18. package/dist/hooks.d.ts +91 -68
  19. package/dist/hooks.mjs +47 -1
  20. package/dist/hooks.mjs.map +1 -1
  21. package/dist/index.cjs +56 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +89 -89
  24. package/dist/index.d.ts +89 -89
  25. package/dist/index.mjs +56 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/package.json +2 -2
  28. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +46 -2
  29. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +3 -2
  30. package/src/_api/generated/cfg_accounts/accounts/models.ts +12 -12
  31. package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +1 -1
  32. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +55 -55
  33. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +23 -23
  34. package/src/_api/generated/cfg_accounts/client.ts +8 -0
  35. package/src/_api/generated/cfg_accounts/errors.ts +5 -0
  36. package/src/_api/generated/cfg_centrifugo/client.ts +8 -0
  37. package/src/_api/generated/cfg_centrifugo/errors.ts +5 -0
  38. package/src/_api/generated/cfg_totp/client.ts +8 -0
  39. package/src/_api/generated/cfg_totp/errors.ts +5 -0
  40. package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +14 -14
  41. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +10 -10
  42. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +25 -25
  43. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
@@ -45,13 +45,15 @@ declare namespace enums {
45
45
  }
46
46
 
47
47
  /**
48
- * Response with available OAuth providers.
48
+ * Request to start OAuth flow.
49
49
  *
50
- * Response model (includes read-only fields).
50
+ * Request model (no read-only fields).
51
51
  */
52
- interface OAuthProvidersResponse$1 {
53
- /** List of available OAuth providers */
54
- providers: Array<Record<string, any>>;
52
+ interface OAuthAuthorizeRequestRequest$1 {
53
+ /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
54
+ redirect_uri?: string;
55
+ /** Optional source URL for registration tracking */
56
+ source_url?: string;
55
57
  }
56
58
  /**
57
59
  * Request to disconnect OAuth provider.
@@ -65,15 +67,60 @@ interface OAuthDisconnectRequestRequest$1 {
65
67
  provider: OAuthConnectionProvider;
66
68
  }
67
69
  /**
68
- * Request to start OAuth flow.
70
+ * Request to complete OAuth flow (callback handler).
69
71
  *
70
72
  * Request model (no read-only fields).
71
73
  */
72
- interface OAuthAuthorizeRequestRequest$1 {
73
- /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
74
+ interface OAuthCallbackRequestRequest$1 {
75
+ /** Authorization code from OAuth provider callback */
76
+ code: string;
77
+ /** State token for CSRF verification (from authorize response) */
78
+ state: string;
79
+ /** Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path */
74
80
  redirect_uri?: string;
75
- /** Optional source URL for registration tracking */
76
- source_url?: string;
81
+ }
82
+ /**
83
+ * Response with OAuth authorization URL.
84
+ *
85
+ * Response model (includes read-only fields).
86
+ */
87
+ interface OAuthAuthorizeResponse$1 {
88
+ /** Full URL to redirect user to OAuth provider */
89
+ authorization_url: string;
90
+ /** State token for CSRF protection. Store this and verify on callback. */
91
+ state: string;
92
+ }
93
+ /**
94
+ * Response with available OAuth providers.
95
+ *
96
+ * Response model (includes read-only fields).
97
+ */
98
+ interface OAuthProvidersResponse$1 {
99
+ /** List of available OAuth providers */
100
+ providers: Array<Record<string, any>>;
101
+ }
102
+ /**
103
+ * Serializer for OAuth connection info (user-facing).
104
+ *
105
+ * Response model (includes read-only fields).
106
+ */
107
+ interface OAuthConnection$1 {
108
+ id: number;
109
+ /** OAuth provider name (github, google, etc.)
110
+
111
+ * `github` - GitHub */
112
+ provider: OAuthConnectionProvider;
113
+ provider_display: string;
114
+ /** Username on the OAuth provider platform */
115
+ provider_username: string;
116
+ /** Email from OAuth provider (may differ from user.email) */
117
+ provider_email: string;
118
+ /** Avatar URL from OAuth provider */
119
+ provider_avatar_url: string;
120
+ /** When this OAuth connection was created */
121
+ connected_at: string;
122
+ /** Last time this OAuth connection was used for login */
123
+ last_login_at: string;
77
124
  }
78
125
  /**
79
126
  * Response with JWT tokens after OAuth authentication. When 2FA is required: -
@@ -101,30 +148,6 @@ interface OAuthTokenResponse$1 {
101
148
  /** True if user should be prompted to enable 2FA */
102
149
  should_prompt_2fa?: boolean;
103
150
  }
104
- /**
105
- * Response with OAuth authorization URL.
106
- *
107
- * Response model (includes read-only fields).
108
- */
109
- interface OAuthAuthorizeResponse$1 {
110
- /** Full URL to redirect user to OAuth provider */
111
- authorization_url: string;
112
- /** State token for CSRF protection. Store this and verify on callback. */
113
- state: string;
114
- }
115
- /**
116
- * Request to complete OAuth flow (callback handler).
117
- *
118
- * Request model (no read-only fields).
119
- */
120
- interface OAuthCallbackRequestRequest$1 {
121
- /** Authorization code from OAuth provider callback */
122
- code: string;
123
- /** State token for CSRF verification (from authorize response) */
124
- state: string;
125
- /** Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path */
126
- redirect_uri?: string;
127
- }
128
151
 
129
152
  /**
130
153
  * API endpoints for Oauth.
@@ -137,7 +160,7 @@ declare class Oauth {
137
160
  *
138
161
  * Get all OAuth connections for the current user.
139
162
  */
140
- accountsOauthConnectionsList(): Promise<any>;
163
+ accountsOauthConnectionsList(): Promise<OAuthConnection$1[]>;
141
164
  /**
142
165
  * Disconnect OAuth provider
143
166
  *
@@ -166,19 +189,6 @@ declare class Oauth {
166
189
  accountsOauthProvidersRetrieve(): Promise<OAuthProvidersResponse$1>;
167
190
  }
168
191
 
169
- /**
170
- * Serializer for updating user profile.
171
- *
172
- * Request model (no read-only fields).
173
- */
174
- interface PatchedUserProfileUpdateRequest$1 {
175
- first_name?: string;
176
- last_name?: string;
177
- company?: string;
178
- phone?: string;
179
- position?: string;
180
- language?: string;
181
- }
182
192
  /**
183
193
  * Serializer for user details.
184
194
  *
@@ -209,6 +219,27 @@ interface User$2 {
209
219
  unanswered_messages_count: number;
210
220
  centrifugo: CentrifugoToken$2 | null;
211
221
  }
222
+ /**
223
+ * Serializer for updating user profile.
224
+ *
225
+ * Request model (no read-only fields).
226
+ */
227
+ interface PatchedUserProfileUpdateRequest$1 {
228
+ first_name?: string;
229
+ last_name?: string;
230
+ company?: string;
231
+ phone?: string;
232
+ position?: string;
233
+ language?: string;
234
+ }
235
+ /**
236
+ *
237
+ * Request model (no read-only fields).
238
+ */
239
+ interface CfgAccountsProfileAvatarCreateRequest$1 {
240
+ /** Avatar image file (JPEG, PNG, GIF, WebP, max 5MB) */
241
+ avatar: File | Blob;
242
+ }
212
243
  /**
213
244
  * Response serializer for account deletion.
214
245
  *
@@ -233,14 +264,6 @@ interface UserProfileUpdateRequest$1 {
233
264
  position?: string;
234
265
  language?: string;
235
266
  }
236
- /**
237
- *
238
- * Request model (no read-only fields).
239
- */
240
- interface CfgAccountsProfileAvatarCreateRequest$1 {
241
- /** Avatar image file (JPEG, PNG, GIF, WebP, max 5MB) */
242
- avatar: File | Blob;
243
- }
244
267
  /**
245
268
  * Nested serializer for Centrifugo WebSocket connection token.
246
269
  *
@@ -335,17 +358,6 @@ interface OTPRequestResponse$1 {
335
358
  /** Success message */
336
359
  message: string;
337
360
  }
338
- /**
339
- * Serializer for OTP request.
340
- *
341
- * Request model (no read-only fields).
342
- */
343
- interface OTPRequestRequest$1 {
344
- /** Email address for OTP delivery */
345
- identifier: string;
346
- /** Source URL for tracking registration (e.g., https://my.djangocfg.com) */
347
- source_url?: string;
348
- }
349
361
  /**
350
362
  * OTP verification response. When 2FA is required: - requires_2fa: True -
351
363
  * session_id: UUID of 2FA verification session - refresh/access/user: null
@@ -367,6 +379,17 @@ interface OTPVerifyResponse$1 {
367
379
  /** Whether user should be prompted to enable 2FA */
368
380
  should_prompt_2fa?: boolean;
369
381
  }
382
+ /**
383
+ * Serializer for OTP request.
384
+ *
385
+ * Request model (no read-only fields).
386
+ */
387
+ interface OTPRequestRequest$1 {
388
+ /** Email address for OTP delivery */
389
+ identifier: string;
390
+ /** Source URL for tracking registration (e.g., https://my.djangocfg.com) */
391
+ source_url?: string;
392
+ }
370
393
  /**
371
394
  * Serializer for user details.
372
395
  *
@@ -1078,7 +1101,7 @@ declare function createAccountsTokenRefreshCreate(data: TokenRefreshRequest, cli
1078
1101
  * @method GET
1079
1102
  * @path /cfg/accounts/oauth/connections/
1080
1103
  */
1081
- declare function getAccountsOauthConnectionsList(client?: any): Promise<any>;
1104
+ declare function getAccountsOauthConnectionsList(client?: any): Promise<OAuthConnection[]>;
1082
1105
  /**
1083
1106
  * Disconnect OAuth provider
1084
1107
  *
@@ -1607,6 +1630,19 @@ declare class API$1 {
1607
1630
  getSchemaPath(): string;
1608
1631
  }
1609
1632
 
1633
+ /**
1634
+ * Serializer for backup codes status.
1635
+ *
1636
+ * Response model (includes read-only fields).
1637
+ */
1638
+ interface BackupCodesStatus$1 {
1639
+ /** Number of unused backup codes */
1640
+ remaining_count: number;
1641
+ /** Total number of codes generated */
1642
+ total_generated: number;
1643
+ /** Warning if running low on codes */
1644
+ warning?: string | null;
1645
+ }
1610
1646
  /**
1611
1647
  * Response serializer for backup codes regeneration.
1612
1648
  *
@@ -1627,19 +1663,6 @@ interface BackupCodesRegenerateRequest$1 {
1627
1663
  /** TOTP code for verification */
1628
1664
  code: string;
1629
1665
  }
1630
- /**
1631
- * Serializer for backup codes status.
1632
- *
1633
- * Response model (includes read-only fields).
1634
- */
1635
- interface BackupCodesStatus$1 {
1636
- /** Number of unused backup codes */
1637
- remaining_count: number;
1638
- /** Total number of codes generated */
1639
- total_generated: number;
1640
- /** Warning if running low on codes */
1641
- warning?: string | null;
1642
- }
1643
1666
 
1644
1667
  /**
1645
1668
  * API endpoints for Backup Codes.
@@ -1669,15 +1692,6 @@ declare enum DeviceListStatus {
1669
1692
  DISABLED = "disabled"
1670
1693
  }
1671
1694
 
1672
- /**
1673
- * Serializer for completely disabling 2FA.
1674
- *
1675
- * Request model (no read-only fields).
1676
- */
1677
- interface DisableRequest$1 {
1678
- /** TOTP code for verification */
1679
- code: string;
1680
- }
1681
1695
  /**
1682
1696
  *
1683
1697
  * Response model (includes read-only fields).
@@ -1702,6 +1716,15 @@ interface PaginatedDeviceListResponseList$1 {
1702
1716
  /** Array of items for current page */
1703
1717
  results: Array<DeviceListResponse$1>;
1704
1718
  }
1719
+ /**
1720
+ * Serializer for completely disabling 2FA.
1721
+ *
1722
+ * Request model (no read-only fields).
1723
+ */
1724
+ interface DisableRequest$1 {
1725
+ /** TOTP code for verification */
1726
+ code: string;
1727
+ }
1705
1728
  /**
1706
1729
  * Response serializer for device list endpoint.
1707
1730
  *
@@ -1752,6 +1775,29 @@ declare class TotpManagement {
1752
1775
  totpDisableCreate(data: DisableRequest$1): Promise<any>;
1753
1776
  }
1754
1777
 
1778
+ /**
1779
+ * Serializer for confirming 2FA setup with first code.
1780
+ *
1781
+ * Request model (no read-only fields).
1782
+ */
1783
+ interface ConfirmSetupRequest$1 {
1784
+ /** Device ID from setup response */
1785
+ device_id: string;
1786
+ /** 6-digit TOTP code from authenticator app */
1787
+ code: string;
1788
+ }
1789
+ /**
1790
+ * Response serializer for setup confirmation.
1791
+ *
1792
+ * Response model (includes read-only fields).
1793
+ */
1794
+ interface ConfirmSetupResponse$1 {
1795
+ message: string;
1796
+ /** List of backup recovery codes (save these!) */
1797
+ backup_codes: Array<string>;
1798
+ /** Warning message about backup codes */
1799
+ backup_codes_warning: string;
1800
+ }
1755
1801
  /**
1756
1802
  * Response serializer for setup initiation.
1757
1803
  *
@@ -1769,17 +1815,6 @@ interface SetupResponse$1 {
1769
1815
  /** Seconds until setup expires (typically 600 = 10 minutes) */
1770
1816
  expires_in: number;
1771
1817
  }
1772
- /**
1773
- * Serializer for confirming 2FA setup with first code.
1774
- *
1775
- * Request model (no read-only fields).
1776
- */
1777
- interface ConfirmSetupRequest$1 {
1778
- /** Device ID from setup response */
1779
- device_id: string;
1780
- /** 6-digit TOTP code from authenticator app */
1781
- code: string;
1782
- }
1783
1818
  /**
1784
1819
  * Serializer for starting 2FA setup.
1785
1820
  *
@@ -1789,18 +1824,6 @@ interface SetupRequest$1 {
1789
1824
  /** Device name for identification (e.g., 'My iPhone') */
1790
1825
  device_name?: string;
1791
1826
  }
1792
- /**
1793
- * Response serializer for setup confirmation.
1794
- *
1795
- * Response model (includes read-only fields).
1796
- */
1797
- interface ConfirmSetupResponse$1 {
1798
- message: string;
1799
- /** List of backup recovery codes (save these!) */
1800
- backup_codes: Array<string>;
1801
- /** Warning message about backup codes */
1802
- backup_codes_warning: string;
1803
- }
1804
1827
 
1805
1828
  /**
1806
1829
  * API endpoints for TOTP Setup.
@@ -1821,26 +1844,26 @@ declare class TotpSetup {
1821
1844
  }
1822
1845
 
1823
1846
  /**
1824
- * Serializer for backup code verification during login.
1847
+ * Serializer for TOTP code verification during login.
1825
1848
  *
1826
1849
  * Request model (no read-only fields).
1827
1850
  */
1828
- interface VerifyBackupRequest$1 {
1851
+ interface VerifyRequest$1 {
1829
1852
  /** 2FA session ID from login response */
1830
1853
  session_id: string;
1831
- /** 8-character backup recovery code */
1832
- backup_code: string;
1854
+ /** 6-digit TOTP code from authenticator app */
1855
+ code: string;
1833
1856
  }
1834
1857
  /**
1835
- * Serializer for TOTP code verification during login.
1858
+ * Serializer for backup code verification during login.
1836
1859
  *
1837
1860
  * Request model (no read-only fields).
1838
1861
  */
1839
- interface VerifyRequest$1 {
1862
+ interface VerifyBackupRequest$1 {
1840
1863
  /** 2FA session ID from login response */
1841
1864
  session_id: string;
1842
- /** 6-digit TOTP code from authenticator app */
1843
- code: string;
1865
+ /** 8-character backup recovery code */
1866
+ backup_code: string;
1844
1867
  }
1845
1868
  /**
1846
1869
  * Response serializer for successful 2FA verification.
@@ -2673,7 +2696,7 @@ declare function useCreateAccountsTokenRefreshCreate(): (data: TokenRefreshReque
2673
2696
  * @method GET
2674
2697
  * @path /cfg/accounts/oauth/connections/
2675
2698
  */
2676
- declare function useAccountsOauthConnectionsList(client?: API$2): ReturnType<typeof useSWR<any>>;
2699
+ declare function useAccountsOauthConnectionsList(client?: API$2): ReturnType<typeof useSWR<OAuthConnection[]>>;
2677
2700
  /**
2678
2701
  * Disconnect OAuth provider
2679
2702
  *