@djangocfg/api 2.1.322 → 2.1.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-server.cjs +1037 -1227
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +1037 -1217
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +2142 -3398
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +158 -209
- package/dist/auth.d.ts +158 -209
- package/dist/auth.mjs +2136 -3392
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +1018 -4423
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +151 -2918
- package/dist/clients.d.ts +151 -2918
- package/dist/clients.mjs +1018 -4417
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +2253 -2819
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2408 -1872
- package/dist/index.d.ts +2408 -1872
- package/dist/index.mjs +2235 -2795
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -7
- package/src/_api/generated/_cfg_accounts/api.ts +120 -0
- package/src/_api/generated/_cfg_accounts/events.ts +198 -0
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +18 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +25 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +25 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +25 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +24 -0
- package/src/_api/generated/_cfg_accounts/index.ts +29 -0
- package/src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts +14 -0
- package/src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts +16 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeResponse.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts +19 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthError.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthProvidersResponse.ts +11 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +18 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPErrorResponse.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts +11 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts +17 -0
- package/src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts +16 -0
- package/src/_api/generated/_cfg_accounts/schemas/ProviderEnum.ts +9 -0
- package/src/_api/generated/_cfg_accounts/schemas/TokenRefresh.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/TokenRefreshRequest.ts +11 -0
- package/src/_api/generated/{cfg_accounts/_utils/schemas/User.schema.ts → _cfg_accounts/schemas/User.ts} +19 -27
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +24 -0
- package/src/_api/generated/_cfg_accounts/sdk.gen.ts +5 -0
- package/src/_api/generated/_cfg_accounts/types.gen.ts +5 -0
- package/src/_api/generated/_cfg_centrifugo/api.ts +120 -0
- package/src/_api/generated/_cfg_centrifugo/events.ts +198 -0
- package/src/_api/generated/_cfg_centrifugo/hooks/index.ts +4 -0
- package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +25 -0
- package/src/_api/generated/_cfg_centrifugo/index.ts +29 -0
- package/src/_api/generated/_cfg_centrifugo/schemas/ConnectionTokenResponse.ts +14 -0
- package/src/_api/generated/_cfg_centrifugo/schemas/index.ts +4 -0
- package/src/_api/generated/_cfg_centrifugo/sdk.gen.ts +5 -0
- package/src/_api/generated/_cfg_centrifugo/types.gen.ts +5 -0
- package/src/_api/generated/_cfg_totp/api.ts +120 -0
- package/src/_api/generated/_cfg_totp/events.ts +198 -0
- package/src/_api/generated/_cfg_totp/hooks/index.ts +12 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +24 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +25 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesDestroy.ts +24 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +25 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +24 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +24 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +24 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +24 -0
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +24 -0
- package/src/_api/generated/_cfg_totp/index.ts +29 -0
- package/src/_api/generated/_cfg_totp/schemas/BackupCodesRegenerateRequest.ts +11 -0
- package/src/_api/generated/_cfg_totp/schemas/BackupCodesRegenerateResponse.ts +12 -0
- package/src/_api/generated/_cfg_totp/schemas/BackupCodesStatus.ts +13 -0
- package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupRequest.ts +12 -0
- package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupResponse.ts +13 -0
- package/src/_api/generated/_cfg_totp/schemas/DeviceList.ts +18 -0
- package/src/_api/generated/_cfg_totp/schemas/DeviceListResponse.ts +13 -0
- package/src/_api/generated/_cfg_totp/schemas/DeviceListStatusEnum.ts +9 -0
- package/src/_api/generated/_cfg_totp/schemas/DisableRequest.ts +11 -0
- package/src/_api/generated/_cfg_totp/schemas/SetupRequest.ts +11 -0
- package/src/_api/generated/_cfg_totp/schemas/SetupResponse.ts +15 -0
- package/src/_api/generated/{cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts → _cfg_totp/schemas/TotpVerifyUser.ts} +17 -25
- package/src/_api/generated/_cfg_totp/schemas/VerifyBackupRequest.ts +12 -0
- package/src/_api/generated/_cfg_totp/schemas/VerifyRequest.ts +12 -0
- package/src/_api/generated/_cfg_totp/schemas/VerifyResponse.ts +17 -0
- package/src/_api/generated/_cfg_totp/schemas/index.ts +18 -0
- package/src/_api/generated/_cfg_totp/sdk.gen.ts +5 -0
- package/src/_api/generated/_cfg_totp/types.gen.ts +5 -0
- package/src/_api/generated/client/client.gen.ts +280 -0
- package/src/_api/generated/client/index.ts +25 -0
- package/src/_api/generated/client/types.gen.ts +217 -0
- package/src/_api/generated/client/utils.gen.ts +318 -0
- package/src/_api/generated/client.gen.ts +16 -0
- package/src/_api/generated/core/auth.gen.ts +41 -0
- package/src/_api/generated/core/bodySerializer.gen.ts +82 -0
- package/src/_api/generated/core/params.gen.ts +169 -0
- package/src/_api/generated/core/pathSerializer.gen.ts +171 -0
- package/src/_api/generated/core/queryKeySerializer.gen.ts +117 -0
- package/src/_api/generated/core/serverSentEvents.gen.ts +242 -0
- package/src/_api/generated/core/types.gen.ts +104 -0
- package/src/_api/generated/core/utils.gen.ts +140 -0
- package/src/_api/generated/helpers/errors.ts +70 -0
- package/src/_api/generated/helpers/index.ts +25 -0
- package/src/_api/generated/helpers/logger.ts +123 -0
- package/src/_api/generated/helpers/storage.ts +83 -0
- package/src/_api/generated/helpers/validation-events.ts +52 -0
- package/src/_api/generated/index.ts +28 -0
- package/src/_api/generated/sdk.gen.ts +1250 -0
- package/src/_api/generated/types.gen.ts +1294 -0
- package/src/_api/index.ts +5 -23
- package/src/auth/context/AccountsContext.tsx +58 -89
- package/src/auth/context/AuthContext.tsx +3 -3
- package/src/auth/context/index.ts +2 -2
- package/src/auth/hooks/useDeleteAccount.ts +3 -1
- package/src/auth/hooks/useGithubAuth.ts +13 -11
- package/src/auth/hooks/useTokenRefresh.ts +7 -4
- package/src/auth/hooks/useTwoFactor.ts +15 -8
- package/src/auth/hooks/useTwoFactorSetup.ts +9 -5
- package/src/auth/hooks/useTwoFactorStatus.ts +5 -3
- package/src/auth/middlewares/tokenRefresh.ts +7 -4
- package/src/clients.ts +14 -51
- package/src/index.ts +35 -60
- package/src/server.ts +25 -23
- package/src/_api/BaseClient.ts +0 -22
- package/src/_api/generated/cfg_accounts/CLAUDE.md +0 -86
- package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts.ts +0 -154
- package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +0 -95
- package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +0 -285
- package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +0 -440
- package/src/_api/generated/cfg_accounts/_utils/fetchers/index.ts +0 -33
- package/src/_api/generated/cfg_accounts/_utils/hooks/accounts.ts +0 -64
- package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +0 -44
- package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +0 -114
- package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +0 -152
- package/src/_api/generated/cfg_accounts/_utils/hooks/index.ts +0 -33
- package/src/_api/generated/cfg_accounts/_utils/schemas/AccountDeleteResponse.schema.ts +0 -20
- package/src/_api/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +0 -22
- package/src/_api/generated/cfg_accounts/_utils/schemas/CfgAccountsProfileAvatarCreateRequest.schema.ts +0 -15
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts +0 -20
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts +0 -21
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +0 -27
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts +0 -20
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts +0 -19
- package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +0 -46
- package/src/_api/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts +0 -41
- package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts +0 -19
- package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +0 -21
- package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts +0 -45
- package/src/_api/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts +0 -24
- package/src/_api/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts +0 -16
- package/src/_api/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts +0 -15
- package/src/_api/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts +0 -24
- package/src/_api/generated/cfg_accounts/_utils/schemas/index.ts +0 -41
- package/src/_api/generated/cfg_accounts/accounts/client.ts +0 -34
- package/src/_api/generated/cfg_accounts/accounts/index.ts +0 -4
- package/src/_api/generated/cfg_accounts/accounts/models.ts +0 -127
- package/src/_api/generated/cfg_accounts/accounts__auth/client.ts +0 -23
- package/src/_api/generated/cfg_accounts/accounts__auth/index.ts +0 -4
- package/src/_api/generated/cfg_accounts/accounts__auth/models.ts +0 -19
- package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +0 -67
- package/src/_api/generated/cfg_accounts/accounts__oauth/index.ts +0 -4
- package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +0 -127
- package/src/_api/generated/cfg_accounts/accounts__user_profile/client.ts +0 -94
- package/src/_api/generated/cfg_accounts/accounts__user_profile/index.ts +0 -4
- package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +0 -98
- package/src/_api/generated/cfg_accounts/api-instance.ts +0 -181
- package/src/_api/generated/cfg_accounts/client.ts +0 -339
- package/src/_api/generated/cfg_accounts/enums.ts +0 -10
- package/src/_api/generated/cfg_accounts/errors.ts +0 -123
- package/src/_api/generated/cfg_accounts/http.ts +0 -160
- package/src/_api/generated/cfg_accounts/index.ts +0 -338
- package/src/_api/generated/cfg_accounts/logger.ts +0 -261
- package/src/_api/generated/cfg_accounts/retry.ts +0 -177
- package/src/_api/generated/cfg_accounts/schema.json +0 -1576
- package/src/_api/generated/cfg_accounts/storage.ts +0 -163
- package/src/_api/generated/cfg_accounts/validation-events.ts +0 -135
- package/src/_api/generated/cfg_centrifugo/CLAUDE.md +0 -60
- package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +0 -94
- package/src/_api/generated/cfg_centrifugo/_utils/fetchers/index.ts +0 -30
- package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +0 -39
- package/src/_api/generated/cfg_centrifugo/_utils/hooks/index.ts +0 -30
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/index.ts +0 -21
- package/src/_api/generated/cfg_centrifugo/api-instance.ts +0 -181
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts +0 -27
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +0 -4
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +0 -18
- package/src/_api/generated/cfg_centrifugo/client.ts +0 -330
- package/src/_api/generated/cfg_centrifugo/errors.ts +0 -123
- package/src/_api/generated/cfg_centrifugo/http.ts +0 -160
- package/src/_api/generated/cfg_centrifugo/index.ts +0 -316
- package/src/_api/generated/cfg_centrifugo/logger.ts +0 -261
- package/src/_api/generated/cfg_centrifugo/retry.ts +0 -177
- package/src/_api/generated/cfg_centrifugo/schema.json +0 -118
- package/src/_api/generated/cfg_centrifugo/storage.ts +0 -163
- package/src/_api/generated/cfg_centrifugo/validation-events.ts +0 -135
- package/src/_api/generated/cfg_totp/CLAUDE.md +0 -83
- package/src/_api/generated/cfg_totp/_utils/fetchers/index.ts +0 -34
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp.ts +0 -50
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +0 -153
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +0 -109
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_setup.ts +0 -154
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_verification.ts +0 -153
- package/src/_api/generated/cfg_totp/_utils/hooks/index.ts +0 -34
- package/src/_api/generated/cfg_totp/_utils/hooks/totp.ts +0 -43
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +0 -60
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +0 -59
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts +0 -64
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts +0 -63
- package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts +0 -19
- package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts +0 -20
- package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts +0 -21
- package/src/_api/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts +0 -21
- package/src/_api/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +0 -26
- package/src/_api/generated/cfg_totp/_utils/schemas/DeviceListResponse.schema.ts +0 -21
- package/src/_api/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts +0 -19
- package/src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts +0 -19
- package/src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts +0 -23
- package/src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts +0 -25
- package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -34
- package/src/_api/generated/cfg_totp/api-instance.ts +0 -181
- package/src/_api/generated/cfg_totp/client.ts +0 -342
- package/src/_api/generated/cfg_totp/enums.ts +0 -13
- package/src/_api/generated/cfg_totp/errors.ts +0 -123
- package/src/_api/generated/cfg_totp/http.ts +0 -160
- package/src/_api/generated/cfg_totp/index.ts +0 -345
- package/src/_api/generated/cfg_totp/logger.ts +0 -261
- package/src/_api/generated/cfg_totp/retry.ts +0 -177
- package/src/_api/generated/cfg_totp/schema.json +0 -910
- package/src/_api/generated/cfg_totp/storage.ts +0 -163
- package/src/_api/generated/cfg_totp/totp/client.ts +0 -24
- package/src/_api/generated/cfg_totp/totp/index.ts +0 -4
- package/src/_api/generated/cfg_totp/totp/models.ts +0 -4
- package/src/_api/generated/cfg_totp/totp__backup_codes/client.ts +0 -32
- package/src/_api/generated/cfg_totp/totp__backup_codes/index.ts +0 -4
- package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +0 -38
- package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +0 -31
- package/src/_api/generated/cfg_totp/totp__totp_management/index.ts +0 -4
- package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +0 -46
- package/src/_api/generated/cfg_totp/totp__totp_setup/client.ts +0 -33
- package/src/_api/generated/cfg_totp/totp__totp_setup/index.ts +0 -4
- package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +0 -55
- package/src/_api/generated/cfg_totp/totp__totp_verification/client.ts +0 -33
- package/src/_api/generated/cfg_totp/totp__totp_verification/index.ts +0 -4
- package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +0 -74
- package/src/_api/generated/cfg_totp/validation-events.ts +0 -135
- package/src/hooks/accounts.ts +0 -8
- package/src/hooks/index.ts +0 -10
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
/**
|
|
4
|
-
* Typed fetchers for User Profile
|
|
5
|
-
*
|
|
6
|
-
* Universal functions that work in any environment:
|
|
7
|
-
* - Next.js (App Router / Pages Router / Server Components)
|
|
8
|
-
* - React Native
|
|
9
|
-
* - Node.js backend
|
|
10
|
-
*
|
|
11
|
-
* These fetchers use Zod schemas for runtime validation.
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Configure API once (in your app entry point)
|
|
16
|
-
* import { configureAPI } from '../../api-instance'
|
|
17
|
-
* configureAPI({ baseUrl: 'https://api.example.com' })
|
|
18
|
-
*
|
|
19
|
-
* // Then use fetchers anywhere
|
|
20
|
-
* const users = await getUsers({ page: 1 })
|
|
21
|
-
*
|
|
22
|
-
* // With SWR
|
|
23
|
-
* const { data } = useSWR(['users', params], () => getUsers(params))
|
|
24
|
-
*
|
|
25
|
-
* // With React Query
|
|
26
|
-
* const { data } = useQuery(['users', params], () => getUsers(params))
|
|
27
|
-
*
|
|
28
|
-
* // In Server Component or SSR (pass custom client)
|
|
29
|
-
* import { API } from '../../index'
|
|
30
|
-
* const api = new API('https://api.example.com')
|
|
31
|
-
* const users = await getUsers({ page: 1 }, api)
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
import { consola } from 'consola'
|
|
35
|
-
import { AccountDeleteResponseSchema, type AccountDeleteResponse } from '../schemas/AccountDeleteResponse.schema'
|
|
36
|
-
import { CfgAccountsProfileAvatarCreateRequestSchema, type CfgAccountsProfileAvatarCreateRequest } from '../schemas/CfgAccountsProfileAvatarCreateRequest.schema'
|
|
37
|
-
import { PatchedUserProfileUpdateRequestSchema, type PatchedUserProfileUpdateRequest } from '../schemas/PatchedUserProfileUpdateRequest.schema'
|
|
38
|
-
import { UserSchema, type User } from '../schemas/User.schema'
|
|
39
|
-
import { UserProfileUpdateRequestSchema, type UserProfileUpdateRequest } from '../schemas/UserProfileUpdateRequest.schema'
|
|
40
|
-
import { getAPIInstance } from '../../api-instance'
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get current user profile
|
|
44
|
-
*
|
|
45
|
-
* @method GET
|
|
46
|
-
* @path /cfg/accounts/profile/
|
|
47
|
-
*/
|
|
48
|
-
export async function getAccountsProfileRetrieve( client?: any
|
|
49
|
-
): Promise<User> {
|
|
50
|
-
const api = client || getAPIInstance()
|
|
51
|
-
const response = await api.user_profile.accountsProfileRetrieve()
|
|
52
|
-
try {
|
|
53
|
-
return UserSchema.parse(response)
|
|
54
|
-
} catch (error) {
|
|
55
|
-
// Zod validation error - log detailed information
|
|
56
|
-
consola.error('❌ Zod Validation Failed');
|
|
57
|
-
consola.box(`getAccountsProfileRetrieve\nPath: /cfg/accounts/profile/\nMethod: GET`);
|
|
58
|
-
|
|
59
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
60
|
-
consola.error('Validation Issues:');
|
|
61
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
62
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
63
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
64
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
65
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
consola.error('Response data:', response);
|
|
70
|
-
|
|
71
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
72
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
73
|
-
try {
|
|
74
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
75
|
-
detail: {
|
|
76
|
-
operation: 'getAccountsProfileRetrieve',
|
|
77
|
-
path: '/cfg/accounts/profile/',
|
|
78
|
-
method: 'GET',
|
|
79
|
-
error: error,
|
|
80
|
-
response: response,
|
|
81
|
-
timestamp: new Date(),
|
|
82
|
-
},
|
|
83
|
-
bubbles: true,
|
|
84
|
-
cancelable: false,
|
|
85
|
-
});
|
|
86
|
-
window.dispatchEvent(event);
|
|
87
|
-
} catch (eventError) {
|
|
88
|
-
// Silently fail - event dispatch should never crash the app
|
|
89
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Re-throw the error
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Upload user avatar
|
|
101
|
-
*
|
|
102
|
-
* @method POST
|
|
103
|
-
* @path /cfg/accounts/profile/avatar/
|
|
104
|
-
*/
|
|
105
|
-
export async function createAccountsProfileAvatarCreate( data: CfgAccountsProfileAvatarCreateRequest, client?: any
|
|
106
|
-
): Promise<User> {
|
|
107
|
-
const api = client || getAPIInstance()
|
|
108
|
-
const response = await api.user_profile.accountsProfileAvatarCreate(data)
|
|
109
|
-
try {
|
|
110
|
-
return UserSchema.parse(response)
|
|
111
|
-
} catch (error) {
|
|
112
|
-
// Zod validation error - log detailed information
|
|
113
|
-
consola.error('❌ Zod Validation Failed');
|
|
114
|
-
consola.box(`createAccountsProfileAvatarCreate\nPath: /cfg/accounts/profile/avatar/\nMethod: POST`);
|
|
115
|
-
|
|
116
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
117
|
-
consola.error('Validation Issues:');
|
|
118
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
119
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
120
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
121
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
122
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
consola.error('Response data:', response);
|
|
127
|
-
|
|
128
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
129
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
130
|
-
try {
|
|
131
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
132
|
-
detail: {
|
|
133
|
-
operation: 'createAccountsProfileAvatarCreate',
|
|
134
|
-
path: '/cfg/accounts/profile/avatar/',
|
|
135
|
-
method: 'POST',
|
|
136
|
-
error: error,
|
|
137
|
-
response: response,
|
|
138
|
-
timestamp: new Date(),
|
|
139
|
-
},
|
|
140
|
-
bubbles: true,
|
|
141
|
-
cancelable: false,
|
|
142
|
-
});
|
|
143
|
-
window.dispatchEvent(event);
|
|
144
|
-
} catch (eventError) {
|
|
145
|
-
// Silently fail - event dispatch should never crash the app
|
|
146
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Re-throw the error
|
|
151
|
-
throw error;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Delete user account
|
|
158
|
-
*
|
|
159
|
-
* @method POST
|
|
160
|
-
* @path /cfg/accounts/profile/delete/
|
|
161
|
-
*/
|
|
162
|
-
export async function createAccountsProfileDeleteCreate( client?: any
|
|
163
|
-
): Promise<AccountDeleteResponse> {
|
|
164
|
-
const api = client || getAPIInstance()
|
|
165
|
-
const response = await api.user_profile.accountsProfileDeleteCreate()
|
|
166
|
-
try {
|
|
167
|
-
return AccountDeleteResponseSchema.parse(response)
|
|
168
|
-
} catch (error) {
|
|
169
|
-
// Zod validation error - log detailed information
|
|
170
|
-
consola.error('❌ Zod Validation Failed');
|
|
171
|
-
consola.box(`createAccountsProfileDeleteCreate\nPath: /cfg/accounts/profile/delete/\nMethod: POST`);
|
|
172
|
-
|
|
173
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
174
|
-
consola.error('Validation Issues:');
|
|
175
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
176
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
177
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
178
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
179
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
consola.error('Response data:', response);
|
|
184
|
-
|
|
185
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
186
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
187
|
-
try {
|
|
188
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
189
|
-
detail: {
|
|
190
|
-
operation: 'createAccountsProfileDeleteCreate',
|
|
191
|
-
path: '/cfg/accounts/profile/delete/',
|
|
192
|
-
method: 'POST',
|
|
193
|
-
error: error,
|
|
194
|
-
response: response,
|
|
195
|
-
timestamp: new Date(),
|
|
196
|
-
},
|
|
197
|
-
bubbles: true,
|
|
198
|
-
cancelable: false,
|
|
199
|
-
});
|
|
200
|
-
window.dispatchEvent(event);
|
|
201
|
-
} catch (eventError) {
|
|
202
|
-
// Silently fail - event dispatch should never crash the app
|
|
203
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Re-throw the error
|
|
208
|
-
throw error;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Partial update user profile
|
|
215
|
-
*
|
|
216
|
-
* @method PUT
|
|
217
|
-
* @path /cfg/accounts/profile/partial/
|
|
218
|
-
*/
|
|
219
|
-
export async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client?: any
|
|
220
|
-
): Promise<User> {
|
|
221
|
-
const api = client || getAPIInstance()
|
|
222
|
-
const response = await api.user_profile.accountsProfilePartialUpdate(data)
|
|
223
|
-
try {
|
|
224
|
-
return UserSchema.parse(response)
|
|
225
|
-
} catch (error) {
|
|
226
|
-
// Zod validation error - log detailed information
|
|
227
|
-
consola.error('❌ Zod Validation Failed');
|
|
228
|
-
consola.box(`partialUpdateAccountsProfilePartialUpdate\nPath: /cfg/accounts/profile/partial/\nMethod: PUT`);
|
|
229
|
-
|
|
230
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
231
|
-
consola.error('Validation Issues:');
|
|
232
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
233
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
234
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
235
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
236
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
consola.error('Response data:', response);
|
|
241
|
-
|
|
242
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
243
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
244
|
-
try {
|
|
245
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
246
|
-
detail: {
|
|
247
|
-
operation: 'partialUpdateAccountsProfilePartialUpdate',
|
|
248
|
-
path: '/cfg/accounts/profile/partial/',
|
|
249
|
-
method: 'PUT',
|
|
250
|
-
error: error,
|
|
251
|
-
response: response,
|
|
252
|
-
timestamp: new Date(),
|
|
253
|
-
},
|
|
254
|
-
bubbles: true,
|
|
255
|
-
cancelable: false,
|
|
256
|
-
});
|
|
257
|
-
window.dispatchEvent(event);
|
|
258
|
-
} catch (eventError) {
|
|
259
|
-
// Silently fail - event dispatch should never crash the app
|
|
260
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Re-throw the error
|
|
265
|
-
throw error;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Partial update user profile
|
|
272
|
-
*
|
|
273
|
-
* @method PATCH
|
|
274
|
-
* @path /cfg/accounts/profile/partial/
|
|
275
|
-
*/
|
|
276
|
-
export async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: any
|
|
277
|
-
): Promise<User> {
|
|
278
|
-
const api = client || getAPIInstance()
|
|
279
|
-
const response = await api.user_profile.accountsProfilePartialPartialUpdate(data)
|
|
280
|
-
try {
|
|
281
|
-
return UserSchema.parse(response)
|
|
282
|
-
} catch (error) {
|
|
283
|
-
// Zod validation error - log detailed information
|
|
284
|
-
consola.error('❌ Zod Validation Failed');
|
|
285
|
-
consola.box(`partialUpdateAccountsProfilePartialPartialUpdate\nPath: /cfg/accounts/profile/partial/\nMethod: PATCH`);
|
|
286
|
-
|
|
287
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
288
|
-
consola.error('Validation Issues:');
|
|
289
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
290
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
291
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
292
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
293
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
consola.error('Response data:', response);
|
|
298
|
-
|
|
299
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
300
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
301
|
-
try {
|
|
302
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
303
|
-
detail: {
|
|
304
|
-
operation: 'partialUpdateAccountsProfilePartialPartialUpdate',
|
|
305
|
-
path: '/cfg/accounts/profile/partial/',
|
|
306
|
-
method: 'PATCH',
|
|
307
|
-
error: error,
|
|
308
|
-
response: response,
|
|
309
|
-
timestamp: new Date(),
|
|
310
|
-
},
|
|
311
|
-
bubbles: true,
|
|
312
|
-
cancelable: false,
|
|
313
|
-
});
|
|
314
|
-
window.dispatchEvent(event);
|
|
315
|
-
} catch (eventError) {
|
|
316
|
-
// Silently fail - event dispatch should never crash the app
|
|
317
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Re-throw the error
|
|
322
|
-
throw error;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Update user profile
|
|
329
|
-
*
|
|
330
|
-
* @method PUT
|
|
331
|
-
* @path /cfg/accounts/profile/update/
|
|
332
|
-
*/
|
|
333
|
-
export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client?: any
|
|
334
|
-
): Promise<User> {
|
|
335
|
-
const api = client || getAPIInstance()
|
|
336
|
-
const response = await api.user_profile.accountsProfileUpdateUpdate(data)
|
|
337
|
-
try {
|
|
338
|
-
return UserSchema.parse(response)
|
|
339
|
-
} catch (error) {
|
|
340
|
-
// Zod validation error - log detailed information
|
|
341
|
-
consola.error('❌ Zod Validation Failed');
|
|
342
|
-
consola.box(`updateAccountsProfileUpdateUpdate\nPath: /cfg/accounts/profile/update/\nMethod: PUT`);
|
|
343
|
-
|
|
344
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
345
|
-
consola.error('Validation Issues:');
|
|
346
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
347
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
348
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
349
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
350
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
consola.error('Response data:', response);
|
|
355
|
-
|
|
356
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
357
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
358
|
-
try {
|
|
359
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
360
|
-
detail: {
|
|
361
|
-
operation: 'updateAccountsProfileUpdateUpdate',
|
|
362
|
-
path: '/cfg/accounts/profile/update/',
|
|
363
|
-
method: 'PUT',
|
|
364
|
-
error: error,
|
|
365
|
-
response: response,
|
|
366
|
-
timestamp: new Date(),
|
|
367
|
-
},
|
|
368
|
-
bubbles: true,
|
|
369
|
-
cancelable: false,
|
|
370
|
-
});
|
|
371
|
-
window.dispatchEvent(event);
|
|
372
|
-
} catch (eventError) {
|
|
373
|
-
// Silently fail - event dispatch should never crash the app
|
|
374
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// Re-throw the error
|
|
379
|
-
throw error;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Update user profile
|
|
386
|
-
*
|
|
387
|
-
* @method PATCH
|
|
388
|
-
* @path /cfg/accounts/profile/update/
|
|
389
|
-
*/
|
|
390
|
-
export async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: any
|
|
391
|
-
): Promise<User> {
|
|
392
|
-
const api = client || getAPIInstance()
|
|
393
|
-
const response = await api.user_profile.accountsProfileUpdatePartialUpdate(data)
|
|
394
|
-
try {
|
|
395
|
-
return UserSchema.parse(response)
|
|
396
|
-
} catch (error) {
|
|
397
|
-
// Zod validation error - log detailed information
|
|
398
|
-
consola.error('❌ Zod Validation Failed');
|
|
399
|
-
consola.box(`partialUpdateAccountsProfileUpdatePartialUpdate\nPath: /cfg/accounts/profile/update/\nMethod: PATCH`);
|
|
400
|
-
|
|
401
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
402
|
-
consola.error('Validation Issues:');
|
|
403
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
404
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
405
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
406
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
407
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
consola.error('Response data:', response);
|
|
412
|
-
|
|
413
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
414
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
415
|
-
try {
|
|
416
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
417
|
-
detail: {
|
|
418
|
-
operation: 'partialUpdateAccountsProfileUpdatePartialUpdate',
|
|
419
|
-
path: '/cfg/accounts/profile/update/',
|
|
420
|
-
method: 'PATCH',
|
|
421
|
-
error: error,
|
|
422
|
-
response: response,
|
|
423
|
-
timestamp: new Date(),
|
|
424
|
-
},
|
|
425
|
-
bubbles: true,
|
|
426
|
-
cancelable: false,
|
|
427
|
-
});
|
|
428
|
-
window.dispatchEvent(event);
|
|
429
|
-
} catch (eventError) {
|
|
430
|
-
// Silently fail - event dispatch should never crash the app
|
|
431
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// Re-throw the error
|
|
436
|
-
throw error;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
/**
|
|
4
|
-
* Typed Fetchers - Universal API functions
|
|
5
|
-
*
|
|
6
|
-
* Auto-generated from OpenAPI specification.
|
|
7
|
-
* These functions work in any JavaScript environment.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Runtime validation with Zod
|
|
11
|
-
* - Type-safe parameters and responses
|
|
12
|
-
* - Works with any data-fetching library (SWR, React Query, etc)
|
|
13
|
-
* - Server Component compatible
|
|
14
|
-
*
|
|
15
|
-
* Usage:
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import * as fetchers from './fetchers'
|
|
18
|
-
*
|
|
19
|
-
* // Direct usage
|
|
20
|
-
* const user = await fetchers.getUser(1)
|
|
21
|
-
*
|
|
22
|
-
* // With SWR
|
|
23
|
-
* const { data } = useSWR('user-1', () => fetchers.getUser(1))
|
|
24
|
-
*
|
|
25
|
-
* // With React Query
|
|
26
|
-
* const { data } = useQuery(['user', 1], () => fetchers.getUser(1))
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
export * from './accounts'
|
|
31
|
-
export * from './accounts__auth'
|
|
32
|
-
export * from './accounts__oauth'
|
|
33
|
-
export * from './accounts__user_profile'
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* SWR Hooks for Accounts
|
|
7
|
-
*
|
|
8
|
-
* React hooks powered by SWR for data fetching with automatic caching,
|
|
9
|
-
* revalidation, and optimistic updates.
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Query hooks (GET)
|
|
14
|
-
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
15
|
-
*
|
|
16
|
-
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
17
|
-
* const createUser = useCreateUser()
|
|
18
|
-
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
import { useSWRConfig } from 'swr'
|
|
22
|
-
import * as Fetchers from '../fetchers/accounts'
|
|
23
|
-
import type { API } from '../../index'
|
|
24
|
-
import type { OTPRequestRequest } from '../schemas/OTPRequestRequest.schema'
|
|
25
|
-
import type { OTPRequestResponse } from '../schemas/OTPRequestResponse.schema'
|
|
26
|
-
import type { OTPVerifyRequest } from '../schemas/OTPVerifyRequest.schema'
|
|
27
|
-
import type { OTPVerifyResponse } from '../schemas/OTPVerifyResponse.schema'
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* API operation
|
|
31
|
-
*
|
|
32
|
-
* @method POST
|
|
33
|
-
* @path /cfg/accounts/otp/request/
|
|
34
|
-
*/
|
|
35
|
-
export function useCreateAccountsOtpRequestCreate() {
|
|
36
|
-
const { mutate } = useSWRConfig()
|
|
37
|
-
|
|
38
|
-
return async (data: OTPRequestRequest, client?: API): Promise<OTPRequestResponse> => {
|
|
39
|
-
const result = await Fetchers.createAccountsOtpRequestCreate(data, client)
|
|
40
|
-
// Revalidate related queries
|
|
41
|
-
mutate('cfg-accounts-otp-request')
|
|
42
|
-
return result
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* API operation
|
|
49
|
-
*
|
|
50
|
-
* @method POST
|
|
51
|
-
* @path /cfg/accounts/otp/verify/
|
|
52
|
-
*/
|
|
53
|
-
export function useCreateAccountsOtpVerifyCreate() {
|
|
54
|
-
const { mutate } = useSWRConfig()
|
|
55
|
-
|
|
56
|
-
return async (data: OTPVerifyRequest, client?: API): Promise<OTPVerifyResponse> => {
|
|
57
|
-
const result = await Fetchers.createAccountsOtpVerifyCreate(data, client)
|
|
58
|
-
// Revalidate related queries
|
|
59
|
-
mutate('cfg-accounts-otp-verify')
|
|
60
|
-
return result
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* SWR Hooks for Auth
|
|
7
|
-
*
|
|
8
|
-
* React hooks powered by SWR for data fetching with automatic caching,
|
|
9
|
-
* revalidation, and optimistic updates.
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Query hooks (GET)
|
|
14
|
-
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
15
|
-
*
|
|
16
|
-
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
17
|
-
* const createUser = useCreateUser()
|
|
18
|
-
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
import { useSWRConfig } from 'swr'
|
|
22
|
-
import * as Fetchers from '../fetchers/accounts__auth'
|
|
23
|
-
import type { API } from '../../index'
|
|
24
|
-
import type { TokenRefresh } from '../schemas/TokenRefresh.schema'
|
|
25
|
-
import type { TokenRefreshRequest } from '../schemas/TokenRefreshRequest.schema'
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* API operation
|
|
29
|
-
*
|
|
30
|
-
* @method POST
|
|
31
|
-
* @path /cfg/accounts/token/refresh/
|
|
32
|
-
*/
|
|
33
|
-
export function useCreateAccountsTokenRefreshCreate() {
|
|
34
|
-
const { mutate } = useSWRConfig()
|
|
35
|
-
|
|
36
|
-
return async (data: TokenRefreshRequest, client?: API): Promise<TokenRefresh> => {
|
|
37
|
-
const result = await Fetchers.createAccountsTokenRefreshCreate(data, client)
|
|
38
|
-
// Revalidate related queries
|
|
39
|
-
mutate('cfg-accounts-token-refresh')
|
|
40
|
-
return result
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* SWR Hooks for Oauth
|
|
7
|
-
*
|
|
8
|
-
* React hooks powered by SWR for data fetching with automatic caching,
|
|
9
|
-
* revalidation, and optimistic updates.
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Query hooks (GET)
|
|
14
|
-
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
15
|
-
*
|
|
16
|
-
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
17
|
-
* const createUser = useCreateUser()
|
|
18
|
-
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
import useSWR from 'swr'
|
|
22
|
-
import { useSWRConfig } from 'swr'
|
|
23
|
-
import * as Fetchers from '../fetchers/accounts__oauth'
|
|
24
|
-
import type { API } from '../../index'
|
|
25
|
-
import type { OAuthAuthorizeRequestRequest } from '../schemas/OAuthAuthorizeRequestRequest.schema'
|
|
26
|
-
import type { OAuthAuthorizeResponse } from '../schemas/OAuthAuthorizeResponse.schema'
|
|
27
|
-
import type { OAuthCallbackRequestRequest } from '../schemas/OAuthCallbackRequestRequest.schema'
|
|
28
|
-
import type { OAuthConnection } from '../schemas/OAuthConnection.schema'
|
|
29
|
-
import type { OAuthDisconnectRequestRequest } from '../schemas/OAuthDisconnectRequestRequest.schema'
|
|
30
|
-
import type { OAuthProvidersResponse } from '../schemas/OAuthProvidersResponse.schema'
|
|
31
|
-
import type { OAuthTokenResponse } from '../schemas/OAuthTokenResponse.schema'
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* List OAuth connections
|
|
35
|
-
*
|
|
36
|
-
* @method GET
|
|
37
|
-
* @path /cfg/accounts/oauth/connections/
|
|
38
|
-
*/
|
|
39
|
-
export function useAccountsOauthConnectionsList(client?: API): ReturnType<typeof useSWR<OAuthConnection[]>> {
|
|
40
|
-
return useSWR<OAuthConnection[]>(
|
|
41
|
-
'cfg-accounts-oauth-connections',
|
|
42
|
-
() => Fetchers.getAccountsOauthConnectionsList(client)
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Disconnect OAuth provider
|
|
49
|
-
*
|
|
50
|
-
* @method POST
|
|
51
|
-
* @path /cfg/accounts/oauth/disconnect/
|
|
52
|
-
*/
|
|
53
|
-
export function useCreateAccountsOauthDisconnectCreate() {
|
|
54
|
-
const { mutate } = useSWRConfig()
|
|
55
|
-
|
|
56
|
-
return async (data: OAuthDisconnectRequestRequest, client?: API): Promise<any> => {
|
|
57
|
-
const result = await Fetchers.createAccountsOauthDisconnectCreate(data, client)
|
|
58
|
-
// Revalidate related queries
|
|
59
|
-
mutate('cfg-accounts-oauth-disconnect')
|
|
60
|
-
return result
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Start GitHub OAuth
|
|
67
|
-
*
|
|
68
|
-
* @method POST
|
|
69
|
-
* @path /cfg/accounts/oauth/github/authorize/
|
|
70
|
-
*/
|
|
71
|
-
export function useCreateAccountsOauthGithubAuthorizeCreate() {
|
|
72
|
-
const { mutate } = useSWRConfig()
|
|
73
|
-
|
|
74
|
-
return async (data: OAuthAuthorizeRequestRequest, client?: API): Promise<OAuthAuthorizeResponse> => {
|
|
75
|
-
const result = await Fetchers.createAccountsOauthGithubAuthorizeCreate(data, client)
|
|
76
|
-
// Revalidate related queries
|
|
77
|
-
mutate('cfg-accounts-oauth-github-authorize')
|
|
78
|
-
return result
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Complete GitHub OAuth
|
|
85
|
-
*
|
|
86
|
-
* @method POST
|
|
87
|
-
* @path /cfg/accounts/oauth/github/callback/
|
|
88
|
-
*/
|
|
89
|
-
export function useCreateAccountsOauthGithubCallbackCreate() {
|
|
90
|
-
const { mutate } = useSWRConfig()
|
|
91
|
-
|
|
92
|
-
return async (data: OAuthCallbackRequestRequest, client?: API): Promise<OAuthTokenResponse> => {
|
|
93
|
-
const result = await Fetchers.createAccountsOauthGithubCallbackCreate(data, client)
|
|
94
|
-
// Revalidate related queries
|
|
95
|
-
mutate('cfg-accounts-oauth-github-callback')
|
|
96
|
-
return result
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* List OAuth providers
|
|
103
|
-
*
|
|
104
|
-
* @method GET
|
|
105
|
-
* @path /cfg/accounts/oauth/providers/
|
|
106
|
-
*/
|
|
107
|
-
export function useAccountsOauthProvidersRetrieve(client?: API): ReturnType<typeof useSWR<OAuthProvidersResponse>> {
|
|
108
|
-
return useSWR<OAuthProvidersResponse>(
|
|
109
|
-
'cfg-accounts-oauth-provider',
|
|
110
|
-
() => Fetchers.getAccountsOauthProvidersRetrieve(client)
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|