@djangocfg/api 2.1.322 → 2.1.327

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 (293) hide show
  1. package/dist/auth-server.cjs +4265 -1169
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +4265 -1159
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +4150 -3053
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +158 -209
  8. package/dist/auth.d.ts +158 -209
  9. package/dist/auth.mjs +4139 -3042
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +3932 -4031
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +2408 -2671
  14. package/dist/clients.d.ts +2408 -2671
  15. package/dist/clients.mjs +3945 -4038
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/index.cjs +4214 -2713
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +2758 -1828
  20. package/dist/index.d.ts +2758 -1828
  21. package/dist/index.mjs +4183 -2676
  22. package/dist/index.mjs.map +1 -1
  23. package/package.json +2 -7
  24. package/src/_api/generated/_shared/errors.ts +70 -0
  25. package/src/_api/generated/_shared/index.ts +25 -0
  26. package/src/_api/generated/_shared/logger.ts +123 -0
  27. package/src/_api/generated/_shared/storage.ts +83 -0
  28. package/src/_api/generated/_shared/validation-events.ts +52 -0
  29. package/src/_api/generated/cfg_accounts/api.ts +187 -0
  30. package/src/_api/generated/cfg_accounts/client/client.gen.ts +280 -0
  31. package/src/_api/generated/cfg_accounts/client/index.ts +25 -0
  32. package/src/_api/generated/cfg_accounts/client/types.gen.ts +217 -0
  33. package/src/_api/generated/cfg_accounts/client/utils.gen.ts +318 -0
  34. package/src/_api/generated/cfg_accounts/client.gen.ts +16 -0
  35. package/src/_api/generated/cfg_accounts/core/auth.gen.ts +41 -0
  36. package/src/_api/generated/cfg_accounts/core/bodySerializer.gen.ts +82 -0
  37. package/src/_api/generated/cfg_accounts/core/params.gen.ts +169 -0
  38. package/src/_api/generated/cfg_accounts/core/pathSerializer.gen.ts +171 -0
  39. package/src/_api/generated/cfg_accounts/core/queryKeySerializer.gen.ts +117 -0
  40. package/src/_api/generated/cfg_accounts/core/serverSentEvents.gen.ts +242 -0
  41. package/src/_api/generated/cfg_accounts/core/types.gen.ts +104 -0
  42. package/src/_api/generated/cfg_accounts/core/utils.gen.ts +140 -0
  43. package/src/_api/generated/cfg_accounts/events.ts +198 -0
  44. package/src/_api/generated/cfg_accounts/hooks/index.ts +18 -0
  45. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +26 -0
  46. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +24 -0
  47. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +24 -0
  48. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +24 -0
  49. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +26 -0
  50. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +24 -0
  51. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +24 -0
  52. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +24 -0
  53. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +24 -0
  54. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +24 -0
  55. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +24 -0
  56. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +26 -0
  57. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +24 -0
  58. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +24 -0
  59. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +24 -0
  60. package/src/_api/generated/cfg_accounts/index.ts +26 -335
  61. package/src/_api/generated/cfg_accounts/schemas/AccountDeleteResponse.ts +12 -0
  62. package/src/_api/generated/cfg_accounts/schemas/CentrifugoToken.ts +14 -0
  63. package/src/_api/generated/cfg_accounts/schemas/CfgUserUpdateRequest.ts +16 -0
  64. package/src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts +12 -0
  65. package/src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeResponse.ts +12 -0
  66. package/src/_api/generated/cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +13 -0
  67. package/src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts +19 -0
  68. package/src/_api/generated/cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts +12 -0
  69. package/src/_api/generated/cfg_accounts/schemas/OAuthError.ts +12 -0
  70. package/src/_api/generated/cfg_accounts/schemas/OAuthProvidersResponse.ts +11 -0
  71. package/src/_api/generated/cfg_accounts/schemas/OAuthTokenResponse.ts +18 -0
  72. package/src/_api/generated/cfg_accounts/schemas/OTPErrorResponse.ts +13 -0
  73. package/src/_api/generated/cfg_accounts/schemas/OTPRequestRequest.ts +12 -0
  74. package/src/_api/generated/cfg_accounts/schemas/OTPRequestResponse.ts +11 -0
  75. package/src/_api/generated/cfg_accounts/schemas/OTPVerifyRequest.ts +13 -0
  76. package/src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts +17 -0
  77. package/src/_api/generated/cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts +16 -0
  78. package/src/_api/generated/cfg_accounts/schemas/ProviderEnum.ts +9 -0
  79. package/src/_api/generated/cfg_accounts/schemas/TokenRefresh.ts +12 -0
  80. package/src/_api/generated/cfg_accounts/schemas/TokenRefreshRequest.ts +11 -0
  81. package/src/_api/generated/cfg_accounts/{_utils/schemas/User.schema.ts → schemas/User.ts} +8 -16
  82. package/src/_api/generated/cfg_accounts/schemas/index.ts +24 -0
  83. package/src/_api/generated/cfg_accounts/sdk.gen.ts +796 -0
  84. package/src/_api/generated/cfg_accounts/types.gen.ts +764 -0
  85. package/src/_api/generated/cfg_centrifugo/api.ts +164 -0
  86. package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +280 -0
  87. package/src/_api/generated/cfg_centrifugo/client/index.ts +25 -0
  88. package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +217 -0
  89. package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +318 -0
  90. package/src/_api/generated/cfg_centrifugo/client.gen.ts +16 -0
  91. package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +41 -0
  92. package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +82 -0
  93. package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +169 -0
  94. package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +171 -0
  95. package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +117 -0
  96. package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +242 -0
  97. package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +104 -0
  98. package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +140 -0
  99. package/src/_api/generated/cfg_centrifugo/events.ts +198 -0
  100. package/src/_api/generated/cfg_centrifugo/hooks/index.ts +4 -0
  101. package/src/_api/generated/cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +26 -0
  102. package/src/_api/generated/cfg_centrifugo/index.ts +26 -313
  103. package/src/_api/generated/cfg_centrifugo/schemas/ConnectionTokenResponse.ts +14 -0
  104. package/src/_api/generated/cfg_centrifugo/schemas/index.ts +4 -0
  105. package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +64 -0
  106. package/src/_api/generated/cfg_centrifugo/types.gen.ts +61 -0
  107. package/src/_api/generated/cfg_totp/api.ts +181 -0
  108. package/src/_api/generated/cfg_totp/client/client.gen.ts +280 -0
  109. package/src/_api/generated/cfg_totp/client/index.ts +25 -0
  110. package/src/_api/generated/cfg_totp/client/types.gen.ts +217 -0
  111. package/src/_api/generated/cfg_totp/client/utils.gen.ts +318 -0
  112. package/src/_api/generated/cfg_totp/client.gen.ts +16 -0
  113. package/src/_api/generated/cfg_totp/core/auth.gen.ts +41 -0
  114. package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +82 -0
  115. package/src/_api/generated/cfg_totp/core/params.gen.ts +169 -0
  116. package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +171 -0
  117. package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +117 -0
  118. package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +242 -0
  119. package/src/_api/generated/cfg_totp/core/types.gen.ts +104 -0
  120. package/src/_api/generated/cfg_totp/core/utils.gen.ts +140 -0
  121. package/src/_api/generated/cfg_totp/events.ts +198 -0
  122. package/src/_api/generated/cfg_totp/hooks/index.ts +12 -0
  123. package/src/_api/generated/cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +24 -0
  124. package/src/_api/generated/cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +26 -0
  125. package/src/_api/generated/cfg_totp/hooks/useCfgTotpDevicesDestroy.ts +24 -0
  126. package/src/_api/generated/cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +26 -0
  127. package/src/_api/generated/cfg_totp/hooks/useCfgTotpDisableCreate.ts +24 -0
  128. package/src/_api/generated/cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +24 -0
  129. package/src/_api/generated/cfg_totp/hooks/useCfgTotpSetupCreate.ts +24 -0
  130. package/src/_api/generated/cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +24 -0
  131. package/src/_api/generated/cfg_totp/hooks/useCfgTotpVerifyCreate.ts +24 -0
  132. package/src/_api/generated/cfg_totp/index.ts +26 -342
  133. package/src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateRequest.ts +11 -0
  134. package/src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateResponse.ts +12 -0
  135. package/src/_api/generated/cfg_totp/schemas/BackupCodesStatus.ts +13 -0
  136. package/src/_api/generated/cfg_totp/schemas/ConfirmSetupRequest.ts +12 -0
  137. package/src/_api/generated/cfg_totp/schemas/ConfirmSetupResponse.ts +13 -0
  138. package/src/_api/generated/cfg_totp/schemas/DeviceList.ts +18 -0
  139. package/src/_api/generated/cfg_totp/schemas/DeviceListResponse.ts +13 -0
  140. package/src/_api/generated/cfg_totp/schemas/DeviceListStatusEnum.ts +9 -0
  141. package/src/_api/generated/cfg_totp/schemas/DisableRequest.ts +11 -0
  142. package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +11 -0
  143. package/src/_api/generated/cfg_totp/schemas/SetupResponse.ts +15 -0
  144. package/src/_api/generated/cfg_totp/{_utils/schemas/TotpVerifyUser.schema.ts → schemas/TotpVerifyUser.ts} +7 -15
  145. package/src/_api/generated/cfg_totp/schemas/VerifyBackupRequest.ts +12 -0
  146. package/src/_api/generated/cfg_totp/schemas/VerifyRequest.ts +12 -0
  147. package/src/_api/generated/cfg_totp/schemas/VerifyResponse.ts +17 -0
  148. package/src/_api/generated/cfg_totp/schemas/index.ts +18 -0
  149. package/src/_api/generated/cfg_totp/sdk.gen.ts +432 -0
  150. package/src/_api/generated/cfg_totp/types.gen.ts +479 -0
  151. package/src/_api/generated/index.ts +30 -0
  152. package/src/_api/index.ts +5 -23
  153. package/src/auth/context/AccountsContext.tsx +58 -89
  154. package/src/auth/context/AuthContext.tsx +3 -3
  155. package/src/auth/context/index.ts +2 -2
  156. package/src/auth/hooks/useDeleteAccount.ts +2 -1
  157. package/src/auth/hooks/useGithubAuth.ts +12 -11
  158. package/src/auth/hooks/useTokenRefresh.ts +6 -4
  159. package/src/auth/hooks/useTwoFactor.ts +14 -8
  160. package/src/auth/hooks/useTwoFactorSetup.ts +8 -5
  161. package/src/auth/hooks/useTwoFactorStatus.ts +3 -2
  162. package/src/auth/middlewares/tokenRefresh.ts +6 -4
  163. package/src/clients.ts +14 -51
  164. package/src/index.ts +15 -57
  165. package/src/server.ts +25 -23
  166. package/src/_api/BaseClient.ts +0 -22
  167. package/src/_api/generated/cfg_accounts/CLAUDE.md +0 -86
  168. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts.ts +0 -154
  169. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +0 -95
  170. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +0 -285
  171. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +0 -440
  172. package/src/_api/generated/cfg_accounts/_utils/fetchers/index.ts +0 -33
  173. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts.ts +0 -64
  174. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +0 -44
  175. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +0 -114
  176. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +0 -152
  177. package/src/_api/generated/cfg_accounts/_utils/hooks/index.ts +0 -33
  178. package/src/_api/generated/cfg_accounts/_utils/schemas/AccountDeleteResponse.schema.ts +0 -20
  179. package/src/_api/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +0 -22
  180. package/src/_api/generated/cfg_accounts/_utils/schemas/CfgAccountsProfileAvatarCreateRequest.schema.ts +0 -15
  181. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts +0 -20
  182. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts +0 -20
  183. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts +0 -21
  184. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +0 -27
  185. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts +0 -20
  186. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts +0 -20
  187. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts +0 -19
  188. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +0 -46
  189. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts +0 -41
  190. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +0 -20
  191. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts +0 -19
  192. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +0 -21
  193. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts +0 -45
  194. package/src/_api/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts +0 -24
  195. package/src/_api/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts +0 -16
  196. package/src/_api/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts +0 -15
  197. package/src/_api/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts +0 -24
  198. package/src/_api/generated/cfg_accounts/_utils/schemas/index.ts +0 -41
  199. package/src/_api/generated/cfg_accounts/accounts/client.ts +0 -34
  200. package/src/_api/generated/cfg_accounts/accounts/index.ts +0 -4
  201. package/src/_api/generated/cfg_accounts/accounts/models.ts +0 -127
  202. package/src/_api/generated/cfg_accounts/accounts__auth/client.ts +0 -23
  203. package/src/_api/generated/cfg_accounts/accounts__auth/index.ts +0 -4
  204. package/src/_api/generated/cfg_accounts/accounts__auth/models.ts +0 -19
  205. package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +0 -67
  206. package/src/_api/generated/cfg_accounts/accounts__oauth/index.ts +0 -4
  207. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +0 -127
  208. package/src/_api/generated/cfg_accounts/accounts__user_profile/client.ts +0 -94
  209. package/src/_api/generated/cfg_accounts/accounts__user_profile/index.ts +0 -4
  210. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +0 -98
  211. package/src/_api/generated/cfg_accounts/api-instance.ts +0 -181
  212. package/src/_api/generated/cfg_accounts/client.ts +0 -339
  213. package/src/_api/generated/cfg_accounts/enums.ts +0 -10
  214. package/src/_api/generated/cfg_accounts/errors.ts +0 -123
  215. package/src/_api/generated/cfg_accounts/http.ts +0 -160
  216. package/src/_api/generated/cfg_accounts/logger.ts +0 -261
  217. package/src/_api/generated/cfg_accounts/retry.ts +0 -177
  218. package/src/_api/generated/cfg_accounts/schema.json +0 -1576
  219. package/src/_api/generated/cfg_accounts/storage.ts +0 -163
  220. package/src/_api/generated/cfg_accounts/validation-events.ts +0 -135
  221. package/src/_api/generated/cfg_centrifugo/CLAUDE.md +0 -60
  222. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +0 -94
  223. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/index.ts +0 -30
  224. package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +0 -39
  225. package/src/_api/generated/cfg_centrifugo/_utils/hooks/index.ts +0 -30
  226. package/src/_api/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts +0 -22
  227. package/src/_api/generated/cfg_centrifugo/_utils/schemas/index.ts +0 -21
  228. package/src/_api/generated/cfg_centrifugo/api-instance.ts +0 -181
  229. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts +0 -27
  230. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +0 -4
  231. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +0 -18
  232. package/src/_api/generated/cfg_centrifugo/client.ts +0 -330
  233. package/src/_api/generated/cfg_centrifugo/errors.ts +0 -123
  234. package/src/_api/generated/cfg_centrifugo/http.ts +0 -160
  235. package/src/_api/generated/cfg_centrifugo/logger.ts +0 -261
  236. package/src/_api/generated/cfg_centrifugo/retry.ts +0 -177
  237. package/src/_api/generated/cfg_centrifugo/schema.json +0 -118
  238. package/src/_api/generated/cfg_centrifugo/storage.ts +0 -163
  239. package/src/_api/generated/cfg_centrifugo/validation-events.ts +0 -135
  240. package/src/_api/generated/cfg_totp/CLAUDE.md +0 -83
  241. package/src/_api/generated/cfg_totp/_utils/fetchers/index.ts +0 -34
  242. package/src/_api/generated/cfg_totp/_utils/fetchers/totp.ts +0 -50
  243. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +0 -153
  244. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +0 -109
  245. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_setup.ts +0 -154
  246. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_verification.ts +0 -153
  247. package/src/_api/generated/cfg_totp/_utils/hooks/index.ts +0 -34
  248. package/src/_api/generated/cfg_totp/_utils/hooks/totp.ts +0 -43
  249. package/src/_api/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +0 -60
  250. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +0 -59
  251. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts +0 -64
  252. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts +0 -63
  253. package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts +0 -19
  254. package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts +0 -20
  255. package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts +0 -21
  256. package/src/_api/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts +0 -20
  257. package/src/_api/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts +0 -21
  258. package/src/_api/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +0 -26
  259. package/src/_api/generated/cfg_totp/_utils/schemas/DeviceListResponse.schema.ts +0 -21
  260. package/src/_api/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts +0 -19
  261. package/src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts +0 -19
  262. package/src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts +0 -23
  263. package/src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts +0 -20
  264. package/src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts +0 -20
  265. package/src/_api/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts +0 -25
  266. package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -34
  267. package/src/_api/generated/cfg_totp/api-instance.ts +0 -181
  268. package/src/_api/generated/cfg_totp/client.ts +0 -342
  269. package/src/_api/generated/cfg_totp/enums.ts +0 -13
  270. package/src/_api/generated/cfg_totp/errors.ts +0 -123
  271. package/src/_api/generated/cfg_totp/http.ts +0 -160
  272. package/src/_api/generated/cfg_totp/logger.ts +0 -261
  273. package/src/_api/generated/cfg_totp/retry.ts +0 -177
  274. package/src/_api/generated/cfg_totp/schema.json +0 -910
  275. package/src/_api/generated/cfg_totp/storage.ts +0 -163
  276. package/src/_api/generated/cfg_totp/totp/client.ts +0 -24
  277. package/src/_api/generated/cfg_totp/totp/index.ts +0 -4
  278. package/src/_api/generated/cfg_totp/totp/models.ts +0 -4
  279. package/src/_api/generated/cfg_totp/totp__backup_codes/client.ts +0 -32
  280. package/src/_api/generated/cfg_totp/totp__backup_codes/index.ts +0 -4
  281. package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +0 -38
  282. package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +0 -31
  283. package/src/_api/generated/cfg_totp/totp__totp_management/index.ts +0 -4
  284. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +0 -46
  285. package/src/_api/generated/cfg_totp/totp__totp_setup/client.ts +0 -33
  286. package/src/_api/generated/cfg_totp/totp__totp_setup/index.ts +0 -4
  287. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +0 -55
  288. package/src/_api/generated/cfg_totp/totp__totp_verification/client.ts +0 -33
  289. package/src/_api/generated/cfg_totp/totp__totp_verification/index.ts +0 -4
  290. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +0 -74
  291. package/src/_api/generated/cfg_totp/validation-events.ts +0 -135
  292. package/src/hooks/accounts.ts +0 -8
  293. package/src/hooks/index.ts +0 -10
package/dist/index.d.ts CHANGED
@@ -1,576 +1,1124 @@
1
1
  import { ConsolaInstance } from 'consola';
2
- import { z, ZodError } from 'zod';
2
+ import { ZodError } from 'zod';
3
3
 
4
- /**
5
- *
6
- * Request model (no read-only fields).
7
- */
8
- interface TokenRefreshRequest$1 {
9
- refresh: string;
10
- }
11
- /**
12
- *
13
- * Response model (includes read-only fields).
14
- */
15
- interface TokenRefresh$1 {
16
- access: string;
17
- refresh: string;
18
- }
19
-
20
- declare namespace models$3 {
21
- export type { TokenRefresh$1 as TokenRefresh, TokenRefreshRequest$1 as TokenRefreshRequest };
22
- }
23
-
24
- /**
25
- * API endpoints for Auth.
26
- */
27
- declare class Auth {
28
- private client;
29
- constructor(client: any);
4
+ type AuthToken$2 = string | undefined;
5
+ interface Auth$3 {
30
6
  /**
31
- * Refresh JWT token.
7
+ * Which part of the request do we use to send the auth?
8
+ *
9
+ * @default 'header'
10
+ */
11
+ in?: 'header' | 'query' | 'cookie';
12
+ /**
13
+ * Header or query parameter name.
14
+ *
15
+ * @default 'Authorization'
32
16
  */
33
- accountsTokenRefreshCreate(data: TokenRefreshRequest$1): Promise<TokenRefresh$1>;
17
+ name?: string;
18
+ scheme?: 'basic' | 'bearer';
19
+ type: 'apiKey' | 'http';
34
20
  }
35
21
 
36
- /**
37
- * OAuth provider to disconnect
38
- * * `github` - GitHub
39
- */
40
- declare enum OAuthConnectionProvider {
41
- GITHUB = "github"
22
+ interface SerializerOptions$2<T> {
23
+ /**
24
+ * @default true
25
+ */
26
+ explode: boolean;
27
+ style: T;
42
28
  }
29
+ type ArrayStyle$2 = 'form' | 'spaceDelimited' | 'pipeDelimited';
30
+ type ObjectStyle$2 = 'form' | 'deepObject';
31
+
32
+ type QuerySerializer$2 = (query: Record<string, unknown>) => string;
33
+ type BodySerializer$2 = (body: unknown) => unknown;
34
+ type QuerySerializerOptionsObject$2 = {
35
+ allowReserved?: boolean;
36
+ array?: Partial<SerializerOptions$2<ArrayStyle$2>>;
37
+ object?: Partial<SerializerOptions$2<ObjectStyle$2>>;
38
+ };
39
+ type QuerySerializerOptions$2 = QuerySerializerOptionsObject$2 & {
40
+ /**
41
+ * Per-parameter serialization overrides. When provided, these settings
42
+ * override the global array/object settings for specific parameter names.
43
+ */
44
+ parameters?: Record<string, QuerySerializerOptionsObject$2>;
45
+ };
43
46
 
44
- type enums_OAuthConnectionProvider = OAuthConnectionProvider;
45
- declare const enums_OAuthConnectionProvider: typeof OAuthConnectionProvider;
46
- declare namespace enums {
47
- export { enums_OAuthConnectionProvider as OAuthConnectionProvider };
47
+ type HttpMethod$2 = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
48
+ type Client$5<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
49
+ /**
50
+ * Returns the final request URL.
51
+ */
52
+ buildUrl: BuildUrlFn;
53
+ getConfig: () => Config;
54
+ request: RequestFn;
55
+ setConfig: (config: Config) => Config;
56
+ } & {
57
+ [K in HttpMethod$2]: MethodFn;
58
+ } & ([SseFn] extends [never] ? {
59
+ sse?: never;
60
+ } : {
61
+ sse: {
62
+ [K in HttpMethod$2]: SseFn;
63
+ };
64
+ });
65
+ interface Config$5 {
66
+ /**
67
+ * Auth token or a function returning auth token. The resolved value will be
68
+ * added to the request payload as defined by its `security` array.
69
+ */
70
+ auth?: ((auth: Auth$3) => Promise<AuthToken$2> | AuthToken$2) | AuthToken$2;
71
+ /**
72
+ * A function for serializing request body parameter. By default,
73
+ * {@link JSON.stringify()} will be used.
74
+ */
75
+ bodySerializer?: BodySerializer$2 | null;
76
+ /**
77
+ * An object containing any HTTP headers that you want to pre-populate your
78
+ * `Headers` object with.
79
+ *
80
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
81
+ */
82
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
83
+ /**
84
+ * The request method.
85
+ *
86
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
87
+ */
88
+ method?: Uppercase<HttpMethod$2>;
89
+ /**
90
+ * A function for serializing request query parameters. By default, arrays
91
+ * will be exploded in form style, objects will be exploded in deepObject
92
+ * style, and reserved characters are percent-encoded.
93
+ *
94
+ * This method will have no effect if the native `paramsSerializer()` Axios
95
+ * API function is used.
96
+ *
97
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
98
+ */
99
+ querySerializer?: QuerySerializer$2 | QuerySerializerOptions$2;
100
+ /**
101
+ * A function validating request data. This is useful if you want to ensure
102
+ * the request conforms to the desired shape, so it can be safely sent to
103
+ * the server.
104
+ */
105
+ requestValidator?: (data: unknown) => Promise<unknown>;
106
+ /**
107
+ * A function transforming response data before it's returned. This is useful
108
+ * for post-processing data, e.g., converting ISO strings into Date objects.
109
+ */
110
+ responseTransformer?: (data: unknown) => Promise<unknown>;
111
+ /**
112
+ * A function validating response data. This is useful if you want to ensure
113
+ * the response conforms to the desired shape, so it can be safely passed to
114
+ * the transformers and returned to the user.
115
+ */
116
+ responseValidator?: (data: unknown) => Promise<unknown>;
48
117
  }
49
118
 
50
- /**
51
- * Request to start OAuth flow.
52
- *
53
- * Request model (no read-only fields).
54
- */
55
- interface OAuthAuthorizeRequestRequest$1 {
56
- /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
57
- redirect_uri?: string;
58
- /** Optional source URL for registration tracking */
59
- source_url?: string;
60
- }
61
- /**
62
- * Request to complete OAuth flow (callback handler).
63
- *
64
- * Request model (no read-only fields).
65
- */
66
- interface OAuthCallbackRequestRequest$1 {
67
- /** Authorization code from OAuth provider callback */
68
- code: string;
69
- /** State token for CSRF verification (from authorize response) */
70
- state: string;
71
- /** Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path */
72
- redirect_uri?: string;
73
- }
74
- /**
75
- * Response with JWT tokens after OAuth authentication. When 2FA is required: -
76
- * requires_2fa: True - session_id: UUID of 2FA verification session -
77
- * access/refresh/user: null When 2FA is not required: - requires_2fa: False -
78
- * session_id: null - access/refresh/user: populated
79
- *
80
- * Response model (includes read-only fields).
81
- */
82
- interface OAuthTokenResponse$1 {
83
- /** True if 2FA verification is required */
84
- requires_2fa?: boolean;
85
- /** 2FA session ID (only when requires_2fa=True) */
86
- session_id?: string | null;
87
- /** JWT access token (null when requires_2fa=True) */
88
- access?: string | null;
89
- /** JWT refresh token (null when requires_2fa=True) */
90
- refresh?: string | null;
91
- /** Authenticated user info (null when requires_2fa=True) */
92
- user?: Record<string, any> | null;
93
- /** True if a new user was created during this OAuth flow */
94
- is_new_user: boolean;
95
- /** True if a new OAuth connection was created */
96
- is_new_connection: boolean;
97
- /** True if user should be prompted to enable 2FA */
98
- should_prompt_2fa?: boolean;
99
- }
100
- /**
101
- * Serializer for OAuth connection info (user-facing).
102
- *
103
- * Response model (includes read-only fields).
104
- */
105
- interface OAuthConnection$1 {
106
- id: number;
107
- /** OAuth provider name (github, google, etc.)
108
-
109
- * `github` - GitHub */
110
- provider: OAuthConnectionProvider;
111
- provider_display: string;
112
- /** Username on the OAuth provider platform */
113
- provider_username: string;
114
- /** Email from OAuth provider (may differ from user.email) */
115
- provider_email: string;
116
- /** Avatar URL from OAuth provider */
117
- provider_avatar_url: string;
118
- /** When this OAuth connection was created */
119
- connected_at: string;
120
- /** Last time this OAuth connection was used for login */
121
- last_login_at: string;
122
- }
123
- /**
124
- * Response with OAuth authorization URL.
125
- *
126
- * Response model (includes read-only fields).
127
- */
128
- interface OAuthAuthorizeResponse$1 {
129
- /** Full URL to redirect user to OAuth provider */
130
- authorization_url: string;
131
- /** State token for CSRF protection. Store this and verify on callback. */
132
- state: string;
133
- }
134
- /**
135
- * Request to disconnect OAuth provider.
136
- *
137
- * Request model (no read-only fields).
138
- */
139
- interface OAuthDisconnectRequestRequest$1 {
140
- /** OAuth provider to disconnect
141
-
142
- * `github` - GitHub */
143
- provider: OAuthConnectionProvider;
144
- }
145
- /**
146
- * Response with available OAuth providers.
147
- *
148
- * Response model (includes read-only fields).
149
- */
150
- interface OAuthProvidersResponse$1 {
151
- /** List of available OAuth providers */
152
- providers: Array<Record<string, any>>;
119
+ type ServerSentEventsOptions$2<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$5, 'method' | 'responseTransformer' | 'responseValidator'> & {
120
+ /**
121
+ * Fetch API implementation. You can use this option to provide a custom
122
+ * fetch instance.
123
+ *
124
+ * @default globalThis.fetch
125
+ */
126
+ fetch?: typeof fetch;
127
+ /**
128
+ * Implementing clients can call request interceptors inside this hook.
129
+ */
130
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
131
+ /**
132
+ * Callback invoked when a network or parsing error occurs during streaming.
133
+ *
134
+ * This option applies only if the endpoint returns a stream of events.
135
+ *
136
+ * @param error The error that occurred.
137
+ */
138
+ onSseError?: (error: unknown) => void;
139
+ /**
140
+ * Callback invoked when an event is streamed from the server.
141
+ *
142
+ * This option applies only if the endpoint returns a stream of events.
143
+ *
144
+ * @param event Event streamed from the server.
145
+ * @returns Nothing (void).
146
+ */
147
+ onSseEvent?: (event: StreamEvent$2<TData>) => void;
148
+ serializedBody?: RequestInit['body'];
149
+ /**
150
+ * Default retry delay in milliseconds.
151
+ *
152
+ * This option applies only if the endpoint returns a stream of events.
153
+ *
154
+ * @default 3000
155
+ */
156
+ sseDefaultRetryDelay?: number;
157
+ /**
158
+ * Maximum number of retry attempts before giving up.
159
+ */
160
+ sseMaxRetryAttempts?: number;
161
+ /**
162
+ * Maximum retry delay in milliseconds.
163
+ *
164
+ * Applies only when exponential backoff is used.
165
+ *
166
+ * This option applies only if the endpoint returns a stream of events.
167
+ *
168
+ * @default 30000
169
+ */
170
+ sseMaxRetryDelay?: number;
171
+ /**
172
+ * Optional sleep function for retry backoff.
173
+ *
174
+ * Defaults to using `setTimeout`.
175
+ */
176
+ sseSleepFn?: (ms: number) => Promise<void>;
177
+ url: string;
178
+ };
179
+ interface StreamEvent$2<TData = unknown> {
180
+ data: TData;
181
+ event?: string;
182
+ id?: string;
183
+ retry?: number;
153
184
  }
154
- /**
155
- * Error response for OAuth endpoints.
156
- *
157
- * Response model (includes read-only fields).
158
- */
159
- interface OAuthError$1 {
160
- /** Error code */
161
- error: string;
162
- /** Human-readable error description */
163
- error_description?: string;
185
+ type ServerSentEventsResult$2<TData = unknown, TReturn = void, TNext = unknown> = {
186
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
187
+ };
188
+
189
+ type ErrInterceptor$2<Err, Res, Req, Options> = (error: Err,
190
+ /** response may be undefined due to a network error where no response object is produced */
191
+ response: Res | undefined,
192
+ /** request may be undefined, because error may be from building the request object itself */
193
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
194
+ type ReqInterceptor$2<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
195
+ type ResInterceptor$2<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
196
+ declare class Interceptors$2<Interceptor> {
197
+ fns: Array<Interceptor | null>;
198
+ clear(): void;
199
+ eject(id: number | Interceptor): void;
200
+ exists(id: number | Interceptor): boolean;
201
+ getInterceptorIndex(id: number | Interceptor): number;
202
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
203
+ use(fn: Interceptor): number;
164
204
  }
165
-
166
- declare namespace models$2 {
167
- export type { OAuthAuthorizeRequestRequest$1 as OAuthAuthorizeRequestRequest, OAuthAuthorizeResponse$1 as OAuthAuthorizeResponse, OAuthCallbackRequestRequest$1 as OAuthCallbackRequestRequest, OAuthConnection$1 as OAuthConnection, OAuthDisconnectRequestRequest$1 as OAuthDisconnectRequestRequest, OAuthError$1 as OAuthError, OAuthProvidersResponse$1 as OAuthProvidersResponse, OAuthTokenResponse$1 as OAuthTokenResponse };
205
+ interface Middleware$2<Req, Res, Err, Options> {
206
+ error: Interceptors$2<ErrInterceptor$2<Err, Res, Req, Options>>;
207
+ request: Interceptors$2<ReqInterceptor$2<Req, Options>>;
208
+ response: Interceptors$2<ResInterceptor$2<Res, Req, Options>>;
168
209
  }
169
210
 
170
- /**
171
- * API endpoints for Oauth.
172
- */
173
- declare class Oauth {
174
- private client;
175
- constructor(client: any);
211
+ type ResponseStyle$2 = 'data' | 'fields';
212
+ interface Config$4<T extends ClientOptions$5 = ClientOptions$5> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$5 {
176
213
  /**
177
- * List OAuth connections
214
+ * Base URL for all requests made by this client.
215
+ */
216
+ baseUrl?: T['baseUrl'];
217
+ /**
218
+ * Fetch API implementation. You can use this option to provide a custom
219
+ * fetch instance.
178
220
  *
179
- * Get all OAuth connections for the current user.
221
+ * @default globalThis.fetch
180
222
  */
181
- accountsOauthConnectionsList(): Promise<OAuthConnection$1[]>;
223
+ fetch?: typeof fetch;
182
224
  /**
183
- * Disconnect OAuth provider
225
+ * Please don't use the Fetch client for Next.js applications. The `next`
226
+ * options won't have any effect.
184
227
  *
185
- * Remove OAuth connection for the specified provider.
228
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
186
229
  */
187
- accountsOauthDisconnectCreate(data: OAuthDisconnectRequestRequest$1): Promise<any>;
230
+ next?: never;
188
231
  /**
189
- * Start GitHub OAuth
232
+ * Return the response data parsed in a specified format. By default, `auto`
233
+ * will infer the appropriate method from the `Content-Type` response header.
234
+ * You can override this behavior with any of the {@link Body} methods.
235
+ * Select `stream` if you don't want to parse response data at all.
190
236
  *
191
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to
192
- * start authentication.
237
+ * @default 'auto'
193
238
  */
194
- accountsOauthGithubAuthorizeCreate(data: OAuthAuthorizeRequestRequest$1): Promise<OAuthAuthorizeResponse$1>;
239
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
195
240
  /**
196
- * Complete GitHub OAuth
241
+ * Should we return only data or multiple fields (data, error, response, etc.)?
197
242
  *
198
- * Exchange authorization code for JWT tokens. Call this after GitHub
199
- * redirects back with code.
243
+ * @default 'fields'
200
244
  */
201
- accountsOauthGithubCallbackCreate(data: OAuthCallbackRequestRequest$1): Promise<OAuthTokenResponse$1>;
245
+ responseStyle?: ResponseStyle$2;
202
246
  /**
203
- * List OAuth providers
247
+ * Throw an error instead of returning it in the response?
204
248
  *
205
- * Get list of available OAuth providers for authentication.
249
+ * @default false
206
250
  */
207
- accountsOauthProvidersRetrieve(): Promise<OAuthProvidersResponse$1>;
251
+ throwOnError?: T['throwOnError'];
208
252
  }
209
-
210
- /**
211
- * Serializer for updating user profile.
212
- *
213
- * Request model (no read-only fields).
214
- */
215
- interface PatchedUserProfileUpdateRequest$1 {
216
- first_name?: string;
217
- last_name?: string;
218
- company?: string;
219
- phone?: string;
220
- position?: string;
221
- language?: string;
253
+ interface RequestOptions$2<TData = unknown, TResponseStyle extends ResponseStyle$2 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$4<{
254
+ responseStyle: TResponseStyle;
255
+ throwOnError: ThrowOnError;
256
+ }>, Pick<ServerSentEventsOptions$2<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
257
+ /**
258
+ * Any body that you want to add to your request.
259
+ *
260
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
261
+ */
262
+ body?: unknown;
263
+ path?: Record<string, unknown>;
264
+ query?: Record<string, unknown>;
265
+ /**
266
+ * Security mechanism(s) to use for the request.
267
+ */
268
+ security?: ReadonlyArray<Auth$3>;
269
+ url: Url;
222
270
  }
223
- /**
224
- *
225
- * Request model (no read-only fields).
226
- */
227
- interface CfgAccountsProfileAvatarCreateRequest$1 {
228
- /** Avatar image file (JPEG, PNG, GIF, WebP, max 5MB) */
229
- avatar: File | Blob;
271
+ interface ResolvedRequestOptions$2<TResponseStyle extends ResponseStyle$2 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions$2<unknown, TResponseStyle, ThrowOnError, Url> {
272
+ headers: Headers;
273
+ serializedBody?: string;
274
+ }
275
+ type RequestResult$2<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle$2 = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
276
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
277
+ request: Request;
278
+ response: Response;
279
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
280
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
281
+ error: undefined;
282
+ } | {
283
+ data: undefined;
284
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
285
+ }) & {
286
+ /** request may be undefined, because error may be from building the request object itself */
287
+ request?: Request;
288
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
289
+ response?: Response;
290
+ }>;
291
+ interface ClientOptions$5 {
292
+ baseUrl?: string;
293
+ responseStyle?: ResponseStyle$2;
294
+ throwOnError?: boolean;
295
+ }
296
+ type MethodFn$2 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: Omit<RequestOptions$2<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult$2<TData, TError, ThrowOnError, TResponseStyle>;
297
+ type SseFn$2 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: Omit<RequestOptions$2<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult$2<TData, TError>>;
298
+ type RequestFn$2 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: Omit<RequestOptions$2<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions$2<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult$2<TData, TError, ThrowOnError, TResponseStyle>;
299
+ type BuildUrlFn$2 = <TData extends {
300
+ body?: unknown;
301
+ path?: Record<string, unknown>;
302
+ query?: Record<string, unknown>;
303
+ url: string;
304
+ }>(options: TData & Options$5<TData>) => string;
305
+ type Client$4 = Client$5<RequestFn$2, Config$4, MethodFn$2, BuildUrlFn$2, SseFn$2> & {
306
+ interceptors: Middleware$2<Request, Response, unknown, ResolvedRequestOptions$2>;
307
+ };
308
+ interface TDataShape$2 {
309
+ body?: unknown;
310
+ headers?: unknown;
311
+ path?: unknown;
312
+ query?: unknown;
313
+ url: string;
230
314
  }
315
+ type OmitKeys$2<T, K> = Pick<T, Exclude<keyof T, K>>;
316
+ type Options$5<TData extends TDataShape$2 = TDataShape$2, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle$2 = 'fields'> = OmitKeys$2<RequestOptions$2<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
317
+
318
+ type ClientOptions$4 = {
319
+ baseUrl: 'http://localhost:8000' | (string & {});
320
+ };
231
321
  /**
232
322
  * Response serializer for account deletion.
233
- *
234
- * Response model (includes read-only fields).
235
323
  */
236
- interface AccountDeleteResponse$1 {
237
- /** Whether the account was successfully deleted */
324
+ type AccountDeleteResponse = {
325
+ /**
326
+ * Whether the account was successfully deleted
327
+ */
238
328
  success: boolean;
239
- /** Human-readable message about the deletion */
329
+ /**
330
+ * Human-readable message about the deletion
331
+ */
240
332
  message: string;
241
- }
333
+ };
242
334
  /**
243
- * Serializer for user details.
244
- *
245
- * Response model (includes read-only fields).
335
+ * Nested serializer for Centrifugo WebSocket connection token.
246
336
  */
247
- interface User$2 {
248
- id: number;
249
- email: string;
250
- first_name?: string;
251
- last_name?: string;
252
- /** Get user's full name. */
253
- full_name: string;
254
- /** Get user's initials for avatar fallback. */
255
- initials: string;
256
- /** Get formatted username for display. */
257
- display_username: string;
258
- company?: string;
259
- phone?: string;
260
- position?: string;
261
- language?: string;
262
- avatar?: string | null;
263
- /** Designates whether the user can log into this admin site. */
264
- is_staff: boolean;
265
- /** Designates that this user has all permissions without explicitly assigning them. */
266
- is_superuser: boolean;
267
- date_joined: string;
268
- last_login?: string | null;
269
- unanswered_messages_count: number;
270
- centrifugo: CentrifugoToken$2 | null;
271
- }
337
+ type CentrifugoToken = {
338
+ /**
339
+ * JWT token for Centrifugo WebSocket connection
340
+ */
341
+ token: string;
342
+ /**
343
+ * Centrifugo WebSocket URL
344
+ */
345
+ centrifugo_url: string;
346
+ /**
347
+ * Token expiration time (ISO 8601)
348
+ */
349
+ expires_at: string;
350
+ /**
351
+ * List of allowed channels for this user
352
+ */
353
+ channels: Array<string>;
354
+ };
272
355
  /**
273
356
  * Serializer for updating user profile.
274
- *
275
- * Request model (no read-only fields).
276
357
  */
277
- interface UserProfileUpdateRequest$1 {
358
+ type CfgUserUpdateRequest = {
278
359
  first_name?: string;
279
360
  last_name?: string;
280
361
  company?: string;
281
362
  phone?: string;
282
363
  position?: string;
283
364
  language?: string;
284
- }
365
+ };
285
366
  /**
286
- * Nested serializer for Centrifugo WebSocket connection token.
287
- *
288
- * Response model (includes read-only fields).
367
+ * Request to start OAuth flow.
289
368
  */
290
- interface CentrifugoToken$2 {
291
- /** JWT token for Centrifugo WebSocket connection */
292
- token: string;
293
- /** Centrifugo WebSocket URL */
294
- centrifugo_url: string;
295
- /** Token expiration time (ISO 8601) */
296
- expires_at: string;
297
- /** List of allowed channels for this user */
298
- channels: Array<string>;
299
- }
300
-
301
- declare namespace models$1 {
302
- export type { AccountDeleteResponse$1 as AccountDeleteResponse, CentrifugoToken$2 as CentrifugoToken, CfgAccountsProfileAvatarCreateRequest$1 as CfgAccountsProfileAvatarCreateRequest, PatchedUserProfileUpdateRequest$1 as PatchedUserProfileUpdateRequest, User$2 as User, UserProfileUpdateRequest$1 as UserProfileUpdateRequest };
303
- }
304
-
369
+ type OAuthAuthorizeRequestRequest = {
370
+ /**
371
+ * URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path
372
+ */
373
+ redirect_uri?: string;
374
+ /**
375
+ * Optional source URL for registration tracking
376
+ */
377
+ source_url?: string;
378
+ };
305
379
  /**
306
- * API endpoints for User Profile.
380
+ * Response with OAuth authorization URL.
307
381
  */
308
- declare class UserProfile {
309
- private client;
310
- constructor(client: any);
382
+ type OAuthAuthorizeResponse = {
311
383
  /**
312
- * Get current user profile
313
- *
314
- * Retrieve the current authenticated user's profile information.
384
+ * Full URL to redirect user to OAuth provider
315
385
  */
316
- accountsProfileRetrieve(): Promise<User$2>;
386
+ authorization_url: string;
317
387
  /**
318
- * Upload user avatar
319
- *
320
- * Upload avatar image for the current authenticated user. Accepts
321
- * multipart/form-data with 'avatar' field.
388
+ * State token for CSRF protection. Store this and verify on callback.
322
389
  */
323
- accountsProfileAvatarCreate(data: CfgAccountsProfileAvatarCreateRequest$1): Promise<User$2>;
390
+ state: string;
391
+ };
392
+ /**
393
+ * Request to complete OAuth flow (callback handler).
394
+ */
395
+ type OAuthCallbackRequestRequest = {
324
396
  /**
325
- * Delete user account
326
- *
327
- * Permanently delete the current user's account. This operation: -
328
- * Deactivates the account (user cannot log in) - Anonymizes personal data
329
- * (GDPR compliance) - Frees up the email address for re-registration -
330
- * Preserves audit trail The account can be restored by an administrator if
331
- * needed.
397
+ * Authorization code from OAuth provider callback
332
398
  */
333
- accountsProfileDeleteCreate(): Promise<AccountDeleteResponse$1>;
399
+ code: string;
334
400
  /**
335
- * Partial update user profile
336
- *
337
- * Partially update the current authenticated user's profile information.
338
- * Supports avatar upload.
401
+ * State token for CSRF verification (from authorize response)
339
402
  */
340
- accountsProfilePartialUpdate(data: UserProfileUpdateRequest$1): Promise<User$2>;
403
+ state: string;
341
404
  /**
342
- * Partial update user profile
343
- *
344
- * Partially update the current authenticated user's profile information.
345
- * Supports avatar upload.
405
+ * Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path
346
406
  */
347
- accountsProfilePartialPartialUpdate(data?: PatchedUserProfileUpdateRequest$1): Promise<User$2>;
407
+ redirect_uri?: string;
408
+ };
409
+ /**
410
+ * Serializer for OAuth connection info (user-facing).
411
+ */
412
+ type OAuthConnection = {
413
+ readonly id: number;
348
414
  /**
349
- * Update user profile
415
+ * OAuth provider name (github, google, etc.)
350
416
  *
351
- * Update the current authenticated user's profile information.
417
+ * * `github` - GitHub
352
418
  */
353
- accountsProfileUpdateUpdate(data: UserProfileUpdateRequest$1): Promise<User$2>;
419
+ readonly provider: ProviderEnum;
420
+ readonly provider_display: string;
354
421
  /**
355
- * Update user profile
356
- *
357
- * Update the current authenticated user's profile information.
422
+ * Username on the OAuth provider platform
358
423
  */
359
- accountsProfileUpdatePartialUpdate(data?: PatchedUserProfileUpdateRequest$1): Promise<User$2>;
360
- }
361
-
424
+ readonly provider_username: string;
425
+ /**
426
+ * Email from OAuth provider (may differ from user.email)
427
+ */
428
+ readonly provider_email: string;
429
+ /**
430
+ * Avatar URL from OAuth provider
431
+ */
432
+ readonly provider_avatar_url: string;
433
+ /**
434
+ * When this OAuth connection was created
435
+ */
436
+ readonly connected_at: string;
437
+ /**
438
+ * Last time this OAuth connection was used for login
439
+ */
440
+ readonly last_login_at: string;
441
+ };
362
442
  /**
363
- * OTP verification response. When 2FA is required: - requires_2fa: True -
364
- * session_id: UUID of 2FA verification session - refresh/access/user: null
365
- * When 2FA is not required: - requires_2fa: False - session_id: null -
366
- * refresh/access/user: populated
443
+ * Request to disconnect OAuth provider.
444
+ */
445
+ type OAuthDisconnectRequestRequest = {
446
+ /**
447
+ * OAuth provider to disconnect
448
+ *
449
+ * * `github` - GitHub
450
+ */
451
+ provider: ProviderEnum;
452
+ };
453
+ /**
454
+ * Error response for OAuth endpoints.
455
+ */
456
+ type OAuthError = {
457
+ /**
458
+ * Error code
459
+ */
460
+ error: string;
461
+ /**
462
+ * Human-readable error description
463
+ */
464
+ error_description?: string;
465
+ };
466
+ /**
467
+ * Response with available OAuth providers.
468
+ */
469
+ type OAuthProvidersResponse = {
470
+ /**
471
+ * List of available OAuth providers
472
+ */
473
+ providers: Array<{
474
+ [key: string]: unknown;
475
+ }>;
476
+ };
477
+ /**
478
+ * Response with JWT tokens after OAuth authentication.
479
+ *
480
+ * When 2FA is required:
481
+ * - requires_2fa: True
482
+ * - session_id: UUID of 2FA verification session
483
+ * - access/refresh/user: null
367
484
  *
368
- * Response model (includes read-only fields).
485
+ * When 2FA is not required:
486
+ * - requires_2fa: False
487
+ * - session_id: null
488
+ * - access/refresh/user: populated
369
489
  */
370
- interface OTPVerifyResponse$1 {
371
- /** Whether 2FA verification is required */
490
+ type OAuthTokenResponse = {
491
+ /**
492
+ * True if 2FA verification is required
493
+ */
372
494
  requires_2fa?: boolean;
373
- /** 2FA session ID (if requires_2fa is True) */
495
+ /**
496
+ * 2FA session ID (only when requires_2fa=True)
497
+ */
374
498
  session_id?: string | null;
375
- /** JWT refresh token (if requires_2fa is False) */
376
- refresh?: string | null;
377
- /** JWT access token (if requires_2fa is False) */
499
+ /**
500
+ * JWT access token (null when requires_2fa=True)
501
+ */
378
502
  access?: string | null;
379
- user?: User$1 | null;
380
- /** Whether user should be prompted to enable 2FA */
503
+ /**
504
+ * JWT refresh token (null when requires_2fa=True)
505
+ */
506
+ refresh?: string | null;
507
+ /**
508
+ * Authenticated user info (null when requires_2fa=True)
509
+ */
510
+ user?: {
511
+ [key: string]: unknown;
512
+ } | null;
513
+ /**
514
+ * True if a new user was created during this OAuth flow
515
+ */
516
+ is_new_user: boolean;
517
+ /**
518
+ * True if a new OAuth connection was created
519
+ */
520
+ is_new_connection: boolean;
521
+ /**
522
+ * True if user should be prompted to enable 2FA
523
+ */
381
524
  should_prompt_2fa?: boolean;
382
- }
383
- /**
384
- * OTP request response.
385
- *
386
- * Response model (includes read-only fields).
387
- */
388
- interface OTPRequestResponse$1 {
389
- /** Success message */
390
- message: string;
391
- }
525
+ };
392
526
  /**
393
- * Typed error response for OTP operations. error_code values: -
394
- * invalid_identifier — malformed email - cooldown — too soon after last
395
- * request (retry_after = seconds) - hourly_limit — hourly quota exceeded
396
- * (retry_after = seconds until reset) - daily_limit — daily quota exceeded
397
- * (retry_after = seconds until reset) - rate_limited — IP-level rate limit hit
398
- * (no retry_after) - user_creation_failed — internal error creating account -
399
- * send_failed — transport error (email / SMS) - internal_error — unexpected
400
- * server error
527
+ * Typed error response for OTP operations.
401
528
  *
402
- * Response model (includes read-only fields).
403
- */
404
- interface OTPErrorResponse$1 {
405
- /** Human-readable error message */
529
+ * error_code values:
530
+ * - invalid_identifier — malformed email
531
+ * - cooldown — too soon after last request (retry_after = seconds)
532
+ * - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
533
+ * - daily_limit — daily quota exceeded (retry_after = seconds until reset)
534
+ * - rate_limited — IP-level rate limit hit (no retry_after)
535
+ * - user_creation_failed — internal error creating account
536
+ * - send_failed — transport error (email / SMS)
537
+ * - internal_error — unexpected server error
538
+ */
539
+ type OtpErrorResponse = {
540
+ /**
541
+ * Human-readable error message
542
+ */
406
543
  error: string;
407
- /** Machine-readable error code */
544
+ /**
545
+ * Machine-readable error code
546
+ */
408
547
  error_code?: string | null;
409
- /** Seconds until the client may retry (present only for rate-limit errors) */
548
+ /**
549
+ * Seconds until the client may retry (present only for rate-limit errors)
550
+ */
410
551
  retry_after?: number | null;
411
- }
552
+ };
412
553
  /**
413
- * Serializer for OTP verification.
414
- *
415
- * Request model (no read-only fields).
554
+ * Serializer for OTP request.
416
555
  */
417
- interface OTPVerifyRequest$1 {
418
- /** Email address used for OTP request */
556
+ type OtpRequestRequest = {
557
+ /**
558
+ * Email address for OTP delivery
559
+ */
419
560
  identifier: string;
420
- otp: string;
421
- /** Source URL for tracking login (e.g., https://my.djangocfg.com) */
561
+ /**
562
+ * Source URL for tracking registration (e.g., https://my.djangocfg.com)
563
+ */
422
564
  source_url?: string;
423
- }
565
+ };
424
566
  /**
425
- * Serializer for OTP request.
426
- *
427
- * Request model (no read-only fields).
567
+ * OTP request response.
568
+ */
569
+ type OtpRequestResponse = {
570
+ /**
571
+ * Success message
572
+ */
573
+ message: string;
574
+ };
575
+ /**
576
+ * Serializer for OTP verification.
428
577
  */
429
- interface OTPRequestRequest$1 {
430
- /** Email address for OTP delivery */
578
+ type OtpVerifyRequest = {
579
+ /**
580
+ * Email address used for OTP request
581
+ */
431
582
  identifier: string;
432
- /** Source URL for tracking registration (e.g., https://my.djangocfg.com) */
583
+ otp: string;
584
+ /**
585
+ * Source URL for tracking login (e.g., https://my.djangocfg.com)
586
+ */
433
587
  source_url?: string;
434
- }
588
+ };
435
589
  /**
436
- * Serializer for user details.
590
+ * OTP verification response.
437
591
  *
438
- * Response model (includes read-only fields).
592
+ * When 2FA is required:
593
+ * - requires_2fa: True
594
+ * - session_id: UUID of 2FA verification session
595
+ * - refresh/access/user: null
596
+ *
597
+ * When 2FA is not required:
598
+ * - requires_2fa: False
599
+ * - session_id: null
600
+ * - refresh/access/user: populated
601
+ */
602
+ type OtpVerifyResponse = {
603
+ /**
604
+ * Whether 2FA verification is required
605
+ */
606
+ requires_2fa?: boolean;
607
+ /**
608
+ * 2FA session ID (if requires_2fa is True)
609
+ */
610
+ session_id?: string | null;
611
+ /**
612
+ * JWT refresh token (if requires_2fa is False)
613
+ */
614
+ refresh?: string | null;
615
+ /**
616
+ * JWT access token (if requires_2fa is False)
617
+ */
618
+ access?: string | null;
619
+ /**
620
+ * User information (if requires_2fa is False)
621
+ */
622
+ user?: User | null;
623
+ /**
624
+ * Whether user should be prompted to enable 2FA
625
+ */
626
+ should_prompt_2fa?: boolean;
627
+ };
628
+ /**
629
+ * Serializer for updating user profile.
439
630
  */
440
- interface User$1 {
441
- id: number;
442
- email: string;
631
+ type PatchedCfgUserUpdateRequest = {
443
632
  first_name?: string;
444
633
  last_name?: string;
445
- /** Get user's full name. */
446
- full_name: string;
447
- /** Get user's initials for avatar fallback. */
448
- initials: string;
449
- /** Get formatted username for display. */
450
- display_username: string;
451
634
  company?: string;
452
635
  phone?: string;
453
636
  position?: string;
454
637
  language?: string;
455
- avatar?: string | null;
456
- /** Designates whether the user can log into this admin site. */
457
- is_staff: boolean;
458
- /** Designates that this user has all permissions without explicitly assigning them. */
459
- is_superuser: boolean;
460
- date_joined: string;
461
- last_login?: string | null;
462
- unanswered_messages_count: number;
463
- centrifugo: CentrifugoToken$1 | null;
464
- }
638
+ };
465
639
  /**
466
- * Nested serializer for Centrifugo WebSocket connection token.
467
- *
468
- * Response model (includes read-only fields).
640
+ * * `github` - GitHub
469
641
  */
470
- interface CentrifugoToken$1 {
471
- /** JWT token for Centrifugo WebSocket connection */
472
- token: string;
473
- /** Centrifugo WebSocket URL */
474
- centrifugo_url: string;
475
- /** Token expiration time (ISO 8601) */
476
- expires_at: string;
477
- /** List of allowed channels for this user */
478
- channels: Array<string>;
479
- }
480
-
481
- declare namespace models {
482
- export type { CentrifugoToken$1 as CentrifugoToken, OTPErrorResponse$1 as OTPErrorResponse, OTPRequestRequest$1 as OTPRequestRequest, OTPRequestResponse$1 as OTPRequestResponse, OTPVerifyRequest$1 as OTPVerifyRequest, OTPVerifyResponse$1 as OTPVerifyResponse, User$1 as User };
642
+ declare enum ProviderEnum {
643
+ GITHUB = "github"
483
644
  }
484
-
645
+ type TokenRefresh = {
646
+ readonly access: string;
647
+ refresh: string;
648
+ };
649
+ type TokenRefreshRequest = {
650
+ refresh: string;
651
+ };
485
652
  /**
486
- * API endpoints for Accounts.
653
+ * Serializer for user details.
487
654
  */
488
- declare class Accounts {
489
- private client;
490
- constructor(client: any);
655
+ type User = {
656
+ readonly id: number;
657
+ readonly email: string;
658
+ first_name?: string;
659
+ last_name?: string;
491
660
  /**
492
- * Request OTP code to email.
661
+ * Get user's full name.
493
662
  */
494
- otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
663
+ readonly full_name: string;
495
664
  /**
496
- * Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
497
- * enabled: - Returns requires_2fa=True with session_id - Client must
498
- * complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
499
- * Returns JWT tokens and user data directly
665
+ * Get user's initials for avatar fallback.
500
666
  */
501
- otpVerifyCreate(data: OTPVerifyRequest$1): Promise<OTPVerifyResponse$1>;
502
- }
503
-
667
+ readonly initials: string;
668
+ /**
669
+ * Get formatted username for display.
670
+ */
671
+ readonly display_username: string;
672
+ company?: string;
673
+ phone?: string;
674
+ position?: string;
675
+ language?: string;
676
+ readonly avatar: string | null;
677
+ /**
678
+ * Staff status
679
+ *
680
+ * Designates whether the user can log into this admin site.
681
+ */
682
+ readonly is_staff: boolean;
683
+ /**
684
+ * Superuser status
685
+ *
686
+ * Designates that this user has all permissions without explicitly assigning them.
687
+ */
688
+ readonly is_superuser: boolean;
689
+ readonly date_joined: string;
690
+ readonly last_login: string | null;
691
+ readonly unanswered_messages_count: number;
692
+ readonly centrifugo: CentrifugoToken | null;
693
+ };
504
694
  /**
505
- * HTTP Client Adapter Pattern
695
+ * OTP verification response.
696
+ *
697
+ * When 2FA is required:
698
+ * - requires_2fa: True
699
+ * - session_id: UUID of 2FA verification session
700
+ * - refresh/access/user: null
506
701
  *
507
- * Allows switching between fetch/axios/httpx without changing generated code.
508
- * Provides unified interface for making HTTP requests.
702
+ * When 2FA is not required:
703
+ * - requires_2fa: False
704
+ * - session_id: null
705
+ * - refresh/access/user: populated
509
706
  */
510
- interface HttpRequest {
511
- method: string;
512
- url: string;
513
- headers?: Record<string, string>;
514
- body?: any;
515
- params?: Record<string, any>;
516
- /** FormData for file uploads (multipart/form-data) */
517
- formData?: FormData;
518
- /** Binary data for octet-stream uploads */
519
- binaryBody?: Blob | ArrayBuffer;
707
+ type OtpVerifyResponseWritable = {
520
708
  /**
521
- * Force a specific response parser. When set, overrides Content-Type sniffing.
522
- * Generated for endpoints whose primary response is binary (file downloads).
709
+ * Whether 2FA verification is required
523
710
  */
524
- responseType?: 'json' | 'text' | 'blob';
525
- }
526
- interface HttpResponse<T = any> {
527
- data: T;
528
- status: number;
529
- statusText: string;
530
- headers: Record<string, string>;
531
- }
711
+ requires_2fa?: boolean;
712
+ /**
713
+ * 2FA session ID (if requires_2fa is True)
714
+ */
715
+ session_id?: string | null;
716
+ /**
717
+ * JWT refresh token (if requires_2fa is False)
718
+ */
719
+ refresh?: string | null;
720
+ /**
721
+ * JWT access token (if requires_2fa is False)
722
+ */
723
+ access?: string | null;
724
+ /**
725
+ * User information (if requires_2fa is False)
726
+ */
727
+ user?: UserWritable | null;
728
+ /**
729
+ * Whether user should be prompted to enable 2FA
730
+ */
731
+ should_prompt_2fa?: boolean;
732
+ };
733
+ type TokenRefreshWritable = {
734
+ refresh: string;
735
+ };
532
736
  /**
533
- * HTTP Client Adapter Interface.
534
- * Implement this to use custom HTTP clients (axios, httpx, etc.)
737
+ * Serializer for user details.
535
738
  */
536
- interface HttpClientAdapter$1 {
537
- request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
739
+ type UserWritable = {
740
+ first_name?: string;
741
+ last_name?: string;
742
+ company?: string;
743
+ phone?: string;
744
+ position?: string;
745
+ language?: string;
746
+ };
747
+ type CfgAccountsOauthConnectionsListData = {
748
+ body?: never;
749
+ path?: never;
750
+ query?: never;
751
+ url: '/cfg/accounts/oauth/connections/';
752
+ };
753
+ type CfgAccountsOauthConnectionsListResponses = {
754
+ 200: Array<OAuthConnection>;
755
+ };
756
+ type CfgAccountsOauthConnectionsListResponse = CfgAccountsOauthConnectionsListResponses[keyof CfgAccountsOauthConnectionsListResponses];
757
+ type CfgAccountsOauthDisconnectCreateData = {
758
+ body: OAuthDisconnectRequestRequest;
759
+ path?: never;
760
+ query?: never;
761
+ url: '/cfg/accounts/oauth/disconnect/';
762
+ };
763
+ type CfgAccountsOauthDisconnectCreateErrors = {
764
+ 400: OAuthError;
765
+ 404: OAuthError;
766
+ };
767
+ type CfgAccountsOauthDisconnectCreateError = CfgAccountsOauthDisconnectCreateErrors[keyof CfgAccountsOauthDisconnectCreateErrors];
768
+ type CfgAccountsOauthDisconnectCreateResponses = {
769
+ 200: {
770
+ message?: string;
771
+ };
772
+ };
773
+ type CfgAccountsOauthDisconnectCreateResponse = CfgAccountsOauthDisconnectCreateResponses[keyof CfgAccountsOauthDisconnectCreateResponses];
774
+ type CfgAccountsOauthGithubAuthorizeCreateData = {
775
+ body?: OAuthAuthorizeRequestRequest;
776
+ path?: never;
777
+ query?: never;
778
+ url: '/cfg/accounts/oauth/github/authorize/';
779
+ };
780
+ type CfgAccountsOauthGithubAuthorizeCreateErrors = {
781
+ 503: OAuthError;
782
+ };
783
+ type CfgAccountsOauthGithubAuthorizeCreateError = CfgAccountsOauthGithubAuthorizeCreateErrors[keyof CfgAccountsOauthGithubAuthorizeCreateErrors];
784
+ type CfgAccountsOauthGithubAuthorizeCreateResponses = {
785
+ 200: OAuthAuthorizeResponse;
786
+ };
787
+ type CfgAccountsOauthGithubAuthorizeCreateResponse = CfgAccountsOauthGithubAuthorizeCreateResponses[keyof CfgAccountsOauthGithubAuthorizeCreateResponses];
788
+ type CfgAccountsOauthGithubCallbackCreateData = {
789
+ body: OAuthCallbackRequestRequest;
790
+ path?: never;
791
+ query?: never;
792
+ url: '/cfg/accounts/oauth/github/callback/';
793
+ };
794
+ type CfgAccountsOauthGithubCallbackCreateErrors = {
795
+ 400: OAuthError;
796
+ };
797
+ type CfgAccountsOauthGithubCallbackCreateError = CfgAccountsOauthGithubCallbackCreateErrors[keyof CfgAccountsOauthGithubCallbackCreateErrors];
798
+ type CfgAccountsOauthGithubCallbackCreateResponses = {
799
+ 200: OAuthTokenResponse;
800
+ };
801
+ type CfgAccountsOauthGithubCallbackCreateResponse = CfgAccountsOauthGithubCallbackCreateResponses[keyof CfgAccountsOauthGithubCallbackCreateResponses];
802
+ type CfgAccountsOauthProvidersRetrieveData = {
803
+ body?: never;
804
+ path?: never;
805
+ query?: never;
806
+ url: '/cfg/accounts/oauth/providers/';
807
+ };
808
+ type CfgAccountsOauthProvidersRetrieveResponses = {
809
+ 200: OAuthProvidersResponse;
810
+ };
811
+ type CfgAccountsOauthProvidersRetrieveResponse = CfgAccountsOauthProvidersRetrieveResponses[keyof CfgAccountsOauthProvidersRetrieveResponses];
812
+ type CfgAccountsOtpRequestCreateData = {
813
+ body: OtpRequestRequest;
814
+ path?: never;
815
+ query?: never;
816
+ url: '/cfg/accounts/otp/request/';
817
+ };
818
+ type CfgAccountsOtpRequestCreateErrors = {
819
+ 400: OtpErrorResponse;
820
+ 429: OtpErrorResponse;
821
+ 500: OtpErrorResponse;
822
+ };
823
+ type CfgAccountsOtpRequestCreateError = CfgAccountsOtpRequestCreateErrors[keyof CfgAccountsOtpRequestCreateErrors];
824
+ type CfgAccountsOtpRequestCreateResponses = {
825
+ 200: OtpRequestResponse;
826
+ };
827
+ type CfgAccountsOtpRequestCreateResponse = CfgAccountsOtpRequestCreateResponses[keyof CfgAccountsOtpRequestCreateResponses];
828
+ type CfgAccountsOtpVerifyCreateData = {
829
+ body: OtpVerifyRequest;
830
+ path?: never;
831
+ query?: never;
832
+ url: '/cfg/accounts/otp/verify/';
833
+ };
834
+ type CfgAccountsOtpVerifyCreateErrors = {
835
+ 401: OtpErrorResponse;
836
+ 429: OtpErrorResponse;
837
+ };
838
+ type CfgAccountsOtpVerifyCreateError = CfgAccountsOtpVerifyCreateErrors[keyof CfgAccountsOtpVerifyCreateErrors];
839
+ type CfgAccountsOtpVerifyCreateResponses = {
840
+ 200: OtpVerifyResponse;
841
+ };
842
+ type CfgAccountsOtpVerifyCreateResponse = CfgAccountsOtpVerifyCreateResponses[keyof CfgAccountsOtpVerifyCreateResponses];
843
+ type CfgAccountsProfileRetrieveData = {
844
+ body?: never;
845
+ path?: never;
846
+ query?: never;
847
+ url: '/cfg/accounts/profile/';
848
+ };
849
+ type CfgAccountsProfileRetrieveErrors = {
850
+ /**
851
+ * Authentication credentials were not provided.
852
+ */
853
+ 401: unknown;
854
+ };
855
+ type CfgAccountsProfileRetrieveResponses = {
856
+ 200: User;
857
+ };
858
+ type CfgAccountsProfileRetrieveResponse = CfgAccountsProfileRetrieveResponses[keyof CfgAccountsProfileRetrieveResponses];
859
+ type CfgAccountsProfileAvatarCreateData = {
860
+ body?: {
861
+ /**
862
+ * Avatar image file (JPEG, PNG, GIF, WebP, max 5MB)
863
+ */
864
+ avatar: Blob | File;
865
+ };
866
+ path?: never;
867
+ query?: never;
868
+ url: '/cfg/accounts/profile/avatar/';
869
+ };
870
+ type CfgAccountsProfileAvatarCreateErrors = {
871
+ /**
872
+ * Invalid file or validation error.
873
+ */
874
+ 400: unknown;
875
+ /**
876
+ * Authentication credentials were not provided.
877
+ */
878
+ 401: unknown;
879
+ };
880
+ type CfgAccountsProfileAvatarCreateResponses = {
881
+ 200: User;
882
+ };
883
+ type CfgAccountsProfileAvatarCreateResponse = CfgAccountsProfileAvatarCreateResponses[keyof CfgAccountsProfileAvatarCreateResponses];
884
+ type CfgAccountsProfileDeleteCreateData = {
885
+ body?: never;
886
+ path?: never;
887
+ query?: never;
888
+ url: '/cfg/accounts/profile/delete/';
889
+ };
890
+ type CfgAccountsProfileDeleteCreateErrors = {
891
+ /**
892
+ * Account is already deleted.
893
+ */
894
+ 400: unknown;
895
+ /**
896
+ * Authentication credentials were not provided.
897
+ */
898
+ 401: unknown;
899
+ };
900
+ type CfgAccountsProfileDeleteCreateResponses = {
901
+ 200: AccountDeleteResponse;
902
+ };
903
+ type CfgAccountsProfileDeleteCreateResponse = CfgAccountsProfileDeleteCreateResponses[keyof CfgAccountsProfileDeleteCreateResponses];
904
+ type CfgAccountsProfilePartialPartialUpdateData = {
905
+ body?: PatchedCfgUserUpdateRequest;
906
+ path?: never;
907
+ query?: never;
908
+ url: '/cfg/accounts/profile/partial/';
909
+ };
910
+ type CfgAccountsProfilePartialPartialUpdateErrors = {
911
+ /**
912
+ * Invalid data provided.
913
+ */
914
+ 400: unknown;
915
+ /**
916
+ * Authentication credentials were not provided.
917
+ */
918
+ 401: unknown;
919
+ };
920
+ type CfgAccountsProfilePartialPartialUpdateResponses = {
921
+ 200: User;
922
+ };
923
+ type CfgAccountsProfilePartialPartialUpdateResponse = CfgAccountsProfilePartialPartialUpdateResponses[keyof CfgAccountsProfilePartialPartialUpdateResponses];
924
+ type CfgAccountsProfilePartialUpdateData = {
925
+ body?: CfgUserUpdateRequest;
926
+ path?: never;
927
+ query?: never;
928
+ url: '/cfg/accounts/profile/partial/';
929
+ };
930
+ type CfgAccountsProfilePartialUpdateErrors = {
931
+ /**
932
+ * Invalid data provided.
933
+ */
934
+ 400: unknown;
935
+ /**
936
+ * Authentication credentials were not provided.
937
+ */
938
+ 401: unknown;
939
+ };
940
+ type CfgAccountsProfilePartialUpdateResponses = {
941
+ 200: User;
942
+ };
943
+ type CfgAccountsProfilePartialUpdateResponse = CfgAccountsProfilePartialUpdateResponses[keyof CfgAccountsProfilePartialUpdateResponses];
944
+ type CfgAccountsProfileUpdatePartialUpdateData = {
945
+ body?: PatchedCfgUserUpdateRequest;
946
+ path?: never;
947
+ query?: never;
948
+ url: '/cfg/accounts/profile/update/';
949
+ };
950
+ type CfgAccountsProfileUpdatePartialUpdateErrors = {
951
+ /**
952
+ * Invalid data provided.
953
+ */
954
+ 400: unknown;
955
+ /**
956
+ * Authentication credentials were not provided.
957
+ */
958
+ 401: unknown;
959
+ };
960
+ type CfgAccountsProfileUpdatePartialUpdateResponses = {
961
+ 200: User;
962
+ };
963
+ type CfgAccountsProfileUpdatePartialUpdateResponse = CfgAccountsProfileUpdatePartialUpdateResponses[keyof CfgAccountsProfileUpdatePartialUpdateResponses];
964
+ type CfgAccountsProfileUpdateUpdateData = {
965
+ body?: CfgUserUpdateRequest;
966
+ path?: never;
967
+ query?: never;
968
+ url: '/cfg/accounts/profile/update/';
969
+ };
970
+ type CfgAccountsProfileUpdateUpdateErrors = {
971
+ /**
972
+ * Invalid data provided.
973
+ */
974
+ 400: unknown;
975
+ /**
976
+ * Authentication credentials were not provided.
977
+ */
978
+ 401: unknown;
979
+ };
980
+ type CfgAccountsProfileUpdateUpdateResponses = {
981
+ 200: User;
982
+ };
983
+ type CfgAccountsProfileUpdateUpdateResponse = CfgAccountsProfileUpdateUpdateResponses[keyof CfgAccountsProfileUpdateUpdateResponses];
984
+ type CfgAccountsTokenRefreshCreateData = {
985
+ body: TokenRefreshRequest;
986
+ path?: never;
987
+ query?: never;
988
+ url: '/cfg/accounts/token/refresh/';
989
+ };
990
+ type CfgAccountsTokenRefreshCreateResponses = {
991
+ 200: TokenRefresh;
992
+ };
993
+ type CfgAccountsTokenRefreshCreateResponse = CfgAccountsTokenRefreshCreateResponses[keyof CfgAccountsTokenRefreshCreateResponses];
994
+
995
+ type types_gen$2_AccountDeleteResponse = AccountDeleteResponse;
996
+ type types_gen$2_CentrifugoToken = CentrifugoToken;
997
+ type types_gen$2_CfgAccountsOauthConnectionsListData = CfgAccountsOauthConnectionsListData;
998
+ type types_gen$2_CfgAccountsOauthConnectionsListResponse = CfgAccountsOauthConnectionsListResponse;
999
+ type types_gen$2_CfgAccountsOauthConnectionsListResponses = CfgAccountsOauthConnectionsListResponses;
1000
+ type types_gen$2_CfgAccountsOauthDisconnectCreateData = CfgAccountsOauthDisconnectCreateData;
1001
+ type types_gen$2_CfgAccountsOauthDisconnectCreateError = CfgAccountsOauthDisconnectCreateError;
1002
+ type types_gen$2_CfgAccountsOauthDisconnectCreateErrors = CfgAccountsOauthDisconnectCreateErrors;
1003
+ type types_gen$2_CfgAccountsOauthDisconnectCreateResponse = CfgAccountsOauthDisconnectCreateResponse;
1004
+ type types_gen$2_CfgAccountsOauthDisconnectCreateResponses = CfgAccountsOauthDisconnectCreateResponses;
1005
+ type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateData = CfgAccountsOauthGithubAuthorizeCreateData;
1006
+ type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateError = CfgAccountsOauthGithubAuthorizeCreateError;
1007
+ type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateErrors = CfgAccountsOauthGithubAuthorizeCreateErrors;
1008
+ type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateResponse = CfgAccountsOauthGithubAuthorizeCreateResponse;
1009
+ type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateResponses = CfgAccountsOauthGithubAuthorizeCreateResponses;
1010
+ type types_gen$2_CfgAccountsOauthGithubCallbackCreateData = CfgAccountsOauthGithubCallbackCreateData;
1011
+ type types_gen$2_CfgAccountsOauthGithubCallbackCreateError = CfgAccountsOauthGithubCallbackCreateError;
1012
+ type types_gen$2_CfgAccountsOauthGithubCallbackCreateErrors = CfgAccountsOauthGithubCallbackCreateErrors;
1013
+ type types_gen$2_CfgAccountsOauthGithubCallbackCreateResponse = CfgAccountsOauthGithubCallbackCreateResponse;
1014
+ type types_gen$2_CfgAccountsOauthGithubCallbackCreateResponses = CfgAccountsOauthGithubCallbackCreateResponses;
1015
+ type types_gen$2_CfgAccountsOauthProvidersRetrieveData = CfgAccountsOauthProvidersRetrieveData;
1016
+ type types_gen$2_CfgAccountsOauthProvidersRetrieveResponse = CfgAccountsOauthProvidersRetrieveResponse;
1017
+ type types_gen$2_CfgAccountsOauthProvidersRetrieveResponses = CfgAccountsOauthProvidersRetrieveResponses;
1018
+ type types_gen$2_CfgAccountsOtpRequestCreateData = CfgAccountsOtpRequestCreateData;
1019
+ type types_gen$2_CfgAccountsOtpRequestCreateError = CfgAccountsOtpRequestCreateError;
1020
+ type types_gen$2_CfgAccountsOtpRequestCreateErrors = CfgAccountsOtpRequestCreateErrors;
1021
+ type types_gen$2_CfgAccountsOtpRequestCreateResponse = CfgAccountsOtpRequestCreateResponse;
1022
+ type types_gen$2_CfgAccountsOtpRequestCreateResponses = CfgAccountsOtpRequestCreateResponses;
1023
+ type types_gen$2_CfgAccountsOtpVerifyCreateData = CfgAccountsOtpVerifyCreateData;
1024
+ type types_gen$2_CfgAccountsOtpVerifyCreateError = CfgAccountsOtpVerifyCreateError;
1025
+ type types_gen$2_CfgAccountsOtpVerifyCreateErrors = CfgAccountsOtpVerifyCreateErrors;
1026
+ type types_gen$2_CfgAccountsOtpVerifyCreateResponse = CfgAccountsOtpVerifyCreateResponse;
1027
+ type types_gen$2_CfgAccountsOtpVerifyCreateResponses = CfgAccountsOtpVerifyCreateResponses;
1028
+ type types_gen$2_CfgAccountsProfileAvatarCreateData = CfgAccountsProfileAvatarCreateData;
1029
+ type types_gen$2_CfgAccountsProfileAvatarCreateErrors = CfgAccountsProfileAvatarCreateErrors;
1030
+ type types_gen$2_CfgAccountsProfileAvatarCreateResponse = CfgAccountsProfileAvatarCreateResponse;
1031
+ type types_gen$2_CfgAccountsProfileAvatarCreateResponses = CfgAccountsProfileAvatarCreateResponses;
1032
+ type types_gen$2_CfgAccountsProfileDeleteCreateData = CfgAccountsProfileDeleteCreateData;
1033
+ type types_gen$2_CfgAccountsProfileDeleteCreateErrors = CfgAccountsProfileDeleteCreateErrors;
1034
+ type types_gen$2_CfgAccountsProfileDeleteCreateResponse = CfgAccountsProfileDeleteCreateResponse;
1035
+ type types_gen$2_CfgAccountsProfileDeleteCreateResponses = CfgAccountsProfileDeleteCreateResponses;
1036
+ type types_gen$2_CfgAccountsProfilePartialPartialUpdateData = CfgAccountsProfilePartialPartialUpdateData;
1037
+ type types_gen$2_CfgAccountsProfilePartialPartialUpdateErrors = CfgAccountsProfilePartialPartialUpdateErrors;
1038
+ type types_gen$2_CfgAccountsProfilePartialPartialUpdateResponse = CfgAccountsProfilePartialPartialUpdateResponse;
1039
+ type types_gen$2_CfgAccountsProfilePartialPartialUpdateResponses = CfgAccountsProfilePartialPartialUpdateResponses;
1040
+ type types_gen$2_CfgAccountsProfilePartialUpdateData = CfgAccountsProfilePartialUpdateData;
1041
+ type types_gen$2_CfgAccountsProfilePartialUpdateErrors = CfgAccountsProfilePartialUpdateErrors;
1042
+ type types_gen$2_CfgAccountsProfilePartialUpdateResponse = CfgAccountsProfilePartialUpdateResponse;
1043
+ type types_gen$2_CfgAccountsProfilePartialUpdateResponses = CfgAccountsProfilePartialUpdateResponses;
1044
+ type types_gen$2_CfgAccountsProfileRetrieveData = CfgAccountsProfileRetrieveData;
1045
+ type types_gen$2_CfgAccountsProfileRetrieveErrors = CfgAccountsProfileRetrieveErrors;
1046
+ type types_gen$2_CfgAccountsProfileRetrieveResponse = CfgAccountsProfileRetrieveResponse;
1047
+ type types_gen$2_CfgAccountsProfileRetrieveResponses = CfgAccountsProfileRetrieveResponses;
1048
+ type types_gen$2_CfgAccountsProfileUpdatePartialUpdateData = CfgAccountsProfileUpdatePartialUpdateData;
1049
+ type types_gen$2_CfgAccountsProfileUpdatePartialUpdateErrors = CfgAccountsProfileUpdatePartialUpdateErrors;
1050
+ type types_gen$2_CfgAccountsProfileUpdatePartialUpdateResponse = CfgAccountsProfileUpdatePartialUpdateResponse;
1051
+ type types_gen$2_CfgAccountsProfileUpdatePartialUpdateResponses = CfgAccountsProfileUpdatePartialUpdateResponses;
1052
+ type types_gen$2_CfgAccountsProfileUpdateUpdateData = CfgAccountsProfileUpdateUpdateData;
1053
+ type types_gen$2_CfgAccountsProfileUpdateUpdateErrors = CfgAccountsProfileUpdateUpdateErrors;
1054
+ type types_gen$2_CfgAccountsProfileUpdateUpdateResponse = CfgAccountsProfileUpdateUpdateResponse;
1055
+ type types_gen$2_CfgAccountsProfileUpdateUpdateResponses = CfgAccountsProfileUpdateUpdateResponses;
1056
+ type types_gen$2_CfgAccountsTokenRefreshCreateData = CfgAccountsTokenRefreshCreateData;
1057
+ type types_gen$2_CfgAccountsTokenRefreshCreateResponse = CfgAccountsTokenRefreshCreateResponse;
1058
+ type types_gen$2_CfgAccountsTokenRefreshCreateResponses = CfgAccountsTokenRefreshCreateResponses;
1059
+ type types_gen$2_CfgUserUpdateRequest = CfgUserUpdateRequest;
1060
+ type types_gen$2_OAuthAuthorizeRequestRequest = OAuthAuthorizeRequestRequest;
1061
+ type types_gen$2_OAuthAuthorizeResponse = OAuthAuthorizeResponse;
1062
+ type types_gen$2_OAuthCallbackRequestRequest = OAuthCallbackRequestRequest;
1063
+ type types_gen$2_OAuthConnection = OAuthConnection;
1064
+ type types_gen$2_OAuthDisconnectRequestRequest = OAuthDisconnectRequestRequest;
1065
+ type types_gen$2_OAuthError = OAuthError;
1066
+ type types_gen$2_OAuthProvidersResponse = OAuthProvidersResponse;
1067
+ type types_gen$2_OAuthTokenResponse = OAuthTokenResponse;
1068
+ type types_gen$2_OtpErrorResponse = OtpErrorResponse;
1069
+ type types_gen$2_OtpRequestRequest = OtpRequestRequest;
1070
+ type types_gen$2_OtpRequestResponse = OtpRequestResponse;
1071
+ type types_gen$2_OtpVerifyRequest = OtpVerifyRequest;
1072
+ type types_gen$2_OtpVerifyResponse = OtpVerifyResponse;
1073
+ type types_gen$2_OtpVerifyResponseWritable = OtpVerifyResponseWritable;
1074
+ type types_gen$2_PatchedCfgUserUpdateRequest = PatchedCfgUserUpdateRequest;
1075
+ type types_gen$2_ProviderEnum = ProviderEnum;
1076
+ declare const types_gen$2_ProviderEnum: typeof ProviderEnum;
1077
+ type types_gen$2_TokenRefresh = TokenRefresh;
1078
+ type types_gen$2_TokenRefreshRequest = TokenRefreshRequest;
1079
+ type types_gen$2_TokenRefreshWritable = TokenRefreshWritable;
1080
+ type types_gen$2_User = User;
1081
+ type types_gen$2_UserWritable = UserWritable;
1082
+ declare namespace types_gen$2 {
1083
+ export { type types_gen$2_AccountDeleteResponse as AccountDeleteResponse, type types_gen$2_CentrifugoToken as CentrifugoToken, type types_gen$2_CfgAccountsOauthConnectionsListData as CfgAccountsOauthConnectionsListData, type types_gen$2_CfgAccountsOauthConnectionsListResponse as CfgAccountsOauthConnectionsListResponse, type types_gen$2_CfgAccountsOauthConnectionsListResponses as CfgAccountsOauthConnectionsListResponses, type types_gen$2_CfgAccountsOauthDisconnectCreateData as CfgAccountsOauthDisconnectCreateData, type types_gen$2_CfgAccountsOauthDisconnectCreateError as CfgAccountsOauthDisconnectCreateError, type types_gen$2_CfgAccountsOauthDisconnectCreateErrors as CfgAccountsOauthDisconnectCreateErrors, type types_gen$2_CfgAccountsOauthDisconnectCreateResponse as CfgAccountsOauthDisconnectCreateResponse, type types_gen$2_CfgAccountsOauthDisconnectCreateResponses as CfgAccountsOauthDisconnectCreateResponses, type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateData as CfgAccountsOauthGithubAuthorizeCreateData, type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateError as CfgAccountsOauthGithubAuthorizeCreateError, type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateErrors as CfgAccountsOauthGithubAuthorizeCreateErrors, type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateResponse as CfgAccountsOauthGithubAuthorizeCreateResponse, type types_gen$2_CfgAccountsOauthGithubAuthorizeCreateResponses as CfgAccountsOauthGithubAuthorizeCreateResponses, type types_gen$2_CfgAccountsOauthGithubCallbackCreateData as CfgAccountsOauthGithubCallbackCreateData, type types_gen$2_CfgAccountsOauthGithubCallbackCreateError as CfgAccountsOauthGithubCallbackCreateError, type types_gen$2_CfgAccountsOauthGithubCallbackCreateErrors as CfgAccountsOauthGithubCallbackCreateErrors, type types_gen$2_CfgAccountsOauthGithubCallbackCreateResponse as CfgAccountsOauthGithubCallbackCreateResponse, type types_gen$2_CfgAccountsOauthGithubCallbackCreateResponses as CfgAccountsOauthGithubCallbackCreateResponses, type types_gen$2_CfgAccountsOauthProvidersRetrieveData as CfgAccountsOauthProvidersRetrieveData, type types_gen$2_CfgAccountsOauthProvidersRetrieveResponse as CfgAccountsOauthProvidersRetrieveResponse, type types_gen$2_CfgAccountsOauthProvidersRetrieveResponses as CfgAccountsOauthProvidersRetrieveResponses, type types_gen$2_CfgAccountsOtpRequestCreateData as CfgAccountsOtpRequestCreateData, type types_gen$2_CfgAccountsOtpRequestCreateError as CfgAccountsOtpRequestCreateError, type types_gen$2_CfgAccountsOtpRequestCreateErrors as CfgAccountsOtpRequestCreateErrors, type types_gen$2_CfgAccountsOtpRequestCreateResponse as CfgAccountsOtpRequestCreateResponse, type types_gen$2_CfgAccountsOtpRequestCreateResponses as CfgAccountsOtpRequestCreateResponses, type types_gen$2_CfgAccountsOtpVerifyCreateData as CfgAccountsOtpVerifyCreateData, type types_gen$2_CfgAccountsOtpVerifyCreateError as CfgAccountsOtpVerifyCreateError, type types_gen$2_CfgAccountsOtpVerifyCreateErrors as CfgAccountsOtpVerifyCreateErrors, type types_gen$2_CfgAccountsOtpVerifyCreateResponse as CfgAccountsOtpVerifyCreateResponse, type types_gen$2_CfgAccountsOtpVerifyCreateResponses as CfgAccountsOtpVerifyCreateResponses, type types_gen$2_CfgAccountsProfileAvatarCreateData as CfgAccountsProfileAvatarCreateData, type types_gen$2_CfgAccountsProfileAvatarCreateErrors as CfgAccountsProfileAvatarCreateErrors, type types_gen$2_CfgAccountsProfileAvatarCreateResponse as CfgAccountsProfileAvatarCreateResponse, type types_gen$2_CfgAccountsProfileAvatarCreateResponses as CfgAccountsProfileAvatarCreateResponses, type types_gen$2_CfgAccountsProfileDeleteCreateData as CfgAccountsProfileDeleteCreateData, type types_gen$2_CfgAccountsProfileDeleteCreateErrors as CfgAccountsProfileDeleteCreateErrors, type types_gen$2_CfgAccountsProfileDeleteCreateResponse as CfgAccountsProfileDeleteCreateResponse, type types_gen$2_CfgAccountsProfileDeleteCreateResponses as CfgAccountsProfileDeleteCreateResponses, type types_gen$2_CfgAccountsProfilePartialPartialUpdateData as CfgAccountsProfilePartialPartialUpdateData, type types_gen$2_CfgAccountsProfilePartialPartialUpdateErrors as CfgAccountsProfilePartialPartialUpdateErrors, type types_gen$2_CfgAccountsProfilePartialPartialUpdateResponse as CfgAccountsProfilePartialPartialUpdateResponse, type types_gen$2_CfgAccountsProfilePartialPartialUpdateResponses as CfgAccountsProfilePartialPartialUpdateResponses, type types_gen$2_CfgAccountsProfilePartialUpdateData as CfgAccountsProfilePartialUpdateData, type types_gen$2_CfgAccountsProfilePartialUpdateErrors as CfgAccountsProfilePartialUpdateErrors, type types_gen$2_CfgAccountsProfilePartialUpdateResponse as CfgAccountsProfilePartialUpdateResponse, type types_gen$2_CfgAccountsProfilePartialUpdateResponses as CfgAccountsProfilePartialUpdateResponses, type types_gen$2_CfgAccountsProfileRetrieveData as CfgAccountsProfileRetrieveData, type types_gen$2_CfgAccountsProfileRetrieveErrors as CfgAccountsProfileRetrieveErrors, type types_gen$2_CfgAccountsProfileRetrieveResponse as CfgAccountsProfileRetrieveResponse, type types_gen$2_CfgAccountsProfileRetrieveResponses as CfgAccountsProfileRetrieveResponses, type types_gen$2_CfgAccountsProfileUpdatePartialUpdateData as CfgAccountsProfileUpdatePartialUpdateData, type types_gen$2_CfgAccountsProfileUpdatePartialUpdateErrors as CfgAccountsProfileUpdatePartialUpdateErrors, type types_gen$2_CfgAccountsProfileUpdatePartialUpdateResponse as CfgAccountsProfileUpdatePartialUpdateResponse, type types_gen$2_CfgAccountsProfileUpdatePartialUpdateResponses as CfgAccountsProfileUpdatePartialUpdateResponses, type types_gen$2_CfgAccountsProfileUpdateUpdateData as CfgAccountsProfileUpdateUpdateData, type types_gen$2_CfgAccountsProfileUpdateUpdateErrors as CfgAccountsProfileUpdateUpdateErrors, type types_gen$2_CfgAccountsProfileUpdateUpdateResponse as CfgAccountsProfileUpdateUpdateResponse, type types_gen$2_CfgAccountsProfileUpdateUpdateResponses as CfgAccountsProfileUpdateUpdateResponses, type types_gen$2_CfgAccountsTokenRefreshCreateData as CfgAccountsTokenRefreshCreateData, type types_gen$2_CfgAccountsTokenRefreshCreateResponse as CfgAccountsTokenRefreshCreateResponse, type types_gen$2_CfgAccountsTokenRefreshCreateResponses as CfgAccountsTokenRefreshCreateResponses, type types_gen$2_CfgUserUpdateRequest as CfgUserUpdateRequest, type ClientOptions$4 as ClientOptions, type types_gen$2_OAuthAuthorizeRequestRequest as OAuthAuthorizeRequestRequest, type types_gen$2_OAuthAuthorizeResponse as OAuthAuthorizeResponse, type types_gen$2_OAuthCallbackRequestRequest as OAuthCallbackRequestRequest, type types_gen$2_OAuthConnection as OAuthConnection, type types_gen$2_OAuthDisconnectRequestRequest as OAuthDisconnectRequestRequest, type types_gen$2_OAuthError as OAuthError, type types_gen$2_OAuthProvidersResponse as OAuthProvidersResponse, type types_gen$2_OAuthTokenResponse as OAuthTokenResponse, type types_gen$2_OtpErrorResponse as OtpErrorResponse, type types_gen$2_OtpRequestRequest as OtpRequestRequest, type types_gen$2_OtpRequestResponse as OtpRequestResponse, type types_gen$2_OtpVerifyRequest as OtpVerifyRequest, type types_gen$2_OtpVerifyResponse as OtpVerifyResponse, type types_gen$2_OtpVerifyResponseWritable as OtpVerifyResponseWritable, type types_gen$2_PatchedCfgUserUpdateRequest as PatchedCfgUserUpdateRequest, types_gen$2_ProviderEnum as ProviderEnum, type types_gen$2_TokenRefresh as TokenRefresh, type types_gen$2_TokenRefreshRequest as TokenRefreshRequest, type types_gen$2_TokenRefreshWritable as TokenRefreshWritable, type types_gen$2_User as User, type types_gen$2_UserWritable as UserWritable };
538
1084
  }
539
- /**
540
- * Default Fetch API adapter.
541
- * Uses native browser fetch() with proper error handling.
542
- */
543
- declare class FetchAdapter implements HttpClientAdapter$1 {
544
- request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
1085
+
1086
+ interface StorageAdapter {
1087
+ getItem(key: string): string | null;
1088
+ setItem(key: string, value: string): void;
1089
+ removeItem(key: string): void;
1090
+ clear?(): void;
545
1091
  }
546
- /**
547
- * FetchAdapter with keepalive:true.
548
- *
549
- * Use this adapter when you need requests to survive page unload
550
- * (visibilitychange / beforeunload) — the browser will complete the request
551
- * even after the page is navigated away. Typical use: monitor / analytics flush.
552
- *
553
- * @example
554
- * ```typescript
555
- * import { APIClient, KeepAliveFetchAdapter } from './client';
556
- * const client = new APIClient(baseUrl, { httpClient: new KeepAliveFetchAdapter() });
557
- * ```
558
- */
559
- declare class KeepAliveFetchAdapter extends FetchAdapter {
560
- request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
1092
+ /** Browser localStorage. Falls back to no-op on SSR / private mode. */
1093
+ declare class LocalStorageAdapter implements StorageAdapter {
1094
+ getItem(key: string): string | null;
1095
+ setItem(key: string, value: string): void;
1096
+ removeItem(key: string): void;
1097
+ clear(): void;
1098
+ }
1099
+ /** In-memory store. Use for SSR, Electron main process, or tests. */
1100
+ declare class MemoryStorageAdapter implements StorageAdapter {
1101
+ private store;
1102
+ getItem(key: string): string | null;
1103
+ setItem(key: string, value: string): void;
1104
+ removeItem(key: string): void;
1105
+ clear(): void;
1106
+ }
1107
+ /** Cookie-backed storage (browser only). */
1108
+ declare class CookieStorageAdapter implements StorageAdapter {
1109
+ private opts;
1110
+ constructor(opts?: {
1111
+ domain?: string;
1112
+ path?: string;
1113
+ secure?: boolean;
1114
+ sameSite?: "Strict" | "Lax" | "None";
1115
+ maxAgeSeconds?: number;
1116
+ });
1117
+ getItem(key: string): string | null;
1118
+ setItem(key: string, value: string): void;
1119
+ removeItem(key: string): void;
561
1120
  }
562
1121
 
563
- /**
564
- * API Logger with Consola
565
- * Beautiful console logging for API requests and responses
566
- *
567
- * Installation:
568
- * npm install consola
569
- */
570
-
571
- /**
572
- * Request log data
573
- */
574
1122
  interface RequestLog {
575
1123
  method: string;
576
1124
  url: string;
@@ -578,9 +1126,6 @@ interface RequestLog {
578
1126
  body?: any;
579
1127
  timestamp: number;
580
1128
  }
581
- /**
582
- * Response log data
583
- */
584
1129
  interface ResponseLog {
585
1130
  status: number;
586
1131
  statusText: string;
@@ -588,9 +1133,6 @@ interface ResponseLog {
588
1133
  duration: number;
589
1134
  timestamp: number;
590
1135
  }
591
- /**
592
- * Error log data
593
- */
594
1136
  interface ErrorLog {
595
1137
  message: string;
596
1138
  statusCode?: number;
@@ -598,1529 +1140,1917 @@ interface ErrorLog {
598
1140
  duration: number;
599
1141
  timestamp: number;
600
1142
  }
601
- /**
602
- * Logger configuration
603
- */
604
1143
  interface LoggerConfig {
605
- /** Enable logging */
606
1144
  enabled: boolean;
607
- /** Log requests */
608
1145
  logRequests: boolean;
609
- /** Log responses */
610
1146
  logResponses: boolean;
611
- /** Log errors */
612
1147
  logErrors: boolean;
613
- /** Log request/response bodies */
614
1148
  logBodies: boolean;
615
- /** Log headers (excluding sensitive ones) */
616
1149
  logHeaders: boolean;
617
- /** Custom consola instance */
618
1150
  consola?: ConsolaInstance;
619
1151
  }
620
- /**
621
- * API Logger class
622
- */
623
1152
  declare class APILogger {
624
1153
  private config;
625
1154
  private consola;
626
1155
  constructor(config?: Partial<LoggerConfig>);
627
- /**
628
- * Enable logging
629
- */
630
1156
  enable(): void;
631
- /**
632
- * Disable logging
633
- */
634
1157
  disable(): void;
635
- /**
636
- * Update configuration
637
- */
638
1158
  setConfig(config: Partial<LoggerConfig>): void;
639
- /**
640
- * Filter sensitive headers
641
- */
642
1159
  private filterHeaders;
643
- /**
644
- * Log request
645
- */
646
1160
  logRequest(request: RequestLog): void;
647
- /**
648
- * Log response
649
- */
650
1161
  logResponse(request: RequestLog, response: ResponseLog): void;
651
- /**
652
- * Log error
653
- */
654
1162
  logError(request: RequestLog, error: ErrorLog): void;
655
- /**
656
- * Log general info
657
- */
658
1163
  info(message: string, ...args: any[]): void;
659
- /**
660
- * Log warning
661
- */
662
1164
  warn(message: string, ...args: any[]): void;
663
- /**
664
- * Log error
665
- */
666
1165
  error(message: string, ...args: any[]): void;
1166
+ debug(message: string, ...args: any[]): void;
1167
+ success(message: string, ...args: any[]): void;
1168
+ withTag(tag: string): ConsolaInstance;
1169
+ }
1170
+ declare const defaultLogger: APILogger;
1171
+
1172
+ type Options$4<TData extends TDataShape$2 = TDataShape$2, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$5<TData, ThrowOnError, TResponse> & {
667
1173
  /**
668
- * Log debug
1174
+ * You can provide a client instance returned by `createClient()` instead of
1175
+ * individual options. This might be also useful if you want to implement a
1176
+ * custom client.
669
1177
  */
670
- debug(message: string, ...args: any[]): void;
1178
+ client?: Client$4;
671
1179
  /**
672
- * Log success
1180
+ * You can pass arbitrary values through the `meta` object. This can be
1181
+ * used to access values that aren't defined as part of the SDK function.
673
1182
  */
674
- success(message: string, ...args: any[]): void;
1183
+ meta?: Record<string, unknown>;
1184
+ };
1185
+ declare class Cfg$2 {
675
1186
  /**
676
- * Create a sub-logger with prefix
1187
+ * List OAuth connections
1188
+ *
1189
+ * Get all OAuth connections for the current user.
677
1190
  */
678
- withTag(tag: string): ConsolaInstance;
679
- }
680
-
681
- /**
682
- * Retry Configuration and Utilities
683
- *
684
- * Provides automatic retry logic for failed HTTP requests using p-retry.
685
- * Retries only on network errors and server errors (5xx), not client errors (4xx).
686
- */
687
- /**
688
- * Information about a failed retry attempt.
689
- */
690
- interface FailedAttemptInfo {
691
- /** The error that caused the failure */
692
- error: Error;
693
- /** The attempt number (1-indexed) */
694
- attemptNumber: number;
695
- /** Number of retries left */
696
- retriesLeft: number;
1191
+ static cfgAccountsOauthConnectionsList<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthConnectionsListData, ThrowOnError>): RequestResult$2<CfgAccountsOauthConnectionsListResponses, unknown, ThrowOnError, "fields">;
1192
+ /**
1193
+ * Disconnect OAuth provider
1194
+ *
1195
+ * Remove OAuth connection for the specified provider.
1196
+ */
1197
+ static cfgAccountsOauthDisconnectCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthDisconnectCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthDisconnectCreateResponses, CfgAccountsOauthDisconnectCreateErrors, ThrowOnError, "fields">;
1198
+ /**
1199
+ * Start GitHub OAuth
1200
+ *
1201
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1202
+ */
1203
+ static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError, "fields">;
1204
+ /**
1205
+ * Complete GitHub OAuth
1206
+ *
1207
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1208
+ */
1209
+ static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError, "fields">;
1210
+ /**
1211
+ * List OAuth providers
1212
+ *
1213
+ * Get list of available OAuth providers for authentication.
1214
+ */
1215
+ static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError, "fields">;
1216
+ /**
1217
+ * Request OTP code to email.
1218
+ */
1219
+ static cfgAccountsOtpRequestCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpRequestCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpRequestCreateResponses, CfgAccountsOtpRequestCreateErrors, ThrowOnError, "fields">;
1220
+ /**
1221
+ * Verify OTP code and return JWT tokens or 2FA session.
1222
+ *
1223
+ * If user has 2FA enabled:
1224
+ * - Returns requires_2fa=True with session_id
1225
+ * - Client must complete 2FA verification at /cfg/totp/verify/
1226
+ *
1227
+ * If user has no 2FA:
1228
+ * - Returns JWT tokens and user data directly
1229
+ */
1230
+ static cfgAccountsOtpVerifyCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpVerifyCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpVerifyCreateResponses, CfgAccountsOtpVerifyCreateErrors, ThrowOnError, "fields">;
1231
+ /**
1232
+ * Get current user profile
1233
+ *
1234
+ * Retrieve the current authenticated user's profile information.
1235
+ */
1236
+ static cfgAccountsProfileRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsProfileRetrieveResponses, CfgAccountsProfileRetrieveErrors, ThrowOnError, "fields">;
1237
+ /**
1238
+ * Upload user avatar
1239
+ *
1240
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1241
+ */
1242
+ static cfgAccountsProfileAvatarCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileAvatarCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileAvatarCreateResponses, CfgAccountsProfileAvatarCreateErrors, ThrowOnError, "fields">;
1243
+ /**
1244
+ * Delete user account
1245
+ *
1246
+ *
1247
+ * Permanently delete the current user's account.
1248
+ *
1249
+ * This operation:
1250
+ * - Deactivates the account (user cannot log in)
1251
+ * - Anonymizes personal data (GDPR compliance)
1252
+ * - Frees up the email address for re-registration
1253
+ * - Preserves audit trail
1254
+ *
1255
+ * The account can be restored by an administrator if needed.
1256
+ *
1257
+ */
1258
+ static cfgAccountsProfileDeleteCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileDeleteCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileDeleteCreateResponses, CfgAccountsProfileDeleteCreateErrors, ThrowOnError, "fields">;
1259
+ /**
1260
+ * Partial update user profile
1261
+ *
1262
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
1263
+ */
1264
+ static cfgAccountsProfilePartialPartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialPartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialPartialUpdateResponses, CfgAccountsProfilePartialPartialUpdateErrors, ThrowOnError, "fields">;
1265
+ /**
1266
+ * Partial update user profile
1267
+ *
1268
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
1269
+ */
1270
+ static cfgAccountsProfilePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialUpdateResponses, CfgAccountsProfilePartialUpdateErrors, ThrowOnError, "fields">;
1271
+ /**
1272
+ * Update user profile
1273
+ *
1274
+ * Update the current authenticated user's profile information.
1275
+ */
1276
+ static cfgAccountsProfileUpdatePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdatePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdatePartialUpdateResponses, CfgAccountsProfileUpdatePartialUpdateErrors, ThrowOnError, "fields">;
1277
+ /**
1278
+ * Update user profile
1279
+ *
1280
+ * Update the current authenticated user's profile information.
1281
+ */
1282
+ static cfgAccountsProfileUpdateUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdateUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdateUpdateResponses, CfgAccountsProfileUpdateUpdateErrors, ThrowOnError, "fields">;
1283
+ /**
1284
+ * Refresh JWT token.
1285
+ */
1286
+ static cfgAccountsTokenRefreshCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsTokenRefreshCreateData, ThrowOnError>): RequestResult$2<CfgAccountsTokenRefreshCreateResponses, unknown, ThrowOnError, "fields">;
697
1287
  }
698
- /**
699
- * Retry configuration options.
700
- *
701
- * Uses exponential backoff with jitter by default to avoid thundering herd.
702
- */
703
- interface RetryConfig {
1288
+ declare class Accounts {
1289
+ /**
1290
+ * List OAuth connections
1291
+ *
1292
+ * Get all OAuth connections for the current user.
1293
+ */
1294
+ static cfgAccountsOauthConnectionsList<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthConnectionsListData, ThrowOnError>): RequestResult$2<CfgAccountsOauthConnectionsListResponses, unknown, ThrowOnError, "fields">;
1295
+ /**
1296
+ * Disconnect OAuth provider
1297
+ *
1298
+ * Remove OAuth connection for the specified provider.
1299
+ */
1300
+ static cfgAccountsOauthDisconnectCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthDisconnectCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthDisconnectCreateResponses, CfgAccountsOauthDisconnectCreateErrors, ThrowOnError, "fields">;
704
1301
  /**
705
- * Maximum number of retry attempts.
706
- * @default 3
1302
+ * Start GitHub OAuth
1303
+ *
1304
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1305
+ */
1306
+ static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError, "fields">;
1307
+ /**
1308
+ * Complete GitHub OAuth
1309
+ *
1310
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
707
1311
  */
708
- retries?: number;
1312
+ static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError, "fields">;
709
1313
  /**
710
- * Exponential backoff factor.
711
- * @default 2
1314
+ * List OAuth providers
1315
+ *
1316
+ * Get list of available OAuth providers for authentication.
712
1317
  */
713
- factor?: number;
1318
+ static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError, "fields">;
714
1319
  /**
715
- * Minimum wait time between retries (ms).
716
- * @default 1000
1320
+ * Request OTP code to email.
717
1321
  */
718
- minTimeout?: number;
1322
+ static cfgAccountsOtpRequestCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpRequestCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpRequestCreateResponses, CfgAccountsOtpRequestCreateErrors, ThrowOnError, "fields">;
719
1323
  /**
720
- * Maximum wait time between retries (ms).
721
- * @default 60000
1324
+ * Verify OTP code and return JWT tokens or 2FA session.
1325
+ *
1326
+ * If user has 2FA enabled:
1327
+ * - Returns requires_2fa=True with session_id
1328
+ * - Client must complete 2FA verification at /cfg/totp/verify/
1329
+ *
1330
+ * If user has no 2FA:
1331
+ * - Returns JWT tokens and user data directly
722
1332
  */
723
- maxTimeout?: number;
1333
+ static cfgAccountsOtpVerifyCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpVerifyCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpVerifyCreateResponses, CfgAccountsOtpVerifyCreateErrors, ThrowOnError, "fields">;
724
1334
  /**
725
- * Add randomness to wait times (jitter).
726
- * Helps avoid thundering herd problem.
727
- * @default true
1335
+ * Get current user profile
1336
+ *
1337
+ * Retrieve the current authenticated user's profile information.
1338
+ */
1339
+ static cfgAccountsProfileRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsProfileRetrieveResponses, CfgAccountsProfileRetrieveErrors, ThrowOnError, "fields">;
1340
+ /**
1341
+ * Upload user avatar
1342
+ *
1343
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1344
+ */
1345
+ static cfgAccountsProfileAvatarCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileAvatarCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileAvatarCreateResponses, CfgAccountsProfileAvatarCreateErrors, ThrowOnError, "fields">;
1346
+ /**
1347
+ * Delete user account
1348
+ *
1349
+ *
1350
+ * Permanently delete the current user's account.
1351
+ *
1352
+ * This operation:
1353
+ * - Deactivates the account (user cannot log in)
1354
+ * - Anonymizes personal data (GDPR compliance)
1355
+ * - Frees up the email address for re-registration
1356
+ * - Preserves audit trail
1357
+ *
1358
+ * The account can be restored by an administrator if needed.
1359
+ *
1360
+ */
1361
+ static cfgAccountsProfileDeleteCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileDeleteCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileDeleteCreateResponses, CfgAccountsProfileDeleteCreateErrors, ThrowOnError, "fields">;
1362
+ /**
1363
+ * Partial update user profile
1364
+ *
1365
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
728
1366
  */
729
- randomize?: boolean;
1367
+ static cfgAccountsProfilePartialPartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialPartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialPartialUpdateResponses, CfgAccountsProfilePartialPartialUpdateErrors, ThrowOnError, "fields">;
730
1368
  /**
731
- * Callback called on each failed attempt.
1369
+ * Partial update user profile
1370
+ *
1371
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
1372
+ */
1373
+ static cfgAccountsProfilePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialUpdateResponses, CfgAccountsProfilePartialUpdateErrors, ThrowOnError, "fields">;
1374
+ /**
1375
+ * Update user profile
1376
+ *
1377
+ * Update the current authenticated user's profile information.
1378
+ */
1379
+ static cfgAccountsProfileUpdatePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdatePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdatePartialUpdateResponses, CfgAccountsProfileUpdatePartialUpdateErrors, ThrowOnError, "fields">;
1380
+ /**
1381
+ * Update user profile
1382
+ *
1383
+ * Update the current authenticated user's profile information.
732
1384
  */
733
- onFailedAttempt?: (info: FailedAttemptInfo) => void;
1385
+ static cfgAccountsProfileUpdateUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdateUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdateUpdateResponses, CfgAccountsProfileUpdateUpdateErrors, ThrowOnError, "fields">;
1386
+ /**
1387
+ * Refresh JWT token.
1388
+ */
1389
+ static cfgAccountsTokenRefreshCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsTokenRefreshCreateData, ThrowOnError>): RequestResult$2<CfgAccountsTokenRefreshCreateResponses, unknown, ThrowOnError, "fields">;
734
1390
  }
735
- /**
736
- * Default retry configuration.
737
- */
738
- declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
739
- /**
740
- * Determine if an error should trigger a retry.
741
- *
742
- * Retries on:
743
- * - Network errors (connection refused, timeout, etc.)
744
- * - Server errors (5xx status codes)
745
- * - Rate limiting (429 status code)
746
- *
747
- * Does NOT retry on:
748
- * - Client errors (4xx except 429)
749
- * - Authentication errors (401, 403)
750
- * - Not found (404)
751
- *
752
- * @param error - The error to check
753
- * @returns true if should retry, false otherwise
754
- */
755
- declare function shouldRetry(error: any): boolean;
756
- /**
757
- * Wrap a function with retry logic.
758
- *
759
- * @param fn - Async function to retry
760
- * @param config - Retry configuration
761
- * @returns Result of the function
762
- *
763
- * @example
764
- * ```typescript
765
- * const result = await withRetry(
766
- * async () => fetch('https://api.example.com/users'),
767
- * { retries: 5, minTimeout: 2000 }
768
- * );
769
- * ```
770
- */
771
- declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
772
-
773
- /**
774
- * Async API client for Django CFG API.
775
- *
776
- * Usage:
777
- * ```typescript
778
- * const client = new APIClient('https://api.example.com');
779
- * const users = await client.users.list();
780
- * const post = await client.posts.create(newPost);
781
- *
782
- * // Custom HTTP adapter (e.g., Axios)
783
- * const client = new APIClient('https://api.example.com', {
784
- * httpClient: new AxiosAdapter()
785
- * });
786
- * ```
787
- */
788
- declare class APIClient {
789
- private baseUrl;
790
- private httpClient;
791
- private logger;
792
- private retryConfig;
793
- private tokenGetter;
794
- auth: Auth;
795
- oauth: Oauth;
796
- user_profile: UserProfile;
797
- accounts: Accounts;
798
- constructor(baseUrl: string, options?: {
799
- httpClient?: HttpClientAdapter$1;
800
- loggerConfig?: Partial<LoggerConfig>;
801
- retryConfig?: RetryConfig;
802
- tokenGetter?: () => string | null;
803
- });
1391
+ declare class OAuth {
804
1392
  /**
805
- * Get CSRF token from cookies (for SessionAuthentication).
1393
+ * List OAuth connections
806
1394
  *
807
- * Returns null if cookie doesn't exist (JWT-only auth).
1395
+ * Get all OAuth connections for the current user.
808
1396
  */
809
- getCsrfToken(): string | null;
1397
+ static cfgAccountsOauthConnectionsList<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthConnectionsListData, ThrowOnError>): RequestResult$2<CfgAccountsOauthConnectionsListResponses, unknown, ThrowOnError, "fields">;
810
1398
  /**
811
- * Get the base URL for building streaming/download URLs.
1399
+ * Disconnect OAuth provider
1400
+ *
1401
+ * Remove OAuth connection for the specified provider.
812
1402
  */
813
- getBaseUrl(): string;
1403
+ static cfgAccountsOauthDisconnectCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthDisconnectCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthDisconnectCreateResponses, CfgAccountsOauthDisconnectCreateErrors, ThrowOnError, "fields">;
814
1404
  /**
815
- * Get JWT token for URL authentication (used in streaming endpoints).
816
- * Returns null if no token getter is configured or no token is available.
1405
+ * Start GitHub OAuth
1406
+ *
1407
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
817
1408
  */
818
- getToken(): string | null;
1409
+ static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError, "fields">;
819
1410
  /**
820
- * Make HTTP request with Django CSRF and session handling.
821
- * Automatically retries on network errors and 5xx server errors.
1411
+ * Complete GitHub OAuth
1412
+ *
1413
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
822
1414
  */
823
- request<T>(method: string, path: string, options?: {
824
- params?: Record<string, any>;
825
- body?: any;
826
- formData?: FormData;
827
- binaryBody?: Blob | ArrayBuffer;
828
- headers?: Record<string, string>;
829
- responseType?: 'json' | 'text' | 'blob';
830
- }): Promise<T>;
1415
+ static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError, "fields">;
831
1416
  /**
832
- * Internal request method (without retry wrapper).
833
- * Used by request() method with optional retry logic.
1417
+ * List OAuth providers
1418
+ *
1419
+ * Get list of available OAuth providers for authentication.
834
1420
  */
835
- private _makeRequest;
1421
+ static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError, "fields">;
836
1422
  }
837
-
838
- /**
839
- * Storage adapters for cross-platform token storage.
840
- *
841
- * Supports:
842
- * - LocalStorage (browser)
843
- * - Cookies (SSR/browser)
844
- * - Memory (Node.js/Electron/testing)
845
- */
846
-
847
- /**
848
- * Storage adapter interface for cross-platform token storage.
849
- */
850
- interface StorageAdapter {
851
- getItem(key: string): string | null;
852
- setItem(key: string, value: string): void;
853
- removeItem(key: string): void;
1423
+ declare class UserProfile {
1424
+ /**
1425
+ * Get current user profile
1426
+ *
1427
+ * Retrieve the current authenticated user's profile information.
1428
+ */
1429
+ static cfgAccountsProfileRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsProfileRetrieveResponses, CfgAccountsProfileRetrieveErrors, ThrowOnError, "fields">;
1430
+ /**
1431
+ * Upload user avatar
1432
+ *
1433
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1434
+ */
1435
+ static cfgAccountsProfileAvatarCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileAvatarCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileAvatarCreateResponses, CfgAccountsProfileAvatarCreateErrors, ThrowOnError, "fields">;
1436
+ /**
1437
+ * Delete user account
1438
+ *
1439
+ *
1440
+ * Permanently delete the current user's account.
1441
+ *
1442
+ * This operation:
1443
+ * - Deactivates the account (user cannot log in)
1444
+ * - Anonymizes personal data (GDPR compliance)
1445
+ * - Frees up the email address for re-registration
1446
+ * - Preserves audit trail
1447
+ *
1448
+ * The account can be restored by an administrator if needed.
1449
+ *
1450
+ */
1451
+ static cfgAccountsProfileDeleteCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileDeleteCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileDeleteCreateResponses, CfgAccountsProfileDeleteCreateErrors, ThrowOnError, "fields">;
1452
+ /**
1453
+ * Partial update user profile
1454
+ *
1455
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
1456
+ */
1457
+ static cfgAccountsProfilePartialPartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialPartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialPartialUpdateResponses, CfgAccountsProfilePartialPartialUpdateErrors, ThrowOnError, "fields">;
1458
+ /**
1459
+ * Partial update user profile
1460
+ *
1461
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
1462
+ */
1463
+ static cfgAccountsProfilePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialUpdateResponses, CfgAccountsProfilePartialUpdateErrors, ThrowOnError, "fields">;
1464
+ /**
1465
+ * Update user profile
1466
+ *
1467
+ * Update the current authenticated user's profile information.
1468
+ */
1469
+ static cfgAccountsProfileUpdatePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdatePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdatePartialUpdateResponses, CfgAccountsProfileUpdatePartialUpdateErrors, ThrowOnError, "fields">;
1470
+ /**
1471
+ * Update user profile
1472
+ *
1473
+ * Update the current authenticated user's profile information.
1474
+ */
1475
+ static cfgAccountsProfileUpdateUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdateUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdateUpdateResponses, CfgAccountsProfileUpdateUpdateErrors, ThrowOnError, "fields">;
854
1476
  }
855
- /**
856
- * LocalStorage adapter with safe try-catch for browser environments.
857
- * Works in modern browsers with localStorage support.
858
- *
859
- * Note: This adapter uses window.localStorage and should only be used in browser/client environments.
860
- * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.
861
- */
862
- declare class LocalStorageAdapter implements StorageAdapter {
863
- private logger?;
864
- constructor(logger?: APILogger);
865
- getItem(key: string): string | null;
866
- setItem(key: string, value: string): void;
867
- removeItem(key: string): void;
1477
+ declare class Auth$2 {
1478
+ /**
1479
+ * Refresh JWT token.
1480
+ */
1481
+ static cfgAccountsTokenRefreshCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsTokenRefreshCreateData, ThrowOnError>): RequestResult$2<CfgAccountsTokenRefreshCreateResponses, unknown, ThrowOnError, "fields">;
868
1482
  }
869
- /**
870
- * Cookie-based storage adapter for SSR and browser environments.
871
- * Useful for Next.js, Nuxt.js, and other SSR frameworks.
872
- */
873
- declare class CookieStorageAdapter implements StorageAdapter {
874
- private logger?;
875
- constructor(logger?: APILogger);
876
- getItem(key: string): string | null;
877
- setItem(key: string, value: string): void;
878
- removeItem(key: string): void;
1483
+
1484
+ interface APIOptions$2 {
1485
+ /** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
1486
+ storage?: StorageAdapter;
1487
+ /** Logger config (defaults to dev-only). */
1488
+ logger?: Partial<LoggerConfig>;
1489
+ /** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
1490
+ locale?: string;
1491
+ /** API key sent as `X-API-Key`. Falls back to NEXT_PUBLIC_API_KEY. */
1492
+ apiKey?: string;
1493
+ /** Send Django session/CSRF cookies cross-origin. Defaults to true. */
1494
+ withCredentials?: boolean;
879
1495
  }
880
1496
  /**
881
- * In-memory storage adapter for Node.js, Electron, and testing environments.
882
- * Data is stored in RAM and cleared when process exits.
1497
+ * Self-contained API wrapper for this group.
1498
+ *
1499
+ * Each group has its own client + interceptor + token store. The interceptor
1500
+ * automatically attaches:
1501
+ * - `Authorization: Bearer <jwt>` from storage
1502
+ * - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
1503
+ * - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
1504
+ * - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
883
1505
  */
884
- declare class MemoryStorageAdapter implements StorageAdapter {
1506
+ declare class API$2 {
1507
+ private baseUrl;
885
1508
  private storage;
886
- private logger?;
887
- constructor(logger?: APILogger);
888
- getItem(key: string): string | null;
889
- setItem(key: string, value: string): void;
890
- removeItem(key: string): void;
1509
+ private locale;
1510
+ private apiKey;
1511
+ readonly logger: APILogger;
1512
+ readonly cfg: typeof Cfg$2;
1513
+ readonly accounts: typeof Accounts;
1514
+ readonly oAuth: typeof OAuth;
1515
+ readonly userProfile: typeof UserProfile;
1516
+ readonly auth: typeof Auth$2;
1517
+ constructor(baseUrl: string, opts?: APIOptions$2);
1518
+ getBaseUrl(): string;
1519
+ setBaseUrl(url: string): void;
1520
+ getToken(): string | null;
1521
+ setToken(token: string | null): void;
1522
+ getRefreshToken(): string | null;
1523
+ setRefreshToken(token: string | null): void;
1524
+ clearToken(): void;
1525
+ isAuthenticated(): boolean;
1526
+ getLocale(): string | null;
1527
+ setLocale(locale: string | null): void;
1528
+ getApiKey(): string | null;
1529
+ setApiKey(key: string | null): void;
891
1530
  }
892
1531
 
893
1532
  /**
894
- * Zod schema for AccountDeleteResponse
895
- *
896
- * This schema provides runtime validation and type inference.
897
- * * Response serializer for account deletion.
898
- * */
899
-
900
- /**
901
- * Response serializer for account deletion.
902
- */
903
- declare const AccountDeleteResponseSchema: z.ZodObject<{
904
- success: z.ZodBoolean;
905
- message: z.ZodString;
906
- }, z.core.$strip>;
907
- /**
908
- * Infer TypeScript type from Zod schema
909
- */
910
- type AccountDeleteResponse = z.infer<typeof AccountDeleteResponseSchema>;
911
-
912
- /**
913
- * Zod schema for CentrifugoToken
914
- *
915
- * This schema provides runtime validation and type inference.
916
- * * Nested serializer for Centrifugo WebSocket connection token.
917
- * */
918
-
919
- /**
920
- * Nested serializer for Centrifugo WebSocket connection token.
921
- */
922
- declare const CentrifugoTokenSchema: z.ZodObject<{
923
- token: z.ZodString;
924
- centrifugo_url: z.ZodString;
925
- expires_at: z.ZodString;
926
- channels: z.ZodArray<z.ZodString>;
927
- }, z.core.$strip>;
928
- /**
929
- * Infer TypeScript type from Zod schema
930
- */
931
- type CentrifugoToken = z.infer<typeof CentrifugoTokenSchema>;
932
-
933
- /**
934
- * Zod schema for CfgAccountsProfileAvatarCreateRequest
935
- *
936
- * This schema provides runtime validation and type inference.
937
- * */
938
-
939
- declare const CfgAccountsProfileAvatarCreateRequestSchema: z.ZodObject<{
940
- avatar: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>]>;
941
- }, z.core.$strip>;
942
- /**
943
- * Infer TypeScript type from Zod schema
944
- */
945
- type CfgAccountsProfileAvatarCreateRequest = z.infer<typeof CfgAccountsProfileAvatarCreateRequestSchema>;
946
-
947
- /**
948
- * Zod schema for OAuthAuthorizeRequestRequest
949
- *
950
- * This schema provides runtime validation and type inference.
951
- * * Request to start OAuth flow.
952
- * */
953
-
954
- /**
955
- * Request to start OAuth flow.
956
- */
957
- declare const OAuthAuthorizeRequestRequestSchema: z.ZodObject<{
958
- redirect_uri: z.ZodOptional<z.ZodString>;
959
- source_url: z.ZodOptional<z.ZodString>;
960
- }, z.core.$strip>;
961
- /**
962
- * Infer TypeScript type from Zod schema
963
- */
964
- type OAuthAuthorizeRequestRequest = z.infer<typeof OAuthAuthorizeRequestRequestSchema>;
965
-
966
- /**
967
- * Zod schema for OAuthAuthorizeResponse
968
- *
969
- * This schema provides runtime validation and type inference.
970
- * * Response with OAuth authorization URL.
971
- * */
972
-
973
- /**
974
- * Response with OAuth authorization URL.
975
- */
976
- declare const OAuthAuthorizeResponseSchema: z.ZodObject<{
977
- authorization_url: z.ZodString;
978
- state: z.ZodString;
979
- }, z.core.$strip>;
980
- /**
981
- * Infer TypeScript type from Zod schema
982
- */
983
- type OAuthAuthorizeResponse = z.infer<typeof OAuthAuthorizeResponseSchema>;
984
-
985
- /**
986
- * Zod schema for OAuthCallbackRequestRequest
987
- *
988
- * This schema provides runtime validation and type inference.
989
- * * Request to complete OAuth flow (callback handler).
990
- * */
991
-
992
- /**
993
- * Request to complete OAuth flow (callback handler).
994
- */
995
- declare const OAuthCallbackRequestRequestSchema: z.ZodObject<{
996
- code: z.ZodString;
997
- state: z.ZodString;
998
- redirect_uri: z.ZodOptional<z.ZodString>;
999
- }, z.core.$strip>;
1000
- /**
1001
- * Infer TypeScript type from Zod schema
1002
- */
1003
- type OAuthCallbackRequestRequest = z.infer<typeof OAuthCallbackRequestRequestSchema>;
1004
-
1005
- /**
1006
- * Zod schema for OAuthConnection
1007
- *
1008
- * This schema provides runtime validation and type inference.
1009
- * * Serializer for OAuth connection info (user-facing).
1010
- * */
1011
-
1012
- /**
1013
- * Serializer for OAuth connection info (user-facing).
1014
- */
1015
- declare const OAuthConnectionSchema: z.ZodObject<{
1016
- id: z.ZodNumber;
1017
- provider: z.ZodEnum<typeof OAuthConnectionProvider>;
1018
- provider_display: z.ZodString;
1019
- provider_username: z.ZodString;
1020
- provider_email: z.ZodEmail;
1021
- provider_avatar_url: z.ZodString;
1022
- connected_at: z.ZodString;
1023
- last_login_at: z.ZodString;
1024
- }, z.core.$strip>;
1025
- /**
1026
- * Infer TypeScript type from Zod schema
1027
- */
1028
- type OAuthConnection = z.infer<typeof OAuthConnectionSchema>;
1029
-
1030
- /**
1031
- * Zod schema for OAuthDisconnectRequestRequest
1032
- *
1033
- * This schema provides runtime validation and type inference.
1034
- * * Request to disconnect OAuth provider.
1035
- * */
1036
-
1037
- /**
1038
- * Request to disconnect OAuth provider.
1039
- */
1040
- declare const OAuthDisconnectRequestRequestSchema: z.ZodObject<{
1041
- provider: z.ZodEnum<typeof OAuthConnectionProvider>;
1042
- }, z.core.$strip>;
1043
- /**
1044
- * Infer TypeScript type from Zod schema
1045
- */
1046
- type OAuthDisconnectRequestRequest = z.infer<typeof OAuthDisconnectRequestRequestSchema>;
1047
-
1048
- /**
1049
- * Zod schema for OAuthError
1050
- *
1051
- * This schema provides runtime validation and type inference.
1052
- * * Error response for OAuth endpoints.
1053
- * */
1054
-
1055
- /**
1056
- * Error response for OAuth endpoints.
1057
- */
1058
- declare const OAuthErrorSchema: z.ZodObject<{
1059
- error: z.ZodString;
1060
- error_description: z.ZodOptional<z.ZodString>;
1061
- }, z.core.$strip>;
1062
- /**
1063
- * Infer TypeScript type from Zod schema
1064
- */
1065
- type OAuthError = z.infer<typeof OAuthErrorSchema>;
1066
-
1067
- /**
1068
- * Zod schema for OAuthProvidersResponse
1069
- *
1070
- * This schema provides runtime validation and type inference.
1071
- * * Response with available OAuth providers.
1072
- * */
1073
-
1074
- /**
1075
- * Response with available OAuth providers.
1076
- */
1077
- declare const OAuthProvidersResponseSchema: z.ZodObject<{
1078
- providers: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
1079
- }, z.core.$strip>;
1080
- /**
1081
- * Infer TypeScript type from Zod schema
1082
- */
1083
- type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>;
1084
-
1085
- /**
1086
- * Zod schema for OAuthTokenResponse
1087
- *
1088
- * This schema provides runtime validation and type inference.
1089
- * * Response with JWT tokens after OAuth authentication.
1090
-
1091
- When 2FA is required:
1092
- - requires_2fa: True
1093
- - session_id: UUID of 2FA verification session
1094
- - access/refresh/user: null
1095
-
1096
- When 2FA is not required:
1097
- - requires_2fa: False
1098
- - session_id: null
1099
- - access/refresh/user: populated
1100
- * */
1101
-
1102
- /**
1103
- * Response with JWT tokens after OAuth authentication.
1104
-
1105
- When 2FA is required:
1106
- - requires_2fa: True
1107
- - session_id: UUID of 2FA verification session
1108
- - access/refresh/user: null
1109
-
1110
- When 2FA is not required:
1111
- - requires_2fa: False
1112
- - session_id: null
1113
- - access/refresh/user: populated
1114
- */
1115
- declare const OAuthTokenResponseSchema: z.ZodObject<{
1116
- requires_2fa: z.ZodOptional<z.ZodBoolean>;
1117
- session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1118
- access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1119
- refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1120
- user: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
1121
- is_new_user: z.ZodBoolean;
1122
- is_new_connection: z.ZodBoolean;
1123
- should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
1124
- }, z.core.$strip>;
1125
- /**
1126
- * Infer TypeScript type from Zod schema
1127
- */
1128
- type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>;
1129
-
1130
- /**
1131
- * Zod schema for OTPErrorResponse
1132
- *
1133
- * This schema provides runtime validation and type inference.
1134
- * * Typed error response for OTP operations.
1135
-
1136
- error_code values:
1137
- - invalid_identifier — malformed email
1138
- - cooldown — too soon after last request (retry_after = seconds)
1139
- - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
1140
- - daily_limit — daily quota exceeded (retry_after = seconds until reset)
1141
- - rate_limited — IP-level rate limit hit (no retry_after)
1142
- - user_creation_failed — internal error creating account
1143
- - send_failed — transport error (email / SMS)
1144
- - internal_error — unexpected server error
1145
- * */
1146
-
1147
- /**
1148
- * Typed error response for OTP operations.
1149
-
1150
- error_code values:
1151
- - invalid_identifier — malformed email
1152
- - cooldown — too soon after last request (retry_after = seconds)
1153
- - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
1154
- - daily_limit — daily quota exceeded (retry_after = seconds until reset)
1155
- - rate_limited — IP-level rate limit hit (no retry_after)
1156
- - user_creation_failed — internal error creating account
1157
- - send_failed — transport error (email / SMS)
1158
- - internal_error — unexpected server error
1159
- */
1160
- declare const OTPErrorResponseSchema: z.ZodObject<{
1161
- error: z.ZodString;
1162
- error_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1163
- retry_after: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1164
- }, z.core.$strip>;
1165
- /**
1166
- * Infer TypeScript type from Zod schema
1167
- */
1168
- type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>;
1169
-
1170
- /**
1171
- * Zod schema for OTPRequestRequest
1172
- *
1173
- * This schema provides runtime validation and type inference.
1174
- * * Serializer for OTP request.
1175
- * */
1176
-
1177
- /**
1178
- * Serializer for OTP request.
1179
- */
1180
- declare const OTPRequestRequestSchema: z.ZodObject<{
1181
- identifier: z.ZodString;
1182
- source_url: z.ZodOptional<z.ZodString>;
1183
- }, z.core.$strip>;
1184
- /**
1185
- * Infer TypeScript type from Zod schema
1186
- */
1187
- type OTPRequestRequest = z.infer<typeof OTPRequestRequestSchema>;
1188
-
1189
- /**
1190
- * Zod schema for OTPRequestResponse
1191
- *
1192
- * This schema provides runtime validation and type inference.
1193
- * * OTP request response.
1194
- * */
1195
-
1196
- /**
1197
- * OTP request response.
1198
- */
1199
- declare const OTPRequestResponseSchema: z.ZodObject<{
1200
- message: z.ZodString;
1201
- }, z.core.$strip>;
1202
- /**
1203
- * Infer TypeScript type from Zod schema
1204
- */
1205
- type OTPRequestResponse = z.infer<typeof OTPRequestResponseSchema>;
1206
-
1207
- /**
1208
- * Zod schema for OTPVerifyRequest
1209
- *
1210
- * This schema provides runtime validation and type inference.
1211
- * * Serializer for OTP verification.
1212
- * */
1213
-
1214
- /**
1215
- * Serializer for OTP verification.
1216
- */
1217
- declare const OTPVerifyRequestSchema: z.ZodObject<{
1218
- identifier: z.ZodString;
1219
- otp: z.ZodString;
1220
- source_url: z.ZodOptional<z.ZodString>;
1221
- }, z.core.$strip>;
1222
- /**
1223
- * Infer TypeScript type from Zod schema
1224
- */
1225
- type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>;
1226
-
1227
- /**
1228
- * Zod schema for OTPVerifyResponse
1229
- *
1230
- * This schema provides runtime validation and type inference.
1231
- * * OTP verification response.
1232
-
1233
- When 2FA is required:
1234
- - requires_2fa: True
1235
- - session_id: UUID of 2FA verification session
1236
- - refresh/access/user: null
1237
-
1238
- When 2FA is not required:
1239
- - requires_2fa: False
1240
- - session_id: null
1241
- - refresh/access/user: populated
1242
- * */
1243
-
1244
- /**
1245
- * OTP verification response.
1246
-
1247
- When 2FA is required:
1248
- - requires_2fa: True
1249
- - session_id: UUID of 2FA verification session
1250
- - refresh/access/user: null
1251
-
1252
- When 2FA is not required:
1253
- - requires_2fa: False
1254
- - session_id: null
1255
- - refresh/access/user: populated
1256
- */
1257
- declare const OTPVerifyResponseSchema: z.ZodObject<{
1258
- requires_2fa: z.ZodOptional<z.ZodBoolean>;
1259
- session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1260
- refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1261
- access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1262
- user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1263
- id: z.ZodNumber;
1264
- email: z.ZodEmail;
1265
- first_name: z.ZodOptional<z.ZodString>;
1266
- last_name: z.ZodOptional<z.ZodString>;
1267
- full_name: z.ZodString;
1268
- initials: z.ZodString;
1269
- display_username: z.ZodString;
1270
- company: z.ZodOptional<z.ZodString>;
1271
- phone: z.ZodOptional<z.ZodString>;
1272
- position: z.ZodOptional<z.ZodString>;
1273
- language: z.ZodOptional<z.ZodString>;
1274
- avatar: z.ZodNullable<z.ZodString>;
1275
- is_staff: z.ZodBoolean;
1276
- is_superuser: z.ZodBoolean;
1277
- date_joined: z.ZodString;
1278
- last_login: z.ZodNullable<z.ZodString>;
1279
- unanswered_messages_count: z.ZodNumber;
1280
- centrifugo: z.ZodNullable<z.ZodObject<{
1281
- token: z.ZodString;
1282
- centrifugo_url: z.ZodString;
1283
- expires_at: z.ZodString;
1284
- channels: z.ZodArray<z.ZodString>;
1285
- }, z.core.$strip>>;
1286
- }, z.core.$strip>>>;
1287
- should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
1288
- }, z.core.$strip>;
1289
- /**
1290
- * Infer TypeScript type from Zod schema
1533
+ * HTTP API Error with DRF field-specific validation errors.
1291
1534
  */
1292
- type OTPVerifyResponse = z.infer<typeof OTPVerifyResponseSchema>;
1535
+ declare class APIError extends Error {
1536
+ statusCode: number;
1537
+ statusText: string;
1538
+ response: any;
1539
+ url: string;
1540
+ constructor(statusCode: number, statusText: string, response: any, url: string, message?: string);
1541
+ get details(): Record<string, any> | null;
1542
+ get fieldErrors(): Record<string, string[]> | null;
1543
+ get errorMessage(): string;
1544
+ get isValidationError(): boolean;
1545
+ get isAuthError(): boolean;
1546
+ get isPermissionError(): boolean;
1547
+ get isNotFoundError(): boolean;
1548
+ get isServerError(): boolean;
1549
+ }
1550
+ /** Network Error (connection failed, timeout, etc.) */
1551
+ declare class NetworkError extends Error {
1552
+ url: string;
1553
+ originalError?: Error;
1554
+ constructor(message: string, url: string, originalError?: Error);
1555
+ }
1293
1556
 
1294
- /**
1295
- * Zod schema for PatchedUserProfileUpdateRequest
1296
- *
1297
- * This schema provides runtime validation and type inference.
1298
- * * Serializer for updating user profile.
1299
- * */
1557
+ interface ValidationErrorDetail {
1558
+ operation: string;
1559
+ path: string;
1560
+ method: string;
1561
+ error: ZodError;
1562
+ response: any;
1563
+ timestamp: Date;
1564
+ }
1565
+ type ValidationErrorEvent = CustomEvent<ValidationErrorDetail>;
1566
+ declare function dispatchValidationError(detail: ValidationErrorDetail): void;
1567
+ declare function onValidationError(callback: (detail: ValidationErrorDetail) => void): () => void;
1568
+ declare function formatZodError(error: ZodError): string;
1300
1569
 
1301
- /**
1302
- * Serializer for updating user profile.
1303
- */
1304
- declare const PatchedUserProfileUpdateRequestSchema: z.ZodObject<{
1305
- first_name: z.ZodOptional<z.ZodString>;
1306
- last_name: z.ZodOptional<z.ZodString>;
1307
- company: z.ZodOptional<z.ZodString>;
1308
- phone: z.ZodOptional<z.ZodString>;
1309
- position: z.ZodOptional<z.ZodString>;
1310
- language: z.ZodOptional<z.ZodString>;
1311
- }, z.core.$strip>;
1312
- /**
1313
- * Infer TypeScript type from Zod schema
1314
- */
1315
- type PatchedUserProfileUpdateRequest = z.infer<typeof PatchedUserProfileUpdateRequestSchema>;
1570
+ type AuthToken$1 = string | undefined;
1571
+ interface Auth$1 {
1572
+ /**
1573
+ * Which part of the request do we use to send the auth?
1574
+ *
1575
+ * @default 'header'
1576
+ */
1577
+ in?: 'header' | 'query' | 'cookie';
1578
+ /**
1579
+ * Header or query parameter name.
1580
+ *
1581
+ * @default 'Authorization'
1582
+ */
1583
+ name?: string;
1584
+ scheme?: 'basic' | 'bearer';
1585
+ type: 'apiKey' | 'http';
1586
+ }
1316
1587
 
1317
- /**
1318
- * Zod schema for TokenRefresh
1319
- *
1320
- * This schema provides runtime validation and type inference.
1321
- * */
1588
+ interface SerializerOptions$1<T> {
1589
+ /**
1590
+ * @default true
1591
+ */
1592
+ explode: boolean;
1593
+ style: T;
1594
+ }
1595
+ type ArrayStyle$1 = 'form' | 'spaceDelimited' | 'pipeDelimited';
1596
+ type ObjectStyle$1 = 'form' | 'deepObject';
1597
+
1598
+ type QuerySerializer$1 = (query: Record<string, unknown>) => string;
1599
+ type BodySerializer$1 = (body: unknown) => unknown;
1600
+ type QuerySerializerOptionsObject$1 = {
1601
+ allowReserved?: boolean;
1602
+ array?: Partial<SerializerOptions$1<ArrayStyle$1>>;
1603
+ object?: Partial<SerializerOptions$1<ObjectStyle$1>>;
1604
+ };
1605
+ type QuerySerializerOptions$1 = QuerySerializerOptionsObject$1 & {
1606
+ /**
1607
+ * Per-parameter serialization overrides. When provided, these settings
1608
+ * override the global array/object settings for specific parameter names.
1609
+ */
1610
+ parameters?: Record<string, QuerySerializerOptionsObject$1>;
1611
+ };
1322
1612
 
1323
- declare const TokenRefreshSchema: z.ZodObject<{
1324
- access: z.ZodString;
1325
- refresh: z.ZodString;
1326
- }, z.core.$strip>;
1327
- /**
1328
- * Infer TypeScript type from Zod schema
1329
- */
1330
- type TokenRefresh = z.infer<typeof TokenRefreshSchema>;
1613
+ type HttpMethod$1 = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
1614
+ type Client$3<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
1615
+ /**
1616
+ * Returns the final request URL.
1617
+ */
1618
+ buildUrl: BuildUrlFn;
1619
+ getConfig: () => Config;
1620
+ request: RequestFn;
1621
+ setConfig: (config: Config) => Config;
1622
+ } & {
1623
+ [K in HttpMethod$1]: MethodFn;
1624
+ } & ([SseFn] extends [never] ? {
1625
+ sse?: never;
1626
+ } : {
1627
+ sse: {
1628
+ [K in HttpMethod$1]: SseFn;
1629
+ };
1630
+ });
1631
+ interface Config$3 {
1632
+ /**
1633
+ * Auth token or a function returning auth token. The resolved value will be
1634
+ * added to the request payload as defined by its `security` array.
1635
+ */
1636
+ auth?: ((auth: Auth$1) => Promise<AuthToken$1> | AuthToken$1) | AuthToken$1;
1637
+ /**
1638
+ * A function for serializing request body parameter. By default,
1639
+ * {@link JSON.stringify()} will be used.
1640
+ */
1641
+ bodySerializer?: BodySerializer$1 | null;
1642
+ /**
1643
+ * An object containing any HTTP headers that you want to pre-populate your
1644
+ * `Headers` object with.
1645
+ *
1646
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
1647
+ */
1648
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
1649
+ /**
1650
+ * The request method.
1651
+ *
1652
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
1653
+ */
1654
+ method?: Uppercase<HttpMethod$1>;
1655
+ /**
1656
+ * A function for serializing request query parameters. By default, arrays
1657
+ * will be exploded in form style, objects will be exploded in deepObject
1658
+ * style, and reserved characters are percent-encoded.
1659
+ *
1660
+ * This method will have no effect if the native `paramsSerializer()` Axios
1661
+ * API function is used.
1662
+ *
1663
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
1664
+ */
1665
+ querySerializer?: QuerySerializer$1 | QuerySerializerOptions$1;
1666
+ /**
1667
+ * A function validating request data. This is useful if you want to ensure
1668
+ * the request conforms to the desired shape, so it can be safely sent to
1669
+ * the server.
1670
+ */
1671
+ requestValidator?: (data: unknown) => Promise<unknown>;
1672
+ /**
1673
+ * A function transforming response data before it's returned. This is useful
1674
+ * for post-processing data, e.g., converting ISO strings into Date objects.
1675
+ */
1676
+ responseTransformer?: (data: unknown) => Promise<unknown>;
1677
+ /**
1678
+ * A function validating response data. This is useful if you want to ensure
1679
+ * the response conforms to the desired shape, so it can be safely passed to
1680
+ * the transformers and returned to the user.
1681
+ */
1682
+ responseValidator?: (data: unknown) => Promise<unknown>;
1683
+ }
1331
1684
 
1332
- /**
1333
- * Zod schema for TokenRefreshRequest
1334
- *
1335
- * This schema provides runtime validation and type inference.
1336
- * */
1685
+ type ServerSentEventsOptions$1<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$3, 'method' | 'responseTransformer' | 'responseValidator'> & {
1686
+ /**
1687
+ * Fetch API implementation. You can use this option to provide a custom
1688
+ * fetch instance.
1689
+ *
1690
+ * @default globalThis.fetch
1691
+ */
1692
+ fetch?: typeof fetch;
1693
+ /**
1694
+ * Implementing clients can call request interceptors inside this hook.
1695
+ */
1696
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
1697
+ /**
1698
+ * Callback invoked when a network or parsing error occurs during streaming.
1699
+ *
1700
+ * This option applies only if the endpoint returns a stream of events.
1701
+ *
1702
+ * @param error The error that occurred.
1703
+ */
1704
+ onSseError?: (error: unknown) => void;
1705
+ /**
1706
+ * Callback invoked when an event is streamed from the server.
1707
+ *
1708
+ * This option applies only if the endpoint returns a stream of events.
1709
+ *
1710
+ * @param event Event streamed from the server.
1711
+ * @returns Nothing (void).
1712
+ */
1713
+ onSseEvent?: (event: StreamEvent$1<TData>) => void;
1714
+ serializedBody?: RequestInit['body'];
1715
+ /**
1716
+ * Default retry delay in milliseconds.
1717
+ *
1718
+ * This option applies only if the endpoint returns a stream of events.
1719
+ *
1720
+ * @default 3000
1721
+ */
1722
+ sseDefaultRetryDelay?: number;
1723
+ /**
1724
+ * Maximum number of retry attempts before giving up.
1725
+ */
1726
+ sseMaxRetryAttempts?: number;
1727
+ /**
1728
+ * Maximum retry delay in milliseconds.
1729
+ *
1730
+ * Applies only when exponential backoff is used.
1731
+ *
1732
+ * This option applies only if the endpoint returns a stream of events.
1733
+ *
1734
+ * @default 30000
1735
+ */
1736
+ sseMaxRetryDelay?: number;
1737
+ /**
1738
+ * Optional sleep function for retry backoff.
1739
+ *
1740
+ * Defaults to using `setTimeout`.
1741
+ */
1742
+ sseSleepFn?: (ms: number) => Promise<void>;
1743
+ url: string;
1744
+ };
1745
+ interface StreamEvent$1<TData = unknown> {
1746
+ data: TData;
1747
+ event?: string;
1748
+ id?: string;
1749
+ retry?: number;
1750
+ }
1751
+ type ServerSentEventsResult$1<TData = unknown, TReturn = void, TNext = unknown> = {
1752
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
1753
+ };
1754
+
1755
+ type ErrInterceptor$1<Err, Res, Req, Options> = (error: Err,
1756
+ /** response may be undefined due to a network error where no response object is produced */
1757
+ response: Res | undefined,
1758
+ /** request may be undefined, because error may be from building the request object itself */
1759
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
1760
+ type ReqInterceptor$1<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
1761
+ type ResInterceptor$1<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
1762
+ declare class Interceptors$1<Interceptor> {
1763
+ fns: Array<Interceptor | null>;
1764
+ clear(): void;
1765
+ eject(id: number | Interceptor): void;
1766
+ exists(id: number | Interceptor): boolean;
1767
+ getInterceptorIndex(id: number | Interceptor): number;
1768
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
1769
+ use(fn: Interceptor): number;
1770
+ }
1771
+ interface Middleware$1<Req, Res, Err, Options> {
1772
+ error: Interceptors$1<ErrInterceptor$1<Err, Res, Req, Options>>;
1773
+ request: Interceptors$1<ReqInterceptor$1<Req, Options>>;
1774
+ response: Interceptors$1<ResInterceptor$1<Res, Req, Options>>;
1775
+ }
1337
1776
 
1338
- declare const TokenRefreshRequestSchema: z.ZodObject<{
1339
- refresh: z.ZodString;
1340
- }, z.core.$strip>;
1341
- /**
1342
- * Infer TypeScript type from Zod schema
1343
- */
1344
- type TokenRefreshRequest = z.infer<typeof TokenRefreshRequestSchema>;
1777
+ type ResponseStyle$1 = 'data' | 'fields';
1778
+ interface Config$2<T extends ClientOptions$3 = ClientOptions$3> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$3 {
1779
+ /**
1780
+ * Base URL for all requests made by this client.
1781
+ */
1782
+ baseUrl?: T['baseUrl'];
1783
+ /**
1784
+ * Fetch API implementation. You can use this option to provide a custom
1785
+ * fetch instance.
1786
+ *
1787
+ * @default globalThis.fetch
1788
+ */
1789
+ fetch?: typeof fetch;
1790
+ /**
1791
+ * Please don't use the Fetch client for Next.js applications. The `next`
1792
+ * options won't have any effect.
1793
+ *
1794
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
1795
+ */
1796
+ next?: never;
1797
+ /**
1798
+ * Return the response data parsed in a specified format. By default, `auto`
1799
+ * will infer the appropriate method from the `Content-Type` response header.
1800
+ * You can override this behavior with any of the {@link Body} methods.
1801
+ * Select `stream` if you don't want to parse response data at all.
1802
+ *
1803
+ * @default 'auto'
1804
+ */
1805
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
1806
+ /**
1807
+ * Should we return only data or multiple fields (data, error, response, etc.)?
1808
+ *
1809
+ * @default 'fields'
1810
+ */
1811
+ responseStyle?: ResponseStyle$1;
1812
+ /**
1813
+ * Throw an error instead of returning it in the response?
1814
+ *
1815
+ * @default false
1816
+ */
1817
+ throwOnError?: T['throwOnError'];
1818
+ }
1819
+ interface RequestOptions$1<TData = unknown, TResponseStyle extends ResponseStyle$1 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$2<{
1820
+ responseStyle: TResponseStyle;
1821
+ throwOnError: ThrowOnError;
1822
+ }>, Pick<ServerSentEventsOptions$1<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
1823
+ /**
1824
+ * Any body that you want to add to your request.
1825
+ *
1826
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
1827
+ */
1828
+ body?: unknown;
1829
+ path?: Record<string, unknown>;
1830
+ query?: Record<string, unknown>;
1831
+ /**
1832
+ * Security mechanism(s) to use for the request.
1833
+ */
1834
+ security?: ReadonlyArray<Auth$1>;
1835
+ url: Url;
1836
+ }
1837
+ interface ResolvedRequestOptions$1<TResponseStyle extends ResponseStyle$1 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions$1<unknown, TResponseStyle, ThrowOnError, Url> {
1838
+ headers: Headers;
1839
+ serializedBody?: string;
1840
+ }
1841
+ type RequestResult$1<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle$1 = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
1842
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1843
+ request: Request;
1844
+ response: Response;
1845
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
1846
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1847
+ error: undefined;
1848
+ } | {
1849
+ data: undefined;
1850
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
1851
+ }) & {
1852
+ /** request may be undefined, because error may be from building the request object itself */
1853
+ request?: Request;
1854
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
1855
+ response?: Response;
1856
+ }>;
1857
+ interface ClientOptions$3 {
1858
+ baseUrl?: string;
1859
+ responseStyle?: ResponseStyle$1;
1860
+ throwOnError?: boolean;
1861
+ }
1862
+ type MethodFn$1 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$1 = 'fields'>(options: Omit<RequestOptions$1<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult$1<TData, TError, ThrowOnError, TResponseStyle>;
1863
+ type SseFn$1 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$1 = 'fields'>(options: Omit<RequestOptions$1<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult$1<TData, TError>>;
1864
+ type RequestFn$1 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$1 = 'fields'>(options: Omit<RequestOptions$1<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions$1<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult$1<TData, TError, ThrowOnError, TResponseStyle>;
1865
+ type BuildUrlFn$1 = <TData extends {
1866
+ body?: unknown;
1867
+ path?: Record<string, unknown>;
1868
+ query?: Record<string, unknown>;
1869
+ url: string;
1870
+ }>(options: TData & Options$3<TData>) => string;
1871
+ type Client$2 = Client$3<RequestFn$1, Config$2, MethodFn$1, BuildUrlFn$1, SseFn$1> & {
1872
+ interceptors: Middleware$1<Request, Response, unknown, ResolvedRequestOptions$1>;
1873
+ };
1874
+ interface TDataShape$1 {
1875
+ body?: unknown;
1876
+ headers?: unknown;
1877
+ path?: unknown;
1878
+ query?: unknown;
1879
+ url: string;
1880
+ }
1881
+ type OmitKeys$1<T, K> = Pick<T, Exclude<keyof T, K>>;
1882
+ type Options$3<TData extends TDataShape$1 = TDataShape$1, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle$1 = 'fields'> = OmitKeys$1<RequestOptions$1<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
1345
1883
 
1884
+ type ClientOptions$2 = {
1885
+ baseUrl: 'http://localhost:8000' | (string & {});
1886
+ };
1346
1887
  /**
1347
- * Zod schema for User
1888
+ * ConnectionTokenResponse
1348
1889
  *
1349
- * This schema provides runtime validation and type inference.
1350
- * * Serializer for user details.
1351
- * */
1352
-
1353
- /**
1354
- * Serializer for user details.
1355
- */
1356
- declare const UserSchema: z.ZodObject<{
1357
- id: z.ZodNumber;
1358
- email: z.ZodEmail;
1359
- first_name: z.ZodOptional<z.ZodString>;
1360
- last_name: z.ZodOptional<z.ZodString>;
1361
- full_name: z.ZodString;
1362
- initials: z.ZodString;
1363
- display_username: z.ZodString;
1364
- company: z.ZodOptional<z.ZodString>;
1365
- phone: z.ZodOptional<z.ZodString>;
1366
- position: z.ZodOptional<z.ZodString>;
1367
- language: z.ZodOptional<z.ZodString>;
1368
- avatar: z.ZodNullable<z.ZodString>;
1369
- is_staff: z.ZodBoolean;
1370
- is_superuser: z.ZodBoolean;
1371
- date_joined: z.ZodString;
1372
- last_login: z.ZodNullable<z.ZodString>;
1373
- unanswered_messages_count: z.ZodNumber;
1374
- centrifugo: z.ZodNullable<z.ZodObject<{
1375
- token: z.ZodString;
1376
- centrifugo_url: z.ZodString;
1377
- expires_at: z.ZodString;
1378
- channels: z.ZodArray<z.ZodString>;
1379
- }, z.core.$strip>>;
1380
- }, z.core.$strip>;
1381
- /**
1382
- * Infer TypeScript type from Zod schema
1890
+ * Response model for Centrifugo connection token.
1383
1891
  */
1384
- type User = z.infer<typeof UserSchema>;
1385
-
1386
- /**
1387
- * Zod schema for UserProfileUpdateRequest
1388
- *
1389
- * This schema provides runtime validation and type inference.
1390
- * * Serializer for updating user profile.
1391
- * */
1892
+ type ConnectionTokenResponse = {
1893
+ /**
1894
+ * Token
1895
+ *
1896
+ * JWT token for Centrifugo connection
1897
+ */
1898
+ token: string;
1899
+ /**
1900
+ * Centrifugo Url
1901
+ *
1902
+ * Centrifugo WebSocket URL
1903
+ */
1904
+ centrifugo_url: string;
1905
+ /**
1906
+ * Expires At
1907
+ *
1908
+ * Token expiration time (ISO 8601)
1909
+ */
1910
+ expires_at: string;
1911
+ /**
1912
+ * Channels
1913
+ *
1914
+ * List of allowed channels
1915
+ */
1916
+ channels: Array<string>;
1917
+ };
1918
+ type CfgCentrifugoAuthTokenRetrieveData = {
1919
+ body?: never;
1920
+ path?: never;
1921
+ query?: never;
1922
+ url: '/cfg/centrifugo/auth/token/';
1923
+ };
1924
+ type CfgCentrifugoAuthTokenRetrieveErrors = {
1925
+ /**
1926
+ * Unauthorized - authentication required
1927
+ */
1928
+ 401: unknown;
1929
+ /**
1930
+ * Server error
1931
+ */
1932
+ 500: unknown;
1933
+ };
1934
+ type CfgCentrifugoAuthTokenRetrieveResponses = {
1935
+ 200: ConnectionTokenResponse;
1936
+ };
1937
+ type CfgCentrifugoAuthTokenRetrieveResponse = CfgCentrifugoAuthTokenRetrieveResponses[keyof CfgCentrifugoAuthTokenRetrieveResponses];
1938
+
1939
+ type types_gen$1_CfgCentrifugoAuthTokenRetrieveData = CfgCentrifugoAuthTokenRetrieveData;
1940
+ type types_gen$1_CfgCentrifugoAuthTokenRetrieveErrors = CfgCentrifugoAuthTokenRetrieveErrors;
1941
+ type types_gen$1_CfgCentrifugoAuthTokenRetrieveResponse = CfgCentrifugoAuthTokenRetrieveResponse;
1942
+ type types_gen$1_CfgCentrifugoAuthTokenRetrieveResponses = CfgCentrifugoAuthTokenRetrieveResponses;
1943
+ type types_gen$1_ConnectionTokenResponse = ConnectionTokenResponse;
1944
+ declare namespace types_gen$1 {
1945
+ export type { types_gen$1_CfgCentrifugoAuthTokenRetrieveData as CfgCentrifugoAuthTokenRetrieveData, types_gen$1_CfgCentrifugoAuthTokenRetrieveErrors as CfgCentrifugoAuthTokenRetrieveErrors, types_gen$1_CfgCentrifugoAuthTokenRetrieveResponse as CfgCentrifugoAuthTokenRetrieveResponse, types_gen$1_CfgCentrifugoAuthTokenRetrieveResponses as CfgCentrifugoAuthTokenRetrieveResponses, ClientOptions$2 as ClientOptions, types_gen$1_ConnectionTokenResponse as ConnectionTokenResponse };
1946
+ }
1392
1947
 
1393
- /**
1394
- * Serializer for updating user profile.
1395
- */
1396
- declare const UserProfileUpdateRequestSchema: z.ZodObject<{
1397
- first_name: z.ZodOptional<z.ZodString>;
1398
- last_name: z.ZodOptional<z.ZodString>;
1399
- company: z.ZodOptional<z.ZodString>;
1400
- phone: z.ZodOptional<z.ZodString>;
1401
- position: z.ZodOptional<z.ZodString>;
1402
- language: z.ZodOptional<z.ZodString>;
1403
- }, z.core.$strip>;
1404
- /**
1405
- * Infer TypeScript type from Zod schema
1406
- */
1407
- type UserProfileUpdateRequest = z.infer<typeof UserProfileUpdateRequestSchema>;
1948
+ type Options$2<TData extends TDataShape$1 = TDataShape$1, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$3<TData, ThrowOnError, TResponse> & {
1949
+ /**
1950
+ * You can provide a client instance returned by `createClient()` instead of
1951
+ * individual options. This might be also useful if you want to implement a
1952
+ * custom client.
1953
+ */
1954
+ client?: Client$2;
1955
+ /**
1956
+ * You can pass arbitrary values through the `meta` object. This can be
1957
+ * used to access values that aren't defined as part of the SDK function.
1958
+ */
1959
+ meta?: Record<string, unknown>;
1960
+ };
1961
+ declare class Cfg$1 {
1962
+ /**
1963
+ * Get Centrifugo connection token
1964
+ *
1965
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
1966
+ */
1967
+ static cfgCentrifugoAuthTokenRetrieve<ThrowOnError extends boolean = false>(options?: Options$2<CfgCentrifugoAuthTokenRetrieveData, ThrowOnError>): RequestResult$1<CfgCentrifugoAuthTokenRetrieveResponses, CfgCentrifugoAuthTokenRetrieveErrors, ThrowOnError, "fields">;
1968
+ }
1969
+ declare class Centrifugo {
1970
+ /**
1971
+ * Get Centrifugo connection token
1972
+ *
1973
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
1974
+ */
1975
+ static cfgCentrifugoAuthTokenRetrieve<ThrowOnError extends boolean = false>(options?: Options$2<CfgCentrifugoAuthTokenRetrieveData, ThrowOnError>): RequestResult$1<CfgCentrifugoAuthTokenRetrieveResponses, CfgCentrifugoAuthTokenRetrieveErrors, ThrowOnError, "fields">;
1976
+ }
1977
+ declare class CentrifugoAuth {
1978
+ /**
1979
+ * Get Centrifugo connection token
1980
+ *
1981
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
1982
+ */
1983
+ static cfgCentrifugoAuthTokenRetrieve<ThrowOnError extends boolean = false>(options?: Options$2<CfgCentrifugoAuthTokenRetrieveData, ThrowOnError>): RequestResult$1<CfgCentrifugoAuthTokenRetrieveResponses, CfgCentrifugoAuthTokenRetrieveErrors, ThrowOnError, "fields">;
1984
+ }
1408
1985
 
1986
+ interface APIOptions$1 {
1987
+ /** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
1988
+ storage?: StorageAdapter;
1989
+ /** Logger config (defaults to dev-only). */
1990
+ logger?: Partial<LoggerConfig>;
1991
+ /** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
1992
+ locale?: string;
1993
+ /** API key sent as `X-API-Key`. Falls back to NEXT_PUBLIC_API_KEY. */
1994
+ apiKey?: string;
1995
+ /** Send Django session/CSRF cookies cross-origin. Defaults to true. */
1996
+ withCredentials?: boolean;
1997
+ }
1409
1998
  /**
1410
- * Zod Schemas - Runtime validation and type inference
1999
+ * Self-contained API wrapper for this group.
1411
2000
  *
1412
- * Auto-generated from OpenAPI specification.
1413
- * Provides runtime validation for API requests and responses.
1414
- *
1415
- * Usage:
1416
- * ```typescript
1417
- * import { UserSchema } from './schemas'
1418
- *
1419
- * // Validate data
1420
- * const user = UserSchema.parse(data)
1421
- *
1422
- * // Type inference
1423
- * type User = z.infer<typeof UserSchema>
1424
- * ```
2001
+ * Each group has its own client + interceptor + token store. The interceptor
2002
+ * automatically attaches:
2003
+ * - `Authorization: Bearer <jwt>` from storage
2004
+ * - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
2005
+ * - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
2006
+ * - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
1425
2007
  */
2008
+ declare class API$1 {
2009
+ private baseUrl;
2010
+ private storage;
2011
+ private locale;
2012
+ private apiKey;
2013
+ readonly logger: APILogger;
2014
+ readonly cfg: typeof Cfg$1;
2015
+ readonly centrifugo: typeof Centrifugo;
2016
+ readonly centrifugoAuth: typeof CentrifugoAuth;
2017
+ constructor(baseUrl: string, opts?: APIOptions$1);
2018
+ getBaseUrl(): string;
2019
+ setBaseUrl(url: string): void;
2020
+ getToken(): string | null;
2021
+ setToken(token: string | null): void;
2022
+ getRefreshToken(): string | null;
2023
+ setRefreshToken(token: string | null): void;
2024
+ clearToken(): void;
2025
+ isAuthenticated(): boolean;
2026
+ getLocale(): string | null;
2027
+ setLocale(locale: string | null): void;
2028
+ getApiKey(): string | null;
2029
+ setApiKey(key: string | null): void;
2030
+ }
1426
2031
 
1427
- type index$2_AccountDeleteResponse = AccountDeleteResponse;
1428
- declare const index$2_AccountDeleteResponseSchema: typeof AccountDeleteResponseSchema;
1429
- type index$2_CentrifugoToken = CentrifugoToken;
1430
- declare const index$2_CentrifugoTokenSchema: typeof CentrifugoTokenSchema;
1431
- type index$2_CfgAccountsProfileAvatarCreateRequest = CfgAccountsProfileAvatarCreateRequest;
1432
- declare const index$2_CfgAccountsProfileAvatarCreateRequestSchema: typeof CfgAccountsProfileAvatarCreateRequestSchema;
1433
- type index$2_OAuthAuthorizeRequestRequest = OAuthAuthorizeRequestRequest;
1434
- declare const index$2_OAuthAuthorizeRequestRequestSchema: typeof OAuthAuthorizeRequestRequestSchema;
1435
- type index$2_OAuthAuthorizeResponse = OAuthAuthorizeResponse;
1436
- declare const index$2_OAuthAuthorizeResponseSchema: typeof OAuthAuthorizeResponseSchema;
1437
- type index$2_OAuthCallbackRequestRequest = OAuthCallbackRequestRequest;
1438
- declare const index$2_OAuthCallbackRequestRequestSchema: typeof OAuthCallbackRequestRequestSchema;
1439
- type index$2_OAuthConnection = OAuthConnection;
1440
- declare const index$2_OAuthConnectionSchema: typeof OAuthConnectionSchema;
1441
- type index$2_OAuthDisconnectRequestRequest = OAuthDisconnectRequestRequest;
1442
- declare const index$2_OAuthDisconnectRequestRequestSchema: typeof OAuthDisconnectRequestRequestSchema;
1443
- type index$2_OAuthError = OAuthError;
1444
- declare const index$2_OAuthErrorSchema: typeof OAuthErrorSchema;
1445
- type index$2_OAuthProvidersResponse = OAuthProvidersResponse;
1446
- declare const index$2_OAuthProvidersResponseSchema: typeof OAuthProvidersResponseSchema;
1447
- type index$2_OAuthTokenResponse = OAuthTokenResponse;
1448
- declare const index$2_OAuthTokenResponseSchema: typeof OAuthTokenResponseSchema;
1449
- type index$2_OTPErrorResponse = OTPErrorResponse;
1450
- declare const index$2_OTPErrorResponseSchema: typeof OTPErrorResponseSchema;
1451
- type index$2_OTPRequestRequest = OTPRequestRequest;
1452
- declare const index$2_OTPRequestRequestSchema: typeof OTPRequestRequestSchema;
1453
- type index$2_OTPRequestResponse = OTPRequestResponse;
1454
- declare const index$2_OTPRequestResponseSchema: typeof OTPRequestResponseSchema;
1455
- type index$2_OTPVerifyRequest = OTPVerifyRequest;
1456
- declare const index$2_OTPVerifyRequestSchema: typeof OTPVerifyRequestSchema;
1457
- type index$2_OTPVerifyResponse = OTPVerifyResponse;
1458
- declare const index$2_OTPVerifyResponseSchema: typeof OTPVerifyResponseSchema;
1459
- type index$2_PatchedUserProfileUpdateRequest = PatchedUserProfileUpdateRequest;
1460
- declare const index$2_PatchedUserProfileUpdateRequestSchema: typeof PatchedUserProfileUpdateRequestSchema;
1461
- type index$2_TokenRefresh = TokenRefresh;
1462
- type index$2_TokenRefreshRequest = TokenRefreshRequest;
1463
- declare const index$2_TokenRefreshRequestSchema: typeof TokenRefreshRequestSchema;
1464
- declare const index$2_TokenRefreshSchema: typeof TokenRefreshSchema;
1465
- type index$2_User = User;
1466
- type index$2_UserProfileUpdateRequest = UserProfileUpdateRequest;
1467
- declare const index$2_UserProfileUpdateRequestSchema: typeof UserProfileUpdateRequestSchema;
1468
- declare const index$2_UserSchema: typeof UserSchema;
1469
- declare namespace index$2 {
1470
- export { type index$2_AccountDeleteResponse as AccountDeleteResponse, index$2_AccountDeleteResponseSchema as AccountDeleteResponseSchema, type index$2_CentrifugoToken as CentrifugoToken, index$2_CentrifugoTokenSchema as CentrifugoTokenSchema, type index$2_CfgAccountsProfileAvatarCreateRequest as CfgAccountsProfileAvatarCreateRequest, index$2_CfgAccountsProfileAvatarCreateRequestSchema as CfgAccountsProfileAvatarCreateRequestSchema, type index$2_OAuthAuthorizeRequestRequest as OAuthAuthorizeRequestRequest, index$2_OAuthAuthorizeRequestRequestSchema as OAuthAuthorizeRequestRequestSchema, type index$2_OAuthAuthorizeResponse as OAuthAuthorizeResponse, index$2_OAuthAuthorizeResponseSchema as OAuthAuthorizeResponseSchema, type index$2_OAuthCallbackRequestRequest as OAuthCallbackRequestRequest, index$2_OAuthCallbackRequestRequestSchema as OAuthCallbackRequestRequestSchema, type index$2_OAuthConnection as OAuthConnection, index$2_OAuthConnectionSchema as OAuthConnectionSchema, type index$2_OAuthDisconnectRequestRequest as OAuthDisconnectRequestRequest, index$2_OAuthDisconnectRequestRequestSchema as OAuthDisconnectRequestRequestSchema, type index$2_OAuthError as OAuthError, index$2_OAuthErrorSchema as OAuthErrorSchema, type index$2_OAuthProvidersResponse as OAuthProvidersResponse, index$2_OAuthProvidersResponseSchema as OAuthProvidersResponseSchema, type index$2_OAuthTokenResponse as OAuthTokenResponse, index$2_OAuthTokenResponseSchema as OAuthTokenResponseSchema, type index$2_OTPErrorResponse as OTPErrorResponse, index$2_OTPErrorResponseSchema as OTPErrorResponseSchema, type index$2_OTPRequestRequest as OTPRequestRequest, index$2_OTPRequestRequestSchema as OTPRequestRequestSchema, type index$2_OTPRequestResponse as OTPRequestResponse, index$2_OTPRequestResponseSchema as OTPRequestResponseSchema, type index$2_OTPVerifyRequest as OTPVerifyRequest, index$2_OTPVerifyRequestSchema as OTPVerifyRequestSchema, type index$2_OTPVerifyResponse as OTPVerifyResponse, index$2_OTPVerifyResponseSchema as OTPVerifyResponseSchema, type index$2_PatchedUserProfileUpdateRequest as PatchedUserProfileUpdateRequest, index$2_PatchedUserProfileUpdateRequestSchema as PatchedUserProfileUpdateRequestSchema, type index$2_TokenRefresh as TokenRefresh, type index$2_TokenRefreshRequest as TokenRefreshRequest, index$2_TokenRefreshRequestSchema as TokenRefreshRequestSchema, index$2_TokenRefreshSchema as TokenRefreshSchema, type index$2_User as User, type index$2_UserProfileUpdateRequest as UserProfileUpdateRequest, index$2_UserProfileUpdateRequestSchema as UserProfileUpdateRequestSchema, index$2_UserSchema as UserSchema };
2032
+ type AuthToken = string | undefined;
2033
+ interface Auth {
2034
+ /**
2035
+ * Which part of the request do we use to send the auth?
2036
+ *
2037
+ * @default 'header'
2038
+ */
2039
+ in?: 'header' | 'query' | 'cookie';
2040
+ /**
2041
+ * Header or query parameter name.
2042
+ *
2043
+ * @default 'Authorization'
2044
+ */
2045
+ name?: string;
2046
+ scheme?: 'basic' | 'bearer';
2047
+ type: 'apiKey' | 'http';
1471
2048
  }
1472
2049
 
1473
- /**
1474
- * Zod Validation Events - Browser CustomEvent integration
1475
- *
1476
- * Dispatches browser CustomEvents when Zod validation fails, allowing
1477
- * React/frontend apps to listen and handle validation errors globally.
1478
- *
1479
- * @example
1480
- * ```typescript
1481
- * // In your React app
1482
- * window.addEventListener('zod-validation-error', (event) => {
1483
- * const { operation, path, method, error, response } = event.detail;
1484
- * console.error(`Validation failed for ${method} ${path}`, error);
1485
- * // Show toast notification, log to Sentry, etc.
1486
- * });
1487
- * ```
1488
- */
2050
+ interface SerializerOptions<T> {
2051
+ /**
2052
+ * @default true
2053
+ */
2054
+ explode: boolean;
2055
+ style: T;
2056
+ }
2057
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
2058
+ type ObjectStyle = 'form' | 'deepObject';
2059
+
2060
+ type QuerySerializer = (query: Record<string, unknown>) => string;
2061
+ type BodySerializer = (body: unknown) => unknown;
2062
+ type QuerySerializerOptionsObject = {
2063
+ allowReserved?: boolean;
2064
+ array?: Partial<SerializerOptions<ArrayStyle>>;
2065
+ object?: Partial<SerializerOptions<ObjectStyle>>;
2066
+ };
2067
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
2068
+ /**
2069
+ * Per-parameter serialization overrides. When provided, these settings
2070
+ * override the global array/object settings for specific parameter names.
2071
+ */
2072
+ parameters?: Record<string, QuerySerializerOptionsObject>;
2073
+ };
1489
2074
 
1490
- /**
1491
- * Validation error event detail
1492
- */
1493
- interface ValidationErrorDetail {
1494
- /** Operation/function name that failed validation */
1495
- operation: string;
1496
- /** API endpoint path */
1497
- path: string;
1498
- /** HTTP method */
1499
- method: string;
1500
- /** Zod validation error */
1501
- error: ZodError;
1502
- /** Raw response data that failed validation */
1503
- response: any;
1504
- /** Timestamp of the error */
1505
- timestamp: Date;
2075
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
2076
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
2077
+ /**
2078
+ * Returns the final request URL.
2079
+ */
2080
+ buildUrl: BuildUrlFn;
2081
+ getConfig: () => Config;
2082
+ request: RequestFn;
2083
+ setConfig: (config: Config) => Config;
2084
+ } & {
2085
+ [K in HttpMethod]: MethodFn;
2086
+ } & ([SseFn] extends [never] ? {
2087
+ sse?: never;
2088
+ } : {
2089
+ sse: {
2090
+ [K in HttpMethod]: SseFn;
2091
+ };
2092
+ });
2093
+ interface Config$1 {
2094
+ /**
2095
+ * Auth token or a function returning auth token. The resolved value will be
2096
+ * added to the request payload as defined by its `security` array.
2097
+ */
2098
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
2099
+ /**
2100
+ * A function for serializing request body parameter. By default,
2101
+ * {@link JSON.stringify()} will be used.
2102
+ */
2103
+ bodySerializer?: BodySerializer | null;
2104
+ /**
2105
+ * An object containing any HTTP headers that you want to pre-populate your
2106
+ * `Headers` object with.
2107
+ *
2108
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
2109
+ */
2110
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
2111
+ /**
2112
+ * The request method.
2113
+ *
2114
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
2115
+ */
2116
+ method?: Uppercase<HttpMethod>;
2117
+ /**
2118
+ * A function for serializing request query parameters. By default, arrays
2119
+ * will be exploded in form style, objects will be exploded in deepObject
2120
+ * style, and reserved characters are percent-encoded.
2121
+ *
2122
+ * This method will have no effect if the native `paramsSerializer()` Axios
2123
+ * API function is used.
2124
+ *
2125
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
2126
+ */
2127
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
2128
+ /**
2129
+ * A function validating request data. This is useful if you want to ensure
2130
+ * the request conforms to the desired shape, so it can be safely sent to
2131
+ * the server.
2132
+ */
2133
+ requestValidator?: (data: unknown) => Promise<unknown>;
2134
+ /**
2135
+ * A function transforming response data before it's returned. This is useful
2136
+ * for post-processing data, e.g., converting ISO strings into Date objects.
2137
+ */
2138
+ responseTransformer?: (data: unknown) => Promise<unknown>;
2139
+ /**
2140
+ * A function validating response data. This is useful if you want to ensure
2141
+ * the response conforms to the desired shape, so it can be safely passed to
2142
+ * the transformers and returned to the user.
2143
+ */
2144
+ responseValidator?: (data: unknown) => Promise<unknown>;
1506
2145
  }
1507
- /**
1508
- * Custom event type for Zod validation errors
1509
- */
1510
- type ValidationErrorEvent = CustomEvent<ValidationErrorDetail>;
1511
- /**
1512
- * Dispatch a Zod validation error event.
1513
- *
1514
- * Only dispatches in browser environment (when window is defined).
1515
- * Safe to call in Node.js/SSR - will be a no-op.
1516
- *
1517
- * @param detail - Validation error details
1518
- */
1519
- declare function dispatchValidationError(detail: ValidationErrorDetail): void;
1520
- /**
1521
- * Add a global listener for Zod validation errors.
1522
- *
1523
- * @param callback - Function to call when validation error occurs
1524
- * @returns Cleanup function to remove the listener
1525
- *
1526
- * @example
1527
- * ```typescript
1528
- * const cleanup = onValidationError(({ operation, error }) => {
1529
- * toast.error(`Validation failed in ${operation}`);
1530
- * logToSentry(error);
1531
- * });
1532
- *
1533
- * // Later, remove listener
1534
- * cleanup();
1535
- * ```
1536
- */
1537
- declare function onValidationError(callback: (detail: ValidationErrorDetail) => void): () => void;
1538
- /**
1539
- * Format Zod error for logging/display.
1540
- *
1541
- * @param error - Zod validation error
1542
- * @returns Formatted error message
1543
- */
1544
- declare function formatZodError(error: ZodError): string;
1545
2146
 
1546
- /**
1547
- * API operation
1548
- *
1549
- * @method POST
1550
- * @path /cfg/accounts/otp/request/
1551
- */
1552
- declare function createAccountsOtpRequestCreate(data: OTPRequestRequest, client?: any): Promise<OTPRequestResponse>;
1553
- /**
1554
- * API operation
1555
- *
1556
- * @method POST
1557
- * @path /cfg/accounts/otp/verify/
1558
- */
1559
- declare function createAccountsOtpVerifyCreate(data: OTPVerifyRequest, client?: any): Promise<OTPVerifyResponse>;
2147
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
2148
+ /**
2149
+ * Fetch API implementation. You can use this option to provide a custom
2150
+ * fetch instance.
2151
+ *
2152
+ * @default globalThis.fetch
2153
+ */
2154
+ fetch?: typeof fetch;
2155
+ /**
2156
+ * Implementing clients can call request interceptors inside this hook.
2157
+ */
2158
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
2159
+ /**
2160
+ * Callback invoked when a network or parsing error occurs during streaming.
2161
+ *
2162
+ * This option applies only if the endpoint returns a stream of events.
2163
+ *
2164
+ * @param error The error that occurred.
2165
+ */
2166
+ onSseError?: (error: unknown) => void;
2167
+ /**
2168
+ * Callback invoked when an event is streamed from the server.
2169
+ *
2170
+ * This option applies only if the endpoint returns a stream of events.
2171
+ *
2172
+ * @param event Event streamed from the server.
2173
+ * @returns Nothing (void).
2174
+ */
2175
+ onSseEvent?: (event: StreamEvent<TData>) => void;
2176
+ serializedBody?: RequestInit['body'];
2177
+ /**
2178
+ * Default retry delay in milliseconds.
2179
+ *
2180
+ * This option applies only if the endpoint returns a stream of events.
2181
+ *
2182
+ * @default 3000
2183
+ */
2184
+ sseDefaultRetryDelay?: number;
2185
+ /**
2186
+ * Maximum number of retry attempts before giving up.
2187
+ */
2188
+ sseMaxRetryAttempts?: number;
2189
+ /**
2190
+ * Maximum retry delay in milliseconds.
2191
+ *
2192
+ * Applies only when exponential backoff is used.
2193
+ *
2194
+ * This option applies only if the endpoint returns a stream of events.
2195
+ *
2196
+ * @default 30000
2197
+ */
2198
+ sseMaxRetryDelay?: number;
2199
+ /**
2200
+ * Optional sleep function for retry backoff.
2201
+ *
2202
+ * Defaults to using `setTimeout`.
2203
+ */
2204
+ sseSleepFn?: (ms: number) => Promise<void>;
2205
+ url: string;
2206
+ };
2207
+ interface StreamEvent<TData = unknown> {
2208
+ data: TData;
2209
+ event?: string;
2210
+ id?: string;
2211
+ retry?: number;
2212
+ }
2213
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
2214
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
2215
+ };
2216
+
2217
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
2218
+ /** response may be undefined due to a network error where no response object is produced */
2219
+ response: Res | undefined,
2220
+ /** request may be undefined, because error may be from building the request object itself */
2221
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
2222
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
2223
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
2224
+ declare class Interceptors<Interceptor> {
2225
+ fns: Array<Interceptor | null>;
2226
+ clear(): void;
2227
+ eject(id: number | Interceptor): void;
2228
+ exists(id: number | Interceptor): boolean;
2229
+ getInterceptorIndex(id: number | Interceptor): number;
2230
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
2231
+ use(fn: Interceptor): number;
2232
+ }
2233
+ interface Middleware<Req, Res, Err, Options> {
2234
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
2235
+ request: Interceptors<ReqInterceptor<Req, Options>>;
2236
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
2237
+ }
1560
2238
 
1561
- /**
1562
- * API operation
1563
- *
1564
- * @method POST
1565
- * @path /cfg/accounts/token/refresh/
1566
- */
1567
- declare function createAccountsTokenRefreshCreate(data: TokenRefreshRequest, client?: any): Promise<TokenRefresh>;
2239
+ type ResponseStyle = 'data' | 'fields';
2240
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
2241
+ /**
2242
+ * Base URL for all requests made by this client.
2243
+ */
2244
+ baseUrl?: T['baseUrl'];
2245
+ /**
2246
+ * Fetch API implementation. You can use this option to provide a custom
2247
+ * fetch instance.
2248
+ *
2249
+ * @default globalThis.fetch
2250
+ */
2251
+ fetch?: typeof fetch;
2252
+ /**
2253
+ * Please don't use the Fetch client for Next.js applications. The `next`
2254
+ * options won't have any effect.
2255
+ *
2256
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
2257
+ */
2258
+ next?: never;
2259
+ /**
2260
+ * Return the response data parsed in a specified format. By default, `auto`
2261
+ * will infer the appropriate method from the `Content-Type` response header.
2262
+ * You can override this behavior with any of the {@link Body} methods.
2263
+ * Select `stream` if you don't want to parse response data at all.
2264
+ *
2265
+ * @default 'auto'
2266
+ */
2267
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
2268
+ /**
2269
+ * Should we return only data or multiple fields (data, error, response, etc.)?
2270
+ *
2271
+ * @default 'fields'
2272
+ */
2273
+ responseStyle?: ResponseStyle;
2274
+ /**
2275
+ * Throw an error instead of returning it in the response?
2276
+ *
2277
+ * @default false
2278
+ */
2279
+ throwOnError?: T['throwOnError'];
2280
+ }
2281
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
2282
+ responseStyle: TResponseStyle;
2283
+ throwOnError: ThrowOnError;
2284
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
2285
+ /**
2286
+ * Any body that you want to add to your request.
2287
+ *
2288
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
2289
+ */
2290
+ body?: unknown;
2291
+ path?: Record<string, unknown>;
2292
+ query?: Record<string, unknown>;
2293
+ /**
2294
+ * Security mechanism(s) to use for the request.
2295
+ */
2296
+ security?: ReadonlyArray<Auth>;
2297
+ url: Url;
2298
+ }
2299
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
2300
+ headers: Headers;
2301
+ serializedBody?: string;
2302
+ }
2303
+ type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
2304
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
2305
+ request: Request;
2306
+ response: Response;
2307
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
2308
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
2309
+ error: undefined;
2310
+ } | {
2311
+ data: undefined;
2312
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
2313
+ }) & {
2314
+ /** request may be undefined, because error may be from building the request object itself */
2315
+ request?: Request;
2316
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
2317
+ response?: Response;
2318
+ }>;
2319
+ interface ClientOptions$1 {
2320
+ baseUrl?: string;
2321
+ responseStyle?: ResponseStyle;
2322
+ throwOnError?: boolean;
2323
+ }
2324
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
2325
+ type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
2326
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
2327
+ type BuildUrlFn = <TData extends {
2328
+ body?: unknown;
2329
+ path?: Record<string, unknown>;
2330
+ query?: Record<string, unknown>;
2331
+ url: string;
2332
+ }>(options: TData & Options$1<TData>) => string;
2333
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
2334
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
2335
+ };
2336
+ interface TDataShape {
2337
+ body?: unknown;
2338
+ headers?: unknown;
2339
+ path?: unknown;
2340
+ query?: unknown;
2341
+ url: string;
2342
+ }
2343
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
2344
+ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
1568
2345
 
2346
+ type ClientOptions = {
2347
+ baseUrl: 'http://localhost:8000' | (string & {});
2348
+ };
1569
2349
  /**
1570
- * List OAuth connections
1571
- *
1572
- * @method GET
1573
- * @path /cfg/accounts/oauth/connections/
1574
- */
1575
- declare function getAccountsOauthConnectionsList(client?: any): Promise<OAuthConnection[]>;
1576
- /**
1577
- * Disconnect OAuth provider
1578
- *
1579
- * @method POST
1580
- * @path /cfg/accounts/oauth/disconnect/
1581
- */
1582
- declare function createAccountsOauthDisconnectCreate(data: OAuthDisconnectRequestRequest, client?: any): Promise<any>;
1583
- /**
1584
- * Start GitHub OAuth
1585
- *
1586
- * @method POST
1587
- * @path /cfg/accounts/oauth/github/authorize/
1588
- */
1589
- declare function createAccountsOauthGithubAuthorizeCreate(data: OAuthAuthorizeRequestRequest, client?: any): Promise<OAuthAuthorizeResponse>;
1590
- /**
1591
- * Complete GitHub OAuth
1592
- *
1593
- * @method POST
1594
- * @path /cfg/accounts/oauth/github/callback/
1595
- */
1596
- declare function createAccountsOauthGithubCallbackCreate(data: OAuthCallbackRequestRequest, client?: any): Promise<OAuthTokenResponse>;
1597
- /**
1598
- * List OAuth providers
1599
- *
1600
- * @method GET
1601
- * @path /cfg/accounts/oauth/providers/
2350
+ * Serializer for regenerating backup codes.
1602
2351
  */
1603
- declare function getAccountsOauthProvidersRetrieve(client?: any): Promise<OAuthProvidersResponse>;
1604
-
2352
+ type BackupCodesRegenerateRequest = {
2353
+ /**
2354
+ * TOTP code for verification
2355
+ */
2356
+ code: string;
2357
+ };
1605
2358
  /**
1606
- * Get current user profile
1607
- *
1608
- * @method GET
1609
- * @path /cfg/accounts/profile/
2359
+ * Response serializer for backup codes regeneration.
1610
2360
  */
1611
- declare function getAccountsProfileRetrieve(client?: any): Promise<User>;
2361
+ type BackupCodesRegenerateResponse = {
2362
+ /**
2363
+ * List of new backup codes (save these!)
2364
+ */
2365
+ backup_codes: Array<string>;
2366
+ /**
2367
+ * Warning about previous codes being invalidated
2368
+ */
2369
+ warning: string;
2370
+ };
1612
2371
  /**
1613
- * Upload user avatar
1614
- *
1615
- * @method POST
1616
- * @path /cfg/accounts/profile/avatar/
2372
+ * Serializer for backup codes status.
1617
2373
  */
1618
- declare function createAccountsProfileAvatarCreate(data: CfgAccountsProfileAvatarCreateRequest, client?: any): Promise<User>;
2374
+ type BackupCodesStatus = {
2375
+ /**
2376
+ * Number of unused backup codes
2377
+ */
2378
+ remaining_count: number;
2379
+ /**
2380
+ * Total number of codes generated
2381
+ */
2382
+ total_generated: number;
2383
+ /**
2384
+ * Warning if running low on codes
2385
+ */
2386
+ warning?: string | null;
2387
+ };
1619
2388
  /**
1620
- * Delete user account
1621
- *
1622
- * @method POST
1623
- * @path /cfg/accounts/profile/delete/
2389
+ * Serializer for confirming 2FA setup with first code.
1624
2390
  */
1625
- declare function createAccountsProfileDeleteCreate(client?: any): Promise<AccountDeleteResponse>;
2391
+ type ConfirmSetupRequest = {
2392
+ /**
2393
+ * Device ID from setup response
2394
+ */
2395
+ device_id: string;
2396
+ /**
2397
+ * 6-digit TOTP code from authenticator app
2398
+ */
2399
+ code: string;
2400
+ };
1626
2401
  /**
1627
- * Partial update user profile
1628
- *
1629
- * @method PUT
1630
- * @path /cfg/accounts/profile/partial/
2402
+ * Response serializer for setup confirmation.
1631
2403
  */
1632
- declare function partialUpdateAccountsProfilePartialUpdate(data: UserProfileUpdateRequest, client?: any): Promise<User>;
2404
+ type ConfirmSetupResponse = {
2405
+ message: string;
2406
+ /**
2407
+ * List of backup recovery codes (save these!)
2408
+ */
2409
+ backup_codes: Array<string>;
2410
+ /**
2411
+ * Warning message about backup codes
2412
+ */
2413
+ backup_codes_warning: string;
2414
+ };
1633
2415
  /**
1634
- * Partial update user profile
1635
- *
1636
- * @method PATCH
1637
- * @path /cfg/accounts/profile/partial/
2416
+ * Serializer for listing TOTP devices.
1638
2417
  */
1639
- declare function partialUpdateAccountsProfilePartialPartialUpdate(data?: PatchedUserProfileUpdateRequest, client?: any): Promise<User>;
2418
+ type DeviceList = {
2419
+ readonly id: string;
2420
+ /**
2421
+ * Device name for identification
2422
+ */
2423
+ readonly name: string;
2424
+ /**
2425
+ * Primary device used for verification
2426
+ */
2427
+ readonly is_primary: boolean;
2428
+ readonly status: DeviceListStatusEnum;
2429
+ readonly created_at: string;
2430
+ /**
2431
+ * When device setup was confirmed
2432
+ */
2433
+ readonly confirmed_at: string | null;
2434
+ /**
2435
+ * Last successful verification
2436
+ */
2437
+ readonly last_used_at: string | null;
2438
+ };
1640
2439
  /**
1641
- * Update user profile
1642
- *
1643
- * @method PUT
1644
- * @path /cfg/accounts/profile/update/
2440
+ * Response serializer for device list endpoint.
1645
2441
  */
1646
- declare function updateAccountsProfileUpdateUpdate(data: UserProfileUpdateRequest, client?: any): Promise<User>;
2442
+ type DeviceListResponse = {
2443
+ devices: Array<DeviceList>;
2444
+ has_2fa_enabled: boolean;
2445
+ };
1647
2446
  /**
1648
- * Update user profile
1649
- *
1650
- * @method PATCH
1651
- * @path /cfg/accounts/profile/update/
2447
+ * * `pending` - Pending Confirmation
2448
+ * * `active` - Active
2449
+ * * `disabled` - Disabled
1652
2450
  */
1653
- declare function partialUpdateAccountsProfileUpdatePartialUpdate(data?: PatchedUserProfileUpdateRequest, client?: any): Promise<User>;
1654
-
2451
+ declare enum DeviceListStatusEnum {
2452
+ PENDING = "pending",
2453
+ ACTIVE = "active",
2454
+ DISABLED = "disabled"
2455
+ }
1655
2456
  /**
1656
- * Typed Fetchers - Universal API functions
1657
- *
1658
- * Auto-generated from OpenAPI specification.
1659
- * These functions work in any JavaScript environment.
1660
- *
1661
- * Features:
1662
- * - Runtime validation with Zod
1663
- * - Type-safe parameters and responses
1664
- * - Works with any data-fetching library (SWR, React Query, etc)
1665
- * - Server Component compatible
1666
- *
1667
- * Usage:
1668
- * ```typescript
1669
- * import * as fetchers from './fetchers'
1670
- *
1671
- * // Direct usage
1672
- * const user = await fetchers.getUser(1)
1673
- *
1674
- * // With SWR
1675
- * const { data } = useSWR('user-1', () => fetchers.getUser(1))
1676
- *
1677
- * // With React Query
1678
- * const { data } = useQuery(['user', 1], () => fetchers.getUser(1))
1679
- * ```
2457
+ * Serializer for completely disabling 2FA.
1680
2458
  */
1681
-
1682
- declare const index$1_createAccountsOauthDisconnectCreate: typeof createAccountsOauthDisconnectCreate;
1683
- declare const index$1_createAccountsOauthGithubAuthorizeCreate: typeof createAccountsOauthGithubAuthorizeCreate;
1684
- declare const index$1_createAccountsOauthGithubCallbackCreate: typeof createAccountsOauthGithubCallbackCreate;
1685
- declare const index$1_createAccountsOtpRequestCreate: typeof createAccountsOtpRequestCreate;
1686
- declare const index$1_createAccountsOtpVerifyCreate: typeof createAccountsOtpVerifyCreate;
1687
- declare const index$1_createAccountsProfileAvatarCreate: typeof createAccountsProfileAvatarCreate;
1688
- declare const index$1_createAccountsProfileDeleteCreate: typeof createAccountsProfileDeleteCreate;
1689
- declare const index$1_createAccountsTokenRefreshCreate: typeof createAccountsTokenRefreshCreate;
1690
- declare const index$1_getAccountsOauthConnectionsList: typeof getAccountsOauthConnectionsList;
1691
- declare const index$1_getAccountsOauthProvidersRetrieve: typeof getAccountsOauthProvidersRetrieve;
1692
- declare const index$1_getAccountsProfileRetrieve: typeof getAccountsProfileRetrieve;
1693
- declare const index$1_partialUpdateAccountsProfilePartialPartialUpdate: typeof partialUpdateAccountsProfilePartialPartialUpdate;
1694
- declare const index$1_partialUpdateAccountsProfilePartialUpdate: typeof partialUpdateAccountsProfilePartialUpdate;
1695
- declare const index$1_partialUpdateAccountsProfileUpdatePartialUpdate: typeof partialUpdateAccountsProfileUpdatePartialUpdate;
1696
- declare const index$1_updateAccountsProfileUpdateUpdate: typeof updateAccountsProfileUpdateUpdate;
1697
- declare namespace index$1 {
1698
- export { index$1_createAccountsOauthDisconnectCreate as createAccountsOauthDisconnectCreate, index$1_createAccountsOauthGithubAuthorizeCreate as createAccountsOauthGithubAuthorizeCreate, index$1_createAccountsOauthGithubCallbackCreate as createAccountsOauthGithubCallbackCreate, index$1_createAccountsOtpRequestCreate as createAccountsOtpRequestCreate, index$1_createAccountsOtpVerifyCreate as createAccountsOtpVerifyCreate, index$1_createAccountsProfileAvatarCreate as createAccountsProfileAvatarCreate, index$1_createAccountsProfileDeleteCreate as createAccountsProfileDeleteCreate, index$1_createAccountsTokenRefreshCreate as createAccountsTokenRefreshCreate, index$1_getAccountsOauthConnectionsList as getAccountsOauthConnectionsList, index$1_getAccountsOauthProvidersRetrieve as getAccountsOauthProvidersRetrieve, index$1_getAccountsProfileRetrieve as getAccountsProfileRetrieve, index$1_partialUpdateAccountsProfilePartialPartialUpdate as partialUpdateAccountsProfilePartialPartialUpdate, index$1_partialUpdateAccountsProfilePartialUpdate as partialUpdateAccountsProfilePartialUpdate, index$1_partialUpdateAccountsProfileUpdatePartialUpdate as partialUpdateAccountsProfileUpdatePartialUpdate, index$1_updateAccountsProfileUpdateUpdate as updateAccountsProfileUpdateUpdate };
1699
- }
1700
-
2459
+ type DisableRequest = {
2460
+ /**
2461
+ * TOTP code for verification
2462
+ */
2463
+ code: string;
2464
+ };
1701
2465
  /**
1702
- * Global API Instance - Singleton configuration with auto-configuration support
1703
- *
1704
- * This module provides a global API instance that auto-configures from
1705
- * environment variables or can be configured manually.
1706
- *
1707
- * AUTO-CONFIGURATION (recommended):
1708
- * Set one of these environment variables and the API will auto-configure:
1709
- * - NEXT_PUBLIC_API_URL (Next.js)
1710
- * - VITE_API_URL (Vite)
1711
- * - REACT_APP_API_URL (Create React App)
1712
- * - API_URL (generic)
1713
- *
1714
- * Then just use fetchers and hooks directly:
1715
- * ```typescript
1716
- * import { getUsers } from './_utils/fetchers'
1717
- * const users = await getUsers({ page: 1 })
1718
- * ```
1719
- *
1720
- * MANUAL CONFIGURATION:
1721
- * ```typescript
1722
- * import { configureAPI } from './api-instance'
1723
- *
1724
- * configureAPI({
1725
- * baseUrl: 'https://api.example.com',
1726
- * token: 'your-jwt-token'
1727
- * })
1728
- * ```
1729
- *
1730
- * For SSR or multiple instances:
1731
- * ```typescript
1732
- * import { API } from './index'
1733
- * import { getUsers } from './_utils/fetchers'
1734
- *
1735
- * const api = new API('https://api.example.com')
1736
- * const users = await getUsers({ page: 1 }, api)
1737
- * ```
2466
+ * Serializer for starting 2FA setup.
1738
2467
  */
1739
-
2468
+ type SetupRequest = {
2469
+ /**
2470
+ * Device name for identification (e.g., 'My iPhone')
2471
+ */
2472
+ device_name?: string;
2473
+ };
1740
2474
  /**
1741
- * Get the global API instance
1742
- * Auto-configures from environment variables on first call if not manually configured.
1743
- * @throws Error if API is not configured and no env variable is set
2475
+ * Response serializer for setup initiation.
1744
2476
  */
1745
- declare function getAPIInstance(): API;
2477
+ type SetupResponse = {
2478
+ /**
2479
+ * Device ID to use for confirmation
2480
+ */
2481
+ device_id: string;
2482
+ /**
2483
+ * Base32-encoded TOTP secret (for manual entry)
2484
+ */
2485
+ secret: string;
2486
+ /**
2487
+ * otpauth:// URI for QR code generation
2488
+ */
2489
+ provisioning_uri: string;
2490
+ /**
2491
+ * Base64-encoded QR code image (data URI)
2492
+ */
2493
+ qr_code_base64: string;
2494
+ /**
2495
+ * Seconds until setup expires (typically 600 = 10 minutes)
2496
+ */
2497
+ expires_in: number;
2498
+ };
1746
2499
  /**
1747
- * Check if API is configured (or can be auto-configured)
2500
+ * User data returned after 2FA verification.
1748
2501
  */
1749
- declare function isAPIConfigured(): boolean;
2502
+ type TotpVerifyUser = {
2503
+ readonly id: number;
2504
+ readonly email: string;
2505
+ first_name?: string;
2506
+ last_name?: string;
2507
+ /**
2508
+ * Get user's full name.
2509
+ */
2510
+ readonly full_name: string;
2511
+ /**
2512
+ * Get user's initials for avatar fallback.
2513
+ */
2514
+ readonly initials: string;
2515
+ /**
2516
+ * Get formatted username for display.
2517
+ */
2518
+ readonly display_username: string;
2519
+ company?: string;
2520
+ phone?: string;
2521
+ position?: string;
2522
+ language?: string;
2523
+ readonly avatar: string | null;
2524
+ /**
2525
+ * Staff status
2526
+ *
2527
+ * Designates whether the user can log into this admin site.
2528
+ */
2529
+ readonly is_staff: boolean;
2530
+ /**
2531
+ * Superuser status
2532
+ *
2533
+ * Designates that this user has all permissions without explicitly assigning them.
2534
+ */
2535
+ readonly is_superuser: boolean;
2536
+ readonly date_joined: string;
2537
+ readonly last_login: string | null;
2538
+ readonly unanswered_messages_count: number;
2539
+ };
1750
2540
  /**
1751
- * Configure the global API instance
1752
- *
1753
- * @param baseUrl - Base URL for the API
1754
- * @param options - Optional configuration (storage, retry, logger)
1755
- *
1756
- * @example
1757
- * ```typescript
1758
- * configureAPI({
1759
- * baseUrl: 'https://api.example.com',
1760
- * token: 'jwt-token',
1761
- * options: {
1762
- * retryConfig: { maxRetries: 3 },
1763
- * loggerConfig: { enabled: true }
1764
- * }
1765
- * })
1766
- * ```
2541
+ * Serializer for backup code verification during login.
1767
2542
  */
1768
- declare function configureAPI(config: {
1769
- baseUrl: string;
1770
- token?: string;
1771
- refreshToken?: string;
1772
- options?: APIOptions;
1773
- }): API;
2543
+ type VerifyBackupRequest = {
2544
+ /**
2545
+ * 2FA session ID from login response
2546
+ */
2547
+ session_id: string;
2548
+ /**
2549
+ * 8-character backup recovery code
2550
+ */
2551
+ backup_code: string;
2552
+ };
1774
2553
  /**
1775
- * Reconfigure the global API instance with new settings
1776
- * Useful for updating tokens or base URL
2554
+ * Serializer for TOTP code verification during login.
1777
2555
  */
1778
- declare function reconfigureAPI(updates: {
1779
- baseUrl?: string;
1780
- token?: string;
1781
- refreshToken?: string;
1782
- }): API;
2556
+ type VerifyRequest = {
2557
+ /**
2558
+ * 2FA session ID from login response
2559
+ */
2560
+ session_id: string;
2561
+ /**
2562
+ * 6-digit TOTP code from authenticator app
2563
+ */
2564
+ code: string;
2565
+ };
1783
2566
  /**
1784
- * Clear tokens from the global API instance
2567
+ * Response serializer for successful 2FA verification.
1785
2568
  */
1786
- declare function clearAPITokens(): void;
2569
+ type VerifyResponse = {
2570
+ message: string;
2571
+ /**
2572
+ * JWT access token
2573
+ */
2574
+ access_token: string;
2575
+ /**
2576
+ * JWT refresh token
2577
+ */
2578
+ refresh_token: string;
2579
+ /**
2580
+ * User profile data
2581
+ */
2582
+ user: TotpVerifyUser;
2583
+ /**
2584
+ * Number of remaining backup codes (if backup code was used)
2585
+ */
2586
+ remaining_backup_codes?: number;
2587
+ /**
2588
+ * Warning message (e.g., low backup codes)
2589
+ */
2590
+ warning?: string;
2591
+ };
1787
2592
  /**
1788
- * Reset the global API instance
1789
- * Useful for testing or logout scenarios
2593
+ * Response serializer for device list endpoint.
1790
2594
  */
1791
- declare function resetAPI(): void;
1792
-
2595
+ type DeviceListResponseWritable = {
2596
+ devices: Array<unknown>;
2597
+ has_2fa_enabled: boolean;
2598
+ };
1793
2599
  /**
1794
- * API Error Classes
1795
- *
1796
- * Typed error classes with Django REST Framework support.
2600
+ * User data returned after 2FA verification.
1797
2601
  */
2602
+ type TotpVerifyUserWritable = {
2603
+ first_name?: string;
2604
+ last_name?: string;
2605
+ company?: string;
2606
+ phone?: string;
2607
+ position?: string;
2608
+ language?: string;
2609
+ };
1798
2610
  /**
1799
- * HTTP API Error with DRF field-specific validation errors.
1800
- *
1801
- * Usage:
1802
- * ```typescript
1803
- * try {
1804
- * await api.users.create(userData);
1805
- * } catch (error) {
1806
- * if (error instanceof APIError) {
1807
- * if (error.isValidationError) {
1808
- * console.log('Field errors:', error.fieldErrors);
1809
- * // { "email": ["Email already exists"], "username": ["Required"] }
1810
- * }
1811
- * }
1812
- * }
1813
- * ```
2611
+ * Response serializer for successful 2FA verification.
1814
2612
  */
1815
- declare class APIError extends Error {
1816
- statusCode: number;
1817
- statusText: string;
1818
- response: any;
1819
- url: string;
1820
- constructor(statusCode: number, statusText: string, response: any, url: string, message?: string);
2613
+ type VerifyResponseWritable = {
2614
+ message: string;
1821
2615
  /**
1822
- * Get error details from response.
1823
- * DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
2616
+ * JWT access token
1824
2617
  */
1825
- get details(): Record<string, any> | null;
2618
+ access_token: string;
1826
2619
  /**
1827
- * Get field-specific validation errors from DRF.
1828
- * Returns: { "field_name": ["error1", "error2"], ... }
2620
+ * JWT refresh token
1829
2621
  */
1830
- get fieldErrors(): Record<string, string[]> | null;
2622
+ refresh_token: string;
1831
2623
  /**
1832
- * Get single error message from DRF.
1833
- * Checks for "detail", "message", or first field error.
2624
+ * User profile data
1834
2625
  */
1835
- get errorMessage(): string;
1836
- get isValidationError(): boolean;
1837
- get isAuthError(): boolean;
1838
- get isPermissionError(): boolean;
1839
- get isNotFoundError(): boolean;
1840
- get isServerError(): boolean;
1841
- }
1842
- /**
1843
- * Network Error (connection failed, timeout, etc.)
1844
- */
1845
- declare class NetworkError extends Error {
1846
- url: string;
1847
- originalError?: Error;
1848
- constructor(message: string, url: string, originalError?: Error);
2626
+ user: TotpVerifyUserWritable;
2627
+ /**
2628
+ * Number of remaining backup codes (if backup code was used)
2629
+ */
2630
+ remaining_backup_codes?: number;
2631
+ /**
2632
+ * Warning message (e.g., low backup codes)
2633
+ */
2634
+ warning?: string;
2635
+ };
2636
+ type CfgTotpBackupCodesRetrieveData = {
2637
+ body?: never;
2638
+ path?: never;
2639
+ query?: never;
2640
+ url: '/cfg/totp/backup-codes/';
2641
+ };
2642
+ type CfgTotpBackupCodesRetrieveResponses = {
2643
+ 200: BackupCodesStatus;
2644
+ };
2645
+ type CfgTotpBackupCodesRetrieveResponse = CfgTotpBackupCodesRetrieveResponses[keyof CfgTotpBackupCodesRetrieveResponses];
2646
+ type CfgTotpBackupCodesRegenerateCreateData = {
2647
+ body: BackupCodesRegenerateRequest;
2648
+ path?: never;
2649
+ query?: never;
2650
+ url: '/cfg/totp/backup-codes/regenerate/';
2651
+ };
2652
+ type CfgTotpBackupCodesRegenerateCreateErrors = {
2653
+ /**
2654
+ * Invalid code or 2FA not enabled
2655
+ */
2656
+ 400: unknown;
2657
+ };
2658
+ type CfgTotpBackupCodesRegenerateCreateResponses = {
2659
+ 200: BackupCodesRegenerateResponse;
2660
+ };
2661
+ type CfgTotpBackupCodesRegenerateCreateResponse = CfgTotpBackupCodesRegenerateCreateResponses[keyof CfgTotpBackupCodesRegenerateCreateResponses];
2662
+ type CfgTotpDevicesRetrieveData = {
2663
+ body?: never;
2664
+ path?: never;
2665
+ query?: never;
2666
+ url: '/cfg/totp/devices/';
2667
+ };
2668
+ type CfgTotpDevicesRetrieveResponses = {
2669
+ 200: DeviceListResponse;
2670
+ };
2671
+ type CfgTotpDevicesRetrieveResponse = CfgTotpDevicesRetrieveResponses[keyof CfgTotpDevicesRetrieveResponses];
2672
+ type CfgTotpDevicesDestroyData = {
2673
+ body?: never;
2674
+ path: {
2675
+ id: string;
2676
+ };
2677
+ query?: never;
2678
+ url: '/cfg/totp/devices/{id}/';
2679
+ };
2680
+ type CfgTotpDevicesDestroyResponses = {
2681
+ /**
2682
+ * No response body
2683
+ */
2684
+ 204: void;
2685
+ };
2686
+ type CfgTotpDevicesDestroyResponse = CfgTotpDevicesDestroyResponses[keyof CfgTotpDevicesDestroyResponses];
2687
+ type CfgTotpDisableCreateData = {
2688
+ body: DisableRequest;
2689
+ path?: never;
2690
+ query?: never;
2691
+ url: '/cfg/totp/disable/';
2692
+ };
2693
+ type CfgTotpDisableCreateErrors = {
2694
+ /**
2695
+ * Invalid code
2696
+ */
2697
+ 400: unknown;
2698
+ };
2699
+ type CfgTotpDisableCreateResponses = {
2700
+ /**
2701
+ * 2FA disabled successfully
2702
+ */
2703
+ 200: unknown;
2704
+ };
2705
+ type CfgTotpSetupCreateData = {
2706
+ body?: SetupRequest;
2707
+ path?: never;
2708
+ query?: never;
2709
+ url: '/cfg/totp/setup/';
2710
+ };
2711
+ type CfgTotpSetupCreateErrors = {
2712
+ /**
2713
+ * 2FA already enabled or invalid request
2714
+ */
2715
+ 400: unknown;
2716
+ };
2717
+ type CfgTotpSetupCreateResponses = {
2718
+ 200: SetupResponse;
2719
+ };
2720
+ type CfgTotpSetupCreateResponse = CfgTotpSetupCreateResponses[keyof CfgTotpSetupCreateResponses];
2721
+ type CfgTotpSetupConfirmCreateData = {
2722
+ body: ConfirmSetupRequest;
2723
+ path?: never;
2724
+ query?: never;
2725
+ url: '/cfg/totp/setup/confirm/';
2726
+ };
2727
+ type CfgTotpSetupConfirmCreateErrors = {
2728
+ /**
2729
+ * Invalid code or setup expired
2730
+ */
2731
+ 400: unknown;
2732
+ };
2733
+ type CfgTotpSetupConfirmCreateResponses = {
2734
+ 200: ConfirmSetupResponse;
2735
+ };
2736
+ type CfgTotpSetupConfirmCreateResponse = CfgTotpSetupConfirmCreateResponses[keyof CfgTotpSetupConfirmCreateResponses];
2737
+ type CfgTotpVerifyCreateData = {
2738
+ body: VerifyRequest;
2739
+ path?: never;
2740
+ query?: never;
2741
+ url: '/cfg/totp/verify/';
2742
+ };
2743
+ type CfgTotpVerifyCreateErrors = {
2744
+ /**
2745
+ * Invalid code or session
2746
+ */
2747
+ 400: unknown;
2748
+ /**
2749
+ * Too many attempts
2750
+ */
2751
+ 403: unknown;
2752
+ };
2753
+ type CfgTotpVerifyCreateResponses = {
2754
+ 200: VerifyResponse;
2755
+ };
2756
+ type CfgTotpVerifyCreateResponse = CfgTotpVerifyCreateResponses[keyof CfgTotpVerifyCreateResponses];
2757
+ type CfgTotpVerifyBackupCreateData = {
2758
+ body: VerifyBackupRequest;
2759
+ path?: never;
2760
+ query?: never;
2761
+ url: '/cfg/totp/verify/backup/';
2762
+ };
2763
+ type CfgTotpVerifyBackupCreateErrors = {
2764
+ /**
2765
+ * Invalid backup code or session
2766
+ */
2767
+ 400: unknown;
2768
+ };
2769
+ type CfgTotpVerifyBackupCreateResponses = {
2770
+ 200: VerifyResponse;
2771
+ };
2772
+ type CfgTotpVerifyBackupCreateResponse = CfgTotpVerifyBackupCreateResponses[keyof CfgTotpVerifyBackupCreateResponses];
2773
+
2774
+ type types_gen_BackupCodesRegenerateRequest = BackupCodesRegenerateRequest;
2775
+ type types_gen_BackupCodesRegenerateResponse = BackupCodesRegenerateResponse;
2776
+ type types_gen_BackupCodesStatus = BackupCodesStatus;
2777
+ type types_gen_CfgTotpBackupCodesRegenerateCreateData = CfgTotpBackupCodesRegenerateCreateData;
2778
+ type types_gen_CfgTotpBackupCodesRegenerateCreateErrors = CfgTotpBackupCodesRegenerateCreateErrors;
2779
+ type types_gen_CfgTotpBackupCodesRegenerateCreateResponse = CfgTotpBackupCodesRegenerateCreateResponse;
2780
+ type types_gen_CfgTotpBackupCodesRegenerateCreateResponses = CfgTotpBackupCodesRegenerateCreateResponses;
2781
+ type types_gen_CfgTotpBackupCodesRetrieveData = CfgTotpBackupCodesRetrieveData;
2782
+ type types_gen_CfgTotpBackupCodesRetrieveResponse = CfgTotpBackupCodesRetrieveResponse;
2783
+ type types_gen_CfgTotpBackupCodesRetrieveResponses = CfgTotpBackupCodesRetrieveResponses;
2784
+ type types_gen_CfgTotpDevicesDestroyData = CfgTotpDevicesDestroyData;
2785
+ type types_gen_CfgTotpDevicesDestroyResponse = CfgTotpDevicesDestroyResponse;
2786
+ type types_gen_CfgTotpDevicesDestroyResponses = CfgTotpDevicesDestroyResponses;
2787
+ type types_gen_CfgTotpDevicesRetrieveData = CfgTotpDevicesRetrieveData;
2788
+ type types_gen_CfgTotpDevicesRetrieveResponse = CfgTotpDevicesRetrieveResponse;
2789
+ type types_gen_CfgTotpDevicesRetrieveResponses = CfgTotpDevicesRetrieveResponses;
2790
+ type types_gen_CfgTotpDisableCreateData = CfgTotpDisableCreateData;
2791
+ type types_gen_CfgTotpDisableCreateErrors = CfgTotpDisableCreateErrors;
2792
+ type types_gen_CfgTotpDisableCreateResponses = CfgTotpDisableCreateResponses;
2793
+ type types_gen_CfgTotpSetupConfirmCreateData = CfgTotpSetupConfirmCreateData;
2794
+ type types_gen_CfgTotpSetupConfirmCreateErrors = CfgTotpSetupConfirmCreateErrors;
2795
+ type types_gen_CfgTotpSetupConfirmCreateResponse = CfgTotpSetupConfirmCreateResponse;
2796
+ type types_gen_CfgTotpSetupConfirmCreateResponses = CfgTotpSetupConfirmCreateResponses;
2797
+ type types_gen_CfgTotpSetupCreateData = CfgTotpSetupCreateData;
2798
+ type types_gen_CfgTotpSetupCreateErrors = CfgTotpSetupCreateErrors;
2799
+ type types_gen_CfgTotpSetupCreateResponse = CfgTotpSetupCreateResponse;
2800
+ type types_gen_CfgTotpSetupCreateResponses = CfgTotpSetupCreateResponses;
2801
+ type types_gen_CfgTotpVerifyBackupCreateData = CfgTotpVerifyBackupCreateData;
2802
+ type types_gen_CfgTotpVerifyBackupCreateErrors = CfgTotpVerifyBackupCreateErrors;
2803
+ type types_gen_CfgTotpVerifyBackupCreateResponse = CfgTotpVerifyBackupCreateResponse;
2804
+ type types_gen_CfgTotpVerifyBackupCreateResponses = CfgTotpVerifyBackupCreateResponses;
2805
+ type types_gen_CfgTotpVerifyCreateData = CfgTotpVerifyCreateData;
2806
+ type types_gen_CfgTotpVerifyCreateErrors = CfgTotpVerifyCreateErrors;
2807
+ type types_gen_CfgTotpVerifyCreateResponse = CfgTotpVerifyCreateResponse;
2808
+ type types_gen_CfgTotpVerifyCreateResponses = CfgTotpVerifyCreateResponses;
2809
+ type types_gen_ClientOptions = ClientOptions;
2810
+ type types_gen_ConfirmSetupRequest = ConfirmSetupRequest;
2811
+ type types_gen_ConfirmSetupResponse = ConfirmSetupResponse;
2812
+ type types_gen_DeviceList = DeviceList;
2813
+ type types_gen_DeviceListResponse = DeviceListResponse;
2814
+ type types_gen_DeviceListResponseWritable = DeviceListResponseWritable;
2815
+ type types_gen_DeviceListStatusEnum = DeviceListStatusEnum;
2816
+ declare const types_gen_DeviceListStatusEnum: typeof DeviceListStatusEnum;
2817
+ type types_gen_DisableRequest = DisableRequest;
2818
+ type types_gen_SetupRequest = SetupRequest;
2819
+ type types_gen_SetupResponse = SetupResponse;
2820
+ type types_gen_TotpVerifyUser = TotpVerifyUser;
2821
+ type types_gen_TotpVerifyUserWritable = TotpVerifyUserWritable;
2822
+ type types_gen_VerifyBackupRequest = VerifyBackupRequest;
2823
+ type types_gen_VerifyRequest = VerifyRequest;
2824
+ type types_gen_VerifyResponse = VerifyResponse;
2825
+ type types_gen_VerifyResponseWritable = VerifyResponseWritable;
2826
+ declare namespace types_gen {
2827
+ export { type types_gen_BackupCodesRegenerateRequest as BackupCodesRegenerateRequest, type types_gen_BackupCodesRegenerateResponse as BackupCodesRegenerateResponse, type types_gen_BackupCodesStatus as BackupCodesStatus, type types_gen_CfgTotpBackupCodesRegenerateCreateData as CfgTotpBackupCodesRegenerateCreateData, type types_gen_CfgTotpBackupCodesRegenerateCreateErrors as CfgTotpBackupCodesRegenerateCreateErrors, type types_gen_CfgTotpBackupCodesRegenerateCreateResponse as CfgTotpBackupCodesRegenerateCreateResponse, type types_gen_CfgTotpBackupCodesRegenerateCreateResponses as CfgTotpBackupCodesRegenerateCreateResponses, type types_gen_CfgTotpBackupCodesRetrieveData as CfgTotpBackupCodesRetrieveData, type types_gen_CfgTotpBackupCodesRetrieveResponse as CfgTotpBackupCodesRetrieveResponse, type types_gen_CfgTotpBackupCodesRetrieveResponses as CfgTotpBackupCodesRetrieveResponses, type types_gen_CfgTotpDevicesDestroyData as CfgTotpDevicesDestroyData, type types_gen_CfgTotpDevicesDestroyResponse as CfgTotpDevicesDestroyResponse, type types_gen_CfgTotpDevicesDestroyResponses as CfgTotpDevicesDestroyResponses, type types_gen_CfgTotpDevicesRetrieveData as CfgTotpDevicesRetrieveData, type types_gen_CfgTotpDevicesRetrieveResponse as CfgTotpDevicesRetrieveResponse, type types_gen_CfgTotpDevicesRetrieveResponses as CfgTotpDevicesRetrieveResponses, type types_gen_CfgTotpDisableCreateData as CfgTotpDisableCreateData, type types_gen_CfgTotpDisableCreateErrors as CfgTotpDisableCreateErrors, type types_gen_CfgTotpDisableCreateResponses as CfgTotpDisableCreateResponses, type types_gen_CfgTotpSetupConfirmCreateData as CfgTotpSetupConfirmCreateData, type types_gen_CfgTotpSetupConfirmCreateErrors as CfgTotpSetupConfirmCreateErrors, type types_gen_CfgTotpSetupConfirmCreateResponse as CfgTotpSetupConfirmCreateResponse, type types_gen_CfgTotpSetupConfirmCreateResponses as CfgTotpSetupConfirmCreateResponses, type types_gen_CfgTotpSetupCreateData as CfgTotpSetupCreateData, type types_gen_CfgTotpSetupCreateErrors as CfgTotpSetupCreateErrors, type types_gen_CfgTotpSetupCreateResponse as CfgTotpSetupCreateResponse, type types_gen_CfgTotpSetupCreateResponses as CfgTotpSetupCreateResponses, type types_gen_CfgTotpVerifyBackupCreateData as CfgTotpVerifyBackupCreateData, type types_gen_CfgTotpVerifyBackupCreateErrors as CfgTotpVerifyBackupCreateErrors, type types_gen_CfgTotpVerifyBackupCreateResponse as CfgTotpVerifyBackupCreateResponse, type types_gen_CfgTotpVerifyBackupCreateResponses as CfgTotpVerifyBackupCreateResponses, type types_gen_CfgTotpVerifyCreateData as CfgTotpVerifyCreateData, type types_gen_CfgTotpVerifyCreateErrors as CfgTotpVerifyCreateErrors, type types_gen_CfgTotpVerifyCreateResponse as CfgTotpVerifyCreateResponse, type types_gen_CfgTotpVerifyCreateResponses as CfgTotpVerifyCreateResponses, type types_gen_ClientOptions as ClientOptions, type types_gen_ConfirmSetupRequest as ConfirmSetupRequest, type types_gen_ConfirmSetupResponse as ConfirmSetupResponse, type types_gen_DeviceList as DeviceList, type types_gen_DeviceListResponse as DeviceListResponse, type types_gen_DeviceListResponseWritable as DeviceListResponseWritable, types_gen_DeviceListStatusEnum as DeviceListStatusEnum, type types_gen_DisableRequest as DisableRequest, type types_gen_SetupRequest as SetupRequest, type types_gen_SetupResponse as SetupResponse, type types_gen_TotpVerifyUser as TotpVerifyUser, type types_gen_TotpVerifyUserWritable as TotpVerifyUserWritable, type types_gen_VerifyBackupRequest as VerifyBackupRequest, type types_gen_VerifyRequest as VerifyRequest, type types_gen_VerifyResponse as VerifyResponse, type types_gen_VerifyResponseWritable as VerifyResponseWritable };
1849
2828
  }
1850
2829
 
1851
- /**
1852
- * Django CFG API - API Client with JWT Management
1853
- *
1854
- * Usage:
1855
- * ```typescript
1856
- * import { API } from './api';
1857
- *
1858
- * const api = new API('https://api.example.com');
1859
- *
1860
- * // Set JWT token
1861
- * api.setToken('your-jwt-token', 'refresh-token');
1862
- *
1863
- * // Use API
1864
- * const posts = await api.posts.list();
1865
- * const user = await api.users.retrieve(1);
1866
- *
1867
- * // Check authentication
1868
- * if (api.isAuthenticated()) {
1869
- * // ...
1870
- * }
1871
- *
1872
- * // Custom storage with logging (for Electron/Node.js)
1873
- * import { MemoryStorageAdapter, APILogger } from './storage';
1874
- * const logger = new APILogger({ enabled: true, logLevel: 'debug' });
1875
- * const api = new API('https://api.example.com', {
1876
- * storage: new MemoryStorageAdapter(logger),
1877
- * loggerConfig: { enabled: true, logLevel: 'debug' }
1878
- * });
1879
- *
1880
- * // Get OpenAPI schema
1881
- * const schema = api.getSchema();
1882
- * ```
1883
- */
1884
-
1885
- declare const TOKEN_KEY = "auth_token";
1886
- declare const REFRESH_TOKEN_KEY = "refresh_token";
1887
- interface APIOptions {
1888
- /** Custom storage adapter (defaults to LocalStorageAdapter) */
1889
- storage?: StorageAdapter;
1890
- /** Custom HTTP client adapter (defaults to FetchAdapter) */
1891
- httpClient?: HttpClientAdapter;
1892
- /** Retry configuration for failed requests */
1893
- retryConfig?: RetryConfig;
1894
- /** Logger configuration */
1895
- loggerConfig?: Partial<LoggerConfig>;
1896
- /** Locale for Accept-Language header (e.g. 'en', 'ko', 'ru') */
1897
- locale?: string;
2830
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
2831
+ /**
2832
+ * You can provide a client instance returned by `createClient()` instead of
2833
+ * individual options. This might be also useful if you want to implement a
2834
+ * custom client.
2835
+ */
2836
+ client?: Client;
2837
+ /**
2838
+ * You can pass arbitrary values through the `meta` object. This can be
2839
+ * used to access values that aren't defined as part of the SDK function.
2840
+ */
2841
+ meta?: Record<string, unknown>;
2842
+ };
2843
+ declare class Cfg {
2844
+ /**
2845
+ * Get backup codes status for user.
2846
+ */
2847
+ static cfgTotpBackupCodesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpBackupCodesRetrieveData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRetrieveResponses, unknown, ThrowOnError, "fields">;
2848
+ /**
2849
+ * Regenerate backup codes.
2850
+ *
2851
+ * Requires TOTP code for verification.
2852
+ * Invalidates all existing codes.
2853
+ */
2854
+ static cfgTotpBackupCodesRegenerateCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpBackupCodesRegenerateCreateData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRegenerateCreateResponses, CfgTotpBackupCodesRegenerateCreateErrors, ThrowOnError, "fields">;
2855
+ /**
2856
+ * List all TOTP devices for user.
2857
+ */
2858
+ static cfgTotpDevicesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpDevicesRetrieveData, ThrowOnError>): RequestResult<CfgTotpDevicesRetrieveResponses, unknown, ThrowOnError, "fields">;
2859
+ /**
2860
+ * Delete a TOTP device.
2861
+ *
2862
+ * Requires verification code if removing the last/primary device.
2863
+ */
2864
+ static cfgTotpDevicesDestroy<ThrowOnError extends boolean = false>(options: Options<CfgTotpDevicesDestroyData, ThrowOnError>): RequestResult<CfgTotpDevicesDestroyResponses, unknown, ThrowOnError, "fields">;
2865
+ /**
2866
+ * Completely disable 2FA for account.
2867
+ *
2868
+ * Requires verification code.
2869
+ */
2870
+ static cfgTotpDisableCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpDisableCreateData, ThrowOnError>): RequestResult<CfgTotpDisableCreateResponses, CfgTotpDisableCreateErrors, ThrowOnError, "fields">;
2871
+ /**
2872
+ * Start 2FA setup process.
2873
+ *
2874
+ * Creates a new TOTP device and returns QR code for scanning.
2875
+ */
2876
+ static cfgTotpSetupCreate<ThrowOnError extends boolean = false>(options?: Options<CfgTotpSetupCreateData, ThrowOnError>): RequestResult<CfgTotpSetupCreateResponses, CfgTotpSetupCreateErrors, ThrowOnError, "fields">;
2877
+ /**
2878
+ * Confirm 2FA setup with first valid code.
2879
+ *
2880
+ * Activates the device and generates backup codes.
2881
+ */
2882
+ static cfgTotpSetupConfirmCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpSetupConfirmCreateData, ThrowOnError>): RequestResult<CfgTotpSetupConfirmCreateResponses, CfgTotpSetupConfirmCreateErrors, ThrowOnError, "fields">;
2883
+ /**
2884
+ * Verify TOTP code for 2FA session.
2885
+ *
2886
+ * Completes authentication and returns JWT tokens on success.
2887
+ */
2888
+ static cfgTotpVerifyCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyCreateResponses, CfgTotpVerifyCreateErrors, ThrowOnError, "fields">;
2889
+ /**
2890
+ * Verify backup recovery code for 2FA session.
2891
+ *
2892
+ * Alternative verification method when TOTP device unavailable.
2893
+ */
2894
+ static cfgTotpVerifyBackupCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyBackupCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyBackupCreateResponses, CfgTotpVerifyBackupCreateErrors, ThrowOnError, "fields">;
1898
2895
  }
1899
- declare class API {
1900
- private baseUrl;
1901
- private _client;
1902
- private _token;
1903
- private _refreshToken;
1904
- private _locale;
1905
- private storage;
1906
- private options?;
1907
- auth: Auth;
1908
- oauth: Oauth;
1909
- user_profile: UserProfile;
1910
- accounts: Accounts;
1911
- constructor(baseUrl: string, options?: APIOptions);
1912
- private _loadTokensFromStorage;
1913
- private _reinitClients;
1914
- private _injectAuthHeader;
1915
- /**
1916
- * Get current JWT token
2896
+ declare class Totp {
2897
+ /**
2898
+ * Get backup codes status for user.
1917
2899
  */
1918
- getToken(): string | null;
2900
+ static cfgTotpBackupCodesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpBackupCodesRetrieveData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRetrieveResponses, unknown, ThrowOnError, "fields">;
1919
2901
  /**
1920
- * Get current refresh token
2902
+ * Regenerate backup codes.
2903
+ *
2904
+ * Requires TOTP code for verification.
2905
+ * Invalidates all existing codes.
1921
2906
  */
1922
- getRefreshToken(): string | null;
2907
+ static cfgTotpBackupCodesRegenerateCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpBackupCodesRegenerateCreateData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRegenerateCreateResponses, CfgTotpBackupCodesRegenerateCreateErrors, ThrowOnError, "fields">;
2908
+ /**
2909
+ * List all TOTP devices for user.
2910
+ */
2911
+ static cfgTotpDevicesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpDevicesRetrieveData, ThrowOnError>): RequestResult<CfgTotpDevicesRetrieveResponses, unknown, ThrowOnError, "fields">;
1923
2912
  /**
1924
- * Set JWT token and refresh token
1925
- * @param token - JWT access token
1926
- * @param refreshToken - JWT refresh token (optional)
2913
+ * Delete a TOTP device.
2914
+ *
2915
+ * Requires verification code if removing the last/primary device.
1927
2916
  */
1928
- setToken(token: string, refreshToken?: string): void;
2917
+ static cfgTotpDevicesDestroy<ThrowOnError extends boolean = false>(options: Options<CfgTotpDevicesDestroyData, ThrowOnError>): RequestResult<CfgTotpDevicesDestroyResponses, unknown, ThrowOnError, "fields">;
1929
2918
  /**
1930
- * Clear all tokens
2919
+ * Completely disable 2FA for account.
2920
+ *
2921
+ * Requires verification code.
1931
2922
  */
1932
- clearTokens(): void;
2923
+ static cfgTotpDisableCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpDisableCreateData, ThrowOnError>): RequestResult<CfgTotpDisableCreateResponses, CfgTotpDisableCreateErrors, ThrowOnError, "fields">;
1933
2924
  /**
1934
- * Check if user is authenticated
2925
+ * Start 2FA setup process.
2926
+ *
2927
+ * Creates a new TOTP device and returns QR code for scanning.
1935
2928
  */
1936
- isAuthenticated(): boolean;
2929
+ static cfgTotpSetupCreate<ThrowOnError extends boolean = false>(options?: Options<CfgTotpSetupCreateData, ThrowOnError>): RequestResult<CfgTotpSetupCreateResponses, CfgTotpSetupCreateErrors, ThrowOnError, "fields">;
1937
2930
  /**
1938
- * Update base URL and reinitialize clients
1939
- * @param url - New base URL
2931
+ * Confirm 2FA setup with first valid code.
2932
+ *
2933
+ * Activates the device and generates backup codes.
1940
2934
  */
1941
- setBaseUrl(url: string): void;
2935
+ static cfgTotpSetupConfirmCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpSetupConfirmCreateData, ThrowOnError>): RequestResult<CfgTotpSetupConfirmCreateResponses, CfgTotpSetupConfirmCreateErrors, ThrowOnError, "fields">;
1942
2936
  /**
1943
- * Get current base URL
2937
+ * Verify TOTP code for 2FA session.
2938
+ *
2939
+ * Completes authentication and returns JWT tokens on success.
1944
2940
  */
1945
- getBaseUrl(): string;
2941
+ static cfgTotpVerifyCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyCreateResponses, CfgTotpVerifyCreateErrors, ThrowOnError, "fields">;
1946
2942
  /**
1947
- * Set locale for Accept-Language header
1948
- * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
2943
+ * Verify backup recovery code for 2FA session.
2944
+ *
2945
+ * Alternative verification method when TOTP device unavailable.
1949
2946
  */
1950
- setLocale(locale: string | null): void;
2947
+ static cfgTotpVerifyBackupCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyBackupCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyBackupCreateResponses, CfgTotpVerifyBackupCreateErrors, ThrowOnError, "fields">;
2948
+ }
2949
+ declare class BackupCodes {
1951
2950
  /**
1952
- * Get current locale
2951
+ * Get backup codes status for user.
1953
2952
  */
1954
- getLocale(): string | null;
2953
+ static cfgTotpBackupCodesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpBackupCodesRetrieveData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRetrieveResponses, unknown, ThrowOnError, "fields">;
1955
2954
  /**
1956
- * Get OpenAPI schema path
1957
- * @returns Path to the OpenAPI schema JSON file
2955
+ * Regenerate backup codes.
1958
2956
  *
1959
- * Note: The OpenAPI schema is available in the schema.json file.
1960
- * You can load it dynamically using:
1961
- * ```typescript
1962
- * const schema = await fetch('./schema.json').then(r => r.json());
1963
- * // or using fs in Node.js:
1964
- * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
1965
- * ```
2957
+ * Requires TOTP code for verification.
2958
+ * Invalidates all existing codes.
1966
2959
  */
1967
- getSchemaPath(): string;
2960
+ static cfgTotpBackupCodesRegenerateCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpBackupCodesRegenerateCreateData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRegenerateCreateResponses, CfgTotpBackupCodesRegenerateCreateErrors, ThrowOnError, "fields">;
1968
2961
  }
1969
-
1970
- type index_API = API;
1971
- declare const index_API: typeof API;
1972
- type index_APIClient = APIClient;
1973
- declare const index_APIClient: typeof APIClient;
1974
- type index_APIError = APIError;
1975
- declare const index_APIError: typeof APIError;
1976
- type index_APILogger = APILogger;
1977
- declare const index_APILogger: typeof APILogger;
1978
- type index_APIOptions = APIOptions;
1979
- type index_AccountDeleteResponse = AccountDeleteResponse;
1980
- declare const index_AccountDeleteResponseSchema: typeof AccountDeleteResponseSchema;
1981
- type index_CentrifugoToken = CentrifugoToken;
1982
- declare const index_CentrifugoTokenSchema: typeof CentrifugoTokenSchema;
1983
- type index_CfgAccountsProfileAvatarCreateRequest = CfgAccountsProfileAvatarCreateRequest;
1984
- declare const index_CfgAccountsProfileAvatarCreateRequestSchema: typeof CfgAccountsProfileAvatarCreateRequestSchema;
1985
- type index_CookieStorageAdapter = CookieStorageAdapter;
1986
- declare const index_CookieStorageAdapter: typeof CookieStorageAdapter;
1987
- declare const index_DEFAULT_RETRY_CONFIG: typeof DEFAULT_RETRY_CONFIG;
1988
- type index_ErrorLog = ErrorLog;
1989
- type index_FailedAttemptInfo = FailedAttemptInfo;
1990
- type index_FetchAdapter = FetchAdapter;
1991
- declare const index_FetchAdapter: typeof FetchAdapter;
1992
- type index_HttpRequest = HttpRequest;
1993
- type index_HttpResponse<T = any> = HttpResponse<T>;
1994
- type index_KeepAliveFetchAdapter = KeepAliveFetchAdapter;
1995
- declare const index_KeepAliveFetchAdapter: typeof KeepAliveFetchAdapter;
1996
- type index_LocalStorageAdapter = LocalStorageAdapter;
1997
- declare const index_LocalStorageAdapter: typeof LocalStorageAdapter;
1998
- type index_LoggerConfig = LoggerConfig;
1999
- type index_MemoryStorageAdapter = MemoryStorageAdapter;
2000
- declare const index_MemoryStorageAdapter: typeof MemoryStorageAdapter;
2001
- type index_NetworkError = NetworkError;
2002
- declare const index_NetworkError: typeof NetworkError;
2003
- type index_OAuthAuthorizeRequestRequest = OAuthAuthorizeRequestRequest;
2004
- declare const index_OAuthAuthorizeRequestRequestSchema: typeof OAuthAuthorizeRequestRequestSchema;
2005
- type index_OAuthAuthorizeResponse = OAuthAuthorizeResponse;
2006
- declare const index_OAuthAuthorizeResponseSchema: typeof OAuthAuthorizeResponseSchema;
2007
- type index_OAuthCallbackRequestRequest = OAuthCallbackRequestRequest;
2008
- declare const index_OAuthCallbackRequestRequestSchema: typeof OAuthCallbackRequestRequestSchema;
2009
- type index_OAuthConnection = OAuthConnection;
2010
- declare const index_OAuthConnectionSchema: typeof OAuthConnectionSchema;
2011
- type index_OAuthDisconnectRequestRequest = OAuthDisconnectRequestRequest;
2012
- declare const index_OAuthDisconnectRequestRequestSchema: typeof OAuthDisconnectRequestRequestSchema;
2013
- type index_OAuthError = OAuthError;
2014
- declare const index_OAuthErrorSchema: typeof OAuthErrorSchema;
2015
- type index_OAuthProvidersResponse = OAuthProvidersResponse;
2016
- declare const index_OAuthProvidersResponseSchema: typeof OAuthProvidersResponseSchema;
2017
- type index_OAuthTokenResponse = OAuthTokenResponse;
2018
- declare const index_OAuthTokenResponseSchema: typeof OAuthTokenResponseSchema;
2019
- type index_OTPErrorResponse = OTPErrorResponse;
2020
- declare const index_OTPErrorResponseSchema: typeof OTPErrorResponseSchema;
2021
- type index_OTPRequestRequest = OTPRequestRequest;
2022
- declare const index_OTPRequestRequestSchema: typeof OTPRequestRequestSchema;
2023
- type index_OTPRequestResponse = OTPRequestResponse;
2024
- declare const index_OTPRequestResponseSchema: typeof OTPRequestResponseSchema;
2025
- type index_OTPVerifyRequest = OTPVerifyRequest;
2026
- declare const index_OTPVerifyRequestSchema: typeof OTPVerifyRequestSchema;
2027
- type index_OTPVerifyResponse = OTPVerifyResponse;
2028
- declare const index_OTPVerifyResponseSchema: typeof OTPVerifyResponseSchema;
2029
- type index_PatchedUserProfileUpdateRequest = PatchedUserProfileUpdateRequest;
2030
- declare const index_PatchedUserProfileUpdateRequestSchema: typeof PatchedUserProfileUpdateRequestSchema;
2031
- declare const index_REFRESH_TOKEN_KEY: typeof REFRESH_TOKEN_KEY;
2032
- type index_RequestLog = RequestLog;
2033
- type index_ResponseLog = ResponseLog;
2034
- type index_RetryConfig = RetryConfig;
2035
- type index_StorageAdapter = StorageAdapter;
2036
- declare const index_TOKEN_KEY: typeof TOKEN_KEY;
2037
- type index_TokenRefresh = TokenRefresh;
2038
- type index_TokenRefreshRequest = TokenRefreshRequest;
2039
- declare const index_TokenRefreshRequestSchema: typeof TokenRefreshRequestSchema;
2040
- declare const index_TokenRefreshSchema: typeof TokenRefreshSchema;
2041
- type index_User = User;
2042
- type index_UserProfileUpdateRequest = UserProfileUpdateRequest;
2043
- declare const index_UserProfileUpdateRequestSchema: typeof UserProfileUpdateRequestSchema;
2044
- declare const index_UserSchema: typeof UserSchema;
2045
- type index_ValidationErrorDetail = ValidationErrorDetail;
2046
- type index_ValidationErrorEvent = ValidationErrorEvent;
2047
- declare const index_clearAPITokens: typeof clearAPITokens;
2048
- declare const index_configureAPI: typeof configureAPI;
2049
- declare const index_createAccountsOauthDisconnectCreate: typeof createAccountsOauthDisconnectCreate;
2050
- declare const index_createAccountsOauthGithubAuthorizeCreate: typeof createAccountsOauthGithubAuthorizeCreate;
2051
- declare const index_createAccountsOauthGithubCallbackCreate: typeof createAccountsOauthGithubCallbackCreate;
2052
- declare const index_createAccountsOtpRequestCreate: typeof createAccountsOtpRequestCreate;
2053
- declare const index_createAccountsOtpVerifyCreate: typeof createAccountsOtpVerifyCreate;
2054
- declare const index_createAccountsProfileAvatarCreate: typeof createAccountsProfileAvatarCreate;
2055
- declare const index_createAccountsProfileDeleteCreate: typeof createAccountsProfileDeleteCreate;
2056
- declare const index_createAccountsTokenRefreshCreate: typeof createAccountsTokenRefreshCreate;
2057
- declare const index_dispatchValidationError: typeof dispatchValidationError;
2058
- declare const index_formatZodError: typeof formatZodError;
2059
- declare const index_getAPIInstance: typeof getAPIInstance;
2060
- declare const index_getAccountsOauthConnectionsList: typeof getAccountsOauthConnectionsList;
2061
- declare const index_getAccountsOauthProvidersRetrieve: typeof getAccountsOauthProvidersRetrieve;
2062
- declare const index_getAccountsProfileRetrieve: typeof getAccountsProfileRetrieve;
2063
- declare const index_isAPIConfigured: typeof isAPIConfigured;
2064
- declare const index_onValidationError: typeof onValidationError;
2065
- declare const index_partialUpdateAccountsProfilePartialPartialUpdate: typeof partialUpdateAccountsProfilePartialPartialUpdate;
2066
- declare const index_partialUpdateAccountsProfilePartialUpdate: typeof partialUpdateAccountsProfilePartialUpdate;
2067
- declare const index_partialUpdateAccountsProfileUpdatePartialUpdate: typeof partialUpdateAccountsProfileUpdatePartialUpdate;
2068
- declare const index_reconfigureAPI: typeof reconfigureAPI;
2069
- declare const index_resetAPI: typeof resetAPI;
2070
- declare const index_shouldRetry: typeof shouldRetry;
2071
- declare const index_updateAccountsProfileUpdateUpdate: typeof updateAccountsProfileUpdateUpdate;
2072
- declare const index_withRetry: typeof withRetry;
2073
- declare namespace index {
2074
- export { index_API as API, index_APIClient as APIClient, index_APIError as APIError, index_APILogger as APILogger, type index_APIOptions as APIOptions, type index_AccountDeleteResponse as AccountDeleteResponse, index_AccountDeleteResponseSchema as AccountDeleteResponseSchema, models as AccountsTypes, models$3 as AuthTypes, type index_CentrifugoToken as CentrifugoToken, index_CentrifugoTokenSchema as CentrifugoTokenSchema, type index_CfgAccountsProfileAvatarCreateRequest as CfgAccountsProfileAvatarCreateRequest, index_CfgAccountsProfileAvatarCreateRequestSchema as CfgAccountsProfileAvatarCreateRequestSchema, index_CookieStorageAdapter as CookieStorageAdapter, index_DEFAULT_RETRY_CONFIG as DEFAULT_RETRY_CONFIG, enums as Enums, type index_ErrorLog as ErrorLog, type index_FailedAttemptInfo as FailedAttemptInfo, index_FetchAdapter as FetchAdapter, index$1 as Fetchers, type HttpClientAdapter$1 as HttpClientAdapter, type index_HttpRequest as HttpRequest, type index_HttpResponse as HttpResponse, index_KeepAliveFetchAdapter as KeepAliveFetchAdapter, index_LocalStorageAdapter as LocalStorageAdapter, type index_LoggerConfig as LoggerConfig, index_MemoryStorageAdapter as MemoryStorageAdapter, index_NetworkError as NetworkError, type index_OAuthAuthorizeRequestRequest as OAuthAuthorizeRequestRequest, index_OAuthAuthorizeRequestRequestSchema as OAuthAuthorizeRequestRequestSchema, type index_OAuthAuthorizeResponse as OAuthAuthorizeResponse, index_OAuthAuthorizeResponseSchema as OAuthAuthorizeResponseSchema, type index_OAuthCallbackRequestRequest as OAuthCallbackRequestRequest, index_OAuthCallbackRequestRequestSchema as OAuthCallbackRequestRequestSchema, type index_OAuthConnection as OAuthConnection, index_OAuthConnectionSchema as OAuthConnectionSchema, type index_OAuthDisconnectRequestRequest as OAuthDisconnectRequestRequest, index_OAuthDisconnectRequestRequestSchema as OAuthDisconnectRequestRequestSchema, type index_OAuthError as OAuthError, index_OAuthErrorSchema as OAuthErrorSchema, type index_OAuthProvidersResponse as OAuthProvidersResponse, index_OAuthProvidersResponseSchema as OAuthProvidersResponseSchema, type index_OAuthTokenResponse as OAuthTokenResponse, index_OAuthTokenResponseSchema as OAuthTokenResponseSchema, type index_OTPErrorResponse as OTPErrorResponse, index_OTPErrorResponseSchema as OTPErrorResponseSchema, type index_OTPRequestRequest as OTPRequestRequest, index_OTPRequestRequestSchema as OTPRequestRequestSchema, type index_OTPRequestResponse as OTPRequestResponse, index_OTPRequestResponseSchema as OTPRequestResponseSchema, type index_OTPVerifyRequest as OTPVerifyRequest, index_OTPVerifyRequestSchema as OTPVerifyRequestSchema, type index_OTPVerifyResponse as OTPVerifyResponse, index_OTPVerifyResponseSchema as OTPVerifyResponseSchema, models$2 as OauthTypes, type index_PatchedUserProfileUpdateRequest as PatchedUserProfileUpdateRequest, index_PatchedUserProfileUpdateRequestSchema as PatchedUserProfileUpdateRequestSchema, index_REFRESH_TOKEN_KEY as REFRESH_TOKEN_KEY, type index_RequestLog as RequestLog, type index_ResponseLog as ResponseLog, type index_RetryConfig as RetryConfig, index$2 as Schemas, type index_StorageAdapter as StorageAdapter, index_TOKEN_KEY as TOKEN_KEY, type index_TokenRefresh as TokenRefresh, type index_TokenRefreshRequest as TokenRefreshRequest, index_TokenRefreshRequestSchema as TokenRefreshRequestSchema, index_TokenRefreshSchema as TokenRefreshSchema, type index_User as User, models$1 as UserProfileTypes, type index_UserProfileUpdateRequest as UserProfileUpdateRequest, index_UserProfileUpdateRequestSchema as UserProfileUpdateRequestSchema, index_UserSchema as UserSchema, type index_ValidationErrorDetail as ValidationErrorDetail, type index_ValidationErrorEvent as ValidationErrorEvent, index_clearAPITokens as clearAPITokens, index_configureAPI as configureAPI, index_createAccountsOauthDisconnectCreate as createAccountsOauthDisconnectCreate, index_createAccountsOauthGithubAuthorizeCreate as createAccountsOauthGithubAuthorizeCreate, index_createAccountsOauthGithubCallbackCreate as createAccountsOauthGithubCallbackCreate, index_createAccountsOtpRequestCreate as createAccountsOtpRequestCreate, index_createAccountsOtpVerifyCreate as createAccountsOtpVerifyCreate, index_createAccountsProfileAvatarCreate as createAccountsProfileAvatarCreate, index_createAccountsProfileDeleteCreate as createAccountsProfileDeleteCreate, index_createAccountsTokenRefreshCreate as createAccountsTokenRefreshCreate, API as default, index_dispatchValidationError as dispatchValidationError, index_formatZodError as formatZodError, index_getAPIInstance as getAPIInstance, index_getAccountsOauthConnectionsList as getAccountsOauthConnectionsList, index_getAccountsOauthProvidersRetrieve as getAccountsOauthProvidersRetrieve, index_getAccountsProfileRetrieve as getAccountsProfileRetrieve, index_isAPIConfigured as isAPIConfigured, index_onValidationError as onValidationError, index_partialUpdateAccountsProfilePartialPartialUpdate as partialUpdateAccountsProfilePartialPartialUpdate, index_partialUpdateAccountsProfilePartialUpdate as partialUpdateAccountsProfilePartialUpdate, index_partialUpdateAccountsProfileUpdatePartialUpdate as partialUpdateAccountsProfileUpdatePartialUpdate, index_reconfigureAPI as reconfigureAPI, index_resetAPI as resetAPI, index_shouldRetry as shouldRetry, index_updateAccountsProfileUpdateUpdate as updateAccountsProfileUpdateUpdate, index_withRetry as withRetry };
2962
+ declare class TotpManagement {
2963
+ /**
2964
+ * List all TOTP devices for user.
2965
+ */
2966
+ static cfgTotpDevicesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpDevicesRetrieveData, ThrowOnError>): RequestResult<CfgTotpDevicesRetrieveResponses, unknown, ThrowOnError, "fields">;
2967
+ /**
2968
+ * Completely disable 2FA for account.
2969
+ *
2970
+ * Requires verification code.
2971
+ */
2972
+ static cfgTotpDisableCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpDisableCreateData, ThrowOnError>): RequestResult<CfgTotpDisableCreateResponses, CfgTotpDisableCreateErrors, ThrowOnError, "fields">;
2973
+ }
2974
+ declare class TotpSetup {
2975
+ /**
2976
+ * Start 2FA setup process.
2977
+ *
2978
+ * Creates a new TOTP device and returns QR code for scanning.
2979
+ */
2980
+ static cfgTotpSetupCreate<ThrowOnError extends boolean = false>(options?: Options<CfgTotpSetupCreateData, ThrowOnError>): RequestResult<CfgTotpSetupCreateResponses, CfgTotpSetupCreateErrors, ThrowOnError, "fields">;
2981
+ /**
2982
+ * Confirm 2FA setup with first valid code.
2983
+ *
2984
+ * Activates the device and generates backup codes.
2985
+ */
2986
+ static cfgTotpSetupConfirmCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpSetupConfirmCreateData, ThrowOnError>): RequestResult<CfgTotpSetupConfirmCreateResponses, CfgTotpSetupConfirmCreateErrors, ThrowOnError, "fields">;
2987
+ }
2988
+ declare class TotpVerification {
2989
+ /**
2990
+ * Verify TOTP code for 2FA session.
2991
+ *
2992
+ * Completes authentication and returns JWT tokens on success.
2993
+ */
2994
+ static cfgTotpVerifyCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyCreateResponses, CfgTotpVerifyCreateErrors, ThrowOnError, "fields">;
2995
+ /**
2996
+ * Verify backup recovery code for 2FA session.
2997
+ *
2998
+ * Alternative verification method when TOTP device unavailable.
2999
+ */
3000
+ static cfgTotpVerifyBackupCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyBackupCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyBackupCreateResponses, CfgTotpVerifyBackupCreateErrors, ThrowOnError, "fields">;
2075
3001
  }
2076
3002
 
3003
+ interface APIOptions {
3004
+ /** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
3005
+ storage?: StorageAdapter;
3006
+ /** Logger config (defaults to dev-only). */
3007
+ logger?: Partial<LoggerConfig>;
3008
+ /** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
3009
+ locale?: string;
3010
+ /** API key sent as `X-API-Key`. Falls back to NEXT_PUBLIC_API_KEY. */
3011
+ apiKey?: string;
3012
+ /** Send Django session/CSRF cookies cross-origin. Defaults to true. */
3013
+ withCredentials?: boolean;
3014
+ }
2077
3015
  /**
2078
- * Zod schema for ConnectionTokenResponse
2079
- *
2080
- * This schema provides runtime validation and type inference.
2081
- * * Response model for Centrifugo connection token.
2082
- * */
2083
-
2084
- /**
2085
- * Response model for Centrifugo connection token.
2086
- */
2087
- declare const ConnectionTokenResponseSchema: z.ZodObject<{
2088
- token: z.ZodString;
2089
- centrifugo_url: z.ZodString;
2090
- expires_at: z.ZodString;
2091
- channels: z.ZodArray<z.ZodString>;
2092
- }, z.core.$strip>;
2093
- /**
2094
- * Infer TypeScript type from Zod schema
2095
- */
2096
- type ConnectionTokenResponse = z.infer<typeof ConnectionTokenResponseSchema>;
2097
-
2098
- /**
2099
- * Get Centrifugo connection token
2100
- *
2101
- * @method GET
2102
- * @path /cfg/centrifugo/auth/token/
2103
- */
2104
- declare function getCentrifugoAuthTokenRetrieve(client?: any): Promise<ConnectionTokenResponse>;
2105
-
2106
- /**
2107
- * @djangocfg/api - Shared API Package
2108
- *
2109
- * Core authentication API (cfg_accounts only).
2110
- * Extensions are now in separate packages:
2111
- * - @djangocfg/ext-support
2112
- * - @djangocfg/ext-payments
2113
- * - etc.
2114
- */
2115
-
2116
- declare const api: API;
2117
- /**
2118
- * Base Client Class
3016
+ * Self-contained API wrapper for this group.
2119
3017
  *
2120
- * Service classes can extend this to access api instance
3018
+ * Each group has its own client + interceptor + token store. The interceptor
3019
+ * automatically attaches:
3020
+ * - `Authorization: Bearer <jwt>` from storage
3021
+ * - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
3022
+ * - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
3023
+ * - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
2121
3024
  */
2122
- declare class BaseClient {
2123
- protected static api: API;
3025
+ declare class API {
3026
+ private baseUrl;
3027
+ private storage;
3028
+ private locale;
3029
+ private apiKey;
3030
+ readonly logger: APILogger;
3031
+ readonly cfg: typeof Cfg;
3032
+ readonly totp: typeof Totp;
3033
+ readonly backupCodes: typeof BackupCodes;
3034
+ readonly totpManagement: typeof TotpManagement;
3035
+ readonly totpSetup: typeof TotpSetup;
3036
+ readonly totpVerification: typeof TotpVerification;
3037
+ constructor(baseUrl: string, opts?: APIOptions);
3038
+ getBaseUrl(): string;
3039
+ setBaseUrl(url: string): void;
3040
+ getToken(): string | null;
3041
+ setToken(token: string | null): void;
3042
+ getRefreshToken(): string | null;
3043
+ setRefreshToken(token: string | null): void;
3044
+ clearToken(): void;
3045
+ isAuthenticated(): boolean;
3046
+ getLocale(): string | null;
3047
+ setLocale(locale: string | null): void;
3048
+ getApiKey(): string | null;
3049
+ setApiKey(key: string | null): void;
2124
3050
  }
2125
3051
 
2126
- export { API, APIClient, APIError, APILogger, type APIOptions, type AccountDeleteResponse, AccountDeleteResponseSchema, models as AccountsTypes, models$3 as AuthTypes, BaseClient, type CentrifugoToken, CentrifugoTokenSchema, type CfgAccountsProfileAvatarCreateRequest, CfgAccountsProfileAvatarCreateRequestSchema, index as CfgAccountsTypes, CookieStorageAdapter, DEFAULT_RETRY_CONFIG, enums as Enums, type ErrorLog, type FailedAttemptInfo, FetchAdapter, index$1 as Fetchers, type HttpClientAdapter$1 as HttpClientAdapter, type HttpRequest, type HttpResponse, KeepAliveFetchAdapter, LocalStorageAdapter, type LoggerConfig, MemoryStorageAdapter, NetworkError, type OAuthAuthorizeRequestRequest, OAuthAuthorizeRequestRequestSchema, type OAuthAuthorizeResponse, OAuthAuthorizeResponseSchema, type OAuthCallbackRequestRequest, OAuthCallbackRequestRequestSchema, type OAuthConnection, OAuthConnectionSchema, type OAuthDisconnectRequestRequest, OAuthDisconnectRequestRequestSchema, type OAuthError, OAuthErrorSchema, type OAuthProvidersResponse, OAuthProvidersResponseSchema, type OAuthTokenResponse, OAuthTokenResponseSchema, type OTPErrorResponse, OTPErrorResponseSchema, type OTPRequestRequest, OTPRequestRequestSchema, type OTPRequestResponse, OTPRequestResponseSchema, type OTPVerifyRequest, OTPVerifyRequestSchema, type OTPVerifyResponse, OTPVerifyResponseSchema, models$2 as OauthTypes, type PatchedUserProfileUpdateRequest, PatchedUserProfileUpdateRequestSchema, REFRESH_TOKEN_KEY, type RequestLog, type ResponseLog, type RetryConfig, index$2 as Schemas, type StorageAdapter, TOKEN_KEY, type TokenRefresh, type TokenRefreshRequest, TokenRefreshRequestSchema, TokenRefreshSchema, type User, models$1 as UserProfileTypes, type UserProfileUpdateRequest, UserProfileUpdateRequestSchema, UserSchema, type ValidationErrorDetail, type ValidationErrorEvent, api, clearAPITokens, configureAPI, createAccountsOauthDisconnectCreate, createAccountsOauthGithubAuthorizeCreate, createAccountsOauthGithubCallbackCreate, createAccountsOtpRequestCreate, createAccountsOtpVerifyCreate, createAccountsProfileAvatarCreate, createAccountsProfileDeleteCreate, createAccountsTokenRefreshCreate, dispatchValidationError, formatZodError, getAPIInstance, getAccountsOauthConnectionsList, getAccountsOauthProvidersRetrieve, getAccountsProfileRetrieve, getCentrifugoAuthTokenRetrieve, isAPIConfigured, onValidationError, partialUpdateAccountsProfilePartialPartialUpdate, partialUpdateAccountsProfilePartialUpdate, partialUpdateAccountsProfileUpdatePartialUpdate, reconfigureAPI, resetAPI, shouldRetry, updateAccountsProfileUpdateUpdate, withRetry };
3052
+ declare const cfgAccountsApi: API$2;
3053
+ declare const cfgCentrifugoApi: API$1;
3054
+ declare const cfgTotpApi: API;
3055
+
3056
+ export { APIError, APILogger, Accounts, types_gen$2 as AccountsTypes, Auth$2 as Auth, BackupCodes, Centrifugo, CentrifugoAuth, types_gen$1 as CentrifugoTypes, API$2 as CfgAccountsAPI, API$1 as CfgCentrifugoAPI, API as CfgTotpAPI, CookieStorageAdapter, type ErrorLog, LocalStorageAdapter, type LoggerConfig, MemoryStorageAdapter, NetworkError, OAuth, type RequestLog, type ResponseLog, type StorageAdapter, Totp, TotpManagement, TotpSetup, types_gen as TotpTypes, TotpVerification, type User, UserProfile, type ValidationErrorDetail, type ValidationErrorEvent, cfgAccountsApi as api, cfgAccountsApi, cfgCentrifugoApi, cfgTotpApi, defaultLogger, dispatchValidationError, formatZodError, onValidationError };