@lumeweb/portal-sdk 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cjs/account/generated/accountAPI.schemas.cjs +0 -0
  3. package/dist/cjs/account/generated/accountAPI.schemas.d.cts +239 -0
  4. package/dist/cjs/account/generated/default.cjs +676 -0
  5. package/dist/cjs/account/generated/default.cjs.map +1 -0
  6. package/dist/cjs/account/generated/default.d.cts +923 -0
  7. package/dist/cjs/account/generated/index.cjs +58 -0
  8. package/dist/cjs/account/generated/index.d.cts +3 -0
  9. package/dist/cjs/account.cjs +348 -0
  10. package/dist/cjs/account.cjs.map +1 -0
  11. package/dist/cjs/account.d.cts +200 -0
  12. package/dist/cjs/http-utils.cjs +87 -0
  13. package/dist/cjs/http-utils.cjs.map +1 -0
  14. package/dist/cjs/http-utils.d.cts +54 -0
  15. package/dist/cjs/index.cjs +75 -0
  16. package/dist/cjs/index.d.cts +8 -0
  17. package/dist/cjs/openapi.cjs +58 -0
  18. package/dist/cjs/openapi.d.cts +3 -0
  19. package/dist/cjs/query-utils.cjs +44 -0
  20. package/dist/cjs/query-utils.cjs.map +1 -0
  21. package/dist/cjs/query-utils.d.cts +65 -0
  22. package/dist/cjs/sdk.cjs +20 -0
  23. package/dist/cjs/sdk.cjs.map +1 -0
  24. package/dist/cjs/sdk.d.cts +12 -0
  25. package/dist/cjs/types.cjs +116 -0
  26. package/dist/cjs/types.cjs.map +1 -0
  27. package/dist/cjs/types.d.cts +58 -0
  28. package/dist/esm/account/generated/accountAPI.schemas.d.ts +239 -0
  29. package/dist/esm/account/generated/accountAPI.schemas.js +0 -0
  30. package/dist/esm/account/generated/default.d.ts +923 -0
  31. package/dist/esm/account/generated/default.js +620 -0
  32. package/dist/esm/account/generated/default.js.map +1 -0
  33. package/dist/esm/account/generated/index.d.ts +3 -0
  34. package/dist/esm/account/generated/index.js +3 -0
  35. package/dist/esm/account.d.ts +200 -0
  36. package/dist/esm/account.js +346 -0
  37. package/dist/esm/account.js.map +1 -0
  38. package/dist/esm/http-utils.d.ts +54 -0
  39. package/dist/esm/http-utils.js +83 -0
  40. package/dist/esm/http-utils.js.map +1 -0
  41. package/dist/esm/index.d.ts +8 -0
  42. package/dist/esm/index.js +8 -0
  43. package/dist/esm/openapi.d.ts +3 -0
  44. package/dist/esm/openapi.js +3 -0
  45. package/dist/esm/query-utils.d.ts +65 -0
  46. package/dist/esm/query-utils.js +44 -0
  47. package/dist/esm/query-utils.js.map +1 -0
  48. package/dist/esm/sdk.d.ts +12 -0
  49. package/dist/esm/sdk.js +20 -0
  50. package/dist/esm/sdk.js.map +1 -0
  51. package/dist/esm/types.d.ts +58 -0
  52. package/dist/esm/types.js +109 -0
  53. package/dist/esm/types.js.map +1 -0
  54. package/package.json +37 -14
@@ -0,0 +1,65 @@
1
+ import { SerializeInput } from "@lumeweb/query-builder";
2
+
3
+ //#region src/query-utils.d.ts
4
+
5
+ /**
6
+ * Operations query parameters for the operations API
7
+ *
8
+ * Uses query-builder helpers to construct the API query parameters:
9
+ * - filters: Array of filter objects → serialized to filters[field][operator]=value
10
+ * - sorters: Array of sort objects → serialized to _sort=field&_order=direction
11
+ * - pagination: Object with start/end → serialized to _start=0&_end=20
12
+ * - search: Search term → passed directly as search=value
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const params: OperationsQueryParams = {
17
+ * filters: [
18
+ * { field: "status", operator: "eq", value: "completed" },
19
+ * { field: "operation", operator: "in", value: ["upload", "download"] }
20
+ * ],
21
+ * sorters: [{ field: "id", order: "desc" }],
22
+ * pagination: { start: 0, end: 20, page: 1, pageSize: 20 },
23
+ * search: "myfile"
24
+ * };
25
+ * ```
26
+ */
27
+ interface OperationsQueryParams extends SerializeInput {
28
+ /** Search term for filename or other relevant operation data */
29
+ search?: string;
30
+ }
31
+ /**
32
+ * Unified operations query parameters
33
+ */
34
+ type OperationsListParams = OperationsQueryParams;
35
+ /**
36
+ * Builds URL query parameters for operations API
37
+ *
38
+ * Serializes query-builder parameters to the API's expected format:
39
+ * - filters → filters[field][operator]=value
40
+ * - sorters → _sort=field&_order=direction
41
+ * - pagination → _start=0&_end=20
42
+ * - search → search=value
43
+ *
44
+ * @param params - Query parameters using query-builder helpers
45
+ * @returns URLSearchParams object ready to use with fetch
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const searchParams = buildOperationsQueryParams({
50
+ * filters: [
51
+ * { field: "status", operator: "eq", value: "completed" },
52
+ * { field: "operation", operator: "in", value: ["upload", "download"] }
53
+ * ],
54
+ * sorters: [{ field: "id", order: "desc" }],
55
+ * pagination: { start: 0, end: 20, page: 1, pageSize: 20 },
56
+ * search: "myfile"
57
+ * });
58
+ *
59
+ * // Result URL: ?filters[status][eq]=completed&filters[operation][in][0]=upload&filters[operation][in][1]=download&_sort=id&_order=desc&_start=0&_end=20&search=myfile
60
+ * ```
61
+ */
62
+ declare function buildOperationsQueryParams(params: OperationsQueryParams): URLSearchParams;
63
+ //#endregion
64
+ export { OperationsListParams, OperationsQueryParams, buildOperationsQueryParams };
65
+ //# sourceMappingURL=query-utils.d.cts.map
@@ -0,0 +1,20 @@
1
+ const require_account = require('./account.cjs');
2
+
3
+ //#region src/sdk.ts
4
+ var Sdk = class {
5
+ accountApi;
6
+ constructor(apiUrl) {
7
+ if (!apiUrl) throw new Error("API URL is required");
8
+ this.accountApi = new require_account.AccountApi(apiUrl);
9
+ }
10
+ account() {
11
+ return this.accountApi;
12
+ }
13
+ setAuthToken(token) {
14
+ this.accountApi.setToken(token);
15
+ }
16
+ };
17
+
18
+ //#endregion
19
+ exports.Sdk = Sdk;
20
+ //# sourceMappingURL=sdk.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.cjs","names":["AccountApi"],"sources":["../../src/sdk.ts"],"sourcesContent":["import { AccountApi } from \"@/account\";\n\nexport class Sdk {\n private readonly accountApi: AccountApi;\n\n constructor(apiUrl: string) {\n if (!apiUrl) throw new Error(\"API URL is required\");\n this.accountApi = new AccountApi(apiUrl);\n }\n\n public account(): AccountApi {\n return this.accountApi;\n }\n\n public setAuthToken(token: string): void {\n this.accountApi.setToken(token);\n }\n}\n"],"mappings":";;;AAEA,IAAa,MAAb,MAAiB;CACf,AAAiB;CAEjB,YAAY,QAAgB;AAC1B,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,sBAAsB;AACnD,OAAK,aAAa,IAAIA,2BAAW,OAAO;;CAG1C,AAAO,UAAsB;AAC3B,SAAO,KAAK;;CAGd,AAAO,aAAa,OAAqB;AACvC,OAAK,WAAW,SAAS,MAAM"}
@@ -0,0 +1,12 @@
1
+ import { AccountApi } from "./account.cjs";
2
+
3
+ //#region src/sdk.d.ts
4
+ declare class Sdk {
5
+ private readonly accountApi;
6
+ constructor(apiUrl: string);
7
+ account(): AccountApi;
8
+ setAuthToken(token: string): void;
9
+ }
10
+ //#endregion
11
+ export { Sdk };
12
+ //# sourceMappingURL=sdk.d.cts.map
@@ -0,0 +1,116 @@
1
+ const require_http_utils = require('./http-utils.cjs');
2
+
3
+ //#region src/types.ts
4
+ /**
5
+ * Standard error type for account-related operations
6
+ */
7
+ var AccountError = class extends Error {
8
+ details;
9
+ fields;
10
+ constructor(message, statusCode, details, fields) {
11
+ super(message);
12
+ this.statusCode = statusCode;
13
+ this.name = "AccountError";
14
+ this.details = details;
15
+ this.fields = fields;
16
+ }
17
+ toJSON() {
18
+ return {
19
+ details: this.details,
20
+ fields: this.fields,
21
+ message: this.message,
22
+ statusCode: this.statusCode
23
+ };
24
+ }
25
+ };
26
+ /**
27
+ * Helper function to normalize field values
28
+ */
29
+ function normalizeFields(fields) {
30
+ if (!fields) return void 0;
31
+ const normalized = {};
32
+ for (const [key, value] of Object.entries(fields)) if (Array.isArray(value)) normalized[key] = value.join(", ");
33
+ else if (value === null || value === void 0) normalized[key] = "";
34
+ else if (typeof value === "object") normalized[key] = JSON.stringify(value);
35
+ else normalized[key] = String(value);
36
+ return normalized;
37
+ }
38
+ /**
39
+ * Extract error details from a response JSON object
40
+ */
41
+ function extractErrorDetails(data) {
42
+ let result = {
43
+ message: "",
44
+ details: void 0,
45
+ fields: void 0
46
+ };
47
+ if (data?.error) {
48
+ if (typeof data.error === "string") result.message = data.error;
49
+ else if (data.error?.message) {
50
+ result.message = data.error.message;
51
+ result.details = data.error.details;
52
+ result.fields = normalizeFields(data.error.fields);
53
+ }
54
+ } else if (data?.message) {
55
+ result.message = data.message;
56
+ result.details = data.details;
57
+ result.fields = normalizeFields(data.fields);
58
+ } else result.message = JSON.stringify(data);
59
+ if (!result.fields) result.fields = normalizeFields(data?.fields) || normalizeFields(data?.error?.fields);
60
+ return result;
61
+ }
62
+ /**
63
+ * Convert a failed fetch Response to an AccountError
64
+ * @param response The failed Response object
65
+ * @returns A properly formatted AccountError
66
+ */
67
+ async function handleFetchError(response) {
68
+ try {
69
+ const isJson = response.headers.get("content-type")?.toLowerCase()?.includes("json");
70
+ const clone = response.clone();
71
+ let errorData;
72
+ if (isJson) try {
73
+ errorData = await response.json();
74
+ } catch {
75
+ errorData = await clone.text().catch(() => "") || response.statusText;
76
+ }
77
+ else {
78
+ errorData = await response.text();
79
+ if (!errorData) errorData = response.statusText;
80
+ }
81
+ const { message, details, fields } = typeof errorData === "string" ? { message: errorData } : extractErrorDetails(errorData);
82
+ return new AccountError(message || "Unknown error", response.status, details, fields);
83
+ } catch (e) {
84
+ return new AccountError(response.statusText || "Unknown error", response.status, { cause: e });
85
+ }
86
+ }
87
+ /**
88
+ * Convert an unknown error to an AccountError
89
+ * @param e The unknown error
90
+ * @returns A properly formatted AccountError
91
+ */
92
+ function handleUnknownError(e) {
93
+ if (e instanceof AccountError) return e;
94
+ if (e instanceof Error) return new AccountError(e.message, 500, { cause: e });
95
+ if (typeof e === "object" && e !== null) {
96
+ let msg;
97
+ try {
98
+ msg = JSON.stringify(e);
99
+ } catch {
100
+ msg = String(e);
101
+ }
102
+ return new AccountError(msg, 500, { cause: e });
103
+ }
104
+ return new AccountError(String(e), 500);
105
+ }
106
+
107
+ //#endregion
108
+ exports.AccountError = AccountError;
109
+ exports.delay = require_http_utils.delay;
110
+ exports.fetchWithHandling = require_http_utils.fetchWithHandling;
111
+ exports.handleFetchError = handleFetchError;
112
+ exports.handleUnknownError = handleUnknownError;
113
+ exports.isEmptyResponse = require_http_utils.isEmptyResponse;
114
+ exports.parseResponse = require_http_utils.parseResponse;
115
+ exports.poll = require_http_utils.poll;
116
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":["export interface RequestInit extends Omit<globalThis.RequestInit, \"headers\"> {\n headers?: Record<string, string>;\n}\n\n/**\n * Generic Result type for consistent error handling\n * @template T The type of data returned on success\n */\nexport type Result<T> =\n | {\n data: T;\n success: true;\n }\n | {\n error: AccountError;\n success: false;\n };\n\n/**\n * Standard error type for account-related operations\n */\nexport class AccountError extends Error {\n public details?: any;\n public fields?: Record<string, string>;\n\n constructor(\n message: string,\n public readonly statusCode: number,\n details?: any,\n fields?: Record<string, string>,\n ) {\n super(message);\n this.name = \"AccountError\";\n this.details = details;\n this.fields = fields;\n }\n\n toJSON() {\n return {\n details: this.details,\n fields: this.fields,\n message: this.message,\n statusCode: this.statusCode,\n };\n }\n}\n\n/**\n * Helper function to normalize field values\n */\nfunction normalizeFields(fields: Record<string, any>): Record<string, string> | undefined {\n if (!fields) return undefined;\n \n const normalized: Record<string, string> = {};\n for (const [key, value] of Object.entries(fields)) {\n if (Array.isArray(value)) {\n normalized[key] = value.join(', ');\n } else if (value === null || value === undefined) {\n normalized[key] = '';\n } else if (typeof value === 'object') {\n normalized[key] = JSON.stringify(value);\n } else {\n normalized[key] = String(value);\n }\n }\n return normalized;\n}\n\n/**\n * Extract error details from a response JSON object\n */\nfunction extractErrorDetails(data: any): {\n message: string;\n details?: any;\n fields?: Record<string, string>;\n} {\n let result: {\n message: string;\n details?: any;\n fields?: Record<string, string>;\n } = {\n message: '',\n details: undefined,\n fields: undefined\n };\n\n // Handle standard error format\n if (data?.error) {\n if (typeof data.error === 'string') {\n result.message = data.error;\n } else if (data.error?.message) {\n result.message = data.error.message;\n result.details = data.error.details;\n result.fields = normalizeFields(data.error.fields);\n }\n } \n // Handle alternative error formats\n else if (data?.message) {\n result.message = data.message;\n result.details = data.details;\n result.fields = normalizeFields(data.fields);\n } else {\n result.message = JSON.stringify(data);\n }\n\n // Always include fields if they exist at any level\n if (!result.fields) {\n result.fields = normalizeFields(data?.fields) || normalizeFields(data?.error?.fields);\n }\n\n return result;\n}\n\n/**\n * Convert a failed fetch Response to an AccountError\n * @param response The failed Response object\n * @returns A properly formatted AccountError\n */\nexport async function handleFetchError(\n response: Response,\n): Promise<AccountError> {\n try {\n const contentType = response.headers.get('content-type');\n const isJson = contentType?.toLowerCase()?.includes('json');\n const clone = response.clone();\n let errorData: any;\n\n if (isJson) {\n try {\n errorData = await response.json();\n } catch {\n // Preserve status; fall back to text/statusText\n const txt = await clone.text().catch(() => '');\n errorData = txt || response.statusText;\n }\n } else {\n errorData = await response.text();\n if (!errorData) errorData = response.statusText;\n }\n\n const { message, details, fields } = typeof errorData === 'string' \n ? { message: errorData }\n : extractErrorDetails(errorData);\n\n return new AccountError(\n message || 'Unknown error',\n response.status,\n details,\n fields\n );\n } catch (e) {\n // As a last resort, still preserve the HTTP status when possible\n return new AccountError(\n response.statusText || 'Unknown error',\n response.status,\n { cause: e }\n );\n }\n}\n\n/**\n * Convert an unknown error to an AccountError\n * @param e The unknown error\n * @returns A properly formatted AccountError\n */\nexport function handleUnknownError(e: unknown): AccountError {\n if (e instanceof AccountError) {\n return e;\n }\n\n if (e instanceof Error) {\n return new AccountError(e.message, 500, { cause: e });\n }\n\n if (typeof e === \"object\" && e !== null) {\n let msg: string;\n try {\n msg = JSON.stringify(e);\n } catch {\n msg = String(e);\n }\n return new AccountError(msg, 500, { cause: e });\n }\n\n return new AccountError(String(e), 500);\n}\n\n/**\n * Options for polling/waiting for an operation to complete\n */\nexport interface OperationPollingOptions {\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 /** Operation statuses that are considered \"settled\" (default: ['completed', 'failed', 'error']) */\n settledStates?: string[];\n}\n\n// Re-export HTTP utilities for convenience\nexport {\n delay,\n isEmptyResponse,\n parseResponse,\n fetchWithHandling,\n poll,\n type PollOptions,\n} from \"@/http-utils\";\n"],"mappings":";;;;;;AAqBA,IAAa,eAAb,cAAkC,MAAM;CACtC,AAAO;CACP,AAAO;CAEP,YACE,SACA,AAAgB,YAChB,SACA,QACA;AACA,QAAM,QAAQ;EAJE;AAKhB,OAAK,OAAO;AACZ,OAAK,UAAU;AACf,OAAK,SAAS;;CAGhB,SAAS;AACP,SAAO;GACL,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,YAAY,KAAK;GAClB;;;;;;AAOL,SAAS,gBAAgB,QAAiE;AACxF,KAAI,CAAC,OAAQ,QAAO;CAEpB,MAAM,aAAqC,EAAE;AAC7C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,MAAM,QAAQ,MAAM,CACtB,YAAW,OAAO,MAAM,KAAK,KAAK;UACzB,UAAU,QAAQ,UAAU,OACrC,YAAW,OAAO;UACT,OAAO,UAAU,SAC1B,YAAW,OAAO,KAAK,UAAU,MAAM;KAEvC,YAAW,OAAO,OAAO,MAAM;AAGnC,QAAO;;;;;AAMT,SAAS,oBAAoB,MAI3B;CACA,IAAI,SAIA;EACF,SAAS;EACT,SAAS;EACT,QAAQ;EACT;AAGD,KAAI,MAAM,OACR;MAAI,OAAO,KAAK,UAAU,SACxB,QAAO,UAAU,KAAK;WACb,KAAK,OAAO,SAAS;AAC9B,UAAO,UAAU,KAAK,MAAM;AAC5B,UAAO,UAAU,KAAK,MAAM;AAC5B,UAAO,SAAS,gBAAgB,KAAK,MAAM,OAAO;;YAI7C,MAAM,SAAS;AACtB,SAAO,UAAU,KAAK;AACtB,SAAO,UAAU,KAAK;AACtB,SAAO,SAAS,gBAAgB,KAAK,OAAO;OAE5C,QAAO,UAAU,KAAK,UAAU,KAAK;AAIvC,KAAI,CAAC,OAAO,OACV,QAAO,SAAS,gBAAgB,MAAM,OAAO,IAAI,gBAAgB,MAAM,OAAO,OAAO;AAGvF,QAAO;;;;;;;AAQT,eAAsB,iBACpB,UACuB;AACvB,KAAI;EAEF,MAAM,SADc,SAAS,QAAQ,IAAI,eAAe,EAC5B,aAAa,EAAE,SAAS,OAAO;EAC3D,MAAM,QAAQ,SAAS,OAAO;EAC9B,IAAI;AAEJ,MAAI,OACF,KAAI;AACF,eAAY,MAAM,SAAS,MAAM;UAC3B;AAGN,eADY,MAAM,MAAM,MAAM,CAAC,YAAY,GAAG,IAC3B,SAAS;;OAEzB;AACL,eAAY,MAAM,SAAS,MAAM;AACjC,OAAI,CAAC,UAAW,aAAY,SAAS;;EAGvC,MAAM,EAAE,SAAS,SAAS,WAAW,OAAO,cAAc,WACtD,EAAE,SAAS,WAAW,GACtB,oBAAoB,UAAU;AAElC,SAAO,IAAI,aACT,WAAW,iBACX,SAAS,QACT,SACA,OACD;UACM,GAAG;AAEV,SAAO,IAAI,aACT,SAAS,cAAc,iBACvB,SAAS,QACT,EAAE,OAAO,GAAG,CACb;;;;;;;;AASL,SAAgB,mBAAmB,GAA0B;AAC3D,KAAI,aAAa,aACf,QAAO;AAGT,KAAI,aAAa,MACf,QAAO,IAAI,aAAa,EAAE,SAAS,KAAK,EAAE,OAAO,GAAG,CAAC;AAGvD,KAAI,OAAO,MAAM,YAAY,MAAM,MAAM;EACvC,IAAI;AACJ,MAAI;AACF,SAAM,KAAK,UAAU,EAAE;UACjB;AACN,SAAM,OAAO,EAAE;;AAEjB,SAAO,IAAI,aAAa,KAAK,KAAK,EAAE,OAAO,GAAG,CAAC;;AAGjD,QAAO,IAAI,aAAa,OAAO,EAAE,EAAE,IAAI"}
@@ -0,0 +1,58 @@
1
+ import { PollOptions, delay, fetchWithHandling, isEmptyResponse, parseResponse, poll } from "./http-utils.cjs";
2
+
3
+ //#region src/types.d.ts
4
+ interface RequestInit extends Omit<globalThis.RequestInit, "headers"> {
5
+ headers?: Record<string, string>;
6
+ }
7
+ /**
8
+ * Generic Result type for consistent error handling
9
+ * @template T The type of data returned on success
10
+ */
11
+ type Result<T> = {
12
+ data: T;
13
+ success: true;
14
+ } | {
15
+ error: AccountError;
16
+ success: false;
17
+ };
18
+ /**
19
+ * Standard error type for account-related operations
20
+ */
21
+ declare class AccountError extends Error {
22
+ readonly statusCode: number;
23
+ details?: any;
24
+ fields?: Record<string, string>;
25
+ constructor(message: string, statusCode: number, details?: any, fields?: Record<string, string>);
26
+ toJSON(): {
27
+ details: any;
28
+ fields: Record<string, string> | undefined;
29
+ message: string;
30
+ statusCode: number;
31
+ };
32
+ }
33
+ /**
34
+ * Convert a failed fetch Response to an AccountError
35
+ * @param response The failed Response object
36
+ * @returns A properly formatted AccountError
37
+ */
38
+ declare function handleFetchError(response: Response): Promise<AccountError>;
39
+ /**
40
+ * Convert an unknown error to an AccountError
41
+ * @param e The unknown error
42
+ * @returns A properly formatted AccountError
43
+ */
44
+ declare function handleUnknownError(e: unknown): AccountError;
45
+ /**
46
+ * Options for polling/waiting for an operation to complete
47
+ */
48
+ interface OperationPollingOptions {
49
+ /** Polling interval in milliseconds (default: 2000) */
50
+ interval?: number;
51
+ /** Maximum time to wait in milliseconds (default: 300000 = 5 minutes) */
52
+ timeout?: number;
53
+ /** Operation statuses that are considered "settled" (default: ['completed', 'failed', 'error']) */
54
+ settledStates?: string[];
55
+ }
56
+ //#endregion
57
+ export { AccountError, OperationPollingOptions, type PollOptions, RequestInit, Result, delay, fetchWithHandling, handleFetchError, handleUnknownError, isEmptyResponse, parseResponse, poll };
58
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1,239 @@
1
+ //#region src/account/generated/accountAPI.schemas.d.ts
2
+ /**
3
+ * Generated by orval v7.18.0 🍺
4
+ * Do not edit manually.
5
+ * Account API
6
+ * API endpoints for managing user accounts, authentication, and API keys.
7
+ * OpenAPI spec version: develop
8
+ */
9
+ interface APIKeyCreateRequest {
10
+ name: string;
11
+ }
12
+ interface APIKeyResponse {
13
+ created_at: string;
14
+ name: string;
15
+ uuid: BinaryUUID;
16
+ }
17
+ interface APIKeyResponseResponse {
18
+ data: APIKeyResponse;
19
+ total: number;
20
+ }
21
+ interface AccessModel {
22
+ matchers: AccessModelDef;
23
+ policy_definition: AccessModelDef;
24
+ policy_effect: AccessModelDef;
25
+ request_definition: AccessModelDef;
26
+ role_definition: AccessModelDef;
27
+ }
28
+ interface AccessModelDef {
29
+ key: string;
30
+ value: string;
31
+ }
32
+ interface AccessPolicy {
33
+ act: string;
34
+ dom: string;
35
+ obj: string;
36
+ sub: string;
37
+ }
38
+ interface AccountInfoResponse {
39
+ avatar?: string;
40
+ created_at?: string;
41
+ email: string;
42
+ first_name: string;
43
+ id: number;
44
+ last_name: string;
45
+ otp: boolean;
46
+ verified: boolean;
47
+ }
48
+ interface AccountPermissionsResponse {
49
+ model: AccessModel;
50
+ permissions: AccessPolicy[];
51
+ }
52
+ /**
53
+ * @minItems 16
54
+ * @maxItems 16
55
+ */
56
+ type BinUUID = number[];
57
+ interface BinaryUUID {
58
+ BinUUID: BinUUID;
59
+ }
60
+ interface CreateAPIKeyResponse {
61
+ name: string;
62
+ token: string;
63
+ uuid: BinaryUUID;
64
+ }
65
+ interface Error {
66
+ error: string;
67
+ message: string;
68
+ namespace: string;
69
+ }
70
+ interface ErrorResponse {
71
+ error: string;
72
+ }
73
+ interface LoginRequest {
74
+ email: string;
75
+ password: string;
76
+ remember: boolean;
77
+ }
78
+ interface LoginResponse {
79
+ otp?: boolean;
80
+ token: string;
81
+ }
82
+ interface OTPDisableRequest {
83
+ password: string;
84
+ }
85
+ interface OTPGenerateResponse {
86
+ otp: string;
87
+ }
88
+ interface OTPValidateRequest {
89
+ otp: string;
90
+ }
91
+ interface OTPVerifyRequest {
92
+ otp: string;
93
+ }
94
+ interface OperationDetailResponse {
95
+ cid?: string;
96
+ current_step?: number;
97
+ error?: string;
98
+ estimated_completion_at?: string;
99
+ id: number;
100
+ operation: string;
101
+ operation_display_name: string;
102
+ progress_percent: number;
103
+ protocol: string;
104
+ protocol_display_name: string;
105
+ started_at: string;
106
+ status: string;
107
+ status_display_name: string;
108
+ status_message: string;
109
+ total_steps?: number;
110
+ updated_at: string;
111
+ }
112
+ interface OperationFilterItem {
113
+ description?: string;
114
+ name: string;
115
+ value: string;
116
+ }
117
+ interface OperationFiltersResponse {
118
+ data: OperationFiltersResponseData;
119
+ }
120
+ interface OperationFiltersResponseData {
121
+ operations: OperationFilterItem[];
122
+ protocols: OperationFilterItem[];
123
+ statuses: OperationFilterItem[];
124
+ }
125
+ interface OperationFiltersResponseResponse {
126
+ data: OperationFiltersResponse;
127
+ total: number;
128
+ }
129
+ interface OperationListItem {
130
+ cid?: string;
131
+ current_step?: number;
132
+ error?: string;
133
+ estimated_completion_at?: string;
134
+ id: number;
135
+ operation: string;
136
+ operation_display_name: string;
137
+ progress_percent: number;
138
+ protocol: string;
139
+ protocol_display_name: string;
140
+ started_at: string;
141
+ status: string;
142
+ status_display_name: string;
143
+ status_message: string;
144
+ total_steps?: number;
145
+ updated_at: string;
146
+ }
147
+ interface OperationListItemResponse {
148
+ data: OperationListItem[];
149
+ total: number;
150
+ }
151
+ interface PasswordResetRequest {
152
+ email: string;
153
+ }
154
+ interface PasswordResetVerifyRequest {
155
+ email: string;
156
+ password: string;
157
+ token: string;
158
+ }
159
+ interface PongResponse {
160
+ ping: string;
161
+ token: string;
162
+ }
163
+ interface RegisterRequest {
164
+ email: string;
165
+ first_name: string;
166
+ last_name: string;
167
+ password: string;
168
+ }
169
+ interface ResendVerifyEmailRequest {
170
+ email: string;
171
+ }
172
+ /**
173
+ * @minItems 16
174
+ * @maxItems 16
175
+ */
176
+ type Uuid = number[];
177
+ interface UpdateEmailRequest {
178
+ email: string;
179
+ password: string;
180
+ }
181
+ interface UpdatePasswordRequest {
182
+ current_password: string;
183
+ new_password: string;
184
+ }
185
+ interface UpdateProfileRequest {
186
+ first_name?: string;
187
+ last_name?: string;
188
+ }
189
+ interface UploadLimitResponse {
190
+ limit: number;
191
+ }
192
+ interface VerifyEmailRequest {
193
+ email: string;
194
+ token: string;
195
+ }
196
+ type PostApiAccountAvatarBody = {
197
+ file: string;
198
+ };
199
+ type GetApiAccountKeysParams = {
200
+ /**
201
+ * Ending index of the items to return (exclusive). Defaults to 10.
202
+ */
203
+ _end?: number;
204
+ /**
205
+ * Starting index of the items to return (0-based). Defaults to 0.
206
+ */
207
+ _start?: number;
208
+ };
209
+ type PostApiAccountVerifyEmailParams = {
210
+ /**
211
+ * Auto-login user after verification (boolean: true/false; also accepts 1/0).
212
+ */
213
+ login?: string;
214
+ };
215
+ type GetApiOperationsParams = {
216
+ /**
217
+ * Ending index of the items to return (exclusive). Defaults to 10.
218
+ */
219
+ _end?: number;
220
+ /**
221
+ * Comma-separated list of sort orders ('asc' or 'desc') corresponding to _sort fields. Defaults to 'asc'.
222
+ */
223
+ _order?: string;
224
+ /**
225
+ * Comma-separated list of fields to sort by. Available fields: id, operation, protocol, status, status_message, progress_percent, cid, total_steps, current_step, error
226
+ */
227
+ _sort?: string;
228
+ /**
229
+ * Starting index of the items to return (0-based). Defaults to 0.
230
+ */
231
+ _start?: number;
232
+ /**
233
+ * Search term for filename or other relevant operation data
234
+ */
235
+ search?: string;
236
+ };
237
+ //#endregion
238
+ export { APIKeyCreateRequest, APIKeyResponse, APIKeyResponseResponse, AccessModel, AccessModelDef, AccessPolicy, AccountInfoResponse, AccountPermissionsResponse, BinUUID, BinaryUUID, CreateAPIKeyResponse, Error, ErrorResponse, GetApiAccountKeysParams, GetApiOperationsParams, LoginRequest, LoginResponse, OTPDisableRequest, OTPGenerateResponse, OTPValidateRequest, OTPVerifyRequest, OperationDetailResponse, OperationFilterItem, OperationFiltersResponse, OperationFiltersResponseData, OperationFiltersResponseResponse, OperationListItem, OperationListItemResponse, PasswordResetRequest, PasswordResetVerifyRequest, PongResponse, PostApiAccountAvatarBody, PostApiAccountVerifyEmailParams, RegisterRequest, ResendVerifyEmailRequest, UpdateEmailRequest, UpdatePasswordRequest, UpdateProfileRequest, UploadLimitResponse, Uuid, VerifyEmailRequest };
239
+ //# sourceMappingURL=accountAPI.schemas.d.ts.map