@djangocfg/api 2.1.327 → 2.1.332
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 +328 -3553
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +328 -3553
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +744 -3036
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +35 -35
- package/dist/auth.d.ts +35 -35
- package/dist/auth.mjs +744 -3036
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +303 -3548
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +28 -2557
- package/dist/clients.d.ts +28 -2557
- package/dist/clients.mjs +303 -3548
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +1130 -3099
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1807 -2165
- package/dist/index.d.ts +1807 -2165
- package/dist/index.mjs +1130 -3099
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/api.ts +67 -0
- package/src/_api/generated/{cfg_totp → _cfg_accounts}/events.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/index.ts +1 -1
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthConnectionsList.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthDisconnectCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthProvidersRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpRequestCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpVerifyCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileAvatarCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileDeleteCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdateUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsTokenRefreshCreate.ts +3 -3
- package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/index.ts +6 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/AccountDeleteResponse.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CentrifugoToken.ts +4 -4
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CfgUserUpdateRequest.ts +4 -4
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeRequestRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeResponse.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthCallbackRequestRequest.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthConnection.ts +6 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthDisconnectRequestRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthError.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthProvidersResponse.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthTokenResponse.ts +7 -7
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPErrorResponse.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestResponse.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyResponse.ts +6 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/PatchedCfgUserUpdateRequest.ts +4 -4
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/ProviderEnum.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefresh.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefreshRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/User.ts +13 -13
- 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 +67 -0
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/events.ts +3 -3
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/index.ts +1 -1
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_centrifugo}/index.ts +6 -6
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/ConnectionTokenResponse.ts +4 -4
- 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 +67 -0
- package/src/_api/generated/{cfg_accounts → _cfg_totp}/events.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/index.ts +1 -1
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesDestroy.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDisableCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupConfirmCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyBackupCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/index.ts +6 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateRequest.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateResponse.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesStatus.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupRequest.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupResponse.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceList.ts +6 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListResponse.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListStatusEnum.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DisableRequest.ts +2 -2
- package/src/_api/generated/_cfg_totp/schemas/SetupRequest.ts +11 -0
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/SetupResponse.ts +4 -4
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/TotpVerifyUser.ts +12 -12
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyBackupRequest.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyRequest.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyResponse.ts +4 -4
- 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/{cfg_centrifugo/client.gen.ts → client.gen.ts} +3 -0
- package/src/_api/generated/helpers/auth.ts +223 -0
- package/src/_api/generated/{_shared → helpers}/index.ts +1 -0
- package/src/_api/generated/index.ts +22 -20
- package/src/_api/generated/{cfg_accounts/sdk.gen.ts → sdk.gen.ts} +455 -1
- package/src/_api/generated/{cfg_accounts/types.gen.ts → types.gen.ts} +607 -77
- package/src/auth/context/AccountsContext.tsx +10 -10
- package/src/auth/context/AuthContext.tsx +1 -1
- package/src/auth/hooks/useDeleteAccount.ts +2 -1
- package/src/auth/hooks/useGithubAuth.ts +3 -2
- package/src/auth/hooks/useTokenRefresh.ts +2 -1
- package/src/auth/hooks/useTwoFactor.ts +4 -3
- package/src/auth/hooks/useTwoFactorSetup.ts +3 -2
- package/src/auth/hooks/useTwoFactorStatus.ts +4 -3
- package/src/auth/middlewares/tokenRefresh.ts +2 -1
- package/src/clients.ts +3 -3
- package/src/index.ts +22 -5
- package/src/server.ts +9 -9
- package/src/_api/generated/cfg_accounts/api.ts +0 -187
- package/src/_api/generated/cfg_accounts/client.gen.ts +0 -16
- package/src/_api/generated/cfg_centrifugo/api.ts +0 -164
- package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +0 -280
- package/src/_api/generated/cfg_centrifugo/client/index.ts +0 -25
- package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +0 -217
- package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +0 -318
- package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +0 -41
- package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +0 -82
- package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +0 -169
- package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +0 -171
- package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +0 -117
- package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +0 -242
- package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +0 -104
- package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +0 -140
- package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +0 -64
- package/src/_api/generated/cfg_centrifugo/types.gen.ts +0 -61
- package/src/_api/generated/cfg_totp/api.ts +0 -181
- package/src/_api/generated/cfg_totp/client/client.gen.ts +0 -280
- package/src/_api/generated/cfg_totp/client/index.ts +0 -25
- package/src/_api/generated/cfg_totp/client/types.gen.ts +0 -217
- package/src/_api/generated/cfg_totp/client/utils.gen.ts +0 -318
- package/src/_api/generated/cfg_totp/client.gen.ts +0 -16
- package/src/_api/generated/cfg_totp/core/auth.gen.ts +0 -41
- package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +0 -82
- package/src/_api/generated/cfg_totp/core/params.gen.ts +0 -169
- package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +0 -171
- package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +0 -117
- package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +0 -242
- package/src/_api/generated/cfg_totp/core/types.gen.ts +0 -104
- package/src/_api/generated/cfg_totp/core/utils.gen.ts +0 -140
- package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +0 -11
- package/src/_api/generated/cfg_totp/sdk.gen.ts +0 -432
- package/src/_api/generated/cfg_totp/types.gen.ts +0 -479
- /package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/index.ts +0 -0
- /package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/index.ts +0 -0
- /package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/index.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/client.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/index.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/types.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/utils.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/auth.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/bodySerializer.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/params.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/pathSerializer.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/queryKeySerializer.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/serverSentEvents.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/types.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/utils.gen.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/errors.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/logger.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/storage.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/validation-events.ts +0 -0
package/dist/clients.d.ts
CHANGED
|
@@ -1,927 +1,5 @@
|
|
|
1
1
|
import { ConsolaInstance } from 'consola';
|
|
2
2
|
|
|
3
|
-
type AuthToken$2 = string | undefined;
|
|
4
|
-
interface Auth$3 {
|
|
5
|
-
/**
|
|
6
|
-
* Which part of the request do we use to send the auth?
|
|
7
|
-
*
|
|
8
|
-
* @default 'header'
|
|
9
|
-
*/
|
|
10
|
-
in?: 'header' | 'query' | 'cookie';
|
|
11
|
-
/**
|
|
12
|
-
* Header or query parameter name.
|
|
13
|
-
*
|
|
14
|
-
* @default 'Authorization'
|
|
15
|
-
*/
|
|
16
|
-
name?: string;
|
|
17
|
-
scheme?: 'basic' | 'bearer';
|
|
18
|
-
type: 'apiKey' | 'http';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface SerializerOptions$2<T> {
|
|
22
|
-
/**
|
|
23
|
-
* @default true
|
|
24
|
-
*/
|
|
25
|
-
explode: boolean;
|
|
26
|
-
style: T;
|
|
27
|
-
}
|
|
28
|
-
type ArrayStyle$2 = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
29
|
-
type ObjectStyle$2 = 'form' | 'deepObject';
|
|
30
|
-
|
|
31
|
-
type QuerySerializer$2 = (query: Record<string, unknown>) => string;
|
|
32
|
-
type BodySerializer$2 = (body: unknown) => unknown;
|
|
33
|
-
type QuerySerializerOptionsObject$2 = {
|
|
34
|
-
allowReserved?: boolean;
|
|
35
|
-
array?: Partial<SerializerOptions$2<ArrayStyle$2>>;
|
|
36
|
-
object?: Partial<SerializerOptions$2<ObjectStyle$2>>;
|
|
37
|
-
};
|
|
38
|
-
type QuerySerializerOptions$2 = QuerySerializerOptionsObject$2 & {
|
|
39
|
-
/**
|
|
40
|
-
* Per-parameter serialization overrides. When provided, these settings
|
|
41
|
-
* override the global array/object settings for specific parameter names.
|
|
42
|
-
*/
|
|
43
|
-
parameters?: Record<string, QuerySerializerOptionsObject$2>;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
type HttpMethod$2 = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
47
|
-
type Client$5<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
48
|
-
/**
|
|
49
|
-
* Returns the final request URL.
|
|
50
|
-
*/
|
|
51
|
-
buildUrl: BuildUrlFn;
|
|
52
|
-
getConfig: () => Config;
|
|
53
|
-
request: RequestFn;
|
|
54
|
-
setConfig: (config: Config) => Config;
|
|
55
|
-
} & {
|
|
56
|
-
[K in HttpMethod$2]: MethodFn;
|
|
57
|
-
} & ([SseFn] extends [never] ? {
|
|
58
|
-
sse?: never;
|
|
59
|
-
} : {
|
|
60
|
-
sse: {
|
|
61
|
-
[K in HttpMethod$2]: SseFn;
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
interface Config$5 {
|
|
65
|
-
/**
|
|
66
|
-
* Auth token or a function returning auth token. The resolved value will be
|
|
67
|
-
* added to the request payload as defined by its `security` array.
|
|
68
|
-
*/
|
|
69
|
-
auth?: ((auth: Auth$3) => Promise<AuthToken$2> | AuthToken$2) | AuthToken$2;
|
|
70
|
-
/**
|
|
71
|
-
* A function for serializing request body parameter. By default,
|
|
72
|
-
* {@link JSON.stringify()} will be used.
|
|
73
|
-
*/
|
|
74
|
-
bodySerializer?: BodySerializer$2 | null;
|
|
75
|
-
/**
|
|
76
|
-
* An object containing any HTTP headers that you want to pre-populate your
|
|
77
|
-
* `Headers` object with.
|
|
78
|
-
*
|
|
79
|
-
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
80
|
-
*/
|
|
81
|
-
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
82
|
-
/**
|
|
83
|
-
* The request method.
|
|
84
|
-
*
|
|
85
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
86
|
-
*/
|
|
87
|
-
method?: Uppercase<HttpMethod$2>;
|
|
88
|
-
/**
|
|
89
|
-
* A function for serializing request query parameters. By default, arrays
|
|
90
|
-
* will be exploded in form style, objects will be exploded in deepObject
|
|
91
|
-
* style, and reserved characters are percent-encoded.
|
|
92
|
-
*
|
|
93
|
-
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
94
|
-
* API function is used.
|
|
95
|
-
*
|
|
96
|
-
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
97
|
-
*/
|
|
98
|
-
querySerializer?: QuerySerializer$2 | QuerySerializerOptions$2;
|
|
99
|
-
/**
|
|
100
|
-
* A function validating request data. This is useful if you want to ensure
|
|
101
|
-
* the request conforms to the desired shape, so it can be safely sent to
|
|
102
|
-
* the server.
|
|
103
|
-
*/
|
|
104
|
-
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
105
|
-
/**
|
|
106
|
-
* A function transforming response data before it's returned. This is useful
|
|
107
|
-
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
108
|
-
*/
|
|
109
|
-
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
110
|
-
/**
|
|
111
|
-
* A function validating response data. This is useful if you want to ensure
|
|
112
|
-
* the response conforms to the desired shape, so it can be safely passed to
|
|
113
|
-
* the transformers and returned to the user.
|
|
114
|
-
*/
|
|
115
|
-
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
type ServerSentEventsOptions$2<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$5, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
119
|
-
/**
|
|
120
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
121
|
-
* fetch instance.
|
|
122
|
-
*
|
|
123
|
-
* @default globalThis.fetch
|
|
124
|
-
*/
|
|
125
|
-
fetch?: typeof fetch;
|
|
126
|
-
/**
|
|
127
|
-
* Implementing clients can call request interceptors inside this hook.
|
|
128
|
-
*/
|
|
129
|
-
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
130
|
-
/**
|
|
131
|
-
* Callback invoked when a network or parsing error occurs during streaming.
|
|
132
|
-
*
|
|
133
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
134
|
-
*
|
|
135
|
-
* @param error The error that occurred.
|
|
136
|
-
*/
|
|
137
|
-
onSseError?: (error: unknown) => void;
|
|
138
|
-
/**
|
|
139
|
-
* Callback invoked when an event is streamed from the server.
|
|
140
|
-
*
|
|
141
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
142
|
-
*
|
|
143
|
-
* @param event Event streamed from the server.
|
|
144
|
-
* @returns Nothing (void).
|
|
145
|
-
*/
|
|
146
|
-
onSseEvent?: (event: StreamEvent$2<TData>) => void;
|
|
147
|
-
serializedBody?: RequestInit['body'];
|
|
148
|
-
/**
|
|
149
|
-
* Default retry delay in milliseconds.
|
|
150
|
-
*
|
|
151
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
152
|
-
*
|
|
153
|
-
* @default 3000
|
|
154
|
-
*/
|
|
155
|
-
sseDefaultRetryDelay?: number;
|
|
156
|
-
/**
|
|
157
|
-
* Maximum number of retry attempts before giving up.
|
|
158
|
-
*/
|
|
159
|
-
sseMaxRetryAttempts?: number;
|
|
160
|
-
/**
|
|
161
|
-
* Maximum retry delay in milliseconds.
|
|
162
|
-
*
|
|
163
|
-
* Applies only when exponential backoff is used.
|
|
164
|
-
*
|
|
165
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
166
|
-
*
|
|
167
|
-
* @default 30000
|
|
168
|
-
*/
|
|
169
|
-
sseMaxRetryDelay?: number;
|
|
170
|
-
/**
|
|
171
|
-
* Optional sleep function for retry backoff.
|
|
172
|
-
*
|
|
173
|
-
* Defaults to using `setTimeout`.
|
|
174
|
-
*/
|
|
175
|
-
sseSleepFn?: (ms: number) => Promise<void>;
|
|
176
|
-
url: string;
|
|
177
|
-
};
|
|
178
|
-
interface StreamEvent$2<TData = unknown> {
|
|
179
|
-
data: TData;
|
|
180
|
-
event?: string;
|
|
181
|
-
id?: string;
|
|
182
|
-
retry?: number;
|
|
183
|
-
}
|
|
184
|
-
type ServerSentEventsResult$2<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
185
|
-
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
type ErrInterceptor$2<Err, Res, Req, Options> = (error: Err,
|
|
189
|
-
/** response may be undefined due to a network error where no response object is produced */
|
|
190
|
-
response: Res | undefined,
|
|
191
|
-
/** request may be undefined, because error may be from building the request object itself */
|
|
192
|
-
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
193
|
-
type ReqInterceptor$2<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
194
|
-
type ResInterceptor$2<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
195
|
-
declare class Interceptors$2<Interceptor> {
|
|
196
|
-
fns: Array<Interceptor | null>;
|
|
197
|
-
clear(): void;
|
|
198
|
-
eject(id: number | Interceptor): void;
|
|
199
|
-
exists(id: number | Interceptor): boolean;
|
|
200
|
-
getInterceptorIndex(id: number | Interceptor): number;
|
|
201
|
-
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
202
|
-
use(fn: Interceptor): number;
|
|
203
|
-
}
|
|
204
|
-
interface Middleware$2<Req, Res, Err, Options> {
|
|
205
|
-
error: Interceptors$2<ErrInterceptor$2<Err, Res, Req, Options>>;
|
|
206
|
-
request: Interceptors$2<ReqInterceptor$2<Req, Options>>;
|
|
207
|
-
response: Interceptors$2<ResInterceptor$2<Res, Req, Options>>;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
type ResponseStyle$2 = 'data' | 'fields';
|
|
211
|
-
interface Config$4<T extends ClientOptions$2 = ClientOptions$2> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$5 {
|
|
212
|
-
/**
|
|
213
|
-
* Base URL for all requests made by this client.
|
|
214
|
-
*/
|
|
215
|
-
baseUrl?: T['baseUrl'];
|
|
216
|
-
/**
|
|
217
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
218
|
-
* fetch instance.
|
|
219
|
-
*
|
|
220
|
-
* @default globalThis.fetch
|
|
221
|
-
*/
|
|
222
|
-
fetch?: typeof fetch;
|
|
223
|
-
/**
|
|
224
|
-
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
225
|
-
* options won't have any effect.
|
|
226
|
-
*
|
|
227
|
-
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
228
|
-
*/
|
|
229
|
-
next?: never;
|
|
230
|
-
/**
|
|
231
|
-
* Return the response data parsed in a specified format. By default, `auto`
|
|
232
|
-
* will infer the appropriate method from the `Content-Type` response header.
|
|
233
|
-
* You can override this behavior with any of the {@link Body} methods.
|
|
234
|
-
* Select `stream` if you don't want to parse response data at all.
|
|
235
|
-
*
|
|
236
|
-
* @default 'auto'
|
|
237
|
-
*/
|
|
238
|
-
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
239
|
-
/**
|
|
240
|
-
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
241
|
-
*
|
|
242
|
-
* @default 'fields'
|
|
243
|
-
*/
|
|
244
|
-
responseStyle?: ResponseStyle$2;
|
|
245
|
-
/**
|
|
246
|
-
* Throw an error instead of returning it in the response?
|
|
247
|
-
*
|
|
248
|
-
* @default false
|
|
249
|
-
*/
|
|
250
|
-
throwOnError?: T['throwOnError'];
|
|
251
|
-
}
|
|
252
|
-
interface RequestOptions$2<TData = unknown, TResponseStyle extends ResponseStyle$2 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$4<{
|
|
253
|
-
responseStyle: TResponseStyle;
|
|
254
|
-
throwOnError: ThrowOnError;
|
|
255
|
-
}>, Pick<ServerSentEventsOptions$2<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
256
|
-
/**
|
|
257
|
-
* Any body that you want to add to your request.
|
|
258
|
-
*
|
|
259
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
260
|
-
*/
|
|
261
|
-
body?: unknown;
|
|
262
|
-
path?: Record<string, unknown>;
|
|
263
|
-
query?: Record<string, unknown>;
|
|
264
|
-
/**
|
|
265
|
-
* Security mechanism(s) to use for the request.
|
|
266
|
-
*/
|
|
267
|
-
security?: ReadonlyArray<Auth$3>;
|
|
268
|
-
url: Url;
|
|
269
|
-
}
|
|
270
|
-
interface ResolvedRequestOptions$2<TResponseStyle extends ResponseStyle$2 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions$2<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
271
|
-
headers: Headers;
|
|
272
|
-
serializedBody?: string;
|
|
273
|
-
}
|
|
274
|
-
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 : {
|
|
275
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
276
|
-
request: Request;
|
|
277
|
-
response: Response;
|
|
278
|
-
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
279
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
280
|
-
error: undefined;
|
|
281
|
-
} | {
|
|
282
|
-
data: undefined;
|
|
283
|
-
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
284
|
-
}) & {
|
|
285
|
-
/** request may be undefined, because error may be from building the request object itself */
|
|
286
|
-
request?: Request;
|
|
287
|
-
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
288
|
-
response?: Response;
|
|
289
|
-
}>;
|
|
290
|
-
interface ClientOptions$2 {
|
|
291
|
-
baseUrl?: string;
|
|
292
|
-
responseStyle?: ResponseStyle$2;
|
|
293
|
-
throwOnError?: boolean;
|
|
294
|
-
}
|
|
295
|
-
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>;
|
|
296
|
-
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>>;
|
|
297
|
-
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>;
|
|
298
|
-
type BuildUrlFn$2 = <TData extends {
|
|
299
|
-
body?: unknown;
|
|
300
|
-
path?: Record<string, unknown>;
|
|
301
|
-
query?: Record<string, unknown>;
|
|
302
|
-
url: string;
|
|
303
|
-
}>(options: TData & Options$5<TData>) => string;
|
|
304
|
-
type Client$4 = Client$5<RequestFn$2, Config$4, MethodFn$2, BuildUrlFn$2, SseFn$2> & {
|
|
305
|
-
interceptors: Middleware$2<Request, Response, unknown, ResolvedRequestOptions$2>;
|
|
306
|
-
};
|
|
307
|
-
interface TDataShape$2 {
|
|
308
|
-
body?: unknown;
|
|
309
|
-
headers?: unknown;
|
|
310
|
-
path?: unknown;
|
|
311
|
-
query?: unknown;
|
|
312
|
-
url: string;
|
|
313
|
-
}
|
|
314
|
-
type OmitKeys$2<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
315
|
-
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'>);
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Response serializer for account deletion.
|
|
319
|
-
*/
|
|
320
|
-
type AccountDeleteResponse = {
|
|
321
|
-
/**
|
|
322
|
-
* Whether the account was successfully deleted
|
|
323
|
-
*/
|
|
324
|
-
success: boolean;
|
|
325
|
-
/**
|
|
326
|
-
* Human-readable message about the deletion
|
|
327
|
-
*/
|
|
328
|
-
message: string;
|
|
329
|
-
};
|
|
330
|
-
/**
|
|
331
|
-
* Nested serializer for Centrifugo WebSocket connection token.
|
|
332
|
-
*/
|
|
333
|
-
type CentrifugoToken = {
|
|
334
|
-
/**
|
|
335
|
-
* JWT token for Centrifugo WebSocket connection
|
|
336
|
-
*/
|
|
337
|
-
token: string;
|
|
338
|
-
/**
|
|
339
|
-
* Centrifugo WebSocket URL
|
|
340
|
-
*/
|
|
341
|
-
centrifugo_url: string;
|
|
342
|
-
/**
|
|
343
|
-
* Token expiration time (ISO 8601)
|
|
344
|
-
*/
|
|
345
|
-
expires_at: string;
|
|
346
|
-
/**
|
|
347
|
-
* List of allowed channels for this user
|
|
348
|
-
*/
|
|
349
|
-
channels: Array<string>;
|
|
350
|
-
};
|
|
351
|
-
/**
|
|
352
|
-
* Serializer for updating user profile.
|
|
353
|
-
*/
|
|
354
|
-
type CfgUserUpdateRequest = {
|
|
355
|
-
first_name?: string;
|
|
356
|
-
last_name?: string;
|
|
357
|
-
company?: string;
|
|
358
|
-
phone?: string;
|
|
359
|
-
position?: string;
|
|
360
|
-
language?: string;
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
363
|
-
* Request to start OAuth flow.
|
|
364
|
-
*/
|
|
365
|
-
type OAuthAuthorizeRequestRequest = {
|
|
366
|
-
/**
|
|
367
|
-
* URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path
|
|
368
|
-
*/
|
|
369
|
-
redirect_uri?: string;
|
|
370
|
-
/**
|
|
371
|
-
* Optional source URL for registration tracking
|
|
372
|
-
*/
|
|
373
|
-
source_url?: string;
|
|
374
|
-
};
|
|
375
|
-
/**
|
|
376
|
-
* Response with OAuth authorization URL.
|
|
377
|
-
*/
|
|
378
|
-
type OAuthAuthorizeResponse = {
|
|
379
|
-
/**
|
|
380
|
-
* Full URL to redirect user to OAuth provider
|
|
381
|
-
*/
|
|
382
|
-
authorization_url: string;
|
|
383
|
-
/**
|
|
384
|
-
* State token for CSRF protection. Store this and verify on callback.
|
|
385
|
-
*/
|
|
386
|
-
state: string;
|
|
387
|
-
};
|
|
388
|
-
/**
|
|
389
|
-
* Request to complete OAuth flow (callback handler).
|
|
390
|
-
*/
|
|
391
|
-
type OAuthCallbackRequestRequest = {
|
|
392
|
-
/**
|
|
393
|
-
* Authorization code from OAuth provider callback
|
|
394
|
-
*/
|
|
395
|
-
code: string;
|
|
396
|
-
/**
|
|
397
|
-
* State token for CSRF verification (from authorize response)
|
|
398
|
-
*/
|
|
399
|
-
state: string;
|
|
400
|
-
/**
|
|
401
|
-
* Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path
|
|
402
|
-
*/
|
|
403
|
-
redirect_uri?: string;
|
|
404
|
-
};
|
|
405
|
-
/**
|
|
406
|
-
* Serializer for OAuth connection info (user-facing).
|
|
407
|
-
*/
|
|
408
|
-
type OAuthConnection = {
|
|
409
|
-
readonly id: number;
|
|
410
|
-
/**
|
|
411
|
-
* OAuth provider name (github, google, etc.)
|
|
412
|
-
*
|
|
413
|
-
* * `github` - GitHub
|
|
414
|
-
*/
|
|
415
|
-
readonly provider: ProviderEnum;
|
|
416
|
-
readonly provider_display: string;
|
|
417
|
-
/**
|
|
418
|
-
* Username on the OAuth provider platform
|
|
419
|
-
*/
|
|
420
|
-
readonly provider_username: string;
|
|
421
|
-
/**
|
|
422
|
-
* Email from OAuth provider (may differ from user.email)
|
|
423
|
-
*/
|
|
424
|
-
readonly provider_email: string;
|
|
425
|
-
/**
|
|
426
|
-
* Avatar URL from OAuth provider
|
|
427
|
-
*/
|
|
428
|
-
readonly provider_avatar_url: string;
|
|
429
|
-
/**
|
|
430
|
-
* When this OAuth connection was created
|
|
431
|
-
*/
|
|
432
|
-
readonly connected_at: string;
|
|
433
|
-
/**
|
|
434
|
-
* Last time this OAuth connection was used for login
|
|
435
|
-
*/
|
|
436
|
-
readonly last_login_at: string;
|
|
437
|
-
};
|
|
438
|
-
/**
|
|
439
|
-
* Request to disconnect OAuth provider.
|
|
440
|
-
*/
|
|
441
|
-
type OAuthDisconnectRequestRequest = {
|
|
442
|
-
/**
|
|
443
|
-
* OAuth provider to disconnect
|
|
444
|
-
*
|
|
445
|
-
* * `github` - GitHub
|
|
446
|
-
*/
|
|
447
|
-
provider: ProviderEnum;
|
|
448
|
-
};
|
|
449
|
-
/**
|
|
450
|
-
* Error response for OAuth endpoints.
|
|
451
|
-
*/
|
|
452
|
-
type OAuthError = {
|
|
453
|
-
/**
|
|
454
|
-
* Error code
|
|
455
|
-
*/
|
|
456
|
-
error: string;
|
|
457
|
-
/**
|
|
458
|
-
* Human-readable error description
|
|
459
|
-
*/
|
|
460
|
-
error_description?: string;
|
|
461
|
-
};
|
|
462
|
-
/**
|
|
463
|
-
* Response with available OAuth providers.
|
|
464
|
-
*/
|
|
465
|
-
type OAuthProvidersResponse = {
|
|
466
|
-
/**
|
|
467
|
-
* List of available OAuth providers
|
|
468
|
-
*/
|
|
469
|
-
providers: Array<{
|
|
470
|
-
[key: string]: unknown;
|
|
471
|
-
}>;
|
|
472
|
-
};
|
|
473
|
-
/**
|
|
474
|
-
* Response with JWT tokens after OAuth authentication.
|
|
475
|
-
*
|
|
476
|
-
* When 2FA is required:
|
|
477
|
-
* - requires_2fa: True
|
|
478
|
-
* - session_id: UUID of 2FA verification session
|
|
479
|
-
* - access/refresh/user: null
|
|
480
|
-
*
|
|
481
|
-
* When 2FA is not required:
|
|
482
|
-
* - requires_2fa: False
|
|
483
|
-
* - session_id: null
|
|
484
|
-
* - access/refresh/user: populated
|
|
485
|
-
*/
|
|
486
|
-
type OAuthTokenResponse = {
|
|
487
|
-
/**
|
|
488
|
-
* True if 2FA verification is required
|
|
489
|
-
*/
|
|
490
|
-
requires_2fa?: boolean;
|
|
491
|
-
/**
|
|
492
|
-
* 2FA session ID (only when requires_2fa=True)
|
|
493
|
-
*/
|
|
494
|
-
session_id?: string | null;
|
|
495
|
-
/**
|
|
496
|
-
* JWT access token (null when requires_2fa=True)
|
|
497
|
-
*/
|
|
498
|
-
access?: string | null;
|
|
499
|
-
/**
|
|
500
|
-
* JWT refresh token (null when requires_2fa=True)
|
|
501
|
-
*/
|
|
502
|
-
refresh?: string | null;
|
|
503
|
-
/**
|
|
504
|
-
* Authenticated user info (null when requires_2fa=True)
|
|
505
|
-
*/
|
|
506
|
-
user?: {
|
|
507
|
-
[key: string]: unknown;
|
|
508
|
-
} | null;
|
|
509
|
-
/**
|
|
510
|
-
* True if a new user was created during this OAuth flow
|
|
511
|
-
*/
|
|
512
|
-
is_new_user: boolean;
|
|
513
|
-
/**
|
|
514
|
-
* True if a new OAuth connection was created
|
|
515
|
-
*/
|
|
516
|
-
is_new_connection: boolean;
|
|
517
|
-
/**
|
|
518
|
-
* True if user should be prompted to enable 2FA
|
|
519
|
-
*/
|
|
520
|
-
should_prompt_2fa?: boolean;
|
|
521
|
-
};
|
|
522
|
-
/**
|
|
523
|
-
* Typed error response for OTP operations.
|
|
524
|
-
*
|
|
525
|
-
* error_code values:
|
|
526
|
-
* - invalid_identifier — malformed email
|
|
527
|
-
* - cooldown — too soon after last request (retry_after = seconds)
|
|
528
|
-
* - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
|
|
529
|
-
* - daily_limit — daily quota exceeded (retry_after = seconds until reset)
|
|
530
|
-
* - rate_limited — IP-level rate limit hit (no retry_after)
|
|
531
|
-
* - user_creation_failed — internal error creating account
|
|
532
|
-
* - send_failed — transport error (email / SMS)
|
|
533
|
-
* - internal_error — unexpected server error
|
|
534
|
-
*/
|
|
535
|
-
type OtpErrorResponse = {
|
|
536
|
-
/**
|
|
537
|
-
* Human-readable error message
|
|
538
|
-
*/
|
|
539
|
-
error: string;
|
|
540
|
-
/**
|
|
541
|
-
* Machine-readable error code
|
|
542
|
-
*/
|
|
543
|
-
error_code?: string | null;
|
|
544
|
-
/**
|
|
545
|
-
* Seconds until the client may retry (present only for rate-limit errors)
|
|
546
|
-
*/
|
|
547
|
-
retry_after?: number | null;
|
|
548
|
-
};
|
|
549
|
-
/**
|
|
550
|
-
* Serializer for OTP request.
|
|
551
|
-
*/
|
|
552
|
-
type OtpRequestRequest = {
|
|
553
|
-
/**
|
|
554
|
-
* Email address for OTP delivery
|
|
555
|
-
*/
|
|
556
|
-
identifier: string;
|
|
557
|
-
/**
|
|
558
|
-
* Source URL for tracking registration (e.g., https://my.djangocfg.com)
|
|
559
|
-
*/
|
|
560
|
-
source_url?: string;
|
|
561
|
-
};
|
|
562
|
-
/**
|
|
563
|
-
* OTP request response.
|
|
564
|
-
*/
|
|
565
|
-
type OtpRequestResponse = {
|
|
566
|
-
/**
|
|
567
|
-
* Success message
|
|
568
|
-
*/
|
|
569
|
-
message: string;
|
|
570
|
-
};
|
|
571
|
-
/**
|
|
572
|
-
* Serializer for OTP verification.
|
|
573
|
-
*/
|
|
574
|
-
type OtpVerifyRequest = {
|
|
575
|
-
/**
|
|
576
|
-
* Email address used for OTP request
|
|
577
|
-
*/
|
|
578
|
-
identifier: string;
|
|
579
|
-
otp: string;
|
|
580
|
-
/**
|
|
581
|
-
* Source URL for tracking login (e.g., https://my.djangocfg.com)
|
|
582
|
-
*/
|
|
583
|
-
source_url?: string;
|
|
584
|
-
};
|
|
585
|
-
/**
|
|
586
|
-
* OTP verification response.
|
|
587
|
-
*
|
|
588
|
-
* When 2FA is required:
|
|
589
|
-
* - requires_2fa: True
|
|
590
|
-
* - session_id: UUID of 2FA verification session
|
|
591
|
-
* - refresh/access/user: null
|
|
592
|
-
*
|
|
593
|
-
* When 2FA is not required:
|
|
594
|
-
* - requires_2fa: False
|
|
595
|
-
* - session_id: null
|
|
596
|
-
* - refresh/access/user: populated
|
|
597
|
-
*/
|
|
598
|
-
type OtpVerifyResponse = {
|
|
599
|
-
/**
|
|
600
|
-
* Whether 2FA verification is required
|
|
601
|
-
*/
|
|
602
|
-
requires_2fa?: boolean;
|
|
603
|
-
/**
|
|
604
|
-
* 2FA session ID (if requires_2fa is True)
|
|
605
|
-
*/
|
|
606
|
-
session_id?: string | null;
|
|
607
|
-
/**
|
|
608
|
-
* JWT refresh token (if requires_2fa is False)
|
|
609
|
-
*/
|
|
610
|
-
refresh?: string | null;
|
|
611
|
-
/**
|
|
612
|
-
* JWT access token (if requires_2fa is False)
|
|
613
|
-
*/
|
|
614
|
-
access?: string | null;
|
|
615
|
-
/**
|
|
616
|
-
* User information (if requires_2fa is False)
|
|
617
|
-
*/
|
|
618
|
-
user?: User | null;
|
|
619
|
-
/**
|
|
620
|
-
* Whether user should be prompted to enable 2FA
|
|
621
|
-
*/
|
|
622
|
-
should_prompt_2fa?: boolean;
|
|
623
|
-
};
|
|
624
|
-
/**
|
|
625
|
-
* Serializer for updating user profile.
|
|
626
|
-
*/
|
|
627
|
-
type PatchedCfgUserUpdateRequest = {
|
|
628
|
-
first_name?: string;
|
|
629
|
-
last_name?: string;
|
|
630
|
-
company?: string;
|
|
631
|
-
phone?: string;
|
|
632
|
-
position?: string;
|
|
633
|
-
language?: string;
|
|
634
|
-
};
|
|
635
|
-
/**
|
|
636
|
-
* * `github` - GitHub
|
|
637
|
-
*/
|
|
638
|
-
declare enum ProviderEnum {
|
|
639
|
-
GITHUB = "github"
|
|
640
|
-
}
|
|
641
|
-
type TokenRefresh = {
|
|
642
|
-
readonly access: string;
|
|
643
|
-
refresh: string;
|
|
644
|
-
};
|
|
645
|
-
type TokenRefreshRequest = {
|
|
646
|
-
refresh: string;
|
|
647
|
-
};
|
|
648
|
-
/**
|
|
649
|
-
* Serializer for user details.
|
|
650
|
-
*/
|
|
651
|
-
type User = {
|
|
652
|
-
readonly id: number;
|
|
653
|
-
readonly email: string;
|
|
654
|
-
first_name?: string;
|
|
655
|
-
last_name?: string;
|
|
656
|
-
/**
|
|
657
|
-
* Get user's full name.
|
|
658
|
-
*/
|
|
659
|
-
readonly full_name: string;
|
|
660
|
-
/**
|
|
661
|
-
* Get user's initials for avatar fallback.
|
|
662
|
-
*/
|
|
663
|
-
readonly initials: string;
|
|
664
|
-
/**
|
|
665
|
-
* Get formatted username for display.
|
|
666
|
-
*/
|
|
667
|
-
readonly display_username: string;
|
|
668
|
-
company?: string;
|
|
669
|
-
phone?: string;
|
|
670
|
-
position?: string;
|
|
671
|
-
language?: string;
|
|
672
|
-
readonly avatar: string | null;
|
|
673
|
-
/**
|
|
674
|
-
* Staff status
|
|
675
|
-
*
|
|
676
|
-
* Designates whether the user can log into this admin site.
|
|
677
|
-
*/
|
|
678
|
-
readonly is_staff: boolean;
|
|
679
|
-
/**
|
|
680
|
-
* Superuser status
|
|
681
|
-
*
|
|
682
|
-
* Designates that this user has all permissions without explicitly assigning them.
|
|
683
|
-
*/
|
|
684
|
-
readonly is_superuser: boolean;
|
|
685
|
-
readonly date_joined: string;
|
|
686
|
-
readonly last_login: string | null;
|
|
687
|
-
readonly unanswered_messages_count: number;
|
|
688
|
-
readonly centrifugo: CentrifugoToken | null;
|
|
689
|
-
};
|
|
690
|
-
type CfgAccountsOauthConnectionsListData = {
|
|
691
|
-
body?: never;
|
|
692
|
-
path?: never;
|
|
693
|
-
query?: never;
|
|
694
|
-
url: '/cfg/accounts/oauth/connections/';
|
|
695
|
-
};
|
|
696
|
-
type CfgAccountsOauthConnectionsListResponses = {
|
|
697
|
-
200: Array<OAuthConnection>;
|
|
698
|
-
};
|
|
699
|
-
type CfgAccountsOauthDisconnectCreateData = {
|
|
700
|
-
body: OAuthDisconnectRequestRequest;
|
|
701
|
-
path?: never;
|
|
702
|
-
query?: never;
|
|
703
|
-
url: '/cfg/accounts/oauth/disconnect/';
|
|
704
|
-
};
|
|
705
|
-
type CfgAccountsOauthDisconnectCreateErrors = {
|
|
706
|
-
400: OAuthError;
|
|
707
|
-
404: OAuthError;
|
|
708
|
-
};
|
|
709
|
-
type CfgAccountsOauthDisconnectCreateResponses = {
|
|
710
|
-
200: {
|
|
711
|
-
message?: string;
|
|
712
|
-
};
|
|
713
|
-
};
|
|
714
|
-
type CfgAccountsOauthGithubAuthorizeCreateData = {
|
|
715
|
-
body?: OAuthAuthorizeRequestRequest;
|
|
716
|
-
path?: never;
|
|
717
|
-
query?: never;
|
|
718
|
-
url: '/cfg/accounts/oauth/github/authorize/';
|
|
719
|
-
};
|
|
720
|
-
type CfgAccountsOauthGithubAuthorizeCreateErrors = {
|
|
721
|
-
503: OAuthError;
|
|
722
|
-
};
|
|
723
|
-
type CfgAccountsOauthGithubAuthorizeCreateResponses = {
|
|
724
|
-
200: OAuthAuthorizeResponse;
|
|
725
|
-
};
|
|
726
|
-
type CfgAccountsOauthGithubCallbackCreateData = {
|
|
727
|
-
body: OAuthCallbackRequestRequest;
|
|
728
|
-
path?: never;
|
|
729
|
-
query?: never;
|
|
730
|
-
url: '/cfg/accounts/oauth/github/callback/';
|
|
731
|
-
};
|
|
732
|
-
type CfgAccountsOauthGithubCallbackCreateErrors = {
|
|
733
|
-
400: OAuthError;
|
|
734
|
-
};
|
|
735
|
-
type CfgAccountsOauthGithubCallbackCreateResponses = {
|
|
736
|
-
200: OAuthTokenResponse;
|
|
737
|
-
};
|
|
738
|
-
type CfgAccountsOauthProvidersRetrieveData = {
|
|
739
|
-
body?: never;
|
|
740
|
-
path?: never;
|
|
741
|
-
query?: never;
|
|
742
|
-
url: '/cfg/accounts/oauth/providers/';
|
|
743
|
-
};
|
|
744
|
-
type CfgAccountsOauthProvidersRetrieveResponses = {
|
|
745
|
-
200: OAuthProvidersResponse;
|
|
746
|
-
};
|
|
747
|
-
type CfgAccountsOtpRequestCreateData = {
|
|
748
|
-
body: OtpRequestRequest;
|
|
749
|
-
path?: never;
|
|
750
|
-
query?: never;
|
|
751
|
-
url: '/cfg/accounts/otp/request/';
|
|
752
|
-
};
|
|
753
|
-
type CfgAccountsOtpRequestCreateErrors = {
|
|
754
|
-
400: OtpErrorResponse;
|
|
755
|
-
429: OtpErrorResponse;
|
|
756
|
-
500: OtpErrorResponse;
|
|
757
|
-
};
|
|
758
|
-
type CfgAccountsOtpRequestCreateResponses = {
|
|
759
|
-
200: OtpRequestResponse;
|
|
760
|
-
};
|
|
761
|
-
type CfgAccountsOtpVerifyCreateData = {
|
|
762
|
-
body: OtpVerifyRequest;
|
|
763
|
-
path?: never;
|
|
764
|
-
query?: never;
|
|
765
|
-
url: '/cfg/accounts/otp/verify/';
|
|
766
|
-
};
|
|
767
|
-
type CfgAccountsOtpVerifyCreateErrors = {
|
|
768
|
-
401: OtpErrorResponse;
|
|
769
|
-
429: OtpErrorResponse;
|
|
770
|
-
};
|
|
771
|
-
type CfgAccountsOtpVerifyCreateResponses = {
|
|
772
|
-
200: OtpVerifyResponse;
|
|
773
|
-
};
|
|
774
|
-
type CfgAccountsProfileRetrieveData = {
|
|
775
|
-
body?: never;
|
|
776
|
-
path?: never;
|
|
777
|
-
query?: never;
|
|
778
|
-
url: '/cfg/accounts/profile/';
|
|
779
|
-
};
|
|
780
|
-
type CfgAccountsProfileRetrieveErrors = {
|
|
781
|
-
/**
|
|
782
|
-
* Authentication credentials were not provided.
|
|
783
|
-
*/
|
|
784
|
-
401: unknown;
|
|
785
|
-
};
|
|
786
|
-
type CfgAccountsProfileRetrieveResponses = {
|
|
787
|
-
200: User;
|
|
788
|
-
};
|
|
789
|
-
type CfgAccountsProfileAvatarCreateData = {
|
|
790
|
-
body?: {
|
|
791
|
-
/**
|
|
792
|
-
* Avatar image file (JPEG, PNG, GIF, WebP, max 5MB)
|
|
793
|
-
*/
|
|
794
|
-
avatar: Blob | File;
|
|
795
|
-
};
|
|
796
|
-
path?: never;
|
|
797
|
-
query?: never;
|
|
798
|
-
url: '/cfg/accounts/profile/avatar/';
|
|
799
|
-
};
|
|
800
|
-
type CfgAccountsProfileAvatarCreateErrors = {
|
|
801
|
-
/**
|
|
802
|
-
* Invalid file or validation error.
|
|
803
|
-
*/
|
|
804
|
-
400: unknown;
|
|
805
|
-
/**
|
|
806
|
-
* Authentication credentials were not provided.
|
|
807
|
-
*/
|
|
808
|
-
401: unknown;
|
|
809
|
-
};
|
|
810
|
-
type CfgAccountsProfileAvatarCreateResponses = {
|
|
811
|
-
200: User;
|
|
812
|
-
};
|
|
813
|
-
type CfgAccountsProfileDeleteCreateData = {
|
|
814
|
-
body?: never;
|
|
815
|
-
path?: never;
|
|
816
|
-
query?: never;
|
|
817
|
-
url: '/cfg/accounts/profile/delete/';
|
|
818
|
-
};
|
|
819
|
-
type CfgAccountsProfileDeleteCreateErrors = {
|
|
820
|
-
/**
|
|
821
|
-
* Account is already deleted.
|
|
822
|
-
*/
|
|
823
|
-
400: unknown;
|
|
824
|
-
/**
|
|
825
|
-
* Authentication credentials were not provided.
|
|
826
|
-
*/
|
|
827
|
-
401: unknown;
|
|
828
|
-
};
|
|
829
|
-
type CfgAccountsProfileDeleteCreateResponses = {
|
|
830
|
-
200: AccountDeleteResponse;
|
|
831
|
-
};
|
|
832
|
-
type CfgAccountsProfilePartialPartialUpdateData = {
|
|
833
|
-
body?: PatchedCfgUserUpdateRequest;
|
|
834
|
-
path?: never;
|
|
835
|
-
query?: never;
|
|
836
|
-
url: '/cfg/accounts/profile/partial/';
|
|
837
|
-
};
|
|
838
|
-
type CfgAccountsProfilePartialPartialUpdateErrors = {
|
|
839
|
-
/**
|
|
840
|
-
* Invalid data provided.
|
|
841
|
-
*/
|
|
842
|
-
400: unknown;
|
|
843
|
-
/**
|
|
844
|
-
* Authentication credentials were not provided.
|
|
845
|
-
*/
|
|
846
|
-
401: unknown;
|
|
847
|
-
};
|
|
848
|
-
type CfgAccountsProfilePartialPartialUpdateResponses = {
|
|
849
|
-
200: User;
|
|
850
|
-
};
|
|
851
|
-
type CfgAccountsProfilePartialUpdateData = {
|
|
852
|
-
body?: CfgUserUpdateRequest;
|
|
853
|
-
path?: never;
|
|
854
|
-
query?: never;
|
|
855
|
-
url: '/cfg/accounts/profile/partial/';
|
|
856
|
-
};
|
|
857
|
-
type CfgAccountsProfilePartialUpdateErrors = {
|
|
858
|
-
/**
|
|
859
|
-
* Invalid data provided.
|
|
860
|
-
*/
|
|
861
|
-
400: unknown;
|
|
862
|
-
/**
|
|
863
|
-
* Authentication credentials were not provided.
|
|
864
|
-
*/
|
|
865
|
-
401: unknown;
|
|
866
|
-
};
|
|
867
|
-
type CfgAccountsProfilePartialUpdateResponses = {
|
|
868
|
-
200: User;
|
|
869
|
-
};
|
|
870
|
-
type CfgAccountsProfileUpdatePartialUpdateData = {
|
|
871
|
-
body?: PatchedCfgUserUpdateRequest;
|
|
872
|
-
path?: never;
|
|
873
|
-
query?: never;
|
|
874
|
-
url: '/cfg/accounts/profile/update/';
|
|
875
|
-
};
|
|
876
|
-
type CfgAccountsProfileUpdatePartialUpdateErrors = {
|
|
877
|
-
/**
|
|
878
|
-
* Invalid data provided.
|
|
879
|
-
*/
|
|
880
|
-
400: unknown;
|
|
881
|
-
/**
|
|
882
|
-
* Authentication credentials were not provided.
|
|
883
|
-
*/
|
|
884
|
-
401: unknown;
|
|
885
|
-
};
|
|
886
|
-
type CfgAccountsProfileUpdatePartialUpdateResponses = {
|
|
887
|
-
200: User;
|
|
888
|
-
};
|
|
889
|
-
type CfgAccountsProfileUpdateUpdateData = {
|
|
890
|
-
body?: CfgUserUpdateRequest;
|
|
891
|
-
path?: never;
|
|
892
|
-
query?: never;
|
|
893
|
-
url: '/cfg/accounts/profile/update/';
|
|
894
|
-
};
|
|
895
|
-
type CfgAccountsProfileUpdateUpdateErrors = {
|
|
896
|
-
/**
|
|
897
|
-
* Invalid data provided.
|
|
898
|
-
*/
|
|
899
|
-
400: unknown;
|
|
900
|
-
/**
|
|
901
|
-
* Authentication credentials were not provided.
|
|
902
|
-
*/
|
|
903
|
-
401: unknown;
|
|
904
|
-
};
|
|
905
|
-
type CfgAccountsProfileUpdateUpdateResponses = {
|
|
906
|
-
200: User;
|
|
907
|
-
};
|
|
908
|
-
type CfgAccountsTokenRefreshCreateData = {
|
|
909
|
-
body: TokenRefreshRequest;
|
|
910
|
-
path?: never;
|
|
911
|
-
query?: never;
|
|
912
|
-
url: '/cfg/accounts/token/refresh/';
|
|
913
|
-
};
|
|
914
|
-
type CfgAccountsTokenRefreshCreateResponses = {
|
|
915
|
-
200: TokenRefresh;
|
|
916
|
-
};
|
|
917
|
-
|
|
918
|
-
interface StorageAdapter {
|
|
919
|
-
getItem(key: string): string | null;
|
|
920
|
-
setItem(key: string, value: string): void;
|
|
921
|
-
removeItem(key: string): void;
|
|
922
|
-
clear?(): void;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
3
|
interface RequestLog {
|
|
926
4
|
method: string;
|
|
927
5
|
url: string;
|
|
@@ -971,321 +49,7 @@ declare class APILogger {
|
|
|
971
49
|
withTag(tag: string): ConsolaInstance;
|
|
972
50
|
}
|
|
973
51
|
|
|
974
|
-
type Options$4<TData extends TDataShape$2 = TDataShape$2, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$5<TData, ThrowOnError, TResponse> & {
|
|
975
|
-
/**
|
|
976
|
-
* You can provide a client instance returned by `createClient()` instead of
|
|
977
|
-
* individual options. This might be also useful if you want to implement a
|
|
978
|
-
* custom client.
|
|
979
|
-
*/
|
|
980
|
-
client?: Client$4;
|
|
981
|
-
/**
|
|
982
|
-
* You can pass arbitrary values through the `meta` object. This can be
|
|
983
|
-
* used to access values that aren't defined as part of the SDK function.
|
|
984
|
-
*/
|
|
985
|
-
meta?: Record<string, unknown>;
|
|
986
|
-
};
|
|
987
|
-
declare class Cfg$2 {
|
|
988
|
-
/**
|
|
989
|
-
* List OAuth connections
|
|
990
|
-
*
|
|
991
|
-
* Get all OAuth connections for the current user.
|
|
992
|
-
*/
|
|
993
|
-
static cfgAccountsOauthConnectionsList<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthConnectionsListData, ThrowOnError>): RequestResult$2<CfgAccountsOauthConnectionsListResponses, unknown, ThrowOnError, "fields">;
|
|
994
|
-
/**
|
|
995
|
-
* Disconnect OAuth provider
|
|
996
|
-
*
|
|
997
|
-
* Remove OAuth connection for the specified provider.
|
|
998
|
-
*/
|
|
999
|
-
static cfgAccountsOauthDisconnectCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthDisconnectCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthDisconnectCreateResponses, CfgAccountsOauthDisconnectCreateErrors, ThrowOnError, "fields">;
|
|
1000
|
-
/**
|
|
1001
|
-
* Start GitHub OAuth
|
|
1002
|
-
*
|
|
1003
|
-
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1004
|
-
*/
|
|
1005
|
-
static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError, "fields">;
|
|
1006
|
-
/**
|
|
1007
|
-
* Complete GitHub OAuth
|
|
1008
|
-
*
|
|
1009
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1010
|
-
*/
|
|
1011
|
-
static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError, "fields">;
|
|
1012
|
-
/**
|
|
1013
|
-
* List OAuth providers
|
|
1014
|
-
*
|
|
1015
|
-
* Get list of available OAuth providers for authentication.
|
|
1016
|
-
*/
|
|
1017
|
-
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
1018
|
-
/**
|
|
1019
|
-
* Request OTP code to email.
|
|
1020
|
-
*/
|
|
1021
|
-
static cfgAccountsOtpRequestCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpRequestCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpRequestCreateResponses, CfgAccountsOtpRequestCreateErrors, ThrowOnError, "fields">;
|
|
1022
|
-
/**
|
|
1023
|
-
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1024
|
-
*
|
|
1025
|
-
* If user has 2FA enabled:
|
|
1026
|
-
* - Returns requires_2fa=True with session_id
|
|
1027
|
-
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1028
|
-
*
|
|
1029
|
-
* If user has no 2FA:
|
|
1030
|
-
* - Returns JWT tokens and user data directly
|
|
1031
|
-
*/
|
|
1032
|
-
static cfgAccountsOtpVerifyCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpVerifyCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpVerifyCreateResponses, CfgAccountsOtpVerifyCreateErrors, ThrowOnError, "fields">;
|
|
1033
|
-
/**
|
|
1034
|
-
* Get current user profile
|
|
1035
|
-
*
|
|
1036
|
-
* Retrieve the current authenticated user's profile information.
|
|
1037
|
-
*/
|
|
1038
|
-
static cfgAccountsProfileRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsProfileRetrieveResponses, CfgAccountsProfileRetrieveErrors, ThrowOnError, "fields">;
|
|
1039
|
-
/**
|
|
1040
|
-
* Upload user avatar
|
|
1041
|
-
*
|
|
1042
|
-
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1043
|
-
*/
|
|
1044
|
-
static cfgAccountsProfileAvatarCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileAvatarCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileAvatarCreateResponses, CfgAccountsProfileAvatarCreateErrors, ThrowOnError, "fields">;
|
|
1045
|
-
/**
|
|
1046
|
-
* Delete user account
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
* Permanently delete the current user's account.
|
|
1050
|
-
*
|
|
1051
|
-
* This operation:
|
|
1052
|
-
* - Deactivates the account (user cannot log in)
|
|
1053
|
-
* - Anonymizes personal data (GDPR compliance)
|
|
1054
|
-
* - Frees up the email address for re-registration
|
|
1055
|
-
* - Preserves audit trail
|
|
1056
|
-
*
|
|
1057
|
-
* The account can be restored by an administrator if needed.
|
|
1058
|
-
*
|
|
1059
|
-
*/
|
|
1060
|
-
static cfgAccountsProfileDeleteCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileDeleteCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileDeleteCreateResponses, CfgAccountsProfileDeleteCreateErrors, ThrowOnError, "fields">;
|
|
1061
|
-
/**
|
|
1062
|
-
* Partial update user profile
|
|
1063
|
-
*
|
|
1064
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1065
|
-
*/
|
|
1066
|
-
static cfgAccountsProfilePartialPartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialPartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialPartialUpdateResponses, CfgAccountsProfilePartialPartialUpdateErrors, ThrowOnError, "fields">;
|
|
1067
|
-
/**
|
|
1068
|
-
* Partial update user profile
|
|
1069
|
-
*
|
|
1070
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1071
|
-
*/
|
|
1072
|
-
static cfgAccountsProfilePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialUpdateResponses, CfgAccountsProfilePartialUpdateErrors, ThrowOnError, "fields">;
|
|
1073
|
-
/**
|
|
1074
|
-
* Update user profile
|
|
1075
|
-
*
|
|
1076
|
-
* Update the current authenticated user's profile information.
|
|
1077
|
-
*/
|
|
1078
|
-
static cfgAccountsProfileUpdatePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdatePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdatePartialUpdateResponses, CfgAccountsProfileUpdatePartialUpdateErrors, ThrowOnError, "fields">;
|
|
1079
|
-
/**
|
|
1080
|
-
* Update user profile
|
|
1081
|
-
*
|
|
1082
|
-
* Update the current authenticated user's profile information.
|
|
1083
|
-
*/
|
|
1084
|
-
static cfgAccountsProfileUpdateUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdateUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdateUpdateResponses, CfgAccountsProfileUpdateUpdateErrors, ThrowOnError, "fields">;
|
|
1085
|
-
/**
|
|
1086
|
-
* Refresh JWT token.
|
|
1087
|
-
*/
|
|
1088
|
-
static cfgAccountsTokenRefreshCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsTokenRefreshCreateData, ThrowOnError>): RequestResult$2<CfgAccountsTokenRefreshCreateResponses, unknown, ThrowOnError, "fields">;
|
|
1089
|
-
}
|
|
1090
|
-
declare class Accounts {
|
|
1091
|
-
/**
|
|
1092
|
-
* List OAuth connections
|
|
1093
|
-
*
|
|
1094
|
-
* Get all OAuth connections for the current user.
|
|
1095
|
-
*/
|
|
1096
|
-
static cfgAccountsOauthConnectionsList<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthConnectionsListData, ThrowOnError>): RequestResult$2<CfgAccountsOauthConnectionsListResponses, unknown, ThrowOnError, "fields">;
|
|
1097
|
-
/**
|
|
1098
|
-
* Disconnect OAuth provider
|
|
1099
|
-
*
|
|
1100
|
-
* Remove OAuth connection for the specified provider.
|
|
1101
|
-
*/
|
|
1102
|
-
static cfgAccountsOauthDisconnectCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthDisconnectCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthDisconnectCreateResponses, CfgAccountsOauthDisconnectCreateErrors, ThrowOnError, "fields">;
|
|
1103
|
-
/**
|
|
1104
|
-
* Start GitHub OAuth
|
|
1105
|
-
*
|
|
1106
|
-
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1107
|
-
*/
|
|
1108
|
-
static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError, "fields">;
|
|
1109
|
-
/**
|
|
1110
|
-
* Complete GitHub OAuth
|
|
1111
|
-
*
|
|
1112
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1113
|
-
*/
|
|
1114
|
-
static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError, "fields">;
|
|
1115
|
-
/**
|
|
1116
|
-
* List OAuth providers
|
|
1117
|
-
*
|
|
1118
|
-
* Get list of available OAuth providers for authentication.
|
|
1119
|
-
*/
|
|
1120
|
-
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
1121
|
-
/**
|
|
1122
|
-
* Request OTP code to email.
|
|
1123
|
-
*/
|
|
1124
|
-
static cfgAccountsOtpRequestCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpRequestCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpRequestCreateResponses, CfgAccountsOtpRequestCreateErrors, ThrowOnError, "fields">;
|
|
1125
|
-
/**
|
|
1126
|
-
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1127
|
-
*
|
|
1128
|
-
* If user has 2FA enabled:
|
|
1129
|
-
* - Returns requires_2fa=True with session_id
|
|
1130
|
-
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1131
|
-
*
|
|
1132
|
-
* If user has no 2FA:
|
|
1133
|
-
* - Returns JWT tokens and user data directly
|
|
1134
|
-
*/
|
|
1135
|
-
static cfgAccountsOtpVerifyCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOtpVerifyCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOtpVerifyCreateResponses, CfgAccountsOtpVerifyCreateErrors, ThrowOnError, "fields">;
|
|
1136
|
-
/**
|
|
1137
|
-
* Get current user profile
|
|
1138
|
-
*
|
|
1139
|
-
* Retrieve the current authenticated user's profile information.
|
|
1140
|
-
*/
|
|
1141
|
-
static cfgAccountsProfileRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsProfileRetrieveResponses, CfgAccountsProfileRetrieveErrors, ThrowOnError, "fields">;
|
|
1142
|
-
/**
|
|
1143
|
-
* Upload user avatar
|
|
1144
|
-
*
|
|
1145
|
-
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1146
|
-
*/
|
|
1147
|
-
static cfgAccountsProfileAvatarCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileAvatarCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileAvatarCreateResponses, CfgAccountsProfileAvatarCreateErrors, ThrowOnError, "fields">;
|
|
1148
|
-
/**
|
|
1149
|
-
* Delete user account
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1152
|
-
* Permanently delete the current user's account.
|
|
1153
|
-
*
|
|
1154
|
-
* This operation:
|
|
1155
|
-
* - Deactivates the account (user cannot log in)
|
|
1156
|
-
* - Anonymizes personal data (GDPR compliance)
|
|
1157
|
-
* - Frees up the email address for re-registration
|
|
1158
|
-
* - Preserves audit trail
|
|
1159
|
-
*
|
|
1160
|
-
* The account can be restored by an administrator if needed.
|
|
1161
|
-
*
|
|
1162
|
-
*/
|
|
1163
|
-
static cfgAccountsProfileDeleteCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileDeleteCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileDeleteCreateResponses, CfgAccountsProfileDeleteCreateErrors, ThrowOnError, "fields">;
|
|
1164
|
-
/**
|
|
1165
|
-
* Partial update user profile
|
|
1166
|
-
*
|
|
1167
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1168
|
-
*/
|
|
1169
|
-
static cfgAccountsProfilePartialPartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialPartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialPartialUpdateResponses, CfgAccountsProfilePartialPartialUpdateErrors, ThrowOnError, "fields">;
|
|
1170
|
-
/**
|
|
1171
|
-
* Partial update user profile
|
|
1172
|
-
*
|
|
1173
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1174
|
-
*/
|
|
1175
|
-
static cfgAccountsProfilePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialUpdateResponses, CfgAccountsProfilePartialUpdateErrors, ThrowOnError, "fields">;
|
|
1176
|
-
/**
|
|
1177
|
-
* Update user profile
|
|
1178
|
-
*
|
|
1179
|
-
* Update the current authenticated user's profile information.
|
|
1180
|
-
*/
|
|
1181
|
-
static cfgAccountsProfileUpdatePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdatePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdatePartialUpdateResponses, CfgAccountsProfileUpdatePartialUpdateErrors, ThrowOnError, "fields">;
|
|
1182
|
-
/**
|
|
1183
|
-
* Update user profile
|
|
1184
|
-
*
|
|
1185
|
-
* Update the current authenticated user's profile information.
|
|
1186
|
-
*/
|
|
1187
|
-
static cfgAccountsProfileUpdateUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdateUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdateUpdateResponses, CfgAccountsProfileUpdateUpdateErrors, ThrowOnError, "fields">;
|
|
1188
|
-
/**
|
|
1189
|
-
* Refresh JWT token.
|
|
1190
|
-
*/
|
|
1191
|
-
static cfgAccountsTokenRefreshCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsTokenRefreshCreateData, ThrowOnError>): RequestResult$2<CfgAccountsTokenRefreshCreateResponses, unknown, ThrowOnError, "fields">;
|
|
1192
|
-
}
|
|
1193
|
-
declare class OAuth {
|
|
1194
|
-
/**
|
|
1195
|
-
* List OAuth connections
|
|
1196
|
-
*
|
|
1197
|
-
* Get all OAuth connections for the current user.
|
|
1198
|
-
*/
|
|
1199
|
-
static cfgAccountsOauthConnectionsList<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthConnectionsListData, ThrowOnError>): RequestResult$2<CfgAccountsOauthConnectionsListResponses, unknown, ThrowOnError, "fields">;
|
|
1200
|
-
/**
|
|
1201
|
-
* Disconnect OAuth provider
|
|
1202
|
-
*
|
|
1203
|
-
* Remove OAuth connection for the specified provider.
|
|
1204
|
-
*/
|
|
1205
|
-
static cfgAccountsOauthDisconnectCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthDisconnectCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthDisconnectCreateResponses, CfgAccountsOauthDisconnectCreateErrors, ThrowOnError, "fields">;
|
|
1206
|
-
/**
|
|
1207
|
-
* Start GitHub OAuth
|
|
1208
|
-
*
|
|
1209
|
-
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1210
|
-
*/
|
|
1211
|
-
static cfgAccountsOauthGithubAuthorizeCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthGithubAuthorizeCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubAuthorizeCreateResponses, CfgAccountsOauthGithubAuthorizeCreateErrors, ThrowOnError, "fields">;
|
|
1212
|
-
/**
|
|
1213
|
-
* Complete GitHub OAuth
|
|
1214
|
-
*
|
|
1215
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1216
|
-
*/
|
|
1217
|
-
static cfgAccountsOauthGithubCallbackCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsOauthGithubCallbackCreateData, ThrowOnError>): RequestResult$2<CfgAccountsOauthGithubCallbackCreateResponses, CfgAccountsOauthGithubCallbackCreateErrors, ThrowOnError, "fields">;
|
|
1218
|
-
/**
|
|
1219
|
-
* List OAuth providers
|
|
1220
|
-
*
|
|
1221
|
-
* Get list of available OAuth providers for authentication.
|
|
1222
|
-
*/
|
|
1223
|
-
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
1224
|
-
}
|
|
1225
|
-
declare class UserProfile {
|
|
1226
|
-
/**
|
|
1227
|
-
* Get current user profile
|
|
1228
|
-
*
|
|
1229
|
-
* Retrieve the current authenticated user's profile information.
|
|
1230
|
-
*/
|
|
1231
|
-
static cfgAccountsProfileRetrieve<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileRetrieveData, ThrowOnError>): RequestResult$2<CfgAccountsProfileRetrieveResponses, CfgAccountsProfileRetrieveErrors, ThrowOnError, "fields">;
|
|
1232
|
-
/**
|
|
1233
|
-
* Upload user avatar
|
|
1234
|
-
*
|
|
1235
|
-
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1236
|
-
*/
|
|
1237
|
-
static cfgAccountsProfileAvatarCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileAvatarCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileAvatarCreateResponses, CfgAccountsProfileAvatarCreateErrors, ThrowOnError, "fields">;
|
|
1238
|
-
/**
|
|
1239
|
-
* Delete user account
|
|
1240
|
-
*
|
|
1241
|
-
*
|
|
1242
|
-
* Permanently delete the current user's account.
|
|
1243
|
-
*
|
|
1244
|
-
* This operation:
|
|
1245
|
-
* - Deactivates the account (user cannot log in)
|
|
1246
|
-
* - Anonymizes personal data (GDPR compliance)
|
|
1247
|
-
* - Frees up the email address for re-registration
|
|
1248
|
-
* - Preserves audit trail
|
|
1249
|
-
*
|
|
1250
|
-
* The account can be restored by an administrator if needed.
|
|
1251
|
-
*
|
|
1252
|
-
*/
|
|
1253
|
-
static cfgAccountsProfileDeleteCreate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileDeleteCreateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileDeleteCreateResponses, CfgAccountsProfileDeleteCreateErrors, ThrowOnError, "fields">;
|
|
1254
|
-
/**
|
|
1255
|
-
* Partial update user profile
|
|
1256
|
-
*
|
|
1257
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1258
|
-
*/
|
|
1259
|
-
static cfgAccountsProfilePartialPartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialPartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialPartialUpdateResponses, CfgAccountsProfilePartialPartialUpdateErrors, ThrowOnError, "fields">;
|
|
1260
|
-
/**
|
|
1261
|
-
* Partial update user profile
|
|
1262
|
-
*
|
|
1263
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1264
|
-
*/
|
|
1265
|
-
static cfgAccountsProfilePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfilePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfilePartialUpdateResponses, CfgAccountsProfilePartialUpdateErrors, ThrowOnError, "fields">;
|
|
1266
|
-
/**
|
|
1267
|
-
* Update user profile
|
|
1268
|
-
*
|
|
1269
|
-
* Update the current authenticated user's profile information.
|
|
1270
|
-
*/
|
|
1271
|
-
static cfgAccountsProfileUpdatePartialUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdatePartialUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdatePartialUpdateResponses, CfgAccountsProfileUpdatePartialUpdateErrors, ThrowOnError, "fields">;
|
|
1272
|
-
/**
|
|
1273
|
-
* Update user profile
|
|
1274
|
-
*
|
|
1275
|
-
* Update the current authenticated user's profile information.
|
|
1276
|
-
*/
|
|
1277
|
-
static cfgAccountsProfileUpdateUpdate<ThrowOnError extends boolean = false>(options?: Options$4<CfgAccountsProfileUpdateUpdateData, ThrowOnError>): RequestResult$2<CfgAccountsProfileUpdateUpdateResponses, CfgAccountsProfileUpdateUpdateErrors, ThrowOnError, "fields">;
|
|
1278
|
-
}
|
|
1279
|
-
declare class Auth$2 {
|
|
1280
|
-
/**
|
|
1281
|
-
* Refresh JWT token.
|
|
1282
|
-
*/
|
|
1283
|
-
static cfgAccountsTokenRefreshCreate<ThrowOnError extends boolean = false>(options: Options$4<CfgAccountsTokenRefreshCreateData, ThrowOnError>): RequestResult$2<CfgAccountsTokenRefreshCreateResponses, unknown, ThrowOnError, "fields">;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
52
|
interface APIOptions$2 {
|
|
1287
|
-
/** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
|
|
1288
|
-
storage?: StorageAdapter;
|
|
1289
53
|
/** Logger config (defaults to dev-only). */
|
|
1290
54
|
logger?: Partial<LoggerConfig>;
|
|
1291
55
|
/** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
|
|
@@ -1296,27 +60,18 @@ interface APIOptions$2 {
|
|
|
1296
60
|
withCredentials?: boolean;
|
|
1297
61
|
}
|
|
1298
62
|
/**
|
|
1299
|
-
*
|
|
63
|
+
* Per-group ergonomic facade.
|
|
64
|
+
*
|
|
65
|
+
* Calling `setToken/setApiKey/setLocale/setBaseUrl` proxies to the
|
|
66
|
+
* global `auth` store — the change applies to **every** group's API
|
|
67
|
+
* instance because they share the same HTTP client and interceptor.
|
|
1300
68
|
*
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
* - `Authorization: Bearer <jwt>` from storage
|
|
1304
|
-
* - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
|
|
1305
|
-
* - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
|
|
1306
|
-
* - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
|
|
69
|
+
* Use the global `auth` object directly when you don't need a group
|
|
70
|
+
* facade: `import { auth } from '@your/api'; auth.setToken(jwt);`
|
|
1307
71
|
*/
|
|
1308
72
|
declare class API$2 {
|
|
1309
|
-
private baseUrl;
|
|
1310
|
-
private storage;
|
|
1311
|
-
private locale;
|
|
1312
|
-
private apiKey;
|
|
1313
73
|
readonly logger: APILogger;
|
|
1314
|
-
|
|
1315
|
-
readonly accounts: typeof Accounts;
|
|
1316
|
-
readonly oAuth: typeof OAuth;
|
|
1317
|
-
readonly userProfile: typeof UserProfile;
|
|
1318
|
-
readonly auth: typeof Auth$2;
|
|
1319
|
-
constructor(baseUrl: string, opts?: APIOptions$2);
|
|
74
|
+
constructor(_baseUrl?: string, opts?: APIOptions$2);
|
|
1320
75
|
getBaseUrl(): string;
|
|
1321
76
|
setBaseUrl(url: string): void;
|
|
1322
77
|
getToken(): string | null;
|
|
@@ -1331,412 +86,7 @@ declare class API$2 {
|
|
|
1331
86
|
setApiKey(key: string | null): void;
|
|
1332
87
|
}
|
|
1333
88
|
|
|
1334
|
-
type AuthToken$1 = string | undefined;
|
|
1335
|
-
interface Auth$1 {
|
|
1336
|
-
/**
|
|
1337
|
-
* Which part of the request do we use to send the auth?
|
|
1338
|
-
*
|
|
1339
|
-
* @default 'header'
|
|
1340
|
-
*/
|
|
1341
|
-
in?: 'header' | 'query' | 'cookie';
|
|
1342
|
-
/**
|
|
1343
|
-
* Header or query parameter name.
|
|
1344
|
-
*
|
|
1345
|
-
* @default 'Authorization'
|
|
1346
|
-
*/
|
|
1347
|
-
name?: string;
|
|
1348
|
-
scheme?: 'basic' | 'bearer';
|
|
1349
|
-
type: 'apiKey' | 'http';
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
interface SerializerOptions$1<T> {
|
|
1353
|
-
/**
|
|
1354
|
-
* @default true
|
|
1355
|
-
*/
|
|
1356
|
-
explode: boolean;
|
|
1357
|
-
style: T;
|
|
1358
|
-
}
|
|
1359
|
-
type ArrayStyle$1 = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
1360
|
-
type ObjectStyle$1 = 'form' | 'deepObject';
|
|
1361
|
-
|
|
1362
|
-
type QuerySerializer$1 = (query: Record<string, unknown>) => string;
|
|
1363
|
-
type BodySerializer$1 = (body: unknown) => unknown;
|
|
1364
|
-
type QuerySerializerOptionsObject$1 = {
|
|
1365
|
-
allowReserved?: boolean;
|
|
1366
|
-
array?: Partial<SerializerOptions$1<ArrayStyle$1>>;
|
|
1367
|
-
object?: Partial<SerializerOptions$1<ObjectStyle$1>>;
|
|
1368
|
-
};
|
|
1369
|
-
type QuerySerializerOptions$1 = QuerySerializerOptionsObject$1 & {
|
|
1370
|
-
/**
|
|
1371
|
-
* Per-parameter serialization overrides. When provided, these settings
|
|
1372
|
-
* override the global array/object settings for specific parameter names.
|
|
1373
|
-
*/
|
|
1374
|
-
parameters?: Record<string, QuerySerializerOptionsObject$1>;
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
|
-
type HttpMethod$1 = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
1378
|
-
type Client$3<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
1379
|
-
/**
|
|
1380
|
-
* Returns the final request URL.
|
|
1381
|
-
*/
|
|
1382
|
-
buildUrl: BuildUrlFn;
|
|
1383
|
-
getConfig: () => Config;
|
|
1384
|
-
request: RequestFn;
|
|
1385
|
-
setConfig: (config: Config) => Config;
|
|
1386
|
-
} & {
|
|
1387
|
-
[K in HttpMethod$1]: MethodFn;
|
|
1388
|
-
} & ([SseFn] extends [never] ? {
|
|
1389
|
-
sse?: never;
|
|
1390
|
-
} : {
|
|
1391
|
-
sse: {
|
|
1392
|
-
[K in HttpMethod$1]: SseFn;
|
|
1393
|
-
};
|
|
1394
|
-
});
|
|
1395
|
-
interface Config$3 {
|
|
1396
|
-
/**
|
|
1397
|
-
* Auth token or a function returning auth token. The resolved value will be
|
|
1398
|
-
* added to the request payload as defined by its `security` array.
|
|
1399
|
-
*/
|
|
1400
|
-
auth?: ((auth: Auth$1) => Promise<AuthToken$1> | AuthToken$1) | AuthToken$1;
|
|
1401
|
-
/**
|
|
1402
|
-
* A function for serializing request body parameter. By default,
|
|
1403
|
-
* {@link JSON.stringify()} will be used.
|
|
1404
|
-
*/
|
|
1405
|
-
bodySerializer?: BodySerializer$1 | null;
|
|
1406
|
-
/**
|
|
1407
|
-
* An object containing any HTTP headers that you want to pre-populate your
|
|
1408
|
-
* `Headers` object with.
|
|
1409
|
-
*
|
|
1410
|
-
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
1411
|
-
*/
|
|
1412
|
-
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
1413
|
-
/**
|
|
1414
|
-
* The request method.
|
|
1415
|
-
*
|
|
1416
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
1417
|
-
*/
|
|
1418
|
-
method?: Uppercase<HttpMethod$1>;
|
|
1419
|
-
/**
|
|
1420
|
-
* A function for serializing request query parameters. By default, arrays
|
|
1421
|
-
* will be exploded in form style, objects will be exploded in deepObject
|
|
1422
|
-
* style, and reserved characters are percent-encoded.
|
|
1423
|
-
*
|
|
1424
|
-
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
1425
|
-
* API function is used.
|
|
1426
|
-
*
|
|
1427
|
-
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
1428
|
-
*/
|
|
1429
|
-
querySerializer?: QuerySerializer$1 | QuerySerializerOptions$1;
|
|
1430
|
-
/**
|
|
1431
|
-
* A function validating request data. This is useful if you want to ensure
|
|
1432
|
-
* the request conforms to the desired shape, so it can be safely sent to
|
|
1433
|
-
* the server.
|
|
1434
|
-
*/
|
|
1435
|
-
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
1436
|
-
/**
|
|
1437
|
-
* A function transforming response data before it's returned. This is useful
|
|
1438
|
-
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
1439
|
-
*/
|
|
1440
|
-
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
1441
|
-
/**
|
|
1442
|
-
* A function validating response data. This is useful if you want to ensure
|
|
1443
|
-
* the response conforms to the desired shape, so it can be safely passed to
|
|
1444
|
-
* the transformers and returned to the user.
|
|
1445
|
-
*/
|
|
1446
|
-
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
type ServerSentEventsOptions$1<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$3, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
1450
|
-
/**
|
|
1451
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
1452
|
-
* fetch instance.
|
|
1453
|
-
*
|
|
1454
|
-
* @default globalThis.fetch
|
|
1455
|
-
*/
|
|
1456
|
-
fetch?: typeof fetch;
|
|
1457
|
-
/**
|
|
1458
|
-
* Implementing clients can call request interceptors inside this hook.
|
|
1459
|
-
*/
|
|
1460
|
-
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
1461
|
-
/**
|
|
1462
|
-
* Callback invoked when a network or parsing error occurs during streaming.
|
|
1463
|
-
*
|
|
1464
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1465
|
-
*
|
|
1466
|
-
* @param error The error that occurred.
|
|
1467
|
-
*/
|
|
1468
|
-
onSseError?: (error: unknown) => void;
|
|
1469
|
-
/**
|
|
1470
|
-
* Callback invoked when an event is streamed from the server.
|
|
1471
|
-
*
|
|
1472
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1473
|
-
*
|
|
1474
|
-
* @param event Event streamed from the server.
|
|
1475
|
-
* @returns Nothing (void).
|
|
1476
|
-
*/
|
|
1477
|
-
onSseEvent?: (event: StreamEvent$1<TData>) => void;
|
|
1478
|
-
serializedBody?: RequestInit['body'];
|
|
1479
|
-
/**
|
|
1480
|
-
* Default retry delay in milliseconds.
|
|
1481
|
-
*
|
|
1482
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1483
|
-
*
|
|
1484
|
-
* @default 3000
|
|
1485
|
-
*/
|
|
1486
|
-
sseDefaultRetryDelay?: number;
|
|
1487
|
-
/**
|
|
1488
|
-
* Maximum number of retry attempts before giving up.
|
|
1489
|
-
*/
|
|
1490
|
-
sseMaxRetryAttempts?: number;
|
|
1491
|
-
/**
|
|
1492
|
-
* Maximum retry delay in milliseconds.
|
|
1493
|
-
*
|
|
1494
|
-
* Applies only when exponential backoff is used.
|
|
1495
|
-
*
|
|
1496
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1497
|
-
*
|
|
1498
|
-
* @default 30000
|
|
1499
|
-
*/
|
|
1500
|
-
sseMaxRetryDelay?: number;
|
|
1501
|
-
/**
|
|
1502
|
-
* Optional sleep function for retry backoff.
|
|
1503
|
-
*
|
|
1504
|
-
* Defaults to using `setTimeout`.
|
|
1505
|
-
*/
|
|
1506
|
-
sseSleepFn?: (ms: number) => Promise<void>;
|
|
1507
|
-
url: string;
|
|
1508
|
-
};
|
|
1509
|
-
interface StreamEvent$1<TData = unknown> {
|
|
1510
|
-
data: TData;
|
|
1511
|
-
event?: string;
|
|
1512
|
-
id?: string;
|
|
1513
|
-
retry?: number;
|
|
1514
|
-
}
|
|
1515
|
-
type ServerSentEventsResult$1<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
1516
|
-
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
1517
|
-
};
|
|
1518
|
-
|
|
1519
|
-
type ErrInterceptor$1<Err, Res, Req, Options> = (error: Err,
|
|
1520
|
-
/** response may be undefined due to a network error where no response object is produced */
|
|
1521
|
-
response: Res | undefined,
|
|
1522
|
-
/** request may be undefined, because error may be from building the request object itself */
|
|
1523
|
-
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
1524
|
-
type ReqInterceptor$1<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
1525
|
-
type ResInterceptor$1<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
1526
|
-
declare class Interceptors$1<Interceptor> {
|
|
1527
|
-
fns: Array<Interceptor | null>;
|
|
1528
|
-
clear(): void;
|
|
1529
|
-
eject(id: number | Interceptor): void;
|
|
1530
|
-
exists(id: number | Interceptor): boolean;
|
|
1531
|
-
getInterceptorIndex(id: number | Interceptor): number;
|
|
1532
|
-
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
1533
|
-
use(fn: Interceptor): number;
|
|
1534
|
-
}
|
|
1535
|
-
interface Middleware$1<Req, Res, Err, Options> {
|
|
1536
|
-
error: Interceptors$1<ErrInterceptor$1<Err, Res, Req, Options>>;
|
|
1537
|
-
request: Interceptors$1<ReqInterceptor$1<Req, Options>>;
|
|
1538
|
-
response: Interceptors$1<ResInterceptor$1<Res, Req, Options>>;
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
type ResponseStyle$1 = 'data' | 'fields';
|
|
1542
|
-
interface Config$2<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$3 {
|
|
1543
|
-
/**
|
|
1544
|
-
* Base URL for all requests made by this client.
|
|
1545
|
-
*/
|
|
1546
|
-
baseUrl?: T['baseUrl'];
|
|
1547
|
-
/**
|
|
1548
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
1549
|
-
* fetch instance.
|
|
1550
|
-
*
|
|
1551
|
-
* @default globalThis.fetch
|
|
1552
|
-
*/
|
|
1553
|
-
fetch?: typeof fetch;
|
|
1554
|
-
/**
|
|
1555
|
-
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
1556
|
-
* options won't have any effect.
|
|
1557
|
-
*
|
|
1558
|
-
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
1559
|
-
*/
|
|
1560
|
-
next?: never;
|
|
1561
|
-
/**
|
|
1562
|
-
* Return the response data parsed in a specified format. By default, `auto`
|
|
1563
|
-
* will infer the appropriate method from the `Content-Type` response header.
|
|
1564
|
-
* You can override this behavior with any of the {@link Body} methods.
|
|
1565
|
-
* Select `stream` if you don't want to parse response data at all.
|
|
1566
|
-
*
|
|
1567
|
-
* @default 'auto'
|
|
1568
|
-
*/
|
|
1569
|
-
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
1570
|
-
/**
|
|
1571
|
-
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
1572
|
-
*
|
|
1573
|
-
* @default 'fields'
|
|
1574
|
-
*/
|
|
1575
|
-
responseStyle?: ResponseStyle$1;
|
|
1576
|
-
/**
|
|
1577
|
-
* Throw an error instead of returning it in the response?
|
|
1578
|
-
*
|
|
1579
|
-
* @default false
|
|
1580
|
-
*/
|
|
1581
|
-
throwOnError?: T['throwOnError'];
|
|
1582
|
-
}
|
|
1583
|
-
interface RequestOptions$1<TData = unknown, TResponseStyle extends ResponseStyle$1 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$2<{
|
|
1584
|
-
responseStyle: TResponseStyle;
|
|
1585
|
-
throwOnError: ThrowOnError;
|
|
1586
|
-
}>, Pick<ServerSentEventsOptions$1<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
1587
|
-
/**
|
|
1588
|
-
* Any body that you want to add to your request.
|
|
1589
|
-
*
|
|
1590
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
1591
|
-
*/
|
|
1592
|
-
body?: unknown;
|
|
1593
|
-
path?: Record<string, unknown>;
|
|
1594
|
-
query?: Record<string, unknown>;
|
|
1595
|
-
/**
|
|
1596
|
-
* Security mechanism(s) to use for the request.
|
|
1597
|
-
*/
|
|
1598
|
-
security?: ReadonlyArray<Auth$1>;
|
|
1599
|
-
url: Url;
|
|
1600
|
-
}
|
|
1601
|
-
interface ResolvedRequestOptions$1<TResponseStyle extends ResponseStyle$1 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions$1<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
1602
|
-
headers: Headers;
|
|
1603
|
-
serializedBody?: string;
|
|
1604
|
-
}
|
|
1605
|
-
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 : {
|
|
1606
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
1607
|
-
request: Request;
|
|
1608
|
-
response: Response;
|
|
1609
|
-
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
1610
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
1611
|
-
error: undefined;
|
|
1612
|
-
} | {
|
|
1613
|
-
data: undefined;
|
|
1614
|
-
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
1615
|
-
}) & {
|
|
1616
|
-
/** request may be undefined, because error may be from building the request object itself */
|
|
1617
|
-
request?: Request;
|
|
1618
|
-
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
1619
|
-
response?: Response;
|
|
1620
|
-
}>;
|
|
1621
|
-
interface ClientOptions$1 {
|
|
1622
|
-
baseUrl?: string;
|
|
1623
|
-
responseStyle?: ResponseStyle$1;
|
|
1624
|
-
throwOnError?: boolean;
|
|
1625
|
-
}
|
|
1626
|
-
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>;
|
|
1627
|
-
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>>;
|
|
1628
|
-
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>;
|
|
1629
|
-
type BuildUrlFn$1 = <TData extends {
|
|
1630
|
-
body?: unknown;
|
|
1631
|
-
path?: Record<string, unknown>;
|
|
1632
|
-
query?: Record<string, unknown>;
|
|
1633
|
-
url: string;
|
|
1634
|
-
}>(options: TData & Options$3<TData>) => string;
|
|
1635
|
-
type Client$2 = Client$3<RequestFn$1, Config$2, MethodFn$1, BuildUrlFn$1, SseFn$1> & {
|
|
1636
|
-
interceptors: Middleware$1<Request, Response, unknown, ResolvedRequestOptions$1>;
|
|
1637
|
-
};
|
|
1638
|
-
interface TDataShape$1 {
|
|
1639
|
-
body?: unknown;
|
|
1640
|
-
headers?: unknown;
|
|
1641
|
-
path?: unknown;
|
|
1642
|
-
query?: unknown;
|
|
1643
|
-
url: string;
|
|
1644
|
-
}
|
|
1645
|
-
type OmitKeys$1<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
1646
|
-
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'>);
|
|
1647
|
-
|
|
1648
|
-
/**
|
|
1649
|
-
* ConnectionTokenResponse
|
|
1650
|
-
*
|
|
1651
|
-
* Response model for Centrifugo connection token.
|
|
1652
|
-
*/
|
|
1653
|
-
type ConnectionTokenResponse = {
|
|
1654
|
-
/**
|
|
1655
|
-
* Token
|
|
1656
|
-
*
|
|
1657
|
-
* JWT token for Centrifugo connection
|
|
1658
|
-
*/
|
|
1659
|
-
token: string;
|
|
1660
|
-
/**
|
|
1661
|
-
* Centrifugo Url
|
|
1662
|
-
*
|
|
1663
|
-
* Centrifugo WebSocket URL
|
|
1664
|
-
*/
|
|
1665
|
-
centrifugo_url: string;
|
|
1666
|
-
/**
|
|
1667
|
-
* Expires At
|
|
1668
|
-
*
|
|
1669
|
-
* Token expiration time (ISO 8601)
|
|
1670
|
-
*/
|
|
1671
|
-
expires_at: string;
|
|
1672
|
-
/**
|
|
1673
|
-
* Channels
|
|
1674
|
-
*
|
|
1675
|
-
* List of allowed channels
|
|
1676
|
-
*/
|
|
1677
|
-
channels: Array<string>;
|
|
1678
|
-
};
|
|
1679
|
-
type CfgCentrifugoAuthTokenRetrieveData = {
|
|
1680
|
-
body?: never;
|
|
1681
|
-
path?: never;
|
|
1682
|
-
query?: never;
|
|
1683
|
-
url: '/cfg/centrifugo/auth/token/';
|
|
1684
|
-
};
|
|
1685
|
-
type CfgCentrifugoAuthTokenRetrieveErrors = {
|
|
1686
|
-
/**
|
|
1687
|
-
* Unauthorized - authentication required
|
|
1688
|
-
*/
|
|
1689
|
-
401: unknown;
|
|
1690
|
-
/**
|
|
1691
|
-
* Server error
|
|
1692
|
-
*/
|
|
1693
|
-
500: unknown;
|
|
1694
|
-
};
|
|
1695
|
-
type CfgCentrifugoAuthTokenRetrieveResponses = {
|
|
1696
|
-
200: ConnectionTokenResponse;
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
|
-
type Options$2<TData extends TDataShape$1 = TDataShape$1, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$3<TData, ThrowOnError, TResponse> & {
|
|
1700
|
-
/**
|
|
1701
|
-
* You can provide a client instance returned by `createClient()` instead of
|
|
1702
|
-
* individual options. This might be also useful if you want to implement a
|
|
1703
|
-
* custom client.
|
|
1704
|
-
*/
|
|
1705
|
-
client?: Client$2;
|
|
1706
|
-
/**
|
|
1707
|
-
* You can pass arbitrary values through the `meta` object. This can be
|
|
1708
|
-
* used to access values that aren't defined as part of the SDK function.
|
|
1709
|
-
*/
|
|
1710
|
-
meta?: Record<string, unknown>;
|
|
1711
|
-
};
|
|
1712
|
-
declare class Cfg$1 {
|
|
1713
|
-
/**
|
|
1714
|
-
* Get Centrifugo connection token
|
|
1715
|
-
*
|
|
1716
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
1717
|
-
*/
|
|
1718
|
-
static cfgCentrifugoAuthTokenRetrieve<ThrowOnError extends boolean = false>(options?: Options$2<CfgCentrifugoAuthTokenRetrieveData, ThrowOnError>): RequestResult$1<CfgCentrifugoAuthTokenRetrieveResponses, CfgCentrifugoAuthTokenRetrieveErrors, ThrowOnError, "fields">;
|
|
1719
|
-
}
|
|
1720
|
-
declare class Centrifugo {
|
|
1721
|
-
/**
|
|
1722
|
-
* Get Centrifugo connection token
|
|
1723
|
-
*
|
|
1724
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
1725
|
-
*/
|
|
1726
|
-
static cfgCentrifugoAuthTokenRetrieve<ThrowOnError extends boolean = false>(options?: Options$2<CfgCentrifugoAuthTokenRetrieveData, ThrowOnError>): RequestResult$1<CfgCentrifugoAuthTokenRetrieveResponses, CfgCentrifugoAuthTokenRetrieveErrors, ThrowOnError, "fields">;
|
|
1727
|
-
}
|
|
1728
|
-
declare class CentrifugoAuth {
|
|
1729
|
-
/**
|
|
1730
|
-
* Get Centrifugo connection token
|
|
1731
|
-
*
|
|
1732
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
1733
|
-
*/
|
|
1734
|
-
static cfgCentrifugoAuthTokenRetrieve<ThrowOnError extends boolean = false>(options?: Options$2<CfgCentrifugoAuthTokenRetrieveData, ThrowOnError>): RequestResult$1<CfgCentrifugoAuthTokenRetrieveResponses, CfgCentrifugoAuthTokenRetrieveErrors, ThrowOnError, "fields">;
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
89
|
interface APIOptions$1 {
|
|
1738
|
-
/** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
|
|
1739
|
-
storage?: StorageAdapter;
|
|
1740
90
|
/** Logger config (defaults to dev-only). */
|
|
1741
91
|
logger?: Partial<LoggerConfig>;
|
|
1742
92
|
/** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
|
|
@@ -1747,25 +97,18 @@ interface APIOptions$1 {
|
|
|
1747
97
|
withCredentials?: boolean;
|
|
1748
98
|
}
|
|
1749
99
|
/**
|
|
1750
|
-
*
|
|
100
|
+
* Per-group ergonomic facade.
|
|
101
|
+
*
|
|
102
|
+
* Calling `setToken/setApiKey/setLocale/setBaseUrl` proxies to the
|
|
103
|
+
* global `auth` store — the change applies to **every** group's API
|
|
104
|
+
* instance because they share the same HTTP client and interceptor.
|
|
1751
105
|
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
* - `Authorization: Bearer <jwt>` from storage
|
|
1755
|
-
* - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
|
|
1756
|
-
* - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
|
|
1757
|
-
* - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
|
|
106
|
+
* Use the global `auth` object directly when you don't need a group
|
|
107
|
+
* facade: `import { auth } from '@your/api'; auth.setToken(jwt);`
|
|
1758
108
|
*/
|
|
1759
109
|
declare class API$1 {
|
|
1760
|
-
private baseUrl;
|
|
1761
|
-
private storage;
|
|
1762
|
-
private locale;
|
|
1763
|
-
private apiKey;
|
|
1764
110
|
readonly logger: APILogger;
|
|
1765
|
-
|
|
1766
|
-
readonly centrifugo: typeof Centrifugo;
|
|
1767
|
-
readonly centrifugoAuth: typeof CentrifugoAuth;
|
|
1768
|
-
constructor(baseUrl: string, opts?: APIOptions$1);
|
|
111
|
+
constructor(_baseUrl?: string, opts?: APIOptions$1);
|
|
1769
112
|
getBaseUrl(): string;
|
|
1770
113
|
setBaseUrl(url: string): void;
|
|
1771
114
|
getToken(): string | null;
|
|
@@ -1780,869 +123,7 @@ declare class API$1 {
|
|
|
1780
123
|
setApiKey(key: string | null): void;
|
|
1781
124
|
}
|
|
1782
125
|
|
|
1783
|
-
type AuthToken = string | undefined;
|
|
1784
|
-
interface Auth {
|
|
1785
|
-
/**
|
|
1786
|
-
* Which part of the request do we use to send the auth?
|
|
1787
|
-
*
|
|
1788
|
-
* @default 'header'
|
|
1789
|
-
*/
|
|
1790
|
-
in?: 'header' | 'query' | 'cookie';
|
|
1791
|
-
/**
|
|
1792
|
-
* Header or query parameter name.
|
|
1793
|
-
*
|
|
1794
|
-
* @default 'Authorization'
|
|
1795
|
-
*/
|
|
1796
|
-
name?: string;
|
|
1797
|
-
scheme?: 'basic' | 'bearer';
|
|
1798
|
-
type: 'apiKey' | 'http';
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
interface SerializerOptions<T> {
|
|
1802
|
-
/**
|
|
1803
|
-
* @default true
|
|
1804
|
-
*/
|
|
1805
|
-
explode: boolean;
|
|
1806
|
-
style: T;
|
|
1807
|
-
}
|
|
1808
|
-
type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
1809
|
-
type ObjectStyle = 'form' | 'deepObject';
|
|
1810
|
-
|
|
1811
|
-
type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
1812
|
-
type BodySerializer = (body: unknown) => unknown;
|
|
1813
|
-
type QuerySerializerOptionsObject = {
|
|
1814
|
-
allowReserved?: boolean;
|
|
1815
|
-
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
1816
|
-
object?: Partial<SerializerOptions<ObjectStyle>>;
|
|
1817
|
-
};
|
|
1818
|
-
type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
1819
|
-
/**
|
|
1820
|
-
* Per-parameter serialization overrides. When provided, these settings
|
|
1821
|
-
* override the global array/object settings for specific parameter names.
|
|
1822
|
-
*/
|
|
1823
|
-
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
1824
|
-
};
|
|
1825
|
-
|
|
1826
|
-
type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
1827
|
-
type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
1828
|
-
/**
|
|
1829
|
-
* Returns the final request URL.
|
|
1830
|
-
*/
|
|
1831
|
-
buildUrl: BuildUrlFn;
|
|
1832
|
-
getConfig: () => Config;
|
|
1833
|
-
request: RequestFn;
|
|
1834
|
-
setConfig: (config: Config) => Config;
|
|
1835
|
-
} & {
|
|
1836
|
-
[K in HttpMethod]: MethodFn;
|
|
1837
|
-
} & ([SseFn] extends [never] ? {
|
|
1838
|
-
sse?: never;
|
|
1839
|
-
} : {
|
|
1840
|
-
sse: {
|
|
1841
|
-
[K in HttpMethod]: SseFn;
|
|
1842
|
-
};
|
|
1843
|
-
});
|
|
1844
|
-
interface Config$1 {
|
|
1845
|
-
/**
|
|
1846
|
-
* Auth token or a function returning auth token. The resolved value will be
|
|
1847
|
-
* added to the request payload as defined by its `security` array.
|
|
1848
|
-
*/
|
|
1849
|
-
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
1850
|
-
/**
|
|
1851
|
-
* A function for serializing request body parameter. By default,
|
|
1852
|
-
* {@link JSON.stringify()} will be used.
|
|
1853
|
-
*/
|
|
1854
|
-
bodySerializer?: BodySerializer | null;
|
|
1855
|
-
/**
|
|
1856
|
-
* An object containing any HTTP headers that you want to pre-populate your
|
|
1857
|
-
* `Headers` object with.
|
|
1858
|
-
*
|
|
1859
|
-
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
1860
|
-
*/
|
|
1861
|
-
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
1862
|
-
/**
|
|
1863
|
-
* The request method.
|
|
1864
|
-
*
|
|
1865
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
1866
|
-
*/
|
|
1867
|
-
method?: Uppercase<HttpMethod>;
|
|
1868
|
-
/**
|
|
1869
|
-
* A function for serializing request query parameters. By default, arrays
|
|
1870
|
-
* will be exploded in form style, objects will be exploded in deepObject
|
|
1871
|
-
* style, and reserved characters are percent-encoded.
|
|
1872
|
-
*
|
|
1873
|
-
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
1874
|
-
* API function is used.
|
|
1875
|
-
*
|
|
1876
|
-
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
1877
|
-
*/
|
|
1878
|
-
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
1879
|
-
/**
|
|
1880
|
-
* A function validating request data. This is useful if you want to ensure
|
|
1881
|
-
* the request conforms to the desired shape, so it can be safely sent to
|
|
1882
|
-
* the server.
|
|
1883
|
-
*/
|
|
1884
|
-
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
1885
|
-
/**
|
|
1886
|
-
* A function transforming response data before it's returned. This is useful
|
|
1887
|
-
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
1888
|
-
*/
|
|
1889
|
-
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
1890
|
-
/**
|
|
1891
|
-
* A function validating response data. This is useful if you want to ensure
|
|
1892
|
-
* the response conforms to the desired shape, so it can be safely passed to
|
|
1893
|
-
* the transformers and returned to the user.
|
|
1894
|
-
*/
|
|
1895
|
-
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
1899
|
-
/**
|
|
1900
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
1901
|
-
* fetch instance.
|
|
1902
|
-
*
|
|
1903
|
-
* @default globalThis.fetch
|
|
1904
|
-
*/
|
|
1905
|
-
fetch?: typeof fetch;
|
|
1906
|
-
/**
|
|
1907
|
-
* Implementing clients can call request interceptors inside this hook.
|
|
1908
|
-
*/
|
|
1909
|
-
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
1910
|
-
/**
|
|
1911
|
-
* Callback invoked when a network or parsing error occurs during streaming.
|
|
1912
|
-
*
|
|
1913
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1914
|
-
*
|
|
1915
|
-
* @param error The error that occurred.
|
|
1916
|
-
*/
|
|
1917
|
-
onSseError?: (error: unknown) => void;
|
|
1918
|
-
/**
|
|
1919
|
-
* Callback invoked when an event is streamed from the server.
|
|
1920
|
-
*
|
|
1921
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1922
|
-
*
|
|
1923
|
-
* @param event Event streamed from the server.
|
|
1924
|
-
* @returns Nothing (void).
|
|
1925
|
-
*/
|
|
1926
|
-
onSseEvent?: (event: StreamEvent<TData>) => void;
|
|
1927
|
-
serializedBody?: RequestInit['body'];
|
|
1928
|
-
/**
|
|
1929
|
-
* Default retry delay in milliseconds.
|
|
1930
|
-
*
|
|
1931
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1932
|
-
*
|
|
1933
|
-
* @default 3000
|
|
1934
|
-
*/
|
|
1935
|
-
sseDefaultRetryDelay?: number;
|
|
1936
|
-
/**
|
|
1937
|
-
* Maximum number of retry attempts before giving up.
|
|
1938
|
-
*/
|
|
1939
|
-
sseMaxRetryAttempts?: number;
|
|
1940
|
-
/**
|
|
1941
|
-
* Maximum retry delay in milliseconds.
|
|
1942
|
-
*
|
|
1943
|
-
* Applies only when exponential backoff is used.
|
|
1944
|
-
*
|
|
1945
|
-
* This option applies only if the endpoint returns a stream of events.
|
|
1946
|
-
*
|
|
1947
|
-
* @default 30000
|
|
1948
|
-
*/
|
|
1949
|
-
sseMaxRetryDelay?: number;
|
|
1950
|
-
/**
|
|
1951
|
-
* Optional sleep function for retry backoff.
|
|
1952
|
-
*
|
|
1953
|
-
* Defaults to using `setTimeout`.
|
|
1954
|
-
*/
|
|
1955
|
-
sseSleepFn?: (ms: number) => Promise<void>;
|
|
1956
|
-
url: string;
|
|
1957
|
-
};
|
|
1958
|
-
interface StreamEvent<TData = unknown> {
|
|
1959
|
-
data: TData;
|
|
1960
|
-
event?: string;
|
|
1961
|
-
id?: string;
|
|
1962
|
-
retry?: number;
|
|
1963
|
-
}
|
|
1964
|
-
type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
1965
|
-
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
1966
|
-
};
|
|
1967
|
-
|
|
1968
|
-
type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
|
|
1969
|
-
/** response may be undefined due to a network error where no response object is produced */
|
|
1970
|
-
response: Res | undefined,
|
|
1971
|
-
/** request may be undefined, because error may be from building the request object itself */
|
|
1972
|
-
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
1973
|
-
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
1974
|
-
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
1975
|
-
declare class Interceptors<Interceptor> {
|
|
1976
|
-
fns: Array<Interceptor | null>;
|
|
1977
|
-
clear(): void;
|
|
1978
|
-
eject(id: number | Interceptor): void;
|
|
1979
|
-
exists(id: number | Interceptor): boolean;
|
|
1980
|
-
getInterceptorIndex(id: number | Interceptor): number;
|
|
1981
|
-
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
1982
|
-
use(fn: Interceptor): number;
|
|
1983
|
-
}
|
|
1984
|
-
interface Middleware<Req, Res, Err, Options> {
|
|
1985
|
-
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
1986
|
-
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
1987
|
-
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
type ResponseStyle = 'data' | 'fields';
|
|
1991
|
-
interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
|
|
1992
|
-
/**
|
|
1993
|
-
* Base URL for all requests made by this client.
|
|
1994
|
-
*/
|
|
1995
|
-
baseUrl?: T['baseUrl'];
|
|
1996
|
-
/**
|
|
1997
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
1998
|
-
* fetch instance.
|
|
1999
|
-
*
|
|
2000
|
-
* @default globalThis.fetch
|
|
2001
|
-
*/
|
|
2002
|
-
fetch?: typeof fetch;
|
|
2003
|
-
/**
|
|
2004
|
-
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
2005
|
-
* options won't have any effect.
|
|
2006
|
-
*
|
|
2007
|
-
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
2008
|
-
*/
|
|
2009
|
-
next?: never;
|
|
2010
|
-
/**
|
|
2011
|
-
* Return the response data parsed in a specified format. By default, `auto`
|
|
2012
|
-
* will infer the appropriate method from the `Content-Type` response header.
|
|
2013
|
-
* You can override this behavior with any of the {@link Body} methods.
|
|
2014
|
-
* Select `stream` if you don't want to parse response data at all.
|
|
2015
|
-
*
|
|
2016
|
-
* @default 'auto'
|
|
2017
|
-
*/
|
|
2018
|
-
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
2019
|
-
/**
|
|
2020
|
-
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
2021
|
-
*
|
|
2022
|
-
* @default 'fields'
|
|
2023
|
-
*/
|
|
2024
|
-
responseStyle?: ResponseStyle;
|
|
2025
|
-
/**
|
|
2026
|
-
* Throw an error instead of returning it in the response?
|
|
2027
|
-
*
|
|
2028
|
-
* @default false
|
|
2029
|
-
*/
|
|
2030
|
-
throwOnError?: T['throwOnError'];
|
|
2031
|
-
}
|
|
2032
|
-
interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
2033
|
-
responseStyle: TResponseStyle;
|
|
2034
|
-
throwOnError: ThrowOnError;
|
|
2035
|
-
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2036
|
-
/**
|
|
2037
|
-
* Any body that you want to add to your request.
|
|
2038
|
-
*
|
|
2039
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
2040
|
-
*/
|
|
2041
|
-
body?: unknown;
|
|
2042
|
-
path?: Record<string, unknown>;
|
|
2043
|
-
query?: Record<string, unknown>;
|
|
2044
|
-
/**
|
|
2045
|
-
* Security mechanism(s) to use for the request.
|
|
2046
|
-
*/
|
|
2047
|
-
security?: ReadonlyArray<Auth>;
|
|
2048
|
-
url: Url;
|
|
2049
|
-
}
|
|
2050
|
-
interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
2051
|
-
headers: Headers;
|
|
2052
|
-
serializedBody?: string;
|
|
2053
|
-
}
|
|
2054
|
-
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 : {
|
|
2055
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
2056
|
-
request: Request;
|
|
2057
|
-
response: Response;
|
|
2058
|
-
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
2059
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
2060
|
-
error: undefined;
|
|
2061
|
-
} | {
|
|
2062
|
-
data: undefined;
|
|
2063
|
-
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
2064
|
-
}) & {
|
|
2065
|
-
/** request may be undefined, because error may be from building the request object itself */
|
|
2066
|
-
request?: Request;
|
|
2067
|
-
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
2068
|
-
response?: Response;
|
|
2069
|
-
}>;
|
|
2070
|
-
interface ClientOptions {
|
|
2071
|
-
baseUrl?: string;
|
|
2072
|
-
responseStyle?: ResponseStyle;
|
|
2073
|
-
throwOnError?: boolean;
|
|
2074
|
-
}
|
|
2075
|
-
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>;
|
|
2076
|
-
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>>;
|
|
2077
|
-
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>;
|
|
2078
|
-
type BuildUrlFn = <TData extends {
|
|
2079
|
-
body?: unknown;
|
|
2080
|
-
path?: Record<string, unknown>;
|
|
2081
|
-
query?: Record<string, unknown>;
|
|
2082
|
-
url: string;
|
|
2083
|
-
}>(options: TData & Options$1<TData>) => string;
|
|
2084
|
-
type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
2085
|
-
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
2086
|
-
};
|
|
2087
|
-
interface TDataShape {
|
|
2088
|
-
body?: unknown;
|
|
2089
|
-
headers?: unknown;
|
|
2090
|
-
path?: unknown;
|
|
2091
|
-
query?: unknown;
|
|
2092
|
-
url: string;
|
|
2093
|
-
}
|
|
2094
|
-
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
2095
|
-
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'>);
|
|
2096
|
-
|
|
2097
|
-
/**
|
|
2098
|
-
* Serializer for regenerating backup codes.
|
|
2099
|
-
*/
|
|
2100
|
-
type BackupCodesRegenerateRequest = {
|
|
2101
|
-
/**
|
|
2102
|
-
* TOTP code for verification
|
|
2103
|
-
*/
|
|
2104
|
-
code: string;
|
|
2105
|
-
};
|
|
2106
|
-
/**
|
|
2107
|
-
* Response serializer for backup codes regeneration.
|
|
2108
|
-
*/
|
|
2109
|
-
type BackupCodesRegenerateResponse = {
|
|
2110
|
-
/**
|
|
2111
|
-
* List of new backup codes (save these!)
|
|
2112
|
-
*/
|
|
2113
|
-
backup_codes: Array<string>;
|
|
2114
|
-
/**
|
|
2115
|
-
* Warning about previous codes being invalidated
|
|
2116
|
-
*/
|
|
2117
|
-
warning: string;
|
|
2118
|
-
};
|
|
2119
|
-
/**
|
|
2120
|
-
* Serializer for backup codes status.
|
|
2121
|
-
*/
|
|
2122
|
-
type BackupCodesStatus = {
|
|
2123
|
-
/**
|
|
2124
|
-
* Number of unused backup codes
|
|
2125
|
-
*/
|
|
2126
|
-
remaining_count: number;
|
|
2127
|
-
/**
|
|
2128
|
-
* Total number of codes generated
|
|
2129
|
-
*/
|
|
2130
|
-
total_generated: number;
|
|
2131
|
-
/**
|
|
2132
|
-
* Warning if running low on codes
|
|
2133
|
-
*/
|
|
2134
|
-
warning?: string | null;
|
|
2135
|
-
};
|
|
2136
|
-
/**
|
|
2137
|
-
* Serializer for confirming 2FA setup with first code.
|
|
2138
|
-
*/
|
|
2139
|
-
type ConfirmSetupRequest = {
|
|
2140
|
-
/**
|
|
2141
|
-
* Device ID from setup response
|
|
2142
|
-
*/
|
|
2143
|
-
device_id: string;
|
|
2144
|
-
/**
|
|
2145
|
-
* 6-digit TOTP code from authenticator app
|
|
2146
|
-
*/
|
|
2147
|
-
code: string;
|
|
2148
|
-
};
|
|
2149
|
-
/**
|
|
2150
|
-
* Response serializer for setup confirmation.
|
|
2151
|
-
*/
|
|
2152
|
-
type ConfirmSetupResponse = {
|
|
2153
|
-
message: string;
|
|
2154
|
-
/**
|
|
2155
|
-
* List of backup recovery codes (save these!)
|
|
2156
|
-
*/
|
|
2157
|
-
backup_codes: Array<string>;
|
|
2158
|
-
/**
|
|
2159
|
-
* Warning message about backup codes
|
|
2160
|
-
*/
|
|
2161
|
-
backup_codes_warning: string;
|
|
2162
|
-
};
|
|
2163
|
-
/**
|
|
2164
|
-
* Serializer for listing TOTP devices.
|
|
2165
|
-
*/
|
|
2166
|
-
type DeviceList = {
|
|
2167
|
-
readonly id: string;
|
|
2168
|
-
/**
|
|
2169
|
-
* Device name for identification
|
|
2170
|
-
*/
|
|
2171
|
-
readonly name: string;
|
|
2172
|
-
/**
|
|
2173
|
-
* Primary device used for verification
|
|
2174
|
-
*/
|
|
2175
|
-
readonly is_primary: boolean;
|
|
2176
|
-
readonly status: DeviceListStatusEnum;
|
|
2177
|
-
readonly created_at: string;
|
|
2178
|
-
/**
|
|
2179
|
-
* When device setup was confirmed
|
|
2180
|
-
*/
|
|
2181
|
-
readonly confirmed_at: string | null;
|
|
2182
|
-
/**
|
|
2183
|
-
* Last successful verification
|
|
2184
|
-
*/
|
|
2185
|
-
readonly last_used_at: string | null;
|
|
2186
|
-
};
|
|
2187
|
-
/**
|
|
2188
|
-
* Response serializer for device list endpoint.
|
|
2189
|
-
*/
|
|
2190
|
-
type DeviceListResponse = {
|
|
2191
|
-
devices: Array<DeviceList>;
|
|
2192
|
-
has_2fa_enabled: boolean;
|
|
2193
|
-
};
|
|
2194
|
-
/**
|
|
2195
|
-
* * `pending` - Pending Confirmation
|
|
2196
|
-
* * `active` - Active
|
|
2197
|
-
* * `disabled` - Disabled
|
|
2198
|
-
*/
|
|
2199
|
-
declare enum DeviceListStatusEnum {
|
|
2200
|
-
PENDING = "pending",
|
|
2201
|
-
ACTIVE = "active",
|
|
2202
|
-
DISABLED = "disabled"
|
|
2203
|
-
}
|
|
2204
|
-
/**
|
|
2205
|
-
* Serializer for completely disabling 2FA.
|
|
2206
|
-
*/
|
|
2207
|
-
type DisableRequest = {
|
|
2208
|
-
/**
|
|
2209
|
-
* TOTP code for verification
|
|
2210
|
-
*/
|
|
2211
|
-
code: string;
|
|
2212
|
-
};
|
|
2213
|
-
/**
|
|
2214
|
-
* Serializer for starting 2FA setup.
|
|
2215
|
-
*/
|
|
2216
|
-
type SetupRequest = {
|
|
2217
|
-
/**
|
|
2218
|
-
* Device name for identification (e.g., 'My iPhone')
|
|
2219
|
-
*/
|
|
2220
|
-
device_name?: string;
|
|
2221
|
-
};
|
|
2222
|
-
/**
|
|
2223
|
-
* Response serializer for setup initiation.
|
|
2224
|
-
*/
|
|
2225
|
-
type SetupResponse = {
|
|
2226
|
-
/**
|
|
2227
|
-
* Device ID to use for confirmation
|
|
2228
|
-
*/
|
|
2229
|
-
device_id: string;
|
|
2230
|
-
/**
|
|
2231
|
-
* Base32-encoded TOTP secret (for manual entry)
|
|
2232
|
-
*/
|
|
2233
|
-
secret: string;
|
|
2234
|
-
/**
|
|
2235
|
-
* otpauth:// URI for QR code generation
|
|
2236
|
-
*/
|
|
2237
|
-
provisioning_uri: string;
|
|
2238
|
-
/**
|
|
2239
|
-
* Base64-encoded QR code image (data URI)
|
|
2240
|
-
*/
|
|
2241
|
-
qr_code_base64: string;
|
|
2242
|
-
/**
|
|
2243
|
-
* Seconds until setup expires (typically 600 = 10 minutes)
|
|
2244
|
-
*/
|
|
2245
|
-
expires_in: number;
|
|
2246
|
-
};
|
|
2247
|
-
/**
|
|
2248
|
-
* User data returned after 2FA verification.
|
|
2249
|
-
*/
|
|
2250
|
-
type TotpVerifyUser = {
|
|
2251
|
-
readonly id: number;
|
|
2252
|
-
readonly email: string;
|
|
2253
|
-
first_name?: string;
|
|
2254
|
-
last_name?: string;
|
|
2255
|
-
/**
|
|
2256
|
-
* Get user's full name.
|
|
2257
|
-
*/
|
|
2258
|
-
readonly full_name: string;
|
|
2259
|
-
/**
|
|
2260
|
-
* Get user's initials for avatar fallback.
|
|
2261
|
-
*/
|
|
2262
|
-
readonly initials: string;
|
|
2263
|
-
/**
|
|
2264
|
-
* Get formatted username for display.
|
|
2265
|
-
*/
|
|
2266
|
-
readonly display_username: string;
|
|
2267
|
-
company?: string;
|
|
2268
|
-
phone?: string;
|
|
2269
|
-
position?: string;
|
|
2270
|
-
language?: string;
|
|
2271
|
-
readonly avatar: string | null;
|
|
2272
|
-
/**
|
|
2273
|
-
* Staff status
|
|
2274
|
-
*
|
|
2275
|
-
* Designates whether the user can log into this admin site.
|
|
2276
|
-
*/
|
|
2277
|
-
readonly is_staff: boolean;
|
|
2278
|
-
/**
|
|
2279
|
-
* Superuser status
|
|
2280
|
-
*
|
|
2281
|
-
* Designates that this user has all permissions without explicitly assigning them.
|
|
2282
|
-
*/
|
|
2283
|
-
readonly is_superuser: boolean;
|
|
2284
|
-
readonly date_joined: string;
|
|
2285
|
-
readonly last_login: string | null;
|
|
2286
|
-
readonly unanswered_messages_count: number;
|
|
2287
|
-
};
|
|
2288
|
-
/**
|
|
2289
|
-
* Serializer for backup code verification during login.
|
|
2290
|
-
*/
|
|
2291
|
-
type VerifyBackupRequest = {
|
|
2292
|
-
/**
|
|
2293
|
-
* 2FA session ID from login response
|
|
2294
|
-
*/
|
|
2295
|
-
session_id: string;
|
|
2296
|
-
/**
|
|
2297
|
-
* 8-character backup recovery code
|
|
2298
|
-
*/
|
|
2299
|
-
backup_code: string;
|
|
2300
|
-
};
|
|
2301
|
-
/**
|
|
2302
|
-
* Serializer for TOTP code verification during login.
|
|
2303
|
-
*/
|
|
2304
|
-
type VerifyRequest = {
|
|
2305
|
-
/**
|
|
2306
|
-
* 2FA session ID from login response
|
|
2307
|
-
*/
|
|
2308
|
-
session_id: string;
|
|
2309
|
-
/**
|
|
2310
|
-
* 6-digit TOTP code from authenticator app
|
|
2311
|
-
*/
|
|
2312
|
-
code: string;
|
|
2313
|
-
};
|
|
2314
|
-
/**
|
|
2315
|
-
* Response serializer for successful 2FA verification.
|
|
2316
|
-
*/
|
|
2317
|
-
type VerifyResponse = {
|
|
2318
|
-
message: string;
|
|
2319
|
-
/**
|
|
2320
|
-
* JWT access token
|
|
2321
|
-
*/
|
|
2322
|
-
access_token: string;
|
|
2323
|
-
/**
|
|
2324
|
-
* JWT refresh token
|
|
2325
|
-
*/
|
|
2326
|
-
refresh_token: string;
|
|
2327
|
-
/**
|
|
2328
|
-
* User profile data
|
|
2329
|
-
*/
|
|
2330
|
-
user: TotpVerifyUser;
|
|
2331
|
-
/**
|
|
2332
|
-
* Number of remaining backup codes (if backup code was used)
|
|
2333
|
-
*/
|
|
2334
|
-
remaining_backup_codes?: number;
|
|
2335
|
-
/**
|
|
2336
|
-
* Warning message (e.g., low backup codes)
|
|
2337
|
-
*/
|
|
2338
|
-
warning?: string;
|
|
2339
|
-
};
|
|
2340
|
-
type CfgTotpBackupCodesRetrieveData = {
|
|
2341
|
-
body?: never;
|
|
2342
|
-
path?: never;
|
|
2343
|
-
query?: never;
|
|
2344
|
-
url: '/cfg/totp/backup-codes/';
|
|
2345
|
-
};
|
|
2346
|
-
type CfgTotpBackupCodesRetrieveResponses = {
|
|
2347
|
-
200: BackupCodesStatus;
|
|
2348
|
-
};
|
|
2349
|
-
type CfgTotpBackupCodesRegenerateCreateData = {
|
|
2350
|
-
body: BackupCodesRegenerateRequest;
|
|
2351
|
-
path?: never;
|
|
2352
|
-
query?: never;
|
|
2353
|
-
url: '/cfg/totp/backup-codes/regenerate/';
|
|
2354
|
-
};
|
|
2355
|
-
type CfgTotpBackupCodesRegenerateCreateErrors = {
|
|
2356
|
-
/**
|
|
2357
|
-
* Invalid code or 2FA not enabled
|
|
2358
|
-
*/
|
|
2359
|
-
400: unknown;
|
|
2360
|
-
};
|
|
2361
|
-
type CfgTotpBackupCodesRegenerateCreateResponses = {
|
|
2362
|
-
200: BackupCodesRegenerateResponse;
|
|
2363
|
-
};
|
|
2364
|
-
type CfgTotpDevicesRetrieveData = {
|
|
2365
|
-
body?: never;
|
|
2366
|
-
path?: never;
|
|
2367
|
-
query?: never;
|
|
2368
|
-
url: '/cfg/totp/devices/';
|
|
2369
|
-
};
|
|
2370
|
-
type CfgTotpDevicesRetrieveResponses = {
|
|
2371
|
-
200: DeviceListResponse;
|
|
2372
|
-
};
|
|
2373
|
-
type CfgTotpDevicesDestroyData = {
|
|
2374
|
-
body?: never;
|
|
2375
|
-
path: {
|
|
2376
|
-
id: string;
|
|
2377
|
-
};
|
|
2378
|
-
query?: never;
|
|
2379
|
-
url: '/cfg/totp/devices/{id}/';
|
|
2380
|
-
};
|
|
2381
|
-
type CfgTotpDevicesDestroyResponses = {
|
|
2382
|
-
/**
|
|
2383
|
-
* No response body
|
|
2384
|
-
*/
|
|
2385
|
-
204: void;
|
|
2386
|
-
};
|
|
2387
|
-
type CfgTotpDisableCreateData = {
|
|
2388
|
-
body: DisableRequest;
|
|
2389
|
-
path?: never;
|
|
2390
|
-
query?: never;
|
|
2391
|
-
url: '/cfg/totp/disable/';
|
|
2392
|
-
};
|
|
2393
|
-
type CfgTotpDisableCreateErrors = {
|
|
2394
|
-
/**
|
|
2395
|
-
* Invalid code
|
|
2396
|
-
*/
|
|
2397
|
-
400: unknown;
|
|
2398
|
-
};
|
|
2399
|
-
type CfgTotpDisableCreateResponses = {
|
|
2400
|
-
/**
|
|
2401
|
-
* 2FA disabled successfully
|
|
2402
|
-
*/
|
|
2403
|
-
200: unknown;
|
|
2404
|
-
};
|
|
2405
|
-
type CfgTotpSetupCreateData = {
|
|
2406
|
-
body?: SetupRequest;
|
|
2407
|
-
path?: never;
|
|
2408
|
-
query?: never;
|
|
2409
|
-
url: '/cfg/totp/setup/';
|
|
2410
|
-
};
|
|
2411
|
-
type CfgTotpSetupCreateErrors = {
|
|
2412
|
-
/**
|
|
2413
|
-
* 2FA already enabled or invalid request
|
|
2414
|
-
*/
|
|
2415
|
-
400: unknown;
|
|
2416
|
-
};
|
|
2417
|
-
type CfgTotpSetupCreateResponses = {
|
|
2418
|
-
200: SetupResponse;
|
|
2419
|
-
};
|
|
2420
|
-
type CfgTotpSetupConfirmCreateData = {
|
|
2421
|
-
body: ConfirmSetupRequest;
|
|
2422
|
-
path?: never;
|
|
2423
|
-
query?: never;
|
|
2424
|
-
url: '/cfg/totp/setup/confirm/';
|
|
2425
|
-
};
|
|
2426
|
-
type CfgTotpSetupConfirmCreateErrors = {
|
|
2427
|
-
/**
|
|
2428
|
-
* Invalid code or setup expired
|
|
2429
|
-
*/
|
|
2430
|
-
400: unknown;
|
|
2431
|
-
};
|
|
2432
|
-
type CfgTotpSetupConfirmCreateResponses = {
|
|
2433
|
-
200: ConfirmSetupResponse;
|
|
2434
|
-
};
|
|
2435
|
-
type CfgTotpVerifyCreateData = {
|
|
2436
|
-
body: VerifyRequest;
|
|
2437
|
-
path?: never;
|
|
2438
|
-
query?: never;
|
|
2439
|
-
url: '/cfg/totp/verify/';
|
|
2440
|
-
};
|
|
2441
|
-
type CfgTotpVerifyCreateErrors = {
|
|
2442
|
-
/**
|
|
2443
|
-
* Invalid code or session
|
|
2444
|
-
*/
|
|
2445
|
-
400: unknown;
|
|
2446
|
-
/**
|
|
2447
|
-
* Too many attempts
|
|
2448
|
-
*/
|
|
2449
|
-
403: unknown;
|
|
2450
|
-
};
|
|
2451
|
-
type CfgTotpVerifyCreateResponses = {
|
|
2452
|
-
200: VerifyResponse;
|
|
2453
|
-
};
|
|
2454
|
-
type CfgTotpVerifyBackupCreateData = {
|
|
2455
|
-
body: VerifyBackupRequest;
|
|
2456
|
-
path?: never;
|
|
2457
|
-
query?: never;
|
|
2458
|
-
url: '/cfg/totp/verify/backup/';
|
|
2459
|
-
};
|
|
2460
|
-
type CfgTotpVerifyBackupCreateErrors = {
|
|
2461
|
-
/**
|
|
2462
|
-
* Invalid backup code or session
|
|
2463
|
-
*/
|
|
2464
|
-
400: unknown;
|
|
2465
|
-
};
|
|
2466
|
-
type CfgTotpVerifyBackupCreateResponses = {
|
|
2467
|
-
200: VerifyResponse;
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
|
-
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
|
|
2471
|
-
/**
|
|
2472
|
-
* You can provide a client instance returned by `createClient()` instead of
|
|
2473
|
-
* individual options. This might be also useful if you want to implement a
|
|
2474
|
-
* custom client.
|
|
2475
|
-
*/
|
|
2476
|
-
client?: Client;
|
|
2477
|
-
/**
|
|
2478
|
-
* You can pass arbitrary values through the `meta` object. This can be
|
|
2479
|
-
* used to access values that aren't defined as part of the SDK function.
|
|
2480
|
-
*/
|
|
2481
|
-
meta?: Record<string, unknown>;
|
|
2482
|
-
};
|
|
2483
|
-
declare class Cfg {
|
|
2484
|
-
/**
|
|
2485
|
-
* Get backup codes status for user.
|
|
2486
|
-
*/
|
|
2487
|
-
static cfgTotpBackupCodesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpBackupCodesRetrieveData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
2488
|
-
/**
|
|
2489
|
-
* Regenerate backup codes.
|
|
2490
|
-
*
|
|
2491
|
-
* Requires TOTP code for verification.
|
|
2492
|
-
* Invalidates all existing codes.
|
|
2493
|
-
*/
|
|
2494
|
-
static cfgTotpBackupCodesRegenerateCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpBackupCodesRegenerateCreateData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRegenerateCreateResponses, CfgTotpBackupCodesRegenerateCreateErrors, ThrowOnError, "fields">;
|
|
2495
|
-
/**
|
|
2496
|
-
* List all TOTP devices for user.
|
|
2497
|
-
*/
|
|
2498
|
-
static cfgTotpDevicesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpDevicesRetrieveData, ThrowOnError>): RequestResult<CfgTotpDevicesRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
2499
|
-
/**
|
|
2500
|
-
* Delete a TOTP device.
|
|
2501
|
-
*
|
|
2502
|
-
* Requires verification code if removing the last/primary device.
|
|
2503
|
-
*/
|
|
2504
|
-
static cfgTotpDevicesDestroy<ThrowOnError extends boolean = false>(options: Options<CfgTotpDevicesDestroyData, ThrowOnError>): RequestResult<CfgTotpDevicesDestroyResponses, unknown, ThrowOnError, "fields">;
|
|
2505
|
-
/**
|
|
2506
|
-
* Completely disable 2FA for account.
|
|
2507
|
-
*
|
|
2508
|
-
* Requires verification code.
|
|
2509
|
-
*/
|
|
2510
|
-
static cfgTotpDisableCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpDisableCreateData, ThrowOnError>): RequestResult<CfgTotpDisableCreateResponses, CfgTotpDisableCreateErrors, ThrowOnError, "fields">;
|
|
2511
|
-
/**
|
|
2512
|
-
* Start 2FA setup process.
|
|
2513
|
-
*
|
|
2514
|
-
* Creates a new TOTP device and returns QR code for scanning.
|
|
2515
|
-
*/
|
|
2516
|
-
static cfgTotpSetupCreate<ThrowOnError extends boolean = false>(options?: Options<CfgTotpSetupCreateData, ThrowOnError>): RequestResult<CfgTotpSetupCreateResponses, CfgTotpSetupCreateErrors, ThrowOnError, "fields">;
|
|
2517
|
-
/**
|
|
2518
|
-
* Confirm 2FA setup with first valid code.
|
|
2519
|
-
*
|
|
2520
|
-
* Activates the device and generates backup codes.
|
|
2521
|
-
*/
|
|
2522
|
-
static cfgTotpSetupConfirmCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpSetupConfirmCreateData, ThrowOnError>): RequestResult<CfgTotpSetupConfirmCreateResponses, CfgTotpSetupConfirmCreateErrors, ThrowOnError, "fields">;
|
|
2523
|
-
/**
|
|
2524
|
-
* Verify TOTP code for 2FA session.
|
|
2525
|
-
*
|
|
2526
|
-
* Completes authentication and returns JWT tokens on success.
|
|
2527
|
-
*/
|
|
2528
|
-
static cfgTotpVerifyCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyCreateResponses, CfgTotpVerifyCreateErrors, ThrowOnError, "fields">;
|
|
2529
|
-
/**
|
|
2530
|
-
* Verify backup recovery code for 2FA session.
|
|
2531
|
-
*
|
|
2532
|
-
* Alternative verification method when TOTP device unavailable.
|
|
2533
|
-
*/
|
|
2534
|
-
static cfgTotpVerifyBackupCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyBackupCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyBackupCreateResponses, CfgTotpVerifyBackupCreateErrors, ThrowOnError, "fields">;
|
|
2535
|
-
}
|
|
2536
|
-
declare class Totp {
|
|
2537
|
-
/**
|
|
2538
|
-
* Get backup codes status for user.
|
|
2539
|
-
*/
|
|
2540
|
-
static cfgTotpBackupCodesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpBackupCodesRetrieveData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
2541
|
-
/**
|
|
2542
|
-
* Regenerate backup codes.
|
|
2543
|
-
*
|
|
2544
|
-
* Requires TOTP code for verification.
|
|
2545
|
-
* Invalidates all existing codes.
|
|
2546
|
-
*/
|
|
2547
|
-
static cfgTotpBackupCodesRegenerateCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpBackupCodesRegenerateCreateData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRegenerateCreateResponses, CfgTotpBackupCodesRegenerateCreateErrors, ThrowOnError, "fields">;
|
|
2548
|
-
/**
|
|
2549
|
-
* List all TOTP devices for user.
|
|
2550
|
-
*/
|
|
2551
|
-
static cfgTotpDevicesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpDevicesRetrieveData, ThrowOnError>): RequestResult<CfgTotpDevicesRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
2552
|
-
/**
|
|
2553
|
-
* Delete a TOTP device.
|
|
2554
|
-
*
|
|
2555
|
-
* Requires verification code if removing the last/primary device.
|
|
2556
|
-
*/
|
|
2557
|
-
static cfgTotpDevicesDestroy<ThrowOnError extends boolean = false>(options: Options<CfgTotpDevicesDestroyData, ThrowOnError>): RequestResult<CfgTotpDevicesDestroyResponses, unknown, ThrowOnError, "fields">;
|
|
2558
|
-
/**
|
|
2559
|
-
* Completely disable 2FA for account.
|
|
2560
|
-
*
|
|
2561
|
-
* Requires verification code.
|
|
2562
|
-
*/
|
|
2563
|
-
static cfgTotpDisableCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpDisableCreateData, ThrowOnError>): RequestResult<CfgTotpDisableCreateResponses, CfgTotpDisableCreateErrors, ThrowOnError, "fields">;
|
|
2564
|
-
/**
|
|
2565
|
-
* Start 2FA setup process.
|
|
2566
|
-
*
|
|
2567
|
-
* Creates a new TOTP device and returns QR code for scanning.
|
|
2568
|
-
*/
|
|
2569
|
-
static cfgTotpSetupCreate<ThrowOnError extends boolean = false>(options?: Options<CfgTotpSetupCreateData, ThrowOnError>): RequestResult<CfgTotpSetupCreateResponses, CfgTotpSetupCreateErrors, ThrowOnError, "fields">;
|
|
2570
|
-
/**
|
|
2571
|
-
* Confirm 2FA setup with first valid code.
|
|
2572
|
-
*
|
|
2573
|
-
* Activates the device and generates backup codes.
|
|
2574
|
-
*/
|
|
2575
|
-
static cfgTotpSetupConfirmCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpSetupConfirmCreateData, ThrowOnError>): RequestResult<CfgTotpSetupConfirmCreateResponses, CfgTotpSetupConfirmCreateErrors, ThrowOnError, "fields">;
|
|
2576
|
-
/**
|
|
2577
|
-
* Verify TOTP code for 2FA session.
|
|
2578
|
-
*
|
|
2579
|
-
* Completes authentication and returns JWT tokens on success.
|
|
2580
|
-
*/
|
|
2581
|
-
static cfgTotpVerifyCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyCreateResponses, CfgTotpVerifyCreateErrors, ThrowOnError, "fields">;
|
|
2582
|
-
/**
|
|
2583
|
-
* Verify backup recovery code for 2FA session.
|
|
2584
|
-
*
|
|
2585
|
-
* Alternative verification method when TOTP device unavailable.
|
|
2586
|
-
*/
|
|
2587
|
-
static cfgTotpVerifyBackupCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyBackupCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyBackupCreateResponses, CfgTotpVerifyBackupCreateErrors, ThrowOnError, "fields">;
|
|
2588
|
-
}
|
|
2589
|
-
declare class BackupCodes {
|
|
2590
|
-
/**
|
|
2591
|
-
* Get backup codes status for user.
|
|
2592
|
-
*/
|
|
2593
|
-
static cfgTotpBackupCodesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpBackupCodesRetrieveData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
2594
|
-
/**
|
|
2595
|
-
* Regenerate backup codes.
|
|
2596
|
-
*
|
|
2597
|
-
* Requires TOTP code for verification.
|
|
2598
|
-
* Invalidates all existing codes.
|
|
2599
|
-
*/
|
|
2600
|
-
static cfgTotpBackupCodesRegenerateCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpBackupCodesRegenerateCreateData, ThrowOnError>): RequestResult<CfgTotpBackupCodesRegenerateCreateResponses, CfgTotpBackupCodesRegenerateCreateErrors, ThrowOnError, "fields">;
|
|
2601
|
-
}
|
|
2602
|
-
declare class TotpManagement {
|
|
2603
|
-
/**
|
|
2604
|
-
* List all TOTP devices for user.
|
|
2605
|
-
*/
|
|
2606
|
-
static cfgTotpDevicesRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgTotpDevicesRetrieveData, ThrowOnError>): RequestResult<CfgTotpDevicesRetrieveResponses, unknown, ThrowOnError, "fields">;
|
|
2607
|
-
/**
|
|
2608
|
-
* Completely disable 2FA for account.
|
|
2609
|
-
*
|
|
2610
|
-
* Requires verification code.
|
|
2611
|
-
*/
|
|
2612
|
-
static cfgTotpDisableCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpDisableCreateData, ThrowOnError>): RequestResult<CfgTotpDisableCreateResponses, CfgTotpDisableCreateErrors, ThrowOnError, "fields">;
|
|
2613
|
-
}
|
|
2614
|
-
declare class TotpSetup {
|
|
2615
|
-
/**
|
|
2616
|
-
* Start 2FA setup process.
|
|
2617
|
-
*
|
|
2618
|
-
* Creates a new TOTP device and returns QR code for scanning.
|
|
2619
|
-
*/
|
|
2620
|
-
static cfgTotpSetupCreate<ThrowOnError extends boolean = false>(options?: Options<CfgTotpSetupCreateData, ThrowOnError>): RequestResult<CfgTotpSetupCreateResponses, CfgTotpSetupCreateErrors, ThrowOnError, "fields">;
|
|
2621
|
-
/**
|
|
2622
|
-
* Confirm 2FA setup with first valid code.
|
|
2623
|
-
*
|
|
2624
|
-
* Activates the device and generates backup codes.
|
|
2625
|
-
*/
|
|
2626
|
-
static cfgTotpSetupConfirmCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpSetupConfirmCreateData, ThrowOnError>): RequestResult<CfgTotpSetupConfirmCreateResponses, CfgTotpSetupConfirmCreateErrors, ThrowOnError, "fields">;
|
|
2627
|
-
}
|
|
2628
|
-
declare class TotpVerification {
|
|
2629
|
-
/**
|
|
2630
|
-
* Verify TOTP code for 2FA session.
|
|
2631
|
-
*
|
|
2632
|
-
* Completes authentication and returns JWT tokens on success.
|
|
2633
|
-
*/
|
|
2634
|
-
static cfgTotpVerifyCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyCreateResponses, CfgTotpVerifyCreateErrors, ThrowOnError, "fields">;
|
|
2635
|
-
/**
|
|
2636
|
-
* Verify backup recovery code for 2FA session.
|
|
2637
|
-
*
|
|
2638
|
-
* Alternative verification method when TOTP device unavailable.
|
|
2639
|
-
*/
|
|
2640
|
-
static cfgTotpVerifyBackupCreate<ThrowOnError extends boolean = false>(options: Options<CfgTotpVerifyBackupCreateData, ThrowOnError>): RequestResult<CfgTotpVerifyBackupCreateResponses, CfgTotpVerifyBackupCreateErrors, ThrowOnError, "fields">;
|
|
2641
|
-
}
|
|
2642
|
-
|
|
2643
126
|
interface APIOptions {
|
|
2644
|
-
/** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
|
|
2645
|
-
storage?: StorageAdapter;
|
|
2646
127
|
/** Logger config (defaults to dev-only). */
|
|
2647
128
|
logger?: Partial<LoggerConfig>;
|
|
2648
129
|
/** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
|
|
@@ -2653,28 +134,18 @@ interface APIOptions {
|
|
|
2653
134
|
withCredentials?: boolean;
|
|
2654
135
|
}
|
|
2655
136
|
/**
|
|
2656
|
-
*
|
|
137
|
+
* Per-group ergonomic facade.
|
|
138
|
+
*
|
|
139
|
+
* Calling `setToken/setApiKey/setLocale/setBaseUrl` proxies to the
|
|
140
|
+
* global `auth` store — the change applies to **every** group's API
|
|
141
|
+
* instance because they share the same HTTP client and interceptor.
|
|
2657
142
|
*
|
|
2658
|
-
*
|
|
2659
|
-
*
|
|
2660
|
-
* - `Authorization: Bearer <jwt>` from storage
|
|
2661
|
-
* - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
|
|
2662
|
-
* - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
|
|
2663
|
-
* - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
|
|
143
|
+
* Use the global `auth` object directly when you don't need a group
|
|
144
|
+
* facade: `import { auth } from '@your/api'; auth.setToken(jwt);`
|
|
2664
145
|
*/
|
|
2665
146
|
declare class API {
|
|
2666
|
-
private baseUrl;
|
|
2667
|
-
private storage;
|
|
2668
|
-
private locale;
|
|
2669
|
-
private apiKey;
|
|
2670
147
|
readonly logger: APILogger;
|
|
2671
|
-
|
|
2672
|
-
readonly totp: typeof Totp;
|
|
2673
|
-
readonly backupCodes: typeof BackupCodes;
|
|
2674
|
-
readonly totpManagement: typeof TotpManagement;
|
|
2675
|
-
readonly totpSetup: typeof TotpSetup;
|
|
2676
|
-
readonly totpVerification: typeof TotpVerification;
|
|
2677
|
-
constructor(baseUrl: string, opts?: APIOptions);
|
|
148
|
+
constructor(_baseUrl?: string, opts?: APIOptions);
|
|
2678
149
|
getBaseUrl(): string;
|
|
2679
150
|
setBaseUrl(url: string): void;
|
|
2680
151
|
getToken(): string | null;
|
|
@@ -2689,8 +160,8 @@ declare class API {
|
|
|
2689
160
|
setApiKey(key: string | null): void;
|
|
2690
161
|
}
|
|
2691
162
|
|
|
2692
|
-
declare const
|
|
2693
|
-
declare const
|
|
2694
|
-
declare const
|
|
163
|
+
declare const CfgAccountsApi: API$2;
|
|
164
|
+
declare const CfgCentrifugoApi: API$1;
|
|
165
|
+
declare const CfgTotpApi: API;
|
|
2695
166
|
|
|
2696
|
-
export { API$2 as AccountsAPI, API$1 as CentrifugoAPI, API as TotpAPI,
|
|
167
|
+
export { API$2 as AccountsAPI, API$1 as CentrifugoAPI, API as TotpAPI, CfgAccountsApi as apiAccounts, CfgCentrifugoApi as apiCentrifugo, CfgTotpApi as apiTotp };
|