mtlx-sdk 0.0.0-bootstrap.0 → 0.10.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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +175 -0
  3. package/dist/client.d.ts +67 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +141 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/index.d.ts +26 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +26 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/lib/buildPath.d.ts +19 -0
  12. package/dist/lib/buildPath.d.ts.map +1 -0
  13. package/dist/lib/buildPath.js +46 -0
  14. package/dist/lib/buildPath.js.map +1 -0
  15. package/dist/lib/dashboardLinks.d.ts +19 -0
  16. package/dist/lib/dashboardLinks.d.ts.map +1 -0
  17. package/dist/lib/dashboardLinks.js +37 -0
  18. package/dist/lib/dashboardLinks.js.map +1 -0
  19. package/dist/lib/enums.d.ts +41 -0
  20. package/dist/lib/enums.d.ts.map +1 -0
  21. package/dist/lib/enums.js +293 -0
  22. package/dist/lib/enums.js.map +1 -0
  23. package/dist/lib/eventRouter.d.ts +41 -0
  24. package/dist/lib/eventRouter.d.ts.map +1 -0
  25. package/dist/lib/eventRouter.js +43 -0
  26. package/dist/lib/eventRouter.js.map +1 -0
  27. package/dist/lib/fetchBinary.d.ts +15 -0
  28. package/dist/lib/fetchBinary.d.ts.map +1 -0
  29. package/dist/lib/fetchBinary.js +35 -0
  30. package/dist/lib/fetchBinary.js.map +1 -0
  31. package/dist/lib/fileFormats.d.ts +67 -0
  32. package/dist/lib/fileFormats.d.ts.map +1 -0
  33. package/dist/lib/fileFormats.js +92 -0
  34. package/dist/lib/fileFormats.js.map +1 -0
  35. package/dist/lib/list.d.ts +59 -0
  36. package/dist/lib/list.d.ts.map +1 -0
  37. package/dist/lib/list.js +53 -0
  38. package/dist/lib/list.js.map +1 -0
  39. package/dist/lib/parseResult.d.ts +14 -0
  40. package/dist/lib/parseResult.d.ts.map +1 -0
  41. package/dist/lib/parseResult.js +13 -0
  42. package/dist/lib/parseResult.js.map +1 -0
  43. package/dist/lib/schemas.d.ts +48 -0
  44. package/dist/lib/schemas.d.ts.map +1 -0
  45. package/dist/lib/schemas.js +43 -0
  46. package/dist/lib/schemas.js.map +1 -0
  47. package/dist/lib/types.d.ts +46 -0
  48. package/dist/lib/types.d.ts.map +1 -0
  49. package/dist/lib/types.js +22 -0
  50. package/dist/lib/types.js.map +1 -0
  51. package/dist/lib/upload.d.ts +36 -0
  52. package/dist/lib/upload.d.ts.map +1 -0
  53. package/dist/lib/upload.js +79 -0
  54. package/dist/lib/upload.js.map +1 -0
  55. package/dist/lib/url.d.ts +7 -0
  56. package/dist/lib/url.d.ts.map +1 -0
  57. package/dist/lib/url.js +26 -0
  58. package/dist/lib/url.js.map +1 -0
  59. package/dist/routes/apiTokens.d.ts +172 -0
  60. package/dist/routes/apiTokens.d.ts.map +1 -0
  61. package/dist/routes/apiTokens.js +133 -0
  62. package/dist/routes/apiTokens.js.map +1 -0
  63. package/dist/routes/assets.d.ts +545 -0
  64. package/dist/routes/assets.d.ts.map +1 -0
  65. package/dist/routes/assets.js +275 -0
  66. package/dist/routes/assets.js.map +1 -0
  67. package/dist/routes/auth.d.ts +102 -0
  68. package/dist/routes/auth.d.ts.map +1 -0
  69. package/dist/routes/auth.js +98 -0
  70. package/dist/routes/auth.js.map +1 -0
  71. package/dist/routes/avatars.d.ts +130 -0
  72. package/dist/routes/avatars.d.ts.map +1 -0
  73. package/dist/routes/avatars.js +121 -0
  74. package/dist/routes/avatars.js.map +1 -0
  75. package/dist/routes/comments.d.ts +165 -0
  76. package/dist/routes/comments.d.ts.map +1 -0
  77. package/dist/routes/comments.js +106 -0
  78. package/dist/routes/comments.js.map +1 -0
  79. package/dist/routes/error.d.ts +10 -0
  80. package/dist/routes/error.d.ts.map +1 -0
  81. package/dist/routes/error.js +12 -0
  82. package/dist/routes/error.js.map +1 -0
  83. package/dist/routes/files.d.ts +70 -0
  84. package/dist/routes/files.d.ts.map +1 -0
  85. package/dist/routes/files.js +80 -0
  86. package/dist/routes/files.js.map +1 -0
  87. package/dist/routes/health.d.ts +10 -0
  88. package/dist/routes/health.d.ts.map +1 -0
  89. package/dist/routes/health.js +12 -0
  90. package/dist/routes/health.js.map +1 -0
  91. package/dist/routes/media.d.ts +22 -0
  92. package/dist/routes/media.d.ts.map +1 -0
  93. package/dist/routes/media.js +18 -0
  94. package/dist/routes/media.js.map +1 -0
  95. package/dist/routes/notifications.d.ts +164 -0
  96. package/dist/routes/notifications.d.ts.map +1 -0
  97. package/dist/routes/notifications.js +97 -0
  98. package/dist/routes/notifications.js.map +1 -0
  99. package/dist/routes/oembed.d.ts +80 -0
  100. package/dist/routes/oembed.d.ts.map +1 -0
  101. package/dist/routes/oembed.js +74 -0
  102. package/dist/routes/oembed.js.map +1 -0
  103. package/dist/routes/serverEvents.d.ts +521 -0
  104. package/dist/routes/serverEvents.d.ts.map +1 -0
  105. package/dist/routes/serverEvents.js +136 -0
  106. package/dist/routes/serverEvents.js.map +1 -0
  107. package/dist/routes/tasks.d.ts +242 -0
  108. package/dist/routes/tasks.d.ts.map +1 -0
  109. package/dist/routes/tasks.js +185 -0
  110. package/dist/routes/tasks.js.map +1 -0
  111. package/dist/routes/users.d.ts +1055 -0
  112. package/dist/routes/users.d.ts.map +1 -0
  113. package/dist/routes/users.js +233 -0
  114. package/dist/routes/users.js.map +1 -0
  115. package/package.json +46 -4
@@ -0,0 +1,275 @@
1
+ import { AxiosError } from 'axios';
2
+ import * as z from 'zod';
3
+ import { parseResult } from '../client.js';
4
+ import { buildPath } from '../lib/buildPath.js';
5
+ import { Enums } from '../lib/enums.js';
6
+ import { createSortingOptionalSchema, listResultSchema, paginationOptionalSchema } from '../lib/list.js';
7
+ import { aiUsageSchema, assetNameSchema, assetParamsSchema, assetVisibilitySchema, booleanPropSchema, descriptionSchema, userNameParamsSchema, } from '../lib/schemas.js';
8
+ import { ImageTransformOptionsSchema } from '../lib/types.js';
9
+ export const materialInfoSchema = z.object({
10
+ version: z.string().optional(),
11
+ colorspace: z.string().optional(),
12
+ materials: z.array(z.object({ name: z.string().optional(), category: z.string() })),
13
+ nodeGraphCount: z.number().int(),
14
+ topLevelNodeCount: z.number().int(),
15
+ referencedTextures: z.array(z.string()),
16
+ warnings: z.array(z.string()),
17
+ });
18
+ export const assetSchema = z.object({
19
+ id: z.number().int(),
20
+ name: z.string(),
21
+ type: z.enum(Enums.AssetType),
22
+ visibility: assetVisibilitySchema,
23
+ userId: z.number().int(),
24
+ userName: z.string(),
25
+ description: z.string(),
26
+ keywords: z.string(),
27
+ shareLicense: z.enum(Enums.ShareLicense),
28
+ aiUsage: aiUsageSchema,
29
+ commentMode: z.enum(Enums.CommentMode),
30
+ reported: z.boolean(),
31
+ likeCount: z.int(),
32
+ shareCount: z.int(),
33
+ createdAt: z.iso.datetime(),
34
+ updatedAt: z.iso.datetime(),
35
+ archived: z.boolean(),
36
+ metadata: z.string().max(10_240),
37
+ versionOriginalSize: z.number().int().nullable().optional(),
38
+ width: z.number().nullable().optional(),
39
+ height: z.number().nullable().optional(),
40
+ depth: z.number().nullable().optional(),
41
+ fileOid: z.string(),
42
+ thumbnailOid: z.string().nullable().optional(),
43
+ materialInfo: materialInfoSchema.optional(),
44
+ });
45
+ export const getAssetThumbnailParamsSchema = assetParamsSchema;
46
+ export const getAssetThumbnailQuerySchema = ImageTransformOptionsSchema.merge(z.strictObject({
47
+ redirectOnNotFound: z.url().optional().describe('The URL to redirect if the asset is not found'),
48
+ }));
49
+ export const listAssetsSortFields = ['createdAt', 'updatedAt', 'name', 'likeCount', 'shareCount'];
50
+ export const listAssetsQuerySchema = paginationOptionalSchema
51
+ .merge(createSortingOptionalSchema(listAssetsSortFields))
52
+ .merge(z.strictObject({
53
+ visibility: assetVisibilitySchema.optional().describe('Filter by visibility (PUBLIC or PRIVATE)'),
54
+ searchText: z.string().max(256).optional().describe('Search text to filter assets by name or description'),
55
+ type: z.enum(Enums.AssetType).optional().describe('Filter by asset type'),
56
+ userName: z.string().max(100).optional().describe('Filter by username'),
57
+ archived: booleanPropSchema
58
+ .optional()
59
+ .describe('Filter by archived status (true for archived, false for non-archived)'),
60
+ }));
61
+ export const listAssetsResultSchema = listResultSchema(assetSchema);
62
+ export const listAssetPropsSchema = z.object({ query: listAssetsQuerySchema }).strict();
63
+ /** @internal */
64
+ export const listAssetSortFields = listAssetsSortFields;
65
+ /** @internal */
66
+ export const listAssetDefaultSort = {
67
+ sortBy: 'createdAt',
68
+ sortDir: 'desc',
69
+ };
70
+ /**
71
+ * Lists assets with optional filtering and pagination.
72
+ *
73
+ * @operationId list-assets
74
+ * @param client - The API client instance
75
+ * @param props - The request properties
76
+ * @param props.query - Query parameters for filtering, pagination, and sorting
77
+ * @returns Promise resolving to a paginated list of assets
78
+ * @example
79
+ * ```typescript
80
+ * const assets = await listAssets(client, {
81
+ * query: { visibility: 'PUBLIC', pageOffset: 0, pageSize: 20 }
82
+ * });
83
+ * ```
84
+ */
85
+ export const listAssets = async (client, props) => {
86
+ const { query } = listAssetPropsSchema.parse(props);
87
+ const path = '/assets';
88
+ const response = await client.axios.get(path, {
89
+ params: query,
90
+ });
91
+ return parseResult(client, listAssetsResultSchema, response.data);
92
+ };
93
+ export const createAssetParamsSchema = userNameParamsSchema;
94
+ export const createAssetBodySchema = z.strictObject({
95
+ name: assetNameSchema.describe('The name of the asset'),
96
+ description: descriptionSchema.optional().describe('Optional description of the asset'),
97
+ type: z.enum(Enums.AssetType).describe('The type of asset'),
98
+ uploadToken: z.string().describe('The upload token from prepareAssetUpload'),
99
+ visibility: assetVisibilitySchema.describe('Visibility level: PUBLIC (anyone can view) or PRIVATE (members only)'),
100
+ shareLicense: z.enum(Enums.ShareLicense).describe('The license for sharing the asset'),
101
+ aiUsage: aiUsageSchema.optional().describe('Optional AI usage policy'),
102
+ commentMode: z.enum(Enums.CommentMode).optional().describe('Comment mode: ENABLED (default), MEMBERS_ONLY, or NONE'),
103
+ metadata: z.string().max(10_240).optional().describe('Optional metadata as a string (max 10240 characters)'),
104
+ });
105
+ export const createAssetPropsSchema = z
106
+ .object({ params: createAssetParamsSchema, body: createAssetBodySchema })
107
+ .strict();
108
+ /**
109
+ * Creates a new asset for a user.
110
+ *
111
+ * @operationId create-asset
112
+ * @param client - The API client instance
113
+ * @param props - The request properties
114
+ * @param props.params - Path parameters (userName)
115
+ * @param props.body - Request body with asset details
116
+ * @returns Promise resolving to the created asset
117
+ * @example
118
+ * ```typescript
119
+ * const asset = await createAsset(client, {
120
+ * params: { userName: 'my-user' },
121
+ * body: {
122
+ * name: 'my-asset',
123
+ * type: 'MATERIAL',
124
+ * uploadToken: '...',
125
+ * visibility: 'PUBLIC',
126
+ * shareLicense: 'CC_BY'
127
+ * }
128
+ * });
129
+ * ```
130
+ */
131
+ export const createAsset = async (client, props) => {
132
+ const { params, body } = createAssetPropsSchema.parse(props);
133
+ const path = buildPath('/assets/$userName', params);
134
+ const response = await client.axios.post(path, body);
135
+ return parseResult(client, assetSchema, response.data);
136
+ };
137
+ export const getAssetParamsSchema = assetParamsSchema;
138
+ export const getAssetPropsSchema = z.object({ params: getAssetParamsSchema }).strict();
139
+ /**
140
+ * Gets asset metadata by user and asset names.
141
+ *
142
+ * @operationId get-asset-metadata
143
+ * @param client - The API client instance
144
+ * @param props - The request properties
145
+ * @param props.params - Path parameters (userName, assetName)
146
+ * @returns Promise resolving to the asset metadata
147
+ * @example
148
+ * ```typescript
149
+ * const asset = await getAsset(client, {
150
+ * params: { userName: 'my-user', assetName: 'my-asset' }
151
+ * });
152
+ * ```
153
+ */
154
+ export const getAsset = async (client, props) => {
155
+ const { params } = getAssetPropsSchema.parse(props);
156
+ const path = buildPath('/assets/$userName/$assetName', params);
157
+ const response = await client.axios.get(path);
158
+ return parseResult(client, assetSchema, response.data);
159
+ };
160
+ export const assetExists = async (client, props) => {
161
+ const { params } = getAssetPropsSchema.parse(props);
162
+ const path = buildPath('/assets/$userName/$assetName', params);
163
+ try {
164
+ await client.axios.get(path);
165
+ return true;
166
+ }
167
+ catch (error) {
168
+ if (error instanceof AxiosError && error.response?.status === 404) {
169
+ return false;
170
+ }
171
+ throw error;
172
+ }
173
+ };
174
+ export const updateAssetParamsSchema = assetParamsSchema;
175
+ export const updateAssetBodySchema = z.strictObject({
176
+ name: assetNameSchema.optional().describe('Optional name of the asset, to rename asset'),
177
+ description: descriptionSchema.optional().describe('Optional description of the asset'),
178
+ keywords: z.string().max(10_240).optional().describe('Optional keywords of the asset'),
179
+ visibility: assetVisibilitySchema.optional().describe('Optional visibility of the asset'),
180
+ shareLicense: z.enum(Enums.ShareLicense).optional().describe('Optional share license of the asset'),
181
+ aiUsage: aiUsageSchema.optional().describe('Optional AI usage policy of the asset'),
182
+ commentMode: z.enum(Enums.CommentMode).optional().describe('Optional comment mode: ENABLED, MEMBERS_ONLY, or NONE'),
183
+ archived: z.boolean().optional().describe('Optional archived status (true to archive, false to unarchive)'),
184
+ metadata: z.string().max(10_240).optional().describe('Optional metadata as a string (max 10240 characters)'),
185
+ uploadToken: z
186
+ .string()
187
+ .optional()
188
+ .describe("Optional upload token from prepare-upload endpoint to update the asset's file content"),
189
+ });
190
+ export const updateAssetPropsSchema = z
191
+ .object({ params: updateAssetParamsSchema, body: updateAssetBodySchema })
192
+ .strict();
193
+ /**
194
+ * Updates an asset's metadata.
195
+ *
196
+ * @operationId update-asset
197
+ * @param client - The API client instance
198
+ * @param props - The request properties
199
+ * @param props.params - Path parameters (userName, assetName)
200
+ * @param props.body - Request body with fields to update
201
+ * @returns Promise resolving to the updated asset
202
+ * @example
203
+ * ```typescript
204
+ * const asset = await updateAsset(client, {
205
+ * params: { userName: 'my-user', assetName: 'my-asset' },
206
+ * body: { description: 'Updated description' }
207
+ * });
208
+ * ```
209
+ */
210
+ export const updateAsset = async (client, props) => {
211
+ const { params, body } = updateAssetPropsSchema.parse(props);
212
+ const path = buildPath('/assets/$userName/$assetName', params);
213
+ const response = await client.axios.patch(path, body);
214
+ return parseResult(client, assetSchema, response.data);
215
+ };
216
+ export const deleteAssetParamsSchema = assetParamsSchema;
217
+ export const deleteAssetResultSchema = z.void();
218
+ export const deleteAssetPropsSchema = z.object({ params: deleteAssetParamsSchema }).strict();
219
+ /**
220
+ * Deletes an asset.
221
+ *
222
+ * @operationId delete-asset
223
+ * @param client - The API client instance
224
+ * @param props - The request properties
225
+ * @param props.params - Path parameters (userName, assetName)
226
+ * @returns Promise that resolves when the asset is deleted
227
+ * @example
228
+ * ```typescript
229
+ * await deleteAsset(client, {
230
+ * params: { userName: 'my-user', assetName: 'my-asset' }
231
+ * });
232
+ * ```
233
+ */
234
+ export const deleteAsset = async (client, props) => {
235
+ const { params } = deleteAssetPropsSchema.parse(props);
236
+ const path = buildPath('/assets/$userName/$assetName', params);
237
+ await client.axios.delete(path);
238
+ };
239
+ export const prepareAssetUploadParamsSchema = userNameParamsSchema;
240
+ export const prepareAssetUploadBodySchema = z.strictObject({
241
+ filename: z.string().min(1).max(255).describe('The filename of the asset'),
242
+ contentType: z.string().min(1).max(255).describe('The content type of the asset'),
243
+ size: z.number().int().positive().describe('The size of the asset'),
244
+ });
245
+ export const prepareAssetUploadResultSchema = z.strictObject({
246
+ uploadUrl: z.url(),
247
+ uploadToken: z.string(),
248
+ });
249
+ export const prepareAssetUploadPropsSchema = z
250
+ .object({ params: prepareAssetUploadParamsSchema, body: prepareAssetUploadBodySchema })
251
+ .strict();
252
+ /**
253
+ * Prepares an asset upload by generating an upload URL and token.
254
+ *
255
+ * @operationId prepare-asset-upload
256
+ * @param client - The API client instance
257
+ * @param props - The request properties
258
+ * @param props.params - Path parameters (userName)
259
+ * @param props.body - Request body with file information
260
+ * @returns Promise resolving to upload URL, token, and user upload ID
261
+ * @example
262
+ * ```typescript
263
+ * const upload = await prepareAssetUpload(client, {
264
+ * params: { userName: 'my-user' },
265
+ * body: { filename: 'copper.mtlx.zip', contentType: 'application/zip', size: 1024000 }
266
+ * });
267
+ * ```
268
+ */
269
+ export const prepareAssetUpload = async (client, props) => {
270
+ const { params, body } = prepareAssetUploadPropsSchema.parse(props);
271
+ const path = buildPath('/assets/$userName/prepare-upload', params);
272
+ const response = await client.axios.post(path, body);
273
+ return parseResult(client, prepareAssetUploadResultSchema, response.data);
274
+ };
275
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sources":["../../src/routes/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnF,cAAc,EAAE,CAAC,CAAC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C;IACnE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrD,OAAO,WAAW,CAAC,MAAM,EAAE,8BAA8B,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC,CAAC"}
@@ -0,0 +1,102 @@
1
+ import * as z from 'zod';
2
+ import type { ApiClient } from '../client.js';
3
+ export declare const refreshAccessTokenBodySchema: z.ZodObject<{
4
+ refreshToken: z.ZodString;
5
+ }, z.core.$strict>;
6
+ export type RefreshAccessTokenBody = z.infer<typeof refreshAccessTokenBodySchema>;
7
+ export declare const refreshAccessTokenResultSchema: z.ZodObject<{
8
+ accessToken: z.ZodString;
9
+ }, z.core.$strict>;
10
+ export type RefreshAccessTokenResult = z.infer<typeof refreshAccessTokenResultSchema>;
11
+ export declare const refreshAccessTokenPropsSchema: z.ZodObject<{
12
+ body: z.ZodObject<{
13
+ refreshToken: z.ZodString;
14
+ }, z.core.$strict>;
15
+ }, z.core.$strict>;
16
+ export type RefreshAccessTokenProps = z.infer<typeof refreshAccessTokenPropsSchema>;
17
+ /**
18
+ * Refreshes an access token using a refresh token.
19
+ * The token type is automatically inferred from the token prefix:
20
+ * - `ut_` prefix for session tokens
21
+ * - `st_` prefix for API tokens
22
+ *
23
+ * @operationId refresh-access-token
24
+ * @param host - The API host URL
25
+ * @param props - The request properties
26
+ * @param props.body - Request body with refresh token (type is inferred from prefix)
27
+ * @returns Promise resolving to a new access token
28
+ */
29
+ export declare const refreshAccessToken: (host: string, props: RefreshAccessTokenProps, validateResults?: boolean) => Promise<RefreshAccessTokenResult>;
30
+ export declare const oauthTokenRequestBodySchema: z.ZodObject<{
31
+ grant_type: z.ZodLiteral<"authorization_code">;
32
+ code: z.ZodString;
33
+ client_id: z.ZodString;
34
+ code_verifier: z.ZodString;
35
+ redirect_uri: z.ZodURL;
36
+ client_secret: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$strict>;
38
+ export type OAuthTokenRequestBody = z.infer<typeof oauthTokenRequestBodySchema>;
39
+ export declare const oauthTokenResultSchema: z.ZodObject<{
40
+ access_token: z.ZodString;
41
+ refresh_token: z.ZodString;
42
+ token_type: z.ZodLiteral<"Bearer">;
43
+ expires_in: z.ZodNumber;
44
+ }, z.core.$strict>;
45
+ export type OAuthTokenResult = z.infer<typeof oauthTokenResultSchema>;
46
+ export declare const exchangeAuthorizationCodePropsSchema: z.ZodObject<{
47
+ body: z.ZodObject<{
48
+ grant_type: z.ZodLiteral<"authorization_code">;
49
+ code: z.ZodString;
50
+ client_id: z.ZodString;
51
+ code_verifier: z.ZodString;
52
+ redirect_uri: z.ZodURL;
53
+ client_secret: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strict>;
55
+ }, z.core.$strict>;
56
+ export type ExchangeAuthorizationCodeProps = z.infer<typeof exchangeAuthorizationCodePropsSchema>;
57
+ /**
58
+ * Exchange an authorization code for access and refresh tokens (OAuth 2.0).
59
+ *
60
+ * @operationId oauth-token
61
+ * @param host - The API host URL
62
+ * @param props - The request properties
63
+ * @param props.body - Request body with grant_type, code, client_id, code_verifier, and redirect_uri
64
+ * @returns Promise resolving to access_token, refresh_token, token_type, and expires_in
65
+ */
66
+ export declare const exchangeAuthorizationCode: (host: string, props: ExchangeAuthorizationCodeProps, validateResults?: boolean) => Promise<OAuthTokenResult>;
67
+ export declare const oauthConsentBodySchema: z.ZodObject<{
68
+ client_id: z.ZodString;
69
+ redirect_uri: z.ZodURL;
70
+ response_type: z.ZodLiteral<"code">;
71
+ scope: z.ZodString;
72
+ state: z.ZodString;
73
+ code_challenge: z.ZodString;
74
+ code_challenge_method: z.ZodLiteral<"S256">;
75
+ action: z.ZodEnum<{
76
+ APPROVE: "APPROVE";
77
+ DENY: "DENY";
78
+ }>;
79
+ session_token: z.ZodString;
80
+ }, z.core.$strict>;
81
+ export type OAuthConsentBody = z.infer<typeof oauthConsentBodySchema>;
82
+ export declare const deleteRefreshTokenParamsSchema: z.ZodObject<{
83
+ token: z.ZodString;
84
+ }, z.core.$strict>;
85
+ export type DeleteRefreshTokenParams = z.infer<typeof deleteRefreshTokenParamsSchema>;
86
+ export declare const deleteRefreshTokenPropsSchema: z.ZodObject<{
87
+ params: z.ZodObject<{
88
+ token: z.ZodString;
89
+ }, z.core.$strict>;
90
+ }, z.core.$strict>;
91
+ export type DeleteRefreshTokenProps = z.infer<typeof deleteRefreshTokenPropsSchema>;
92
+ /**
93
+ * Deletes a refresh token (session) by invalidating it.
94
+ *
95
+ * @operationId delete-refresh-token
96
+ * @param client - The API client instance
97
+ * @param props - The request properties
98
+ * @param props.params - Path parameters (token)
99
+ * @returns Promise that resolves when the refresh token is deleted
100
+ */
101
+ export declare const deleteRefreshToken: (client: ApiClient, props: DeleteRefreshTokenProps) => Promise<void>;
102
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sources":["../../src/routes/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,eAAO,MAAM,4BAA4B;;kBAMvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,8BAA8B;;kBAEzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,6BAA6B;;;;kBAA4D,CAAC;AACvG,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,SACvB,MAAM,SACL,uBAAuB,gCAE7B,OAAO,CAAC,wBAAwB,CAOlC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;kBAOtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,sBAAsB;;;;;kBAKjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,oCAAoC;;;;;;;;;kBAA2D,CAAC;AAC7G,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,SAC9B,MAAM,SACL,8BAA8B,gCAEpC,OAAO,CAAC,gBAAgB,CAW1B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;kBAUjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,8BAA8B;;kBAEzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,6BAA6B;;;;kBAAgE,CAAC;AAC3G,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,WAAkB,SAAS,SAAS,uBAAuB,KAAG,OAAO,CAAC,IAAI,CAIxG,CAAC"}
@@ -0,0 +1,98 @@
1
+ import axios from 'axios';
2
+ import * as z from 'zod';
3
+ import { buildPath } from '../lib/buildPath.js';
4
+ export const refreshAccessTokenBodySchema = z.strictObject({
5
+ refreshToken: z
6
+ .string()
7
+ .describe('The refresh token to use for refreshing the access token (must start with "ut_" for session tokens or "st_" for API tokens)'),
8
+ });
9
+ export const refreshAccessTokenResultSchema = z.strictObject({
10
+ accessToken: z.string(),
11
+ });
12
+ export const refreshAccessTokenPropsSchema = z.object({ body: refreshAccessTokenBodySchema }).strict();
13
+ /**
14
+ * Refreshes an access token using a refresh token.
15
+ * The token type is automatically inferred from the token prefix:
16
+ * - `ut_` prefix for session tokens
17
+ * - `st_` prefix for API tokens
18
+ *
19
+ * @operationId refresh-access-token
20
+ * @param host - The API host URL
21
+ * @param props - The request properties
22
+ * @param props.body - Request body with refresh token (type is inferred from prefix)
23
+ * @returns Promise resolving to a new access token
24
+ */
25
+ export const refreshAccessToken = async (host, props, validateResults = false) => {
26
+ const { body } = refreshAccessTokenPropsSchema.parse(props);
27
+ const response = await axios.post(`${host}/auth/refresh-access-token`, body);
28
+ if (validateResults) {
29
+ return refreshAccessTokenResultSchema.parse(response.data);
30
+ }
31
+ return response.data;
32
+ };
33
+ export const oauthTokenRequestBodySchema = z.strictObject({
34
+ grant_type: z.literal('authorization_code'),
35
+ code: z.string(),
36
+ client_id: z.string(),
37
+ code_verifier: z.string(),
38
+ redirect_uri: z.url(),
39
+ client_secret: z.string().optional(),
40
+ });
41
+ export const oauthTokenResultSchema = z.strictObject({
42
+ access_token: z.string(),
43
+ refresh_token: z.string(),
44
+ token_type: z.literal('Bearer'),
45
+ expires_in: z.number(),
46
+ });
47
+ export const exchangeAuthorizationCodePropsSchema = z.object({ body: oauthTokenRequestBodySchema }).strict();
48
+ /**
49
+ * Exchange an authorization code for access and refresh tokens (OAuth 2.0).
50
+ *
51
+ * @operationId oauth-token
52
+ * @param host - The API host URL
53
+ * @param props - The request properties
54
+ * @param props.body - Request body with grant_type, code, client_id, code_verifier, and redirect_uri
55
+ * @returns Promise resolving to access_token, refresh_token, token_type, and expires_in
56
+ */
57
+ export const exchangeAuthorizationCode = async (host, props, validateResults = false) => {
58
+ const { body } = exchangeAuthorizationCodePropsSchema.parse(props);
59
+ const response = await axios.post(`${host}/auth/token`, body, {
60
+ headers: {
61
+ 'Content-Type': 'application/json',
62
+ },
63
+ });
64
+ if (validateResults) {
65
+ return oauthTokenResultSchema.parse(response.data);
66
+ }
67
+ return response.data;
68
+ };
69
+ export const oauthConsentBodySchema = z.strictObject({
70
+ client_id: z.string(),
71
+ redirect_uri: z.url(),
72
+ response_type: z.literal('code'),
73
+ scope: z.string(),
74
+ state: z.string(),
75
+ code_challenge: z.string(),
76
+ code_challenge_method: z.literal('S256'),
77
+ action: z.enum(['APPROVE', 'DENY']),
78
+ session_token: z.string(),
79
+ });
80
+ export const deleteRefreshTokenParamsSchema = z.strictObject({
81
+ token: z.string().describe('The refresh token to delete'),
82
+ });
83
+ export const deleteRefreshTokenPropsSchema = z.object({ params: deleteRefreshTokenParamsSchema }).strict();
84
+ /**
85
+ * Deletes a refresh token (session) by invalidating it.
86
+ *
87
+ * @operationId delete-refresh-token
88
+ * @param client - The API client instance
89
+ * @param props - The request properties
90
+ * @param props.params - Path parameters (token)
91
+ * @returns Promise that resolves when the refresh token is deleted
92
+ */
93
+ export const deleteRefreshToken = async (client, props) => {
94
+ const { params } = deleteRefreshTokenPropsSchema.parse(props);
95
+ const path = buildPath('/auth/refresh-token/$token', params);
96
+ await client.axios.delete(path);
97
+ };
98
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sources":["../../src/routes/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IACzD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,CACP,6HAA6H,CAC9H;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC3D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,C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AAG,CAAC,CAAC,YAAY,CAAC;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC1D,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG3G;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAiB,EAAE,KAA8B,EAAiB,EAAE;IAC3G,MAAM,EAAE,MAAM,EAAE,GAAG,6BAA6B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,SAAS,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IAC7D,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC"}
@@ -0,0 +1,130 @@
1
+ import * as z from 'zod';
2
+ import type { ApiClient } from '../client.js';
3
+ import { type BinaryResponse, type BinaryResponseType } from '../lib/types.js';
4
+ export declare const uploadAvatarQuerySchema: z.ZodObject<{
5
+ userName: z.ZodString;
6
+ }, z.core.$strict>;
7
+ export type UploadAvatarQuery = z.infer<typeof uploadAvatarQuerySchema>;
8
+ export declare const uploadAvatarBodySchema: z.ZodObject<{
9
+ file: z.ZodInstanceOf<File>;
10
+ }, z.core.$strict>;
11
+ export type UploadAvatarBody = z.infer<typeof uploadAvatarBodySchema>;
12
+ export declare const uploadAvatarPropsSchema: z.ZodObject<{
13
+ query: z.ZodObject<{
14
+ userName: z.ZodString;
15
+ }, z.core.$strict>;
16
+ body: z.ZodObject<{
17
+ file: z.ZodInstanceOf<File>;
18
+ }, z.core.$strict>;
19
+ }, z.core.$strict>;
20
+ export type UploadAvatarProps = z.infer<typeof uploadAvatarPropsSchema>;
21
+ /**
22
+ * Uploads an avatar for a user.
23
+ *
24
+ * @operationId upload-avatar
25
+ * @param client - The API client instance
26
+ * @param props - The request properties
27
+ * @param props.query - Query parameters (userName)
28
+ * @param props.body - Request body containing the file to upload
29
+ * @returns Promise that resolves when the avatar is uploaded
30
+ * @example
31
+ * ```typescript
32
+ * await uploadAvatar(client, {
33
+ * query: { userName: 'my-user' },
34
+ * body: { file: avatarFile }
35
+ * });
36
+ * ```
37
+ */
38
+ export declare const uploadAvatar: (client: ApiClient, props: UploadAvatarProps) => Promise<void>;
39
+ export declare const getAvatarQuerySchema: z.ZodObject<{
40
+ width: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
41
+ height: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
42
+ quality: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
43
+ format: z.ZodOptional<z.ZodEnum<{
44
+ avif: "avif";
45
+ jpg: "jpg";
46
+ png: "png";
47
+ webp: "webp";
48
+ }>>;
49
+ redirectOnNotFound: z.ZodOptional<z.ZodURL>;
50
+ cacheKey: z.ZodOptional<z.ZodString>;
51
+ userName: z.ZodString;
52
+ }, z.core.$strict>;
53
+ export type GetAvatarQuery = z.infer<typeof getAvatarQuerySchema>;
54
+ export declare const getAvatarPropsSchema: z.ZodObject<{
55
+ query: z.ZodObject<{
56
+ width: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
57
+ height: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
58
+ quality: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
59
+ format: z.ZodOptional<z.ZodEnum<{
60
+ avif: "avif";
61
+ jpg: "jpg";
62
+ png: "png";
63
+ webp: "webp";
64
+ }>>;
65
+ redirectOnNotFound: z.ZodOptional<z.ZodURL>;
66
+ cacheKey: z.ZodOptional<z.ZodString>;
67
+ userName: z.ZodString;
68
+ }, z.core.$strict>;
69
+ }, z.core.$strict>;
70
+ export type GetAvatarProps = z.infer<typeof getAvatarPropsSchema>;
71
+ /**
72
+ * Gets the URL for an avatar.
73
+ *
74
+ * @operationId get-avatar
75
+ * @param client - The API client instance
76
+ * @param props - The request properties
77
+ * @param props.query - Query parameters (userName, image transform options)
78
+ * @returns URL object for the avatar
79
+ * @example
80
+ * ```typescript
81
+ * const avatarUrl = getAvatarUrl(client, {
82
+ * query: { userName: 'my-user', width: 200, height: 200 }
83
+ * });
84
+ * ```
85
+ */
86
+ export declare const getAvatarUrl: (client: ApiClient, props: GetAvatarProps) => URL;
87
+ /**
88
+ * Gets avatar binary data.
89
+ *
90
+ * @operationId get-avatar
91
+ * @param client - The API client instance
92
+ * @param props - The request properties
93
+ * @param props.query - Query parameters (userName, image transform options)
94
+ * @param binaryResponse - Optional binary response type configuration
95
+ * @returns Promise resolving to the avatar binary data
96
+ * @example
97
+ * ```typescript
98
+ * const avatarData = await getAvatar(client, {
99
+ * query: { userName: 'my-user', width: 200, height: 200 }
100
+ * });
101
+ * ```
102
+ */
103
+ export declare const getAvatar: <T extends BinaryResponse>(client: ApiClient, props: GetAvatarProps, binaryResponse?: T) => Promise<BinaryResponseType<T>>;
104
+ export declare const deleteAvatarQuerySchema: z.ZodObject<{
105
+ userName: z.ZodString;
106
+ }, z.core.$strict>;
107
+ export type DeleteAvatarQuery = z.infer<typeof deleteAvatarQuerySchema>;
108
+ export declare const deleteAvatarPropsSchema: z.ZodObject<{
109
+ query: z.ZodObject<{
110
+ userName: z.ZodString;
111
+ }, z.core.$strict>;
112
+ }, z.core.$strict>;
113
+ export type DeleteAvatarProps = z.infer<typeof deleteAvatarPropsSchema>;
114
+ /**
115
+ * Deletes a user's avatar.
116
+ *
117
+ * @operationId delete-avatar
118
+ * @param client - The API client instance
119
+ * @param props - The request properties
120
+ * @param props.query - Query parameters (userName)
121
+ * @returns Promise that resolves when the avatar is deleted
122
+ * @example
123
+ * ```typescript
124
+ * await deleteAvatar(client, {
125
+ * query: { userName: 'my-user' }
126
+ * });
127
+ * ```
128
+ */
129
+ export declare const deleteAvatar: (client: ApiClient, props: DeleteAvatarProps) => Promise<void>;
130
+ //# sourceMappingURL=avatars.d.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