@lumeweb/portal-sdk 0.0.2 → 0.1.1
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/LICENSE +1 -1
- package/dist/esm/account/generated/accountAPI.schemas.d.ts +646 -0
- package/dist/esm/account/generated/accountAPI.schemas.js +0 -0
- package/dist/esm/account/generated/billing.d.ts +688 -0
- package/dist/esm/account/generated/billing.js +444 -0
- package/dist/esm/account/generated/billing.js.map +1 -0
- package/dist/esm/account/generated/default.d.ts +944 -0
- package/dist/esm/account/generated/default.js +760 -0
- package/dist/esm/account/generated/default.js.map +1 -0
- package/dist/esm/account/generated/index.d.ts +3 -0
- package/dist/esm/account/generated/index.js +3 -0
- package/dist/esm/account/generated/quota.d.ts +35 -0
- package/dist/esm/account/generated/quota.js +28 -0
- package/dist/esm/account/generated/quota.js.map +1 -0
- package/dist/esm/account.d.ts +199 -0
- package/dist/esm/account.js +346 -0
- package/dist/esm/account.js.map +1 -0
- package/dist/esm/http-utils.d.ts +53 -0
- package/dist/esm/http-utils.js +83 -0
- package/dist/esm/http-utils.js.map +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/openapi.d.ts +3 -0
- package/dist/esm/openapi.js +3 -0
- package/dist/esm/query-utils.d.ts +64 -0
- package/dist/esm/query-utils.js +44 -0
- package/dist/esm/query-utils.js.map +1 -0
- package/dist/esm/sdk.d.ts +12 -0
- package/dist/esm/sdk.js +20 -0
- package/dist/esm/sdk.js.map +1 -0
- package/dist/esm/types.d.ts +58 -0
- package/dist/esm/types.js +109 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +37 -14
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { parseResponse, poll } from "./http-utils.js";
|
|
2
|
+
import { handleFetchError, handleUnknownError } from "./types.js";
|
|
3
|
+
import { buildOperationsQueryParams } from "./query-utils.js";
|
|
4
|
+
|
|
5
|
+
//#region src/account.ts
|
|
6
|
+
/**
|
|
7
|
+
* Operation status constants
|
|
8
|
+
*/
|
|
9
|
+
const OPERATION_STATUS = {
|
|
10
|
+
COMPLETED: "completed",
|
|
11
|
+
FAILED: "failed",
|
|
12
|
+
ERROR: "error",
|
|
13
|
+
PENDING: "pending",
|
|
14
|
+
RUNNING: "running"
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Default settled states for operations
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_SETTLED_STATES = [
|
|
20
|
+
OPERATION_STATUS.COMPLETED,
|
|
21
|
+
OPERATION_STATUS.FAILED,
|
|
22
|
+
OPERATION_STATUS.ERROR
|
|
23
|
+
];
|
|
24
|
+
var AccountApi = class {
|
|
25
|
+
_jwtToken;
|
|
26
|
+
apiUrl;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the current JWT token
|
|
29
|
+
* @returns {string|undefined} The current JWT token or undefined if not set
|
|
30
|
+
*/
|
|
31
|
+
get jwtToken() {
|
|
32
|
+
return this._jwtToken;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new AccountApi instance
|
|
36
|
+
* @param {string} apiUrl - The base API URL
|
|
37
|
+
*/
|
|
38
|
+
constructor(apiUrl) {
|
|
39
|
+
const apiUrlParsed = new URL(apiUrl);
|
|
40
|
+
apiUrlParsed.hostname = `account.${apiUrlParsed.hostname}`;
|
|
41
|
+
this.apiUrl = apiUrlParsed.toString();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Clears the current JWT token
|
|
45
|
+
*/
|
|
46
|
+
clearToken() {
|
|
47
|
+
this._jwtToken = void 0;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Confirm a password reset
|
|
51
|
+
* @param passwordResetVerifyRequest Password reset verification details
|
|
52
|
+
* @returns Result indicating success or failure
|
|
53
|
+
*/
|
|
54
|
+
async confirmPasswordReset(passwordResetVerifyRequest) {
|
|
55
|
+
return this.fetchJson("/api/account/password-reset/confirm", {
|
|
56
|
+
body: JSON.stringify(passwordResetVerifyRequest),
|
|
57
|
+
method: "POST"
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Disable OTP for two-factor authentication
|
|
62
|
+
* @param otpDisableRequest OTP disable request details
|
|
63
|
+
* @returns Result indicating success or failure
|
|
64
|
+
*/
|
|
65
|
+
async disableOtp(otpDisableRequest) {
|
|
66
|
+
return this.fetchJson("/api/auth/otp/disable", {
|
|
67
|
+
body: JSON.stringify(otpDisableRequest),
|
|
68
|
+
method: "POST"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Generate OTP for two-factor authentication
|
|
73
|
+
* @returns Result containing OTP response
|
|
74
|
+
*/
|
|
75
|
+
async generateOtp() {
|
|
76
|
+
return this.fetchJson("/api/auth/otp/generate", { method: "GET" });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get account information
|
|
80
|
+
* @returns Result containing account info
|
|
81
|
+
*/
|
|
82
|
+
async info() {
|
|
83
|
+
return this.fetchJson("/api/account", { method: "GET" });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Login to the account service
|
|
87
|
+
* @param loginRequest Login credentials
|
|
88
|
+
* @returns Result containing login response or error
|
|
89
|
+
*/
|
|
90
|
+
async login(loginRequest) {
|
|
91
|
+
const result = await this.fetchJson("/api/auth/login", {
|
|
92
|
+
body: JSON.stringify(loginRequest),
|
|
93
|
+
method: "POST"
|
|
94
|
+
});
|
|
95
|
+
if (result.success && result.data?.token) this.setToken(result.data.token);
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Logout from the account service
|
|
100
|
+
* @returns Result indicating success or failure
|
|
101
|
+
*/
|
|
102
|
+
async logout() {
|
|
103
|
+
const result = await this.fetchJson("/api/auth/logout", { method: "POST" });
|
|
104
|
+
if (result.success) this.clearToken();
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Check authentication status
|
|
109
|
+
* @returns Result containing ping response
|
|
110
|
+
*/
|
|
111
|
+
async ping() {
|
|
112
|
+
const result = await this.fetchJson("/api/auth/ping", { method: "POST" });
|
|
113
|
+
if (result.success && result.data?.token) this.setToken(result.data.token);
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Register a new account
|
|
118
|
+
* @param registerRequest Registration details
|
|
119
|
+
* @returns Result indicating success or failure
|
|
120
|
+
*/
|
|
121
|
+
async register(registerRequest) {
|
|
122
|
+
return this.fetchJson("/api/auth/register", {
|
|
123
|
+
body: JSON.stringify(registerRequest),
|
|
124
|
+
method: "POST"
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Request account deletion
|
|
129
|
+
* @returns Result indicating success or failure
|
|
130
|
+
*/
|
|
131
|
+
async requestAccountDeletion() {
|
|
132
|
+
return this.fetchJson("/api/account/delete", { method: "DELETE" });
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Request email verification to be resent
|
|
136
|
+
* @param resendRequest Email details for verification
|
|
137
|
+
* @returns Result indicating success or failure
|
|
138
|
+
*/
|
|
139
|
+
async requestEmailVerification(resendRequest) {
|
|
140
|
+
return this.fetchJson("/api/account/verify-email/resend", {
|
|
141
|
+
body: JSON.stringify(resendRequest),
|
|
142
|
+
method: "POST"
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Request a password reset
|
|
147
|
+
* @param passwordResetRequest Password reset request details
|
|
148
|
+
* @returns Result indicating success or failure
|
|
149
|
+
*/
|
|
150
|
+
async requestPasswordReset(passwordResetRequest) {
|
|
151
|
+
return this.fetchJson("/api/account/password-reset/request", {
|
|
152
|
+
body: JSON.stringify(passwordResetRequest),
|
|
153
|
+
method: "POST"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Sets the JWT token for authentication
|
|
158
|
+
* @param {string} token - The JWT token to set
|
|
159
|
+
*/
|
|
160
|
+
setToken(token) {
|
|
161
|
+
this._jwtToken = token;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Update account email address
|
|
165
|
+
* @param email New email address
|
|
166
|
+
* @param password Current password for verification
|
|
167
|
+
* @returns Result indicating success or failure
|
|
168
|
+
*/
|
|
169
|
+
async updateEmail(email, password) {
|
|
170
|
+
return this.fetchJson("/api/account/update-email", {
|
|
171
|
+
body: JSON.stringify({
|
|
172
|
+
email,
|
|
173
|
+
password
|
|
174
|
+
}),
|
|
175
|
+
method: "POST"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Update account password
|
|
180
|
+
* @param currentPassword Current password for verification
|
|
181
|
+
* @param newPassword New password to set
|
|
182
|
+
* @returns Result indicating success or failure
|
|
183
|
+
*/
|
|
184
|
+
async updatePassword(currentPassword, newPassword) {
|
|
185
|
+
return this.fetchJson("/api/account/update-password", {
|
|
186
|
+
body: JSON.stringify({
|
|
187
|
+
current_password: currentPassword,
|
|
188
|
+
new_password: newPassword
|
|
189
|
+
}),
|
|
190
|
+
method: "POST"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get upload limit information
|
|
195
|
+
* @returns Result containing upload limit info
|
|
196
|
+
*/
|
|
197
|
+
async uploadLimit() {
|
|
198
|
+
return this.fetchJson("/api/upload-limit", { method: "GET" });
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Validate OTP for two-factor authentication login
|
|
202
|
+
* @param otpValidateRequest OTP validation details
|
|
203
|
+
* @returns Result containing login response
|
|
204
|
+
*/
|
|
205
|
+
async validateOtp(otpValidateRequest) {
|
|
206
|
+
const result = await this.fetchJson("/api/auth/otp/validate", {
|
|
207
|
+
body: JSON.stringify(otpValidateRequest),
|
|
208
|
+
method: "POST"
|
|
209
|
+
});
|
|
210
|
+
if (result.success && result.data?.token) this.setToken(result.data.token);
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Verify email address
|
|
215
|
+
* @param verifyEmailRequest Email verification details
|
|
216
|
+
* @param login Optional flag to enable auto-login after verification
|
|
217
|
+
* @returns Result indicating success or failure
|
|
218
|
+
*/
|
|
219
|
+
async verifyEmail(verifyEmailRequest, login) {
|
|
220
|
+
const url = new URL("/api/account/verify-email", this.apiUrl);
|
|
221
|
+
if (login === true) url.searchParams.set("login", "true");
|
|
222
|
+
return this.fetchJson(url.toString(), {
|
|
223
|
+
body: JSON.stringify(verifyEmailRequest),
|
|
224
|
+
method: "POST"
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Verify OTP for enabling two-factor authentication
|
|
229
|
+
* @param otpVerifyRequest OTP verification details
|
|
230
|
+
* @returns Result indicating success or failure
|
|
231
|
+
*/
|
|
232
|
+
async verifyOtp(otpVerifyRequest) {
|
|
233
|
+
return this.fetchJson("/api/auth/otp/verify", {
|
|
234
|
+
body: JSON.stringify(otpVerifyRequest),
|
|
235
|
+
method: "POST"
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* List operations with filtering, searching, and pagination
|
|
240
|
+
*
|
|
241
|
+
* @param params Query parameters using query-builder helpers
|
|
242
|
+
* @returns Result containing list of operations
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const result = await accountApi.listOperations({
|
|
247
|
+
* filters: [
|
|
248
|
+
* { field: "status", operator: "eq", value: "completed" },
|
|
249
|
+
* { field: "operation", operator: "in", value: ["upload", "download"] }
|
|
250
|
+
* ],
|
|
251
|
+
* sorters: [{ field: "id", order: "desc" }],
|
|
252
|
+
* pagination: { start: 0, end: 20, page: 1, pageSize: 20 },
|
|
253
|
+
* search: "myfile"
|
|
254
|
+
* });
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
async listOperations(params) {
|
|
258
|
+
const url = new URL("/api/operations", this.apiUrl);
|
|
259
|
+
if (params) buildOperationsQueryParams(params).forEach((value, key) => {
|
|
260
|
+
url.searchParams.append(key, value);
|
|
261
|
+
});
|
|
262
|
+
return this.fetchJson(url.toString(), { method: "GET" });
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get detailed information for a specific operation
|
|
266
|
+
* @param id The operation ID
|
|
267
|
+
* @returns Result containing operation details
|
|
268
|
+
*/
|
|
269
|
+
async getOperation(id) {
|
|
270
|
+
return this.fetchJson(`/api/operations/${id}`, { method: "GET" });
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Get available filter values for operations
|
|
274
|
+
* @returns Result containing filter options
|
|
275
|
+
*/
|
|
276
|
+
async getOperationFilters() {
|
|
277
|
+
return this.fetchJson("/api/operations/filters", { method: "GET" });
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Wait for an operation to complete or reach a settled state
|
|
281
|
+
* @param id The operation ID to wait for
|
|
282
|
+
* @param options Polling options (interval, timeout, settledStates)
|
|
283
|
+
* @returns Result containing the final operation details
|
|
284
|
+
*/
|
|
285
|
+
async waitForOperation(id, options = {}) {
|
|
286
|
+
const { interval = 2e3, timeout = 3e5, settledStates = DEFAULT_SETTLED_STATES } = options;
|
|
287
|
+
const settledStatesSet = new Set(settledStates);
|
|
288
|
+
return poll(() => this.getOperation(id), (operation) => {
|
|
289
|
+
return !!(operation.status && settledStatesSet.has(operation.status.toLowerCase()));
|
|
290
|
+
}, {
|
|
291
|
+
interval,
|
|
292
|
+
timeout
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Builds fetch options with authorization headers
|
|
297
|
+
* @param {RequestInit} [init] - Optional initial request options
|
|
298
|
+
* @returns {RequestInit} The constructed request options
|
|
299
|
+
* @private
|
|
300
|
+
*/
|
|
301
|
+
buildOptions(init = {}) {
|
|
302
|
+
const headers = {
|
|
303
|
+
"Content-Type": "application/json",
|
|
304
|
+
...init.headers
|
|
305
|
+
};
|
|
306
|
+
if (this.jwtToken) headers.Authorization = `Bearer ${this.jwtToken}`;
|
|
307
|
+
return {
|
|
308
|
+
...init,
|
|
309
|
+
credentials: "include",
|
|
310
|
+
headers
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Makes a JSON request to the API
|
|
315
|
+
* @template T
|
|
316
|
+
* @param {string} input - The API endpoint path or absolute URL
|
|
317
|
+
* @param {RequestInit} [init] - Optional request initialization
|
|
318
|
+
* @returns {Promise<Result<T>>} Promise resolving to the result
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
async fetchJson(input, init = {}) {
|
|
322
|
+
try {
|
|
323
|
+
const response = await fetch(new URL(input, this.apiUrl).toString(), this.buildOptions(init));
|
|
324
|
+
if (!response.ok) return {
|
|
325
|
+
error: await handleFetchError(response),
|
|
326
|
+
success: false
|
|
327
|
+
};
|
|
328
|
+
return {
|
|
329
|
+
data: await parseResponse(response),
|
|
330
|
+
success: true
|
|
331
|
+
};
|
|
332
|
+
} catch (e) {
|
|
333
|
+
let error;
|
|
334
|
+
if (e instanceof Response) error = await handleFetchError(e);
|
|
335
|
+
else error = await handleUnknownError(e);
|
|
336
|
+
return {
|
|
337
|
+
error,
|
|
338
|
+
success: false
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
//#endregion
|
|
345
|
+
export { AccountApi, DEFAULT_SETTLED_STATES, OPERATION_STATUS };
|
|
346
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","names":[],"sources":["../../src/account.ts"],"sourcesContent":["import type { RequestInit } from \"@/types\";\nimport {\n AccountError,\n handleFetchError,\n handleUnknownError,\n OperationPollingOptions,\n Result,\n} from \"@/types\";\n\nimport {\n AccountInfoResponse,\n GetApiOperationsParams,\n LoginRequest,\n LoginResponse,\n OperationDetailResponse,\n OperationFiltersResponseResponse,\n OperationListItemResponse,\n OTPDisableRequest,\n OTPGenerateResponse,\n OTPValidateRequest,\n OTPVerifyRequest,\n PasswordResetRequest,\n PasswordResetVerifyRequest,\n PongResponse,\n RegisterRequest,\n ResendVerifyEmailRequest,\n UploadLimitResponse,\n VerifyEmailRequest,\n} from \"@/account/generated\";\nimport type {\n OperationsListParams,\n} from \"@/query-utils\";\nimport { buildOperationsQueryParams } from \"@/query-utils\";\nimport { delay, parseResponse, poll } from \"@/http-utils\";\n\n/**\n * Operation status constants\n */\nconst OPERATION_STATUS = {\n COMPLETED: \"completed\",\n FAILED: \"failed\",\n ERROR: \"error\",\n PENDING: \"pending\",\n RUNNING: \"running\",\n} as const;\n\n/**\n * Default settled states for operations\n */\nconst DEFAULT_SETTLED_STATES = [\n OPERATION_STATUS.COMPLETED,\n OPERATION_STATUS.FAILED,\n OPERATION_STATUS.ERROR,\n] as const;\n\ntype SettledState = typeof DEFAULT_SETTLED_STATES[number];\n\nexport { DEFAULT_SETTLED_STATES, OPERATION_STATUS, type SettledState };\n\nexport class AccountApi {\n private _jwtToken?: string;\n private readonly apiUrl: string;\n\n /**\n * Gets the current JWT token\n * @returns {string|undefined} The current JWT token or undefined if not set\n */\n private get jwtToken(): string | undefined {\n return this._jwtToken;\n }\n\n /**\n * Creates a new AccountApi instance\n * @param {string} apiUrl - The base API URL\n */\n constructor(apiUrl: string) {\n const apiUrlParsed = new URL(apiUrl);\n apiUrlParsed.hostname = `account.${apiUrlParsed.hostname}`;\n this.apiUrl = apiUrlParsed.toString();\n }\n\n /**\n * Clears the current JWT token\n */\n public clearToken(): void {\n this._jwtToken = undefined;\n }\n\n /**\n * Confirm a password reset\n * @param passwordResetVerifyRequest Password reset verification details\n * @returns Result indicating success or failure\n */\n public async confirmPasswordReset(\n passwordResetVerifyRequest: PasswordResetVerifyRequest,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/account/password-reset/confirm\", {\n body: JSON.stringify(passwordResetVerifyRequest),\n method: \"POST\",\n });\n }\n\n /**\n * Disable OTP for two-factor authentication\n * @param otpDisableRequest OTP disable request details\n * @returns Result indicating success or failure\n */\n public async disableOtp(\n otpDisableRequest: OTPDisableRequest,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/auth/otp/disable\", {\n body: JSON.stringify(otpDisableRequest),\n method: \"POST\",\n });\n }\n\n /**\n * Generate OTP for two-factor authentication\n * @returns Result containing OTP response\n */\n public async generateOtp(): Promise<Result<OTPGenerateResponse>> {\n return this.fetchJson<OTPGenerateResponse>(\"/api/auth/otp/generate\", {\n method: \"GET\",\n });\n }\n\n /**\n * Get account information\n * @returns Result containing account info\n */\n public async info(): Promise<Result<AccountInfoResponse>> {\n return this.fetchJson<AccountInfoResponse>(\"/api/account\", {\n method: \"GET\",\n });\n }\n\n /**\n * Login to the account service\n * @param loginRequest Login credentials\n * @returns Result containing login response or error\n */\n public async login(\n loginRequest: LoginRequest,\n ): Promise<Result<LoginResponse>> {\n const result = await this.fetchJson<LoginResponse>(\"/api/auth/login\", {\n body: JSON.stringify(loginRequest),\n method: \"POST\",\n });\n\n if (result.success && result.data?.token) {\n this.setToken(result.data.token);\n }\n\n return result;\n }\n\n /**\n * Logout from the account service\n * @returns Result indicating success or failure\n */\n public async logout(): Promise<Result<void>> {\n const result = await this.fetchJson<void>(\"/api/auth/logout\", {\n method: \"POST\",\n });\n\n if (result.success) {\n this.clearToken();\n }\n\n return result;\n }\n\n /**\n * Check authentication status\n * @returns Result containing ping response\n */\n public async ping(): Promise<Result<PongResponse>> {\n const result = await this.fetchJson<PongResponse>(\"/api/auth/ping\", {\n method: \"POST\",\n });\n\n if (result.success && result.data?.token) {\n this.setToken(result.data.token);\n }\n\n return result;\n }\n\n /**\n * Register a new account\n * @param registerRequest Registration details\n * @returns Result indicating success or failure\n */\n public async register(\n registerRequest: RegisterRequest,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/auth/register\", {\n body: JSON.stringify(registerRequest),\n method: \"POST\",\n });\n }\n\n /**\n * Request account deletion\n * @returns Result indicating success or failure\n */\n public async requestAccountDeletion(): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/account/delete\", {\n method: \"DELETE\",\n });\n }\n\n /**\n * Request email verification to be resent\n * @param resendRequest Email details for verification\n * @returns Result indicating success or failure\n */\n public async requestEmailVerification(\n resendRequest: ResendVerifyEmailRequest,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/account/verify-email/resend\", {\n body: JSON.stringify(resendRequest),\n method: \"POST\",\n });\n }\n\n /**\n * Request a password reset\n * @param passwordResetRequest Password reset request details\n * @returns Result indicating success or failure\n */\n public async requestPasswordReset(\n passwordResetRequest: PasswordResetRequest,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/account/password-reset/request\", {\n body: JSON.stringify(passwordResetRequest),\n method: \"POST\",\n });\n }\n\n /**\n * Sets the JWT token for authentication\n * @param {string} token - The JWT token to set\n */\n public setToken(token: string): void {\n this._jwtToken = token;\n }\n\n /**\n * Update account email address\n * @param email New email address\n * @param password Current password for verification\n * @returns Result indicating success or failure\n */\n public async updateEmail(\n email: string,\n password: string,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/account/update-email\", {\n body: JSON.stringify({ email, password }),\n method: \"POST\",\n });\n }\n\n /**\n * Update account password\n * @param currentPassword Current password for verification\n * @param newPassword New password to set\n * @returns Result indicating success or failure\n */\n public async updatePassword(\n currentPassword: string,\n newPassword: string,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/account/update-password\", {\n body: JSON.stringify({\n current_password: currentPassword,\n new_password: newPassword,\n }),\n method: \"POST\",\n });\n }\n\n /**\n * Get upload limit information\n * @returns Result containing upload limit info\n */\n public async uploadLimit(): Promise<Result<UploadLimitResponse>> {\n return this.fetchJson<UploadLimitResponse>(\"/api/upload-limit\", {\n method: \"GET\",\n });\n }\n\n /**\n * Validate OTP for two-factor authentication login\n * @param otpValidateRequest OTP validation details\n * @returns Result containing login response\n */\n public async validateOtp(\n otpValidateRequest: OTPValidateRequest,\n ): Promise<Result<LoginResponse>> {\n const result = await this.fetchJson<LoginResponse>(\n \"/api/auth/otp/validate\",\n {\n body: JSON.stringify(otpValidateRequest),\n method: \"POST\",\n },\n );\n\n if (result.success && result.data?.token) {\n this.setToken(result.data.token);\n }\n\n return result;\n }\n\n /**\n * Verify email address\n * @param verifyEmailRequest Email verification details\n * @param login Optional flag to enable auto-login after verification\n * @returns Result indicating success or failure\n */\n public async verifyEmail(\n verifyEmailRequest: VerifyEmailRequest,\n login?: boolean,\n ): Promise<Result<void>> {\n const url = new URL(\"/api/account/verify-email\", this.apiUrl);\n if (login === true) {\n url.searchParams.set(\"login\", \"true\");\n }\n return this.fetchJson<void>(url.toString(), {\n body: JSON.stringify(verifyEmailRequest),\n method: \"POST\",\n });\n }\n\n /**\n * Verify OTP for enabling two-factor authentication\n * @param otpVerifyRequest OTP verification details\n * @returns Result indicating success or failure\n */\n public async verifyOtp(\n otpVerifyRequest: OTPVerifyRequest,\n ): Promise<Result<void>> {\n return this.fetchJson<void>(\"/api/auth/otp/verify\", {\n body: JSON.stringify(otpVerifyRequest),\n method: \"POST\",\n });\n }\n\n /**\n * List operations with filtering, searching, and pagination\n * \n * @param params Query parameters using query-builder helpers\n * @returns Result containing list of operations\n * \n * @example\n * ```ts\n * const result = await accountApi.listOperations({\n * filters: [\n * { field: \"status\", operator: \"eq\", value: \"completed\" },\n * { field: \"operation\", operator: \"in\", value: [\"upload\", \"download\"] }\n * ],\n * sorters: [{ field: \"id\", order: \"desc\" }],\n * pagination: { start: 0, end: 20, page: 1, pageSize: 20 },\n * search: \"myfile\"\n * });\n * ```\n */\n public async listOperations(\n params?: OperationsListParams,\n ): Promise<Result<OperationListItemResponse>> {\n const url = new URL(\"/api/operations\", this.apiUrl);\n \n if (params) {\n const searchParams = buildOperationsQueryParams(params);\n searchParams.forEach((value, key) => {\n url.searchParams.append(key, value);\n });\n }\n \n return this.fetchJson<OperationListItemResponse>(url.toString(), {\n method: \"GET\",\n });\n }\n\n /**\n * Get detailed information for a specific operation\n * @param id The operation ID\n * @returns Result containing operation details\n */\n public async getOperation(\n id: number,\n ): Promise<Result<OperationDetailResponse>> {\n return this.fetchJson<OperationDetailResponse>(`/api/operations/${id}`, {\n method: \"GET\",\n });\n }\n\n /**\n * Get available filter values for operations\n * @returns Result containing filter options\n */\n public async getOperationFilters(): Promise<Result<OperationFiltersResponseResponse>> {\n return this.fetchJson<OperationFiltersResponseResponse>(\"/api/operations/filters\", {\n method: \"GET\",\n });\n }\n\n /**\n * Wait for an operation to complete or reach a settled state\n * @param id The operation ID to wait for\n * @param options Polling options (interval, timeout, settledStates)\n * @returns Result containing the final operation details\n */\n public async waitForOperation(\n id: number,\n options: OperationPollingOptions = {},\n ): Promise<Result<OperationDetailResponse>> {\n const {\n interval = 2000,\n timeout = 300000,\n settledStates = DEFAULT_SETTLED_STATES,\n } = options;\n\n const settledStatesSet = new Set(settledStates);\n\n return poll(\n () => this.getOperation(id),\n (operation) => {\n return !!(operation.status && settledStatesSet.has(operation.status.toLowerCase()));\n },\n { interval, timeout },\n );\n }\n\n /**\n * Builds fetch options with authorization headers\n * @param {RequestInit} [init] - Optional initial request options\n * @returns {RequestInit} The constructed request options\n * @private\n */\n private buildOptions(init: RequestInit = {}): RequestInit {\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...init.headers!,\n };\n\n if (this.jwtToken) {\n headers.Authorization = `Bearer ${this.jwtToken}`;\n }\n\n return {\n ...init,\n credentials: \"include\",\n headers,\n };\n }\n\n /**\n * Makes a JSON request to the API\n * @template T\n * @param {string} input - The API endpoint path or absolute URL\n * @param {RequestInit} [init] - Optional request initialization\n * @returns {Promise<Result<T>>} Promise resolving to the result\n * @private\n */\n private async fetchJson<T>(\n input: string,\n init: RequestInit = {},\n ): Promise<Result<T>> {\n try {\n const response = await fetch(\n new URL(input, this.apiUrl).toString(),\n this.buildOptions(init),\n );\n\n if (!response.ok) {\n return {\n error: await handleFetchError(response),\n success: false,\n };\n }\n\n const data = await parseResponse<T>(response);\n return {\n data,\n success: true,\n };\n } catch (e) {\n let error: AccountError;\n if (e instanceof Response) {\n error = await handleFetchError(e);\n } else {\n error = await handleUnknownError(e);\n }\n return {\n error,\n success: false,\n };\n }\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RequestInit, Result } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/http-utils.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a promise that resolves after a specified delay
|
|
6
|
+
* @param ms Delay in milliseconds
|
|
7
|
+
* @returns Promise that resolves after the delay
|
|
8
|
+
*/
|
|
9
|
+
declare function delay(ms: number): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Options for polling a condition
|
|
12
|
+
*/
|
|
13
|
+
interface PollOptions<T> {
|
|
14
|
+
/** Polling interval in milliseconds (default: 2000) */
|
|
15
|
+
interval?: number;
|
|
16
|
+
/** Maximum time to wait in milliseconds (default: 300000 = 5 minutes) */
|
|
17
|
+
timeout?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Polls a fetch function until a condition is met or timeout occurs
|
|
21
|
+
* @template T The type of data returned by the fetch function
|
|
22
|
+
* @param fetchFn Function that fetches the current state
|
|
23
|
+
* @param shouldStop Predicate function that determines when to stop polling
|
|
24
|
+
* @param options Polling options (interval, timeout)
|
|
25
|
+
* @returns Promise resolving to the final fetch result
|
|
26
|
+
*/
|
|
27
|
+
declare function poll<T>(fetchFn: () => Promise<Result<T>>, shouldStop: (value: T) => boolean, options?: PollOptions<T>): Promise<Result<T>>;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a response has an empty body based on status code or content-length header
|
|
30
|
+
* @param {Response} response - The response to check
|
|
31
|
+
* @returns {boolean} True if the response is empty, false otherwise
|
|
32
|
+
*/
|
|
33
|
+
declare function isEmptyResponse(response: Response): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Safely parses a response body, handling empty responses
|
|
36
|
+
* @param {Response} response - The response to parse
|
|
37
|
+
* @returns {Promise<T>} The parsed data or undefined for empty responses
|
|
38
|
+
*/
|
|
39
|
+
declare function parseResponse<T>(response: Response): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Standardized fetch wrapper with consistent error handling
|
|
42
|
+
* @param {string} url - The URL to fetch
|
|
43
|
+
* @param {RequestInit} init - Fetch options
|
|
44
|
+
* @returns {Promise<{ data: T; status: number; headers: Headers }>}
|
|
45
|
+
*/
|
|
46
|
+
declare function fetchWithHandling<T>(url: string, init?: RequestInit): Promise<{
|
|
47
|
+
data: T;
|
|
48
|
+
status: number;
|
|
49
|
+
headers: Headers;
|
|
50
|
+
}>;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { PollOptions, delay, fetchWithHandling, isEmptyResponse, parseResponse, poll };
|
|
53
|
+
//# sourceMappingURL=http-utils.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AccountError } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/http-utils.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a promise that resolves after a specified delay
|
|
6
|
+
* @param ms Delay in milliseconds
|
|
7
|
+
* @returns Promise that resolves after the delay
|
|
8
|
+
*/
|
|
9
|
+
function delay(ms) {
|
|
10
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Polls a fetch function until a condition is met or timeout occurs
|
|
14
|
+
* @template T The type of data returned by the fetch function
|
|
15
|
+
* @param fetchFn Function that fetches the current state
|
|
16
|
+
* @param shouldStop Predicate function that determines when to stop polling
|
|
17
|
+
* @param options Polling options (interval, timeout)
|
|
18
|
+
* @returns Promise resolving to the final fetch result
|
|
19
|
+
*/
|
|
20
|
+
async function poll(fetchFn, shouldStop, options = {}) {
|
|
21
|
+
const { interval = 2e3, timeout = 3e5 } = options;
|
|
22
|
+
const startTime = Date.now();
|
|
23
|
+
const timeoutMs = timeout;
|
|
24
|
+
const pollInternal = async () => {
|
|
25
|
+
if (Date.now() - startTime >= timeoutMs) return {
|
|
26
|
+
error: new AccountError(`Polling timed out after ${timeout}ms`, 408),
|
|
27
|
+
success: false
|
|
28
|
+
};
|
|
29
|
+
const result = await fetchFn();
|
|
30
|
+
if (!result.success) return result;
|
|
31
|
+
if (result.data && shouldStop(result.data)) return result;
|
|
32
|
+
const remainingTime = timeoutMs - (Date.now() - startTime);
|
|
33
|
+
await delay(Math.min(interval, remainingTime));
|
|
34
|
+
return pollInternal();
|
|
35
|
+
};
|
|
36
|
+
return pollInternal();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Checks if a response has an empty body based on status code or content-length header
|
|
40
|
+
* @param {Response} response - The response to check
|
|
41
|
+
* @returns {boolean} True if the response is empty, false otherwise
|
|
42
|
+
*/
|
|
43
|
+
function isEmptyResponse(response) {
|
|
44
|
+
if ([
|
|
45
|
+
204,
|
|
46
|
+
205,
|
|
47
|
+
304
|
|
48
|
+
].includes(response.status)) return true;
|
|
49
|
+
const contentLength = response.headers.get("content-length");
|
|
50
|
+
return !!(contentLength === "0" || contentLength && parseInt(contentLength, 10) === 0);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Safely parses a response body, handling empty responses
|
|
54
|
+
* @param {Response} response - The response to parse
|
|
55
|
+
* @returns {Promise<T>} The parsed data or undefined for empty responses
|
|
56
|
+
*/
|
|
57
|
+
async function parseResponse(response) {
|
|
58
|
+
if (isEmptyResponse(response)) return;
|
|
59
|
+
try {
|
|
60
|
+
return await response.json();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (isEmptyResponse(response)) return;
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Standardized fetch wrapper with consistent error handling
|
|
68
|
+
* @param {string} url - The URL to fetch
|
|
69
|
+
* @param {RequestInit} init - Fetch options
|
|
70
|
+
* @returns {Promise<{ data: T; status: number; headers: Headers }>}
|
|
71
|
+
*/
|
|
72
|
+
async function fetchWithHandling(url, init = {}) {
|
|
73
|
+
const response = await fetch(url, init);
|
|
74
|
+
return {
|
|
75
|
+
data: await parseResponse(response),
|
|
76
|
+
status: response.status,
|
|
77
|
+
headers: response.headers
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { delay, fetchWithHandling, isEmptyResponse, parseResponse, poll };
|
|
83
|
+
//# sourceMappingURL=http-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-utils.js","names":[],"sources":["../../src/http-utils.ts"],"sourcesContent":["import type { RequestInit, Result } from \"@/types\";\nimport { AccountError } from \"@/types\";\n\n/**\n * Creates a promise that resolves after a specified delay\n * @param ms Delay in milliseconds\n * @returns Promise that resolves after the delay\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Options for polling a condition\n */\nexport interface PollOptions<T> {\n /** Polling interval in milliseconds (default: 2000) */\n interval?: number;\n /** Maximum time to wait in milliseconds (default: 300000 = 5 minutes) */\n timeout?: number;\n}\n\n/**\n * Polls a fetch function until a condition is met or timeout occurs\n * @template T The type of data returned by the fetch function\n * @param fetchFn Function that fetches the current state\n * @param shouldStop Predicate function that determines when to stop polling\n * @param options Polling options (interval, timeout)\n * @returns Promise resolving to the final fetch result\n */\nexport async function poll<T>(\n fetchFn: () => Promise<Result<T>>,\n shouldStop: (value: T) => boolean,\n options: PollOptions<T> = {},\n): Promise<Result<T>> {\n const { interval = 2000, timeout = 300000 } = options;\n const startTime = Date.now();\n const timeoutMs = timeout;\n\n const pollInternal = async (): Promise<Result<T>> => {\n const elapsed = Date.now() - startTime;\n \n if (elapsed >= timeoutMs) {\n return {\n error: new AccountError(`Polling timed out after ${timeout}ms`, 408),\n success: false,\n };\n }\n\n const result = await fetchFn();\n\n if (!result.success) {\n return result;\n }\n\n if (result.data && shouldStop(result.data)) {\n return result;\n }\n\n // Recalculate elapsed time after fetchFn completes to account for network latency\n const currentElapsed = Date.now() - startTime;\n const remainingTime = timeoutMs - currentElapsed;\n const nextInterval = Math.min(interval, remainingTime);\n await delay(nextInterval);\n return pollInternal();\n };\n\n return pollInternal();\n}\n\n/**\n * Checks if a response has an empty body based on status code or content-length header\n * @param {Response} response - The response to check\n * @returns {boolean} True if the response is empty, false otherwise\n */\nexport function isEmptyResponse(response: Response): boolean {\n const emptyStatusCodes = [204, 205, 304];\n if (emptyStatusCodes.includes(response.status)) {\n return true;\n }\n\n const contentLength = response.headers.get(\"content-length\");\n return !!(\n contentLength === \"0\" ||\n (contentLength && parseInt(contentLength, 10) === 0)\n );\n}\n\n/**\n * Safely parses a response body, handling empty responses\n * @param {Response} response - The response to parse\n * @returns {Promise<T>} The parsed data or undefined for empty responses\n */\nexport async function parseResponse<T>(response: Response): Promise<T> {\n if (isEmptyResponse(response)) {\n return undefined as unknown as T;\n }\n\n try {\n return await response.json();\n } catch (error) {\n if (isEmptyResponse(response)) {\n return undefined as unknown as T;\n }\n throw error;\n }\n}\n\n/**\n * Standardized fetch wrapper with consistent error handling\n * @param {string} url - The URL to fetch\n * @param {RequestInit} init - Fetch options\n * @returns {Promise<{ data: T; status: number; headers: Headers }>}\n */\nexport async function fetchWithHandling<T>(\n url: string,\n init: RequestInit = {},\n): Promise<{ data: T; status: number; headers: Headers }> {\n const response = await fetch(url, init);\n const data = await parseResponse<T>(response);\n return { data, status: response.status, headers: response.headers };\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,MAAM,IAA2B;AAC/C,QAAO,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;;AAqB1D,eAAsB,KACpB,SACA,YACA,UAA0B,EAAE,EACR;CACpB,MAAM,EAAE,WAAW,KAAM,UAAU,QAAW;CAC9C,MAAM,YAAY,KAAK,KAAK;CAC5B,MAAM,YAAY;CAElB,MAAM,eAAe,YAAgC;AAGnD,MAFgB,KAAK,KAAK,GAAG,aAEd,UACb,QAAO;GACL,OAAO,IAAI,aAAa,2BAA2B,QAAQ,KAAK,IAAI;GACpE,SAAS;GACV;EAGH,MAAM,SAAS,MAAM,SAAS;AAE9B,MAAI,CAAC,OAAO,QACV,QAAO;AAGT,MAAI,OAAO,QAAQ,WAAW,OAAO,KAAK,CACxC,QAAO;EAKT,MAAM,gBAAgB,aADC,KAAK,KAAK,GAAG;AAGpC,QAAM,MADe,KAAK,IAAI,UAAU,cAChB,CAAC;AACzB,SAAO,cAAc;;AAGvB,QAAO,cAAc;;;;;;;AAQvB,SAAgB,gBAAgB,UAA6B;AAE3D,KAAI;EADsB;EAAK;EAAK;EAChB,CAAC,SAAS,SAAS,OAAO,CAC5C,QAAO;CAGT,MAAM,gBAAgB,SAAS,QAAQ,IAAI,iBAAiB;AAC5D,QAAO,CAAC,EACN,kBAAkB,OACjB,iBAAiB,SAAS,eAAe,GAAG,KAAK;;;;;;;AAStD,eAAsB,cAAiB,UAAgC;AACrE,KAAI,gBAAgB,SAAS,CAC3B;AAGF,KAAI;AACF,SAAO,MAAM,SAAS,MAAM;UACrB,OAAO;AACd,MAAI,gBAAgB,SAAS,CAC3B;AAEF,QAAM;;;;;;;;;AAUV,eAAsB,kBACpB,KACA,OAAoB,EAAE,EACkC;CACxD,MAAM,WAAW,MAAM,MAAM,KAAK,KAAK;AAEvC,QAAO;EAAE,YADU,cAAiB,SAAS;EAC9B,QAAQ,SAAS;EAAQ,SAAS,SAAS;EAAS"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PollOptions, delay, fetchWithHandling, isEmptyResponse, parseResponse, poll } from "./http-utils.js";
|
|
2
|
+
import { AccountError, OperationPollingOptions, RequestInit, Result, handleFetchError, handleUnknownError } from "./types.js";
|
|
3
|
+
import { APIEndpointInfoResponse, APIKeyCreateRequest, APIKeyListResponse, APIKeyResponse, AccessModel, AccessModelDef, AccessPolicy, AccountInfoResponse, AccountPermissionsResponse, BalanceResponse, BinaryUUID, ChangePlanRequest, CheckoutSessionStatusResponse, CheckoutUIFragment, CheckoutUIFragmentMetadata, CheckoutUIResponse, CheckoutUIResponseMetadata, CreateAPIKeyResponse, Decimal, Error, ErrorResponse, GatewayAbilities, GatewayListResponse, GatewayPublicInfo, GetApiAccountBillingCheckoutSessionSessionIdStatusParams, GetApiAccountBillingCheckoutUiPlanIdParams, GetApiAccountKeysParams, GetApiAccountQuotaHistoryParams, GetApiOperationsParams, LoginRequest, LoginResponse, ManagementCapabilitiesResponse, ManagementCapabilitiesResponseAdminOperations, ManagementCapabilitiesResponseOperations, ManagementRequest, ManagementResultResponse, OTPDisableRequest, OTPGenerateResponse, OTPValidateRequest, OTPVerifyRequest, OperationDetailResponse, OperationFilterItem, OperationFiltersResponse, OperationFiltersResponseData, OperationFiltersResponseResponse, OperationListItem, OperationListItemResponse, PasswordResetRequest, PasswordResetVerifyRequest, PongResponse, PostApiAccountAvatarBody, PostApiAccountBillingWebhooksGatewayTypeBody, PostApiAccountVerifyEmailParams, PublicPricingPlanPeriodDTO, PublicPricingPlanResponse, PublicPricingPlansListResponse, QuotaHistoryResponse, QuotaStatusResponse, QuotaTypeStatus, RegisterRequest, ResendVerifyEmailRequest, StringUUIDSchema, SubscriptionStatusResponse, UpdateEmailRequest, UpdatePasswordRequest, UpdateProfileRequest, UploadLimitResponse, UsagePoint, UserCreditItem, UserCreditsListResponse, Uuid, VerifyEmailRequest, WindowInfo } from "./account/generated/accountAPI.schemas.js";
|
|
4
|
+
import { deleteApiAccount, deleteApiAccountKeysKeyID, deleteApiAccountKeysKeyIDResponse, deleteApiAccountKeysKeyIDResponse200, deleteApiAccountKeysKeyIDResponse400, deleteApiAccountKeysKeyIDResponse404, deleteApiAccountKeysKeyIDResponse500, deleteApiAccountKeysKeyIDResponseError, deleteApiAccountKeysKeyIDResponseSuccess, deleteApiAccountResponse, deleteApiAccountResponse200, deleteApiAccountResponse400, deleteApiAccountResponse404, deleteApiAccountResponse500, deleteApiAccountResponseError, deleteApiAccountResponseSuccess, getApiAccount, getApiAccountAvatar, getApiAccountAvatarResponse, getApiAccountAvatarResponse200, getApiAccountAvatarResponse400, getApiAccountAvatarResponse404, getApiAccountAvatarResponse500, getApiAccountAvatarResponseError, getApiAccountAvatarResponseSuccess, getApiAccountKeys, getApiAccountKeysResponse, getApiAccountKeysResponse200, getApiAccountKeysResponse400, getApiAccountKeysResponse404, getApiAccountKeysResponse500, getApiAccountKeysResponseError, getApiAccountKeysResponseSuccess, getApiAccountPermissions, getApiAccountPermissionsResponse, getApiAccountPermissionsResponse200, getApiAccountPermissionsResponse400, getApiAccountPermissionsResponse404, getApiAccountPermissionsResponse500, getApiAccountPermissionsResponseError, getApiAccountPermissionsResponseSuccess, getApiAccountQuotaHistory, getApiAccountQuotaHistoryResponse, getApiAccountQuotaHistoryResponse200, getApiAccountQuotaHistoryResponse400, getApiAccountQuotaHistoryResponse404, getApiAccountQuotaHistoryResponse500, getApiAccountQuotaHistoryResponseError, getApiAccountQuotaHistoryResponseSuccess, getApiAccountResponse, getApiAccountResponse200, getApiAccountResponse400, getApiAccountResponse401, getApiAccountResponse403, getApiAccountResponse404, getApiAccountResponse500, getApiAccountResponseError, getApiAccountResponseSuccess, getApiOperations, getApiOperationsFilters, getApiOperationsFiltersResponse, getApiOperationsFiltersResponse200, getApiOperationsFiltersResponse400, getApiOperationsFiltersResponse404, getApiOperationsFiltersResponse500, getApiOperationsFiltersResponseError, getApiOperationsFiltersResponseSuccess, getApiOperationsId, getApiOperationsIdResponse, getApiOperationsIdResponse200, getApiOperationsIdResponse400, getApiOperationsIdResponse404, getApiOperationsIdResponse500, getApiOperationsIdResponseError, getApiOperationsIdResponseSuccess, getApiOperationsResponse, getApiOperationsResponse200, getApiOperationsResponse400, getApiOperationsResponse404, getApiOperationsResponse500, getApiOperationsResponseError, getApiOperationsResponseSuccess, getApiUploadLimit, getApiUploadLimitResponse, getApiUploadLimitResponse200, getApiUploadLimitResponse400, getApiUploadLimitResponse404, getApiUploadLimitResponse500, getApiUploadLimitResponseError, getApiUploadLimitResponseSuccess, getDeleteApiAccountKeysKeyIDUrl, getDeleteApiAccountUrl, getGetApiAccountAvatarUrl, getGetApiAccountKeysUrl, getGetApiAccountPermissionsUrl, getGetApiAccountQuotaHistoryUrl, getGetApiAccountUrl, getGetApiOperationsFiltersUrl, getGetApiOperationsIdUrl, getGetApiOperationsUrl, getGetApiUploadLimitUrl, getPatchApiAccountUrl, getPostApiAccountAvatarUrl, getPostApiAccountKeysUrl, getPostApiAccountPasswordResetConfirmUrl, getPostApiAccountPasswordResetRequestUrl, getPostApiAccountUpdateEmailUrl, getPostApiAccountUpdatePasswordUrl, getPostApiAccountVerifyEmailResendUrl, getPostApiAccountVerifyEmailUrl, getPostApiAuthKeyUrl, getPostApiAuthLoginUrl, getPostApiAuthLogoutUrl, getPostApiAuthOtpDisableUrl, getPostApiAuthOtpGenerateUrl, getPostApiAuthOtpValidateUrl, getPostApiAuthOtpVerifyUrl, getPostApiAuthPingUrl, getPostApiAuthRegisterUrl, patchApiAccount, patchApiAccountResponse, patchApiAccountResponse200, patchApiAccountResponse400, patchApiAccountResponse401, patchApiAccountResponse403, patchApiAccountResponse404, patchApiAccountResponse500, patchApiAccountResponseError, patchApiAccountResponseSuccess, postApiAccountAvatar, postApiAccountAvatarResponse, postApiAccountAvatarResponse200, postApiAccountAvatarResponse204, postApiAccountAvatarResponse400, postApiAccountAvatarResponse404, postApiAccountAvatarResponse500, postApiAccountAvatarResponseError, postApiAccountAvatarResponseSuccess, postApiAccountKeys, postApiAccountKeysResponse, postApiAccountKeysResponse200, postApiAccountKeysResponse400, postApiAccountKeysResponse404, postApiAccountKeysResponse500, postApiAccountKeysResponseError, postApiAccountKeysResponseSuccess, postApiAccountPasswordResetConfirm, postApiAccountPasswordResetConfirmResponse, postApiAccountPasswordResetConfirmResponse200, postApiAccountPasswordResetConfirmResponse400, postApiAccountPasswordResetConfirmResponse404, postApiAccountPasswordResetConfirmResponse500, postApiAccountPasswordResetConfirmResponseError, postApiAccountPasswordResetConfirmResponseSuccess, postApiAccountPasswordResetRequest, postApiAccountPasswordResetRequestResponse, postApiAccountPasswordResetRequestResponse200, postApiAccountPasswordResetRequestResponse400, postApiAccountPasswordResetRequestResponse401, postApiAccountPasswordResetRequestResponse403, postApiAccountPasswordResetRequestResponse404, postApiAccountPasswordResetRequestResponse500, postApiAccountPasswordResetRequestResponseError, postApiAccountPasswordResetRequestResponseSuccess, postApiAccountUpdateEmail, postApiAccountUpdateEmailResponse, postApiAccountUpdateEmailResponse200, postApiAccountUpdateEmailResponse400, postApiAccountUpdateEmailResponse404, postApiAccountUpdateEmailResponse500, postApiAccountUpdateEmailResponseError, postApiAccountUpdateEmailResponseSuccess, postApiAccountUpdatePassword, postApiAccountUpdatePasswordResponse, postApiAccountUpdatePasswordResponse200, postApiAccountUpdatePasswordResponse400, postApiAccountUpdatePasswordResponse404, postApiAccountUpdatePasswordResponse500, postApiAccountUpdatePasswordResponseError, postApiAccountUpdatePasswordResponseSuccess, postApiAccountVerifyEmail, postApiAccountVerifyEmailResend, postApiAccountVerifyEmailResendResponse, postApiAccountVerifyEmailResendResponse200, postApiAccountVerifyEmailResendResponse400, postApiAccountVerifyEmailResendResponse404, postApiAccountVerifyEmailResendResponse500, postApiAccountVerifyEmailResendResponseError, postApiAccountVerifyEmailResendResponseSuccess, postApiAccountVerifyEmailResponse, postApiAccountVerifyEmailResponse200, postApiAccountVerifyEmailResponse400, postApiAccountVerifyEmailResponse404, postApiAccountVerifyEmailResponse500, postApiAccountVerifyEmailResponseError, postApiAccountVerifyEmailResponseSuccess, postApiAuthKey, postApiAuthKeyResponse, postApiAuthKeyResponse200, postApiAuthKeyResponse400, postApiAuthKeyResponse401, postApiAuthKeyResponse403, postApiAuthKeyResponse404, postApiAuthKeyResponse500, postApiAuthKeyResponseError, postApiAuthKeyResponseSuccess, postApiAuthLogin, postApiAuthLoginResponse, postApiAuthLoginResponse200, postApiAuthLoginResponse302, postApiAuthLoginResponse400, postApiAuthLoginResponse401, postApiAuthLoginResponse403, postApiAuthLoginResponse404, postApiAuthLoginResponse500, postApiAuthLoginResponseError, postApiAuthLoginResponseSuccess, postApiAuthLogout, postApiAuthLogoutResponse, postApiAuthLogoutResponse200, postApiAuthLogoutResponse400, postApiAuthLogoutResponse401, postApiAuthLogoutResponse403, postApiAuthLogoutResponse404, postApiAuthLogoutResponse500, postApiAuthLogoutResponseError, postApiAuthLogoutResponseSuccess, postApiAuthOtpDisable, postApiAuthOtpDisableResponse, postApiAuthOtpDisableResponse200, postApiAuthOtpDisableResponse204, postApiAuthOtpDisableResponse400, postApiAuthOtpDisableResponse404, postApiAuthOtpDisableResponse500, postApiAuthOtpDisableResponseError, postApiAuthOtpDisableResponseSuccess, postApiAuthOtpGenerate, postApiAuthOtpGenerateResponse, postApiAuthOtpGenerateResponse200, postApiAuthOtpGenerateResponse400, postApiAuthOtpGenerateResponse401, postApiAuthOtpGenerateResponse403, postApiAuthOtpGenerateResponse404, postApiAuthOtpGenerateResponse500, postApiAuthOtpGenerateResponseError, postApiAuthOtpGenerateResponseSuccess, postApiAuthOtpValidate, postApiAuthOtpValidateResponse, postApiAuthOtpValidateResponse302, postApiAuthOtpValidateResponse400, postApiAuthOtpValidateResponse401, postApiAuthOtpValidateResponse403, postApiAuthOtpValidateResponse404, postApiAuthOtpValidateResponse500, postApiAuthOtpValidateResponseError, postApiAuthOtpVerify, postApiAuthOtpVerifyResponse, postApiAuthOtpVerifyResponse200, postApiAuthOtpVerifyResponse204, postApiAuthOtpVerifyResponse400, postApiAuthOtpVerifyResponse404, postApiAuthOtpVerifyResponse500, postApiAuthOtpVerifyResponseError, postApiAuthOtpVerifyResponseSuccess, postApiAuthPing, postApiAuthPingResponse, postApiAuthPingResponse200, postApiAuthPingResponse400, postApiAuthPingResponse401, postApiAuthPingResponse403, postApiAuthPingResponse404, postApiAuthPingResponse500, postApiAuthPingResponseError, postApiAuthPingResponseSuccess, postApiAuthRegister, postApiAuthRegisterResponse, postApiAuthRegisterResponse200, postApiAuthRegisterResponse400, postApiAuthRegisterResponse401, postApiAuthRegisterResponse403, postApiAuthRegisterResponse404, postApiAuthRegisterResponse409, postApiAuthRegisterResponse500, postApiAuthRegisterResponseError, postApiAuthRegisterResponseSuccess } from "./account/generated/default.js";
|
|
5
|
+
import { OperationsListParams, OperationsQueryParams, buildOperationsQueryParams } from "./query-utils.js";
|
|
6
|
+
import { DEFAULT_SETTLED_STATES, OPERATION_STATUS } from "./account.js";
|
|
7
|
+
import { getApiAccountBillingBalance, getApiAccountBillingBalanceResponse, getApiAccountBillingBalanceResponse200, getApiAccountBillingBalanceResponse400, getApiAccountBillingBalanceResponse401, getApiAccountBillingBalanceResponse403, getApiAccountBillingBalanceResponse404, getApiAccountBillingBalanceResponse500, getApiAccountBillingBalanceResponseError, getApiAccountBillingBalanceResponseSuccess, getApiAccountBillingCheckoutSessionSessionIdStatus, getApiAccountBillingCheckoutSessionSessionIdStatusResponse, getApiAccountBillingCheckoutSessionSessionIdStatusResponse200, getApiAccountBillingCheckoutSessionSessionIdStatusResponse400, getApiAccountBillingCheckoutSessionSessionIdStatusResponse401, getApiAccountBillingCheckoutSessionSessionIdStatusResponse403, getApiAccountBillingCheckoutSessionSessionIdStatusResponse404, getApiAccountBillingCheckoutSessionSessionIdStatusResponse500, getApiAccountBillingCheckoutSessionSessionIdStatusResponse501, getApiAccountBillingCheckoutSessionSessionIdStatusResponseError, getApiAccountBillingCheckoutSessionSessionIdStatusResponseSuccess, getApiAccountBillingCheckoutUiPlanId, getApiAccountBillingCheckoutUiPlanIdResponse, getApiAccountBillingCheckoutUiPlanIdResponse200, getApiAccountBillingCheckoutUiPlanIdResponse400, getApiAccountBillingCheckoutUiPlanIdResponse401, getApiAccountBillingCheckoutUiPlanIdResponse403, getApiAccountBillingCheckoutUiPlanIdResponse404, getApiAccountBillingCheckoutUiPlanIdResponse409, getApiAccountBillingCheckoutUiPlanIdResponse500, getApiAccountBillingCheckoutUiPlanIdResponseError, getApiAccountBillingCheckoutUiPlanIdResponseSuccess, getApiAccountBillingCredits, getApiAccountBillingCreditsResponse, getApiAccountBillingCreditsResponse200, getApiAccountBillingCreditsResponse400, getApiAccountBillingCreditsResponse401, getApiAccountBillingCreditsResponse403, getApiAccountBillingCreditsResponse404, getApiAccountBillingCreditsResponse500, getApiAccountBillingCreditsResponseError, getApiAccountBillingCreditsResponseSuccess, getApiAccountBillingManagementCapabilities, getApiAccountBillingManagementCapabilitiesResponse, getApiAccountBillingManagementCapabilitiesResponse200, getApiAccountBillingManagementCapabilitiesResponse400, getApiAccountBillingManagementCapabilitiesResponse401, getApiAccountBillingManagementCapabilitiesResponse403, getApiAccountBillingManagementCapabilitiesResponse404, getApiAccountBillingManagementCapabilitiesResponse500, getApiAccountBillingManagementCapabilitiesResponseError, getApiAccountBillingManagementCapabilitiesResponseSuccess, getApiAccountBillingSubscription, getApiAccountBillingSubscriptionEvents, getApiAccountBillingSubscriptionEventsResponse, getApiAccountBillingSubscriptionEventsResponse200, getApiAccountBillingSubscriptionEventsResponse400, getApiAccountBillingSubscriptionEventsResponse401, getApiAccountBillingSubscriptionEventsResponse403, getApiAccountBillingSubscriptionEventsResponse404, getApiAccountBillingSubscriptionEventsResponse500, getApiAccountBillingSubscriptionEventsResponseError, getApiAccountBillingSubscriptionEventsResponseSuccess, getApiAccountBillingSubscriptionResponse, getApiAccountBillingSubscriptionResponse200, getApiAccountBillingSubscriptionResponse400, getApiAccountBillingSubscriptionResponse401, getApiAccountBillingSubscriptionResponse403, getApiAccountBillingSubscriptionResponse404, getApiAccountBillingSubscriptionResponse500, getApiAccountBillingSubscriptionResponseError, getApiAccountBillingSubscriptionResponseSuccess, getApiBillingGateways, getApiBillingGatewaysIdLogo, getApiBillingGatewaysIdLogoResponse, getApiBillingGatewaysIdLogoResponse200, getApiBillingGatewaysIdLogoResponse400, getApiBillingGatewaysIdLogoResponse401, getApiBillingGatewaysIdLogoResponse403, getApiBillingGatewaysIdLogoResponse404, getApiBillingGatewaysIdLogoResponse500, getApiBillingGatewaysIdLogoResponseError, getApiBillingGatewaysIdLogoResponseSuccess, getApiBillingGatewaysResponse, getApiBillingGatewaysResponse200, getApiBillingGatewaysResponse400, getApiBillingGatewaysResponse401, getApiBillingGatewaysResponse403, getApiBillingGatewaysResponse404, getApiBillingGatewaysResponse500, getApiBillingGatewaysResponseError, getApiBillingGatewaysResponseSuccess, getApiBillingPlans, getApiBillingPlansResponse, getApiBillingPlansResponse200, getApiBillingPlansResponse400, getApiBillingPlansResponse401, getApiBillingPlansResponse403, getApiBillingPlansResponse404, getApiBillingPlansResponse500, getApiBillingPlansResponseError, getApiBillingPlansResponseSuccess, getGetApiAccountBillingBalanceUrl, getGetApiAccountBillingCheckoutSessionSessionIdStatusUrl, getGetApiAccountBillingCheckoutUiPlanIdUrl, getGetApiAccountBillingCreditsUrl, getGetApiAccountBillingManagementCapabilitiesUrl, getGetApiAccountBillingSubscriptionEventsUrl, getGetApiAccountBillingSubscriptionUrl, getGetApiBillingGatewaysIdLogoUrl, getGetApiBillingGatewaysUrl, getGetApiBillingPlansUrl, getPostApiAccountBillingCancelAbortUrl, getPostApiAccountBillingCancelUrl, getPostApiAccountBillingChangePlanUrl, getPostApiAccountBillingCustomerPortalUrl, getPostApiAccountBillingManagementUrl, getPostApiAccountBillingPauseUrl, getPostApiAccountBillingResumeUrl, getPostApiAccountBillingWebhooksGatewayTypeUrl, postApiAccountBillingCancel, postApiAccountBillingCancelAbort, postApiAccountBillingCancelAbortResponse, postApiAccountBillingCancelAbortResponse200, postApiAccountBillingCancelAbortResponse400, postApiAccountBillingCancelAbortResponse401, postApiAccountBillingCancelAbortResponse403, postApiAccountBillingCancelAbortResponse404, postApiAccountBillingCancelAbortResponse500, postApiAccountBillingCancelAbortResponseError, postApiAccountBillingCancelAbortResponseSuccess, postApiAccountBillingCancelResponse, postApiAccountBillingCancelResponse200, postApiAccountBillingCancelResponse400, postApiAccountBillingCancelResponse401, postApiAccountBillingCancelResponse403, postApiAccountBillingCancelResponse404, postApiAccountBillingCancelResponse500, postApiAccountBillingCancelResponseError, postApiAccountBillingCancelResponseSuccess, postApiAccountBillingChangePlan, postApiAccountBillingChangePlanResponse, postApiAccountBillingChangePlanResponse200, postApiAccountBillingChangePlanResponse400, postApiAccountBillingChangePlanResponse401, postApiAccountBillingChangePlanResponse403, postApiAccountBillingChangePlanResponse404, postApiAccountBillingChangePlanResponse500, postApiAccountBillingChangePlanResponseError, postApiAccountBillingChangePlanResponseSuccess, postApiAccountBillingCustomerPortal, postApiAccountBillingCustomerPortalResponse, postApiAccountBillingCustomerPortalResponse200, postApiAccountBillingCustomerPortalResponse400, postApiAccountBillingCustomerPortalResponse401, postApiAccountBillingCustomerPortalResponse403, postApiAccountBillingCustomerPortalResponse404, postApiAccountBillingCustomerPortalResponse500, postApiAccountBillingCustomerPortalResponseError, postApiAccountBillingCustomerPortalResponseSuccess, postApiAccountBillingManagement, postApiAccountBillingManagementResponse, postApiAccountBillingManagementResponse200, postApiAccountBillingManagementResponse400, postApiAccountBillingManagementResponse401, postApiAccountBillingManagementResponse403, postApiAccountBillingManagementResponse404, postApiAccountBillingManagementResponse500, postApiAccountBillingManagementResponseError, postApiAccountBillingManagementResponseSuccess, postApiAccountBillingPause, postApiAccountBillingPauseResponse, postApiAccountBillingPauseResponse200, postApiAccountBillingPauseResponse400, postApiAccountBillingPauseResponse401, postApiAccountBillingPauseResponse403, postApiAccountBillingPauseResponse404, postApiAccountBillingPauseResponse500, postApiAccountBillingPauseResponseError, postApiAccountBillingPauseResponseSuccess, postApiAccountBillingResume, postApiAccountBillingResumeResponse, postApiAccountBillingResumeResponse200, postApiAccountBillingResumeResponse400, postApiAccountBillingResumeResponse401, postApiAccountBillingResumeResponse403, postApiAccountBillingResumeResponse404, postApiAccountBillingResumeResponse500, postApiAccountBillingResumeResponseError, postApiAccountBillingResumeResponseSuccess, postApiAccountBillingWebhooksGatewayType, postApiAccountBillingWebhooksGatewayTypeResponse, postApiAccountBillingWebhooksGatewayTypeResponse200, postApiAccountBillingWebhooksGatewayTypeResponse204, postApiAccountBillingWebhooksGatewayTypeResponse400, postApiAccountBillingWebhooksGatewayTypeResponse401, postApiAccountBillingWebhooksGatewayTypeResponse403, postApiAccountBillingWebhooksGatewayTypeResponse404, postApiAccountBillingWebhooksGatewayTypeResponse413, postApiAccountBillingWebhooksGatewayTypeResponse500, postApiAccountBillingWebhooksGatewayTypeResponseError, postApiAccountBillingWebhooksGatewayTypeResponseSuccess } from "./account/generated/billing.js";
|
|
8
|
+
import { getApiAccountQuota, getApiAccountQuotaResponse, getApiAccountQuotaResponse200, getApiAccountQuotaResponse400, getApiAccountQuotaResponse404, getApiAccountQuotaResponse500, getApiAccountQuotaResponseError, getApiAccountQuotaResponseSuccess, getGetApiAccountQuotaUrl } from "./account/generated/quota.js";
|
|
9
|
+
import { Sdk } from "./sdk.js";
|
|
10
|
+
export { APIEndpointInfoResponse, APIKeyCreateRequest, APIKeyListResponse, APIKeyResponse, AccessModel, AccessModelDef, AccessPolicy, AccountError, AccountInfoResponse, AccountPermissionsResponse, BalanceResponse, BinaryUUID, ChangePlanRequest, CheckoutSessionStatusResponse, CheckoutUIFragment, CheckoutUIFragmentMetadata, CheckoutUIResponse, CheckoutUIResponseMetadata, CreateAPIKeyResponse, DEFAULT_SETTLED_STATES, Decimal, Error, ErrorResponse, GatewayAbilities, GatewayListResponse, GatewayPublicInfo, GetApiAccountBillingCheckoutSessionSessionIdStatusParams, GetApiAccountBillingCheckoutUiPlanIdParams, GetApiAccountKeysParams, GetApiAccountQuotaHistoryParams, GetApiOperationsParams, LoginRequest, LoginResponse, ManagementCapabilitiesResponse, ManagementCapabilitiesResponseAdminOperations, ManagementCapabilitiesResponseOperations, ManagementRequest, ManagementResultResponse, OPERATION_STATUS, OTPDisableRequest, OTPGenerateResponse, OTPValidateRequest, OTPVerifyRequest, OperationDetailResponse, OperationFilterItem, OperationFiltersResponse, OperationFiltersResponseData, OperationFiltersResponseResponse, OperationListItem, OperationListItemResponse, OperationPollingOptions, OperationsListParams, type OperationsQueryParams, PasswordResetRequest, PasswordResetVerifyRequest, PollOptions, PongResponse, PostApiAccountAvatarBody, PostApiAccountBillingWebhooksGatewayTypeBody, PostApiAccountVerifyEmailParams, PublicPricingPlanPeriodDTO, PublicPricingPlanResponse, PublicPricingPlansListResponse, QuotaHistoryResponse, QuotaStatusResponse, QuotaTypeStatus, RegisterRequest, RequestInit, ResendVerifyEmailRequest, Result, Sdk, StringUUIDSchema, SubscriptionStatusResponse, UpdateEmailRequest, UpdatePasswordRequest, UpdateProfileRequest, UploadLimitResponse, UsagePoint, UserCreditItem, UserCreditsListResponse, Uuid, VerifyEmailRequest, WindowInfo, buildOperationsQueryParams, delay, deleteApiAccount, deleteApiAccountKeysKeyID, deleteApiAccountKeysKeyIDResponse, deleteApiAccountKeysKeyIDResponse200, deleteApiAccountKeysKeyIDResponse400, deleteApiAccountKeysKeyIDResponse404, deleteApiAccountKeysKeyIDResponse500, deleteApiAccountKeysKeyIDResponseError, deleteApiAccountKeysKeyIDResponseSuccess, deleteApiAccountResponse, deleteApiAccountResponse200, deleteApiAccountResponse400, deleteApiAccountResponse404, deleteApiAccountResponse500, deleteApiAccountResponseError, deleteApiAccountResponseSuccess, fetchWithHandling, getApiAccount, getApiAccountAvatar, getApiAccountAvatarResponse, getApiAccountAvatarResponse200, getApiAccountAvatarResponse400, getApiAccountAvatarResponse404, getApiAccountAvatarResponse500, getApiAccountAvatarResponseError, getApiAccountAvatarResponseSuccess, getApiAccountBillingBalance, getApiAccountBillingBalanceResponse, getApiAccountBillingBalanceResponse200, getApiAccountBillingBalanceResponse400, getApiAccountBillingBalanceResponse401, getApiAccountBillingBalanceResponse403, getApiAccountBillingBalanceResponse404, getApiAccountBillingBalanceResponse500, getApiAccountBillingBalanceResponseError, getApiAccountBillingBalanceResponseSuccess, getApiAccountBillingCheckoutSessionSessionIdStatus, getApiAccountBillingCheckoutSessionSessionIdStatusResponse, getApiAccountBillingCheckoutSessionSessionIdStatusResponse200, getApiAccountBillingCheckoutSessionSessionIdStatusResponse400, getApiAccountBillingCheckoutSessionSessionIdStatusResponse401, getApiAccountBillingCheckoutSessionSessionIdStatusResponse403, getApiAccountBillingCheckoutSessionSessionIdStatusResponse404, getApiAccountBillingCheckoutSessionSessionIdStatusResponse500, getApiAccountBillingCheckoutSessionSessionIdStatusResponse501, getApiAccountBillingCheckoutSessionSessionIdStatusResponseError, getApiAccountBillingCheckoutSessionSessionIdStatusResponseSuccess, getApiAccountBillingCheckoutUiPlanId, getApiAccountBillingCheckoutUiPlanIdResponse, getApiAccountBillingCheckoutUiPlanIdResponse200, getApiAccountBillingCheckoutUiPlanIdResponse400, getApiAccountBillingCheckoutUiPlanIdResponse401, getApiAccountBillingCheckoutUiPlanIdResponse403, getApiAccountBillingCheckoutUiPlanIdResponse404, getApiAccountBillingCheckoutUiPlanIdResponse409, getApiAccountBillingCheckoutUiPlanIdResponse500, getApiAccountBillingCheckoutUiPlanIdResponseError, getApiAccountBillingCheckoutUiPlanIdResponseSuccess, getApiAccountBillingCredits, getApiAccountBillingCreditsResponse, getApiAccountBillingCreditsResponse200, getApiAccountBillingCreditsResponse400, getApiAccountBillingCreditsResponse401, getApiAccountBillingCreditsResponse403, getApiAccountBillingCreditsResponse404, getApiAccountBillingCreditsResponse500, getApiAccountBillingCreditsResponseError, getApiAccountBillingCreditsResponseSuccess, getApiAccountBillingManagementCapabilities, getApiAccountBillingManagementCapabilitiesResponse, getApiAccountBillingManagementCapabilitiesResponse200, getApiAccountBillingManagementCapabilitiesResponse400, getApiAccountBillingManagementCapabilitiesResponse401, getApiAccountBillingManagementCapabilitiesResponse403, getApiAccountBillingManagementCapabilitiesResponse404, getApiAccountBillingManagementCapabilitiesResponse500, getApiAccountBillingManagementCapabilitiesResponseError, getApiAccountBillingManagementCapabilitiesResponseSuccess, getApiAccountBillingSubscription, getApiAccountBillingSubscriptionEvents, getApiAccountBillingSubscriptionEventsResponse, getApiAccountBillingSubscriptionEventsResponse200, getApiAccountBillingSubscriptionEventsResponse400, getApiAccountBillingSubscriptionEventsResponse401, getApiAccountBillingSubscriptionEventsResponse403, getApiAccountBillingSubscriptionEventsResponse404, getApiAccountBillingSubscriptionEventsResponse500, getApiAccountBillingSubscriptionEventsResponseError, getApiAccountBillingSubscriptionEventsResponseSuccess, getApiAccountBillingSubscriptionResponse, getApiAccountBillingSubscriptionResponse200, getApiAccountBillingSubscriptionResponse400, getApiAccountBillingSubscriptionResponse401, getApiAccountBillingSubscriptionResponse403, getApiAccountBillingSubscriptionResponse404, getApiAccountBillingSubscriptionResponse500, getApiAccountBillingSubscriptionResponseError, getApiAccountBillingSubscriptionResponseSuccess, getApiAccountKeys, getApiAccountKeysResponse, getApiAccountKeysResponse200, getApiAccountKeysResponse400, getApiAccountKeysResponse404, getApiAccountKeysResponse500, getApiAccountKeysResponseError, getApiAccountKeysResponseSuccess, getApiAccountPermissions, getApiAccountPermissionsResponse, getApiAccountPermissionsResponse200, getApiAccountPermissionsResponse400, getApiAccountPermissionsResponse404, getApiAccountPermissionsResponse500, getApiAccountPermissionsResponseError, getApiAccountPermissionsResponseSuccess, getApiAccountQuota, getApiAccountQuotaHistory, getApiAccountQuotaHistoryResponse, getApiAccountQuotaHistoryResponse200, getApiAccountQuotaHistoryResponse400, getApiAccountQuotaHistoryResponse404, getApiAccountQuotaHistoryResponse500, getApiAccountQuotaHistoryResponseError, getApiAccountQuotaHistoryResponseSuccess, getApiAccountQuotaResponse, getApiAccountQuotaResponse200, getApiAccountQuotaResponse400, getApiAccountQuotaResponse404, getApiAccountQuotaResponse500, getApiAccountQuotaResponseError, getApiAccountQuotaResponseSuccess, getApiAccountResponse, getApiAccountResponse200, getApiAccountResponse400, getApiAccountResponse401, getApiAccountResponse403, getApiAccountResponse404, getApiAccountResponse500, getApiAccountResponseError, getApiAccountResponseSuccess, getApiBillingGateways, getApiBillingGatewaysIdLogo, getApiBillingGatewaysIdLogoResponse, getApiBillingGatewaysIdLogoResponse200, getApiBillingGatewaysIdLogoResponse400, getApiBillingGatewaysIdLogoResponse401, getApiBillingGatewaysIdLogoResponse403, getApiBillingGatewaysIdLogoResponse404, getApiBillingGatewaysIdLogoResponse500, getApiBillingGatewaysIdLogoResponseError, getApiBillingGatewaysIdLogoResponseSuccess, getApiBillingGatewaysResponse, getApiBillingGatewaysResponse200, getApiBillingGatewaysResponse400, getApiBillingGatewaysResponse401, getApiBillingGatewaysResponse403, getApiBillingGatewaysResponse404, getApiBillingGatewaysResponse500, getApiBillingGatewaysResponseError, getApiBillingGatewaysResponseSuccess, getApiBillingPlans, getApiBillingPlansResponse, getApiBillingPlansResponse200, getApiBillingPlansResponse400, getApiBillingPlansResponse401, getApiBillingPlansResponse403, getApiBillingPlansResponse404, getApiBillingPlansResponse500, getApiBillingPlansResponseError, getApiBillingPlansResponseSuccess, getApiOperations, getApiOperationsFilters, getApiOperationsFiltersResponse, getApiOperationsFiltersResponse200, getApiOperationsFiltersResponse400, getApiOperationsFiltersResponse404, getApiOperationsFiltersResponse500, getApiOperationsFiltersResponseError, getApiOperationsFiltersResponseSuccess, getApiOperationsId, getApiOperationsIdResponse, getApiOperationsIdResponse200, getApiOperationsIdResponse400, getApiOperationsIdResponse404, getApiOperationsIdResponse500, getApiOperationsIdResponseError, getApiOperationsIdResponseSuccess, getApiOperationsResponse, getApiOperationsResponse200, getApiOperationsResponse400, getApiOperationsResponse404, getApiOperationsResponse500, getApiOperationsResponseError, getApiOperationsResponseSuccess, getApiUploadLimit, getApiUploadLimitResponse, getApiUploadLimitResponse200, getApiUploadLimitResponse400, getApiUploadLimitResponse404, getApiUploadLimitResponse500, getApiUploadLimitResponseError, getApiUploadLimitResponseSuccess, getDeleteApiAccountKeysKeyIDUrl, getDeleteApiAccountUrl, getGetApiAccountAvatarUrl, getGetApiAccountBillingBalanceUrl, getGetApiAccountBillingCheckoutSessionSessionIdStatusUrl, getGetApiAccountBillingCheckoutUiPlanIdUrl, getGetApiAccountBillingCreditsUrl, getGetApiAccountBillingManagementCapabilitiesUrl, getGetApiAccountBillingSubscriptionEventsUrl, getGetApiAccountBillingSubscriptionUrl, getGetApiAccountKeysUrl, getGetApiAccountPermissionsUrl, getGetApiAccountQuotaHistoryUrl, getGetApiAccountQuotaUrl, getGetApiAccountUrl, getGetApiBillingGatewaysIdLogoUrl, getGetApiBillingGatewaysUrl, getGetApiBillingPlansUrl, getGetApiOperationsFiltersUrl, getGetApiOperationsIdUrl, getGetApiOperationsUrl, getGetApiUploadLimitUrl, getPatchApiAccountUrl, getPostApiAccountAvatarUrl, getPostApiAccountBillingCancelAbortUrl, getPostApiAccountBillingCancelUrl, getPostApiAccountBillingChangePlanUrl, getPostApiAccountBillingCustomerPortalUrl, getPostApiAccountBillingManagementUrl, getPostApiAccountBillingPauseUrl, getPostApiAccountBillingResumeUrl, getPostApiAccountBillingWebhooksGatewayTypeUrl, getPostApiAccountKeysUrl, getPostApiAccountPasswordResetConfirmUrl, getPostApiAccountPasswordResetRequestUrl, getPostApiAccountUpdateEmailUrl, getPostApiAccountUpdatePasswordUrl, getPostApiAccountVerifyEmailResendUrl, getPostApiAccountVerifyEmailUrl, getPostApiAuthKeyUrl, getPostApiAuthLoginUrl, getPostApiAuthLogoutUrl, getPostApiAuthOtpDisableUrl, getPostApiAuthOtpGenerateUrl, getPostApiAuthOtpValidateUrl, getPostApiAuthOtpVerifyUrl, getPostApiAuthPingUrl, getPostApiAuthRegisterUrl, handleFetchError, handleUnknownError, isEmptyResponse, parseResponse, patchApiAccount, patchApiAccountResponse, patchApiAccountResponse200, patchApiAccountResponse400, patchApiAccountResponse401, patchApiAccountResponse403, patchApiAccountResponse404, patchApiAccountResponse500, patchApiAccountResponseError, patchApiAccountResponseSuccess, poll, postApiAccountAvatar, postApiAccountAvatarResponse, postApiAccountAvatarResponse200, postApiAccountAvatarResponse204, postApiAccountAvatarResponse400, postApiAccountAvatarResponse404, postApiAccountAvatarResponse500, postApiAccountAvatarResponseError, postApiAccountAvatarResponseSuccess, postApiAccountBillingCancel, postApiAccountBillingCancelAbort, postApiAccountBillingCancelAbortResponse, postApiAccountBillingCancelAbortResponse200, postApiAccountBillingCancelAbortResponse400, postApiAccountBillingCancelAbortResponse401, postApiAccountBillingCancelAbortResponse403, postApiAccountBillingCancelAbortResponse404, postApiAccountBillingCancelAbortResponse500, postApiAccountBillingCancelAbortResponseError, postApiAccountBillingCancelAbortResponseSuccess, postApiAccountBillingCancelResponse, postApiAccountBillingCancelResponse200, postApiAccountBillingCancelResponse400, postApiAccountBillingCancelResponse401, postApiAccountBillingCancelResponse403, postApiAccountBillingCancelResponse404, postApiAccountBillingCancelResponse500, postApiAccountBillingCancelResponseError, postApiAccountBillingCancelResponseSuccess, postApiAccountBillingChangePlan, postApiAccountBillingChangePlanResponse, postApiAccountBillingChangePlanResponse200, postApiAccountBillingChangePlanResponse400, postApiAccountBillingChangePlanResponse401, postApiAccountBillingChangePlanResponse403, postApiAccountBillingChangePlanResponse404, postApiAccountBillingChangePlanResponse500, postApiAccountBillingChangePlanResponseError, postApiAccountBillingChangePlanResponseSuccess, postApiAccountBillingCustomerPortal, postApiAccountBillingCustomerPortalResponse, postApiAccountBillingCustomerPortalResponse200, postApiAccountBillingCustomerPortalResponse400, postApiAccountBillingCustomerPortalResponse401, postApiAccountBillingCustomerPortalResponse403, postApiAccountBillingCustomerPortalResponse404, postApiAccountBillingCustomerPortalResponse500, postApiAccountBillingCustomerPortalResponseError, postApiAccountBillingCustomerPortalResponseSuccess, postApiAccountBillingManagement, postApiAccountBillingManagementResponse, postApiAccountBillingManagementResponse200, postApiAccountBillingManagementResponse400, postApiAccountBillingManagementResponse401, postApiAccountBillingManagementResponse403, postApiAccountBillingManagementResponse404, postApiAccountBillingManagementResponse500, postApiAccountBillingManagementResponseError, postApiAccountBillingManagementResponseSuccess, postApiAccountBillingPause, postApiAccountBillingPauseResponse, postApiAccountBillingPauseResponse200, postApiAccountBillingPauseResponse400, postApiAccountBillingPauseResponse401, postApiAccountBillingPauseResponse403, postApiAccountBillingPauseResponse404, postApiAccountBillingPauseResponse500, postApiAccountBillingPauseResponseError, postApiAccountBillingPauseResponseSuccess, postApiAccountBillingResume, postApiAccountBillingResumeResponse, postApiAccountBillingResumeResponse200, postApiAccountBillingResumeResponse400, postApiAccountBillingResumeResponse401, postApiAccountBillingResumeResponse403, postApiAccountBillingResumeResponse404, postApiAccountBillingResumeResponse500, postApiAccountBillingResumeResponseError, postApiAccountBillingResumeResponseSuccess, postApiAccountBillingWebhooksGatewayType, postApiAccountBillingWebhooksGatewayTypeResponse, postApiAccountBillingWebhooksGatewayTypeResponse200, postApiAccountBillingWebhooksGatewayTypeResponse204, postApiAccountBillingWebhooksGatewayTypeResponse400, postApiAccountBillingWebhooksGatewayTypeResponse401, postApiAccountBillingWebhooksGatewayTypeResponse403, postApiAccountBillingWebhooksGatewayTypeResponse404, postApiAccountBillingWebhooksGatewayTypeResponse413, postApiAccountBillingWebhooksGatewayTypeResponse500, postApiAccountBillingWebhooksGatewayTypeResponseError, postApiAccountBillingWebhooksGatewayTypeResponseSuccess, postApiAccountKeys, postApiAccountKeysResponse, postApiAccountKeysResponse200, postApiAccountKeysResponse400, postApiAccountKeysResponse404, postApiAccountKeysResponse500, postApiAccountKeysResponseError, postApiAccountKeysResponseSuccess, postApiAccountPasswordResetConfirm, postApiAccountPasswordResetConfirmResponse, postApiAccountPasswordResetConfirmResponse200, postApiAccountPasswordResetConfirmResponse400, postApiAccountPasswordResetConfirmResponse404, postApiAccountPasswordResetConfirmResponse500, postApiAccountPasswordResetConfirmResponseError, postApiAccountPasswordResetConfirmResponseSuccess, postApiAccountPasswordResetRequest, postApiAccountPasswordResetRequestResponse, postApiAccountPasswordResetRequestResponse200, postApiAccountPasswordResetRequestResponse400, postApiAccountPasswordResetRequestResponse401, postApiAccountPasswordResetRequestResponse403, postApiAccountPasswordResetRequestResponse404, postApiAccountPasswordResetRequestResponse500, postApiAccountPasswordResetRequestResponseError, postApiAccountPasswordResetRequestResponseSuccess, postApiAccountUpdateEmail, postApiAccountUpdateEmailResponse, postApiAccountUpdateEmailResponse200, postApiAccountUpdateEmailResponse400, postApiAccountUpdateEmailResponse404, postApiAccountUpdateEmailResponse500, postApiAccountUpdateEmailResponseError, postApiAccountUpdateEmailResponseSuccess, postApiAccountUpdatePassword, postApiAccountUpdatePasswordResponse, postApiAccountUpdatePasswordResponse200, postApiAccountUpdatePasswordResponse400, postApiAccountUpdatePasswordResponse404, postApiAccountUpdatePasswordResponse500, postApiAccountUpdatePasswordResponseError, postApiAccountUpdatePasswordResponseSuccess, postApiAccountVerifyEmail, postApiAccountVerifyEmailResend, postApiAccountVerifyEmailResendResponse, postApiAccountVerifyEmailResendResponse200, postApiAccountVerifyEmailResendResponse400, postApiAccountVerifyEmailResendResponse404, postApiAccountVerifyEmailResendResponse500, postApiAccountVerifyEmailResendResponseError, postApiAccountVerifyEmailResendResponseSuccess, postApiAccountVerifyEmailResponse, postApiAccountVerifyEmailResponse200, postApiAccountVerifyEmailResponse400, postApiAccountVerifyEmailResponse404, postApiAccountVerifyEmailResponse500, postApiAccountVerifyEmailResponseError, postApiAccountVerifyEmailResponseSuccess, postApiAuthKey, postApiAuthKeyResponse, postApiAuthKeyResponse200, postApiAuthKeyResponse400, postApiAuthKeyResponse401, postApiAuthKeyResponse403, postApiAuthKeyResponse404, postApiAuthKeyResponse500, postApiAuthKeyResponseError, postApiAuthKeyResponseSuccess, postApiAuthLogin, postApiAuthLoginResponse, postApiAuthLoginResponse200, postApiAuthLoginResponse302, postApiAuthLoginResponse400, postApiAuthLoginResponse401, postApiAuthLoginResponse403, postApiAuthLoginResponse404, postApiAuthLoginResponse500, postApiAuthLoginResponseError, postApiAuthLoginResponseSuccess, postApiAuthLogout, postApiAuthLogoutResponse, postApiAuthLogoutResponse200, postApiAuthLogoutResponse400, postApiAuthLogoutResponse401, postApiAuthLogoutResponse403, postApiAuthLogoutResponse404, postApiAuthLogoutResponse500, postApiAuthLogoutResponseError, postApiAuthLogoutResponseSuccess, postApiAuthOtpDisable, postApiAuthOtpDisableResponse, postApiAuthOtpDisableResponse200, postApiAuthOtpDisableResponse204, postApiAuthOtpDisableResponse400, postApiAuthOtpDisableResponse404, postApiAuthOtpDisableResponse500, postApiAuthOtpDisableResponseError, postApiAuthOtpDisableResponseSuccess, postApiAuthOtpGenerate, postApiAuthOtpGenerateResponse, postApiAuthOtpGenerateResponse200, postApiAuthOtpGenerateResponse400, postApiAuthOtpGenerateResponse401, postApiAuthOtpGenerateResponse403, postApiAuthOtpGenerateResponse404, postApiAuthOtpGenerateResponse500, postApiAuthOtpGenerateResponseError, postApiAuthOtpGenerateResponseSuccess, postApiAuthOtpValidate, postApiAuthOtpValidateResponse, postApiAuthOtpValidateResponse302, postApiAuthOtpValidateResponse400, postApiAuthOtpValidateResponse401, postApiAuthOtpValidateResponse403, postApiAuthOtpValidateResponse404, postApiAuthOtpValidateResponse500, postApiAuthOtpValidateResponseError, postApiAuthOtpVerify, postApiAuthOtpVerifyResponse, postApiAuthOtpVerifyResponse200, postApiAuthOtpVerifyResponse204, postApiAuthOtpVerifyResponse400, postApiAuthOtpVerifyResponse404, postApiAuthOtpVerifyResponse500, postApiAuthOtpVerifyResponseError, postApiAuthOtpVerifyResponseSuccess, postApiAuthPing, postApiAuthPingResponse, postApiAuthPingResponse200, postApiAuthPingResponse400, postApiAuthPingResponse401, postApiAuthPingResponse403, postApiAuthPingResponse404, postApiAuthPingResponse500, postApiAuthPingResponseError, postApiAuthPingResponseSuccess, postApiAuthRegister, postApiAuthRegisterResponse, postApiAuthRegisterResponse200, postApiAuthRegisterResponse400, postApiAuthRegisterResponse401, postApiAuthRegisterResponse403, postApiAuthRegisterResponse404, postApiAuthRegisterResponse409, postApiAuthRegisterResponse500, postApiAuthRegisterResponseError, postApiAuthRegisterResponseSuccess };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { delay, fetchWithHandling, isEmptyResponse, parseResponse, poll } from "./http-utils.js";
|
|
2
|
+
import { AccountError, handleFetchError, handleUnknownError } from "./types.js";
|
|
3
|
+
import { buildOperationsQueryParams } from "./query-utils.js";
|
|
4
|
+
import { DEFAULT_SETTLED_STATES, OPERATION_STATUS } from "./account.js";
|
|
5
|
+
import { Sdk } from "./sdk.js";
|
|
6
|
+
import { deleteApiAccount, deleteApiAccountKeysKeyID, getApiAccount, getApiAccountAvatar, getApiAccountKeys, getApiAccountPermissions, getApiAccountQuotaHistory, getApiOperations, getApiOperationsFilters, getApiOperationsId, getApiUploadLimit, getDeleteApiAccountKeysKeyIDUrl, getDeleteApiAccountUrl, getGetApiAccountAvatarUrl, getGetApiAccountKeysUrl, getGetApiAccountPermissionsUrl, getGetApiAccountQuotaHistoryUrl, getGetApiAccountUrl, getGetApiOperationsFiltersUrl, getGetApiOperationsIdUrl, getGetApiOperationsUrl, getGetApiUploadLimitUrl, getPatchApiAccountUrl, getPostApiAccountAvatarUrl, getPostApiAccountKeysUrl, getPostApiAccountPasswordResetConfirmUrl, getPostApiAccountPasswordResetRequestUrl, getPostApiAccountUpdateEmailUrl, getPostApiAccountUpdatePasswordUrl, getPostApiAccountVerifyEmailResendUrl, getPostApiAccountVerifyEmailUrl, getPostApiAuthKeyUrl, getPostApiAuthLoginUrl, getPostApiAuthLogoutUrl, getPostApiAuthOtpDisableUrl, getPostApiAuthOtpGenerateUrl, getPostApiAuthOtpValidateUrl, getPostApiAuthOtpVerifyUrl, getPostApiAuthPingUrl, getPostApiAuthRegisterUrl, patchApiAccount, postApiAccountAvatar, postApiAccountKeys, postApiAccountPasswordResetConfirm, postApiAccountPasswordResetRequest, postApiAccountUpdateEmail, postApiAccountUpdatePassword, postApiAccountVerifyEmail, postApiAccountVerifyEmailResend, postApiAuthKey, postApiAuthLogin, postApiAuthLogout, postApiAuthOtpDisable, postApiAuthOtpGenerate, postApiAuthOtpValidate, postApiAuthOtpVerify, postApiAuthPing, postApiAuthRegister } from "./account/generated/default.js";
|
|
7
|
+
import { getApiAccountBillingBalance, getApiAccountBillingCheckoutSessionSessionIdStatus, getApiAccountBillingCheckoutUiPlanId, getApiAccountBillingCredits, getApiAccountBillingManagementCapabilities, getApiAccountBillingSubscription, getApiAccountBillingSubscriptionEvents, getApiBillingGateways, getApiBillingGatewaysIdLogo, getApiBillingPlans, getGetApiAccountBillingBalanceUrl, getGetApiAccountBillingCheckoutSessionSessionIdStatusUrl, getGetApiAccountBillingCheckoutUiPlanIdUrl, getGetApiAccountBillingCreditsUrl, getGetApiAccountBillingManagementCapabilitiesUrl, getGetApiAccountBillingSubscriptionEventsUrl, getGetApiAccountBillingSubscriptionUrl, getGetApiBillingGatewaysIdLogoUrl, getGetApiBillingGatewaysUrl, getGetApiBillingPlansUrl, getPostApiAccountBillingCancelAbortUrl, getPostApiAccountBillingCancelUrl, getPostApiAccountBillingChangePlanUrl, getPostApiAccountBillingCustomerPortalUrl, getPostApiAccountBillingManagementUrl, getPostApiAccountBillingPauseUrl, getPostApiAccountBillingResumeUrl, getPostApiAccountBillingWebhooksGatewayTypeUrl, postApiAccountBillingCancel, postApiAccountBillingCancelAbort, postApiAccountBillingChangePlan, postApiAccountBillingCustomerPortal, postApiAccountBillingManagement, postApiAccountBillingPause, postApiAccountBillingResume, postApiAccountBillingWebhooksGatewayType } from "./account/generated/billing.js";
|
|
8
|
+
import { getApiAccountQuota, getGetApiAccountQuotaUrl } from "./account/generated/quota.js";
|
|
9
|
+
|
|
10
|
+
export { AccountError, DEFAULT_SETTLED_STATES, OPERATION_STATUS, Sdk, buildOperationsQueryParams, delay, deleteApiAccount, deleteApiAccountKeysKeyID, fetchWithHandling, getApiAccount, getApiAccountAvatar, getApiAccountBillingBalance, getApiAccountBillingCheckoutSessionSessionIdStatus, getApiAccountBillingCheckoutUiPlanId, getApiAccountBillingCredits, getApiAccountBillingManagementCapabilities, getApiAccountBillingSubscription, getApiAccountBillingSubscriptionEvents, getApiAccountKeys, getApiAccountPermissions, getApiAccountQuota, getApiAccountQuotaHistory, getApiBillingGateways, getApiBillingGatewaysIdLogo, getApiBillingPlans, getApiOperations, getApiOperationsFilters, getApiOperationsId, getApiUploadLimit, getDeleteApiAccountKeysKeyIDUrl, getDeleteApiAccountUrl, getGetApiAccountAvatarUrl, getGetApiAccountBillingBalanceUrl, getGetApiAccountBillingCheckoutSessionSessionIdStatusUrl, getGetApiAccountBillingCheckoutUiPlanIdUrl, getGetApiAccountBillingCreditsUrl, getGetApiAccountBillingManagementCapabilitiesUrl, getGetApiAccountBillingSubscriptionEventsUrl, getGetApiAccountBillingSubscriptionUrl, getGetApiAccountKeysUrl, getGetApiAccountPermissionsUrl, getGetApiAccountQuotaHistoryUrl, getGetApiAccountQuotaUrl, getGetApiAccountUrl, getGetApiBillingGatewaysIdLogoUrl, getGetApiBillingGatewaysUrl, getGetApiBillingPlansUrl, getGetApiOperationsFiltersUrl, getGetApiOperationsIdUrl, getGetApiOperationsUrl, getGetApiUploadLimitUrl, getPatchApiAccountUrl, getPostApiAccountAvatarUrl, getPostApiAccountBillingCancelAbortUrl, getPostApiAccountBillingCancelUrl, getPostApiAccountBillingChangePlanUrl, getPostApiAccountBillingCustomerPortalUrl, getPostApiAccountBillingManagementUrl, getPostApiAccountBillingPauseUrl, getPostApiAccountBillingResumeUrl, getPostApiAccountBillingWebhooksGatewayTypeUrl, getPostApiAccountKeysUrl, getPostApiAccountPasswordResetConfirmUrl, getPostApiAccountPasswordResetRequestUrl, getPostApiAccountUpdateEmailUrl, getPostApiAccountUpdatePasswordUrl, getPostApiAccountVerifyEmailResendUrl, getPostApiAccountVerifyEmailUrl, getPostApiAuthKeyUrl, getPostApiAuthLoginUrl, getPostApiAuthLogoutUrl, getPostApiAuthOtpDisableUrl, getPostApiAuthOtpGenerateUrl, getPostApiAuthOtpValidateUrl, getPostApiAuthOtpVerifyUrl, getPostApiAuthPingUrl, getPostApiAuthRegisterUrl, handleFetchError, handleUnknownError, isEmptyResponse, parseResponse, patchApiAccount, poll, postApiAccountAvatar, postApiAccountBillingCancel, postApiAccountBillingCancelAbort, postApiAccountBillingChangePlan, postApiAccountBillingCustomerPortal, postApiAccountBillingManagement, postApiAccountBillingPause, postApiAccountBillingResume, postApiAccountBillingWebhooksGatewayType, postApiAccountKeys, postApiAccountPasswordResetConfirm, postApiAccountPasswordResetRequest, postApiAccountUpdateEmail, postApiAccountUpdatePassword, postApiAccountVerifyEmail, postApiAccountVerifyEmailResend, postApiAuthKey, postApiAuthLogin, postApiAuthLogout, postApiAuthOtpDisable, postApiAuthOtpGenerate, postApiAuthOtpValidate, postApiAuthOtpVerify, postApiAuthPing, postApiAuthRegister };
|