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.
- package/LICENSE +21 -0
- package/README.md +175 -0
- package/dist/client.d.ts +67 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +141 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/buildPath.d.ts +19 -0
- package/dist/lib/buildPath.d.ts.map +1 -0
- package/dist/lib/buildPath.js +46 -0
- package/dist/lib/buildPath.js.map +1 -0
- package/dist/lib/dashboardLinks.d.ts +19 -0
- package/dist/lib/dashboardLinks.d.ts.map +1 -0
- package/dist/lib/dashboardLinks.js +37 -0
- package/dist/lib/dashboardLinks.js.map +1 -0
- package/dist/lib/enums.d.ts +41 -0
- package/dist/lib/enums.d.ts.map +1 -0
- package/dist/lib/enums.js +293 -0
- package/dist/lib/enums.js.map +1 -0
- package/dist/lib/eventRouter.d.ts +41 -0
- package/dist/lib/eventRouter.d.ts.map +1 -0
- package/dist/lib/eventRouter.js +43 -0
- package/dist/lib/eventRouter.js.map +1 -0
- package/dist/lib/fetchBinary.d.ts +15 -0
- package/dist/lib/fetchBinary.d.ts.map +1 -0
- package/dist/lib/fetchBinary.js +35 -0
- package/dist/lib/fetchBinary.js.map +1 -0
- package/dist/lib/fileFormats.d.ts +67 -0
- package/dist/lib/fileFormats.d.ts.map +1 -0
- package/dist/lib/fileFormats.js +92 -0
- package/dist/lib/fileFormats.js.map +1 -0
- package/dist/lib/list.d.ts +59 -0
- package/dist/lib/list.d.ts.map +1 -0
- package/dist/lib/list.js +53 -0
- package/dist/lib/list.js.map +1 -0
- package/dist/lib/parseResult.d.ts +14 -0
- package/dist/lib/parseResult.d.ts.map +1 -0
- package/dist/lib/parseResult.js +13 -0
- package/dist/lib/parseResult.js.map +1 -0
- package/dist/lib/schemas.d.ts +48 -0
- package/dist/lib/schemas.d.ts.map +1 -0
- package/dist/lib/schemas.js +43 -0
- package/dist/lib/schemas.js.map +1 -0
- package/dist/lib/types.d.ts +46 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +22 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/upload.d.ts +36 -0
- package/dist/lib/upload.d.ts.map +1 -0
- package/dist/lib/upload.js +79 -0
- package/dist/lib/upload.js.map +1 -0
- package/dist/lib/url.d.ts +7 -0
- package/dist/lib/url.d.ts.map +1 -0
- package/dist/lib/url.js +26 -0
- package/dist/lib/url.js.map +1 -0
- package/dist/routes/apiTokens.d.ts +172 -0
- package/dist/routes/apiTokens.d.ts.map +1 -0
- package/dist/routes/apiTokens.js +133 -0
- package/dist/routes/apiTokens.js.map +1 -0
- package/dist/routes/assets.d.ts +545 -0
- package/dist/routes/assets.d.ts.map +1 -0
- package/dist/routes/assets.js +275 -0
- package/dist/routes/assets.js.map +1 -0
- package/dist/routes/auth.d.ts +102 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +98 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/avatars.d.ts +130 -0
- package/dist/routes/avatars.d.ts.map +1 -0
- package/dist/routes/avatars.js +121 -0
- package/dist/routes/avatars.js.map +1 -0
- package/dist/routes/comments.d.ts +165 -0
- package/dist/routes/comments.d.ts.map +1 -0
- package/dist/routes/comments.js +106 -0
- package/dist/routes/comments.js.map +1 -0
- package/dist/routes/error.d.ts +10 -0
- package/dist/routes/error.d.ts.map +1 -0
- package/dist/routes/error.js +12 -0
- package/dist/routes/error.js.map +1 -0
- package/dist/routes/files.d.ts +70 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +80 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/health.d.ts +10 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +12 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/media.d.ts +22 -0
- package/dist/routes/media.d.ts.map +1 -0
- package/dist/routes/media.js +18 -0
- package/dist/routes/media.js.map +1 -0
- package/dist/routes/notifications.d.ts +164 -0
- package/dist/routes/notifications.d.ts.map +1 -0
- package/dist/routes/notifications.js +97 -0
- package/dist/routes/notifications.js.map +1 -0
- package/dist/routes/oembed.d.ts +80 -0
- package/dist/routes/oembed.d.ts.map +1 -0
- package/dist/routes/oembed.js +74 -0
- package/dist/routes/oembed.js.map +1 -0
- package/dist/routes/serverEvents.d.ts +521 -0
- package/dist/routes/serverEvents.d.ts.map +1 -0
- package/dist/routes/serverEvents.js +136 -0
- package/dist/routes/serverEvents.js.map +1 -0
- package/dist/routes/tasks.d.ts +242 -0
- package/dist/routes/tasks.d.ts.map +1 -0
- package/dist/routes/tasks.js +185 -0
- package/dist/routes/tasks.js.map +1 -0
- package/dist/routes/users.d.ts +1055 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/users.js +233 -0
- package/dist/routes/users.js.map +1 -0
- package/package.json +46 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { fetchBinary } from '../lib/fetchBinary.js';
|
|
3
|
+
import { userNameSchema } from '../lib/schemas.js';
|
|
4
|
+
import { defaultBinaryResponse, imageTransformOptionsSchemaProps, } from '../lib/types.js';
|
|
5
|
+
import { makeUrl } from '../lib/url.js';
|
|
6
|
+
const commonQuerySchemaProps = {
|
|
7
|
+
...imageTransformOptionsSchemaProps,
|
|
8
|
+
redirectOnNotFound: z.url().optional(),
|
|
9
|
+
cacheKey: z.string().max(256).optional(),
|
|
10
|
+
};
|
|
11
|
+
export const uploadAvatarQuerySchema = z.strictObject({
|
|
12
|
+
userName: userNameSchema,
|
|
13
|
+
});
|
|
14
|
+
export const uploadAvatarBodySchema = z.strictObject({
|
|
15
|
+
file: z.instanceof(File),
|
|
16
|
+
});
|
|
17
|
+
export const uploadAvatarPropsSchema = z
|
|
18
|
+
.object({ query: uploadAvatarQuerySchema, body: uploadAvatarBodySchema })
|
|
19
|
+
.strict();
|
|
20
|
+
/**
|
|
21
|
+
* Uploads an avatar for a user.
|
|
22
|
+
*
|
|
23
|
+
* @operationId upload-avatar
|
|
24
|
+
* @param client - The API client instance
|
|
25
|
+
* @param props - The request properties
|
|
26
|
+
* @param props.query - Query parameters (userName)
|
|
27
|
+
* @param props.body - Request body containing the file to upload
|
|
28
|
+
* @returns Promise that resolves when the avatar is uploaded
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* await uploadAvatar(client, {
|
|
32
|
+
* query: { userName: 'my-user' },
|
|
33
|
+
* body: { file: avatarFile }
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export const uploadAvatar = async (client, props) => {
|
|
38
|
+
const { query, body } = uploadAvatarPropsSchema.parse(props);
|
|
39
|
+
const path = '/avatars';
|
|
40
|
+
const formData = new FormData();
|
|
41
|
+
formData.append('file', body.file);
|
|
42
|
+
await client.axios.post(path, formData, {
|
|
43
|
+
params: query,
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'multipart/form-data',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export const getAvatarQuerySchema = z.strictObject({
|
|
50
|
+
...commonQuerySchemaProps,
|
|
51
|
+
userName: userNameSchema,
|
|
52
|
+
});
|
|
53
|
+
export const getAvatarPropsSchema = z.object({ query: getAvatarQuerySchema }).strict();
|
|
54
|
+
/**
|
|
55
|
+
* Gets the URL for an avatar.
|
|
56
|
+
*
|
|
57
|
+
* @operationId get-avatar
|
|
58
|
+
* @param client - The API client instance
|
|
59
|
+
* @param props - The request properties
|
|
60
|
+
* @param props.query - Query parameters (userName, image transform options)
|
|
61
|
+
* @returns URL object for the avatar
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const avatarUrl = getAvatarUrl(client, {
|
|
65
|
+
* query: { userName: 'my-user', width: 200, height: 200 }
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export const getAvatarUrl = (client, props) => {
|
|
70
|
+
const { query } = getAvatarPropsSchema.parse(props);
|
|
71
|
+
const path = `/avatars`;
|
|
72
|
+
return makeUrl(client.host, path, query);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Gets avatar binary data.
|
|
76
|
+
*
|
|
77
|
+
* @operationId get-avatar
|
|
78
|
+
* @param client - The API client instance
|
|
79
|
+
* @param props - The request properties
|
|
80
|
+
* @param props.query - Query parameters (userName, image transform options)
|
|
81
|
+
* @param binaryResponse - Optional binary response type configuration
|
|
82
|
+
* @returns Promise resolving to the avatar binary data
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const avatarData = await getAvatar(client, {
|
|
86
|
+
* query: { userName: 'my-user', width: 200, height: 200 }
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export const getAvatar = async (client, props, binaryResponse = defaultBinaryResponse()) => {
|
|
91
|
+
const url = getAvatarUrl(client, props);
|
|
92
|
+
const response = await fetchBinary(client.axios, url.toString(), { params: props.query }, binaryResponse);
|
|
93
|
+
return response.data;
|
|
94
|
+
};
|
|
95
|
+
export const deleteAvatarQuerySchema = z.strictObject({
|
|
96
|
+
userName: userNameSchema,
|
|
97
|
+
});
|
|
98
|
+
export const deleteAvatarPropsSchema = z.object({ query: deleteAvatarQuerySchema }).strict();
|
|
99
|
+
/**
|
|
100
|
+
* Deletes a user's avatar.
|
|
101
|
+
*
|
|
102
|
+
* @operationId delete-avatar
|
|
103
|
+
* @param client - The API client instance
|
|
104
|
+
* @param props - The request properties
|
|
105
|
+
* @param props.query - Query parameters (userName)
|
|
106
|
+
* @returns Promise that resolves when the avatar is deleted
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* await deleteAvatar(client, {
|
|
110
|
+
* query: { userName: 'my-user' }
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export const deleteAvatar = async (client, props) => {
|
|
115
|
+
const { query } = deleteAvatarPropsSchema.parse(props);
|
|
116
|
+
const path = `/avatars`;
|
|
117
|
+
await client.axios.delete(path, {
|
|
118
|
+
params: query,
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=avatars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatars.js","sources":["../../src/routes/avatars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAGL,qBAAqB,EACrB,gCAAgC,GACjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,sBAAsB,GAAG;IAC7B,GAAG,gCAAgC;IACnC,kBAAkB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;CACzB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;KACxE,MAAM,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cAAc,GAAG,qBAAqB,EAAK,EACX,EAAE;IAClC,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC;IAC1G,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG7F;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAAiB,EAAE,KAAwB,EAAiB,EAAE;IAC/F,MAAM,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,UAAU,CAAC;IACxB,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;QAC9B,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { ApiClient } from '../client.js';
|
|
3
|
+
import type { SortingFromFields } from '../lib/list.js';
|
|
4
|
+
import { type AssetParams, type CommentParams } from '../lib/schemas.js';
|
|
5
|
+
export declare const commentSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodNumber;
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
likeCount: z.ZodNumber;
|
|
9
|
+
createdAt: z.ZodISODateTime;
|
|
10
|
+
moderatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
11
|
+
moderationReason: z.ZodNullable<z.ZodString>;
|
|
12
|
+
createdByUserId: z.ZodNumber;
|
|
13
|
+
createdByName: z.ZodString;
|
|
14
|
+
likeId: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type Comment = z.infer<typeof commentSchema>;
|
|
17
|
+
export declare const createCommentParamsSchema: z.ZodObject<{
|
|
18
|
+
userName: z.ZodString;
|
|
19
|
+
assetName: z.ZodString;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type CreateCommentParams = AssetParams;
|
|
22
|
+
export declare const createCommentBodySchema: z.ZodObject<{
|
|
23
|
+
text: z.ZodString;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export type CreateCommentBody = z.infer<typeof createCommentBodySchema>;
|
|
26
|
+
export type CreateCommentResult = z.infer<typeof commentSchema>;
|
|
27
|
+
export declare const createCommentPropsSchema: z.ZodObject<{
|
|
28
|
+
params: z.ZodObject<{
|
|
29
|
+
userName: z.ZodString;
|
|
30
|
+
assetName: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
body: z.ZodObject<{
|
|
33
|
+
text: z.ZodString;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export type CreateCommentProps = z.infer<typeof createCommentPropsSchema>;
|
|
37
|
+
/**
|
|
38
|
+
* @operationId create-comment
|
|
39
|
+
* @param client - The API client instance
|
|
40
|
+
* @param props - The request properties
|
|
41
|
+
* @param props.params - Path parameters (userName, assetName)
|
|
42
|
+
* @param props.body - Request body with comment text
|
|
43
|
+
* @returns Promise resolving to the created comment
|
|
44
|
+
*/
|
|
45
|
+
export declare const createComment: (client: ApiClient, props: CreateCommentProps) => Promise<CreateCommentResult>;
|
|
46
|
+
export declare const listCommentsSortFields: readonly ['createdAt'];
|
|
47
|
+
export declare const listCommentsQuerySchema: z.ZodObject<{
|
|
48
|
+
pageOffset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
49
|
+
pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
50
|
+
sortBy: z.ZodOptional<z.ZodEnum<{
|
|
51
|
+
createdAt: "createdAt";
|
|
52
|
+
}>>;
|
|
53
|
+
sortDir: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
asc: "asc";
|
|
55
|
+
desc: "desc";
|
|
56
|
+
}>>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type ListCommentQuery = z.infer<typeof listCommentsQuerySchema>;
|
|
59
|
+
export declare const listCommentsResultSchema: z.ZodObject<{
|
|
60
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodNumber;
|
|
62
|
+
text: z.ZodString;
|
|
63
|
+
likeCount: z.ZodNumber;
|
|
64
|
+
createdAt: z.ZodISODateTime;
|
|
65
|
+
moderatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
66
|
+
moderationReason: z.ZodNullable<z.ZodString>;
|
|
67
|
+
createdByUserId: z.ZodNumber;
|
|
68
|
+
createdByName: z.ZodString;
|
|
69
|
+
likeId: z.ZodNullable<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
rowCount: z.ZodInt;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export type ListCommentResult = z.infer<typeof listCommentsResultSchema>;
|
|
74
|
+
export declare const listCommentPropsSchema: z.ZodObject<{
|
|
75
|
+
params: z.ZodObject<{
|
|
76
|
+
userName: z.ZodString;
|
|
77
|
+
assetName: z.ZodString;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
query: z.ZodObject<{
|
|
80
|
+
pageOffset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
|
+
pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
82
|
+
sortBy: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
createdAt: "createdAt";
|
|
84
|
+
}>>;
|
|
85
|
+
sortDir: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
asc: "asc";
|
|
87
|
+
desc: "desc";
|
|
88
|
+
}>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export type ListCommentProps = z.infer<typeof listCommentPropsSchema>;
|
|
92
|
+
/** @internal */
|
|
93
|
+
export declare const listCommentSortFields: readonly ["createdAt"];
|
|
94
|
+
/** @internal */
|
|
95
|
+
export declare const listCommentDefaultSort: SortingFromFields<typeof listCommentSortFields>;
|
|
96
|
+
export type ListCommentSortField = (typeof listCommentSortFields)[number];
|
|
97
|
+
/**
|
|
98
|
+
* Lists comments for an asset.
|
|
99
|
+
*
|
|
100
|
+
* @operationId list-comments
|
|
101
|
+
* @param client - The API client instance
|
|
102
|
+
* @param props - The request properties
|
|
103
|
+
* @param props.params - Path parameters (userName, assetName)
|
|
104
|
+
* @param props.query - Query parameters (pagination, sorting)
|
|
105
|
+
* @returns Promise resolving to a paginated list of comments
|
|
106
|
+
*/
|
|
107
|
+
export declare const listComments: (client: ApiClient, props: ListCommentProps) => Promise<ListCommentResult>;
|
|
108
|
+
export declare const editCommentParamsSchema: z.ZodObject<{
|
|
109
|
+
userName: z.ZodString;
|
|
110
|
+
assetName: z.ZodString;
|
|
111
|
+
commentId: z.ZodCoercedNumber<unknown>;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
export type EditCommentParams = CommentParams;
|
|
114
|
+
export declare const editCommentBodySchema: z.ZodObject<{
|
|
115
|
+
text: z.ZodString;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
export type EditCommentBody = z.infer<typeof editCommentBodySchema>;
|
|
118
|
+
export type EditCommentResult = z.infer<typeof commentSchema>;
|
|
119
|
+
export declare const editCommentPropsSchema: z.ZodObject<{
|
|
120
|
+
params: z.ZodObject<{
|
|
121
|
+
userName: z.ZodString;
|
|
122
|
+
assetName: z.ZodString;
|
|
123
|
+
commentId: z.ZodCoercedNumber<unknown>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
body: z.ZodObject<{
|
|
126
|
+
text: z.ZodString;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
}, z.core.$strict>;
|
|
129
|
+
export type EditCommentProps = z.infer<typeof editCommentPropsSchema>;
|
|
130
|
+
/**
|
|
131
|
+
* Edits an existing comment.
|
|
132
|
+
*
|
|
133
|
+
* @operationId edit-comment
|
|
134
|
+
* @param client - The API client instance
|
|
135
|
+
* @param props - The request properties
|
|
136
|
+
* @param props.params - Path parameters (userName, assetName, commentId)
|
|
137
|
+
* @param props.body - Request body with updated comment text
|
|
138
|
+
* @returns Promise resolving to the updated comment
|
|
139
|
+
*/
|
|
140
|
+
export declare const editComment: (client: ApiClient, props: EditCommentProps) => Promise<EditCommentResult>;
|
|
141
|
+
export declare const deleteCommentParamsSchema: z.ZodObject<{
|
|
142
|
+
userName: z.ZodString;
|
|
143
|
+
assetName: z.ZodString;
|
|
144
|
+
commentId: z.ZodCoercedNumber<unknown>;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
export type DeleteCommentParams = CommentParams;
|
|
147
|
+
export declare const deleteCommentPropsSchema: z.ZodObject<{
|
|
148
|
+
params: z.ZodObject<{
|
|
149
|
+
userName: z.ZodString;
|
|
150
|
+
assetName: z.ZodString;
|
|
151
|
+
commentId: z.ZodCoercedNumber<unknown>;
|
|
152
|
+
}, z.core.$strict>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
export type DeleteCommentProps = z.infer<typeof deleteCommentPropsSchema>;
|
|
155
|
+
/**
|
|
156
|
+
* Deletes a comment.
|
|
157
|
+
*
|
|
158
|
+
* @operationId delete-comment
|
|
159
|
+
* @param client - The API client instance
|
|
160
|
+
* @param props - The request properties
|
|
161
|
+
* @param props.params - Path parameters (userName, assetName, commentId)
|
|
162
|
+
* @returns Promise that resolves when the comment is deleted
|
|
163
|
+
*/
|
|
164
|
+
export declare const deleteComment: (client: ApiClient, props: DeleteCommentProps) => Promise<void>;
|
|
165
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sources":["../../src/routes/comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGnB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,aAAa;;;;;;;;;;iBAUxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,yBAAyB;;;kBAAoB,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAE9C,eAAO,MAAM,uBAAuB;;kBAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEhE,eAAO,MAAM,wBAAwB;;;;;;;;kBAE1B,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,WAAkB,SAAS,SAAS,kBAAkB,KAAG,OAAO,CAAC,mBAAmB,CAK7G,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAI,WAAW,CAAU,CAAC;AAE7D,eAAO,MAAM,uBAAuB;;;;;;;;;;iBAEnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,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AyB;;;;kBAAsB,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEhD,eAAO,MAAM,wBAAwB;;;;;;kBAA2D,CAAC;AACjG,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,WAAkB,SAAS,SAAS,kBAAkB,KAAG,OAAO,CAAC,IAAI,CAI9F,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { parseResult } from '../client.js';
|
|
3
|
+
import { buildPath } from '../lib/buildPath.js';
|
|
4
|
+
import { createSortingOptionalSchema, listResultSchema, paginationOptionalSchema } from '../lib/list.js';
|
|
5
|
+
import { assetParamsSchema, commentParamsSchema, commentTextSchema, } from '../lib/schemas.js';
|
|
6
|
+
export const commentSchema = z.object({
|
|
7
|
+
id: z.number().int(),
|
|
8
|
+
text: commentTextSchema,
|
|
9
|
+
likeCount: z.number().int().nonnegative(),
|
|
10
|
+
createdAt: z.iso.datetime(),
|
|
11
|
+
moderatedAt: z.iso.datetime().nullable(),
|
|
12
|
+
moderationReason: z.string().nullable(),
|
|
13
|
+
createdByUserId: z.number().int(),
|
|
14
|
+
createdByName: z.string(),
|
|
15
|
+
likeId: z.number().int().nullable(),
|
|
16
|
+
});
|
|
17
|
+
export const createCommentParamsSchema = assetParamsSchema;
|
|
18
|
+
export const createCommentBodySchema = z.strictObject({
|
|
19
|
+
text: commentTextSchema.describe('The comment text'),
|
|
20
|
+
});
|
|
21
|
+
export const createCommentPropsSchema = z
|
|
22
|
+
.object({ params: createCommentParamsSchema, body: createCommentBodySchema })
|
|
23
|
+
.strict();
|
|
24
|
+
/**
|
|
25
|
+
* @operationId create-comment
|
|
26
|
+
* @param client - The API client instance
|
|
27
|
+
* @param props - The request properties
|
|
28
|
+
* @param props.params - Path parameters (userName, assetName)
|
|
29
|
+
* @param props.body - Request body with comment text
|
|
30
|
+
* @returns Promise resolving to the created comment
|
|
31
|
+
*/
|
|
32
|
+
export const createComment = async (client, props) => {
|
|
33
|
+
const { params, body } = createCommentPropsSchema.parse(props);
|
|
34
|
+
const path = buildPath('/comments/$userName/$assetName', params);
|
|
35
|
+
const response = await client.axios.post(path, body);
|
|
36
|
+
return parseResult(client, commentSchema, response.data);
|
|
37
|
+
};
|
|
38
|
+
export const listCommentsSortFields = ['createdAt'];
|
|
39
|
+
export const listCommentsQuerySchema = paginationOptionalSchema.merge(createSortingOptionalSchema(listCommentsSortFields));
|
|
40
|
+
export const listCommentsResultSchema = listResultSchema(commentSchema);
|
|
41
|
+
export const listCommentPropsSchema = z.object({ params: assetParamsSchema, query: listCommentsQuerySchema }).strict();
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const listCommentSortFields = listCommentsSortFields;
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const listCommentDefaultSort = {
|
|
46
|
+
sortBy: 'createdAt',
|
|
47
|
+
sortDir: 'desc',
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Lists comments for an asset.
|
|
51
|
+
*
|
|
52
|
+
* @operationId list-comments
|
|
53
|
+
* @param client - The API client instance
|
|
54
|
+
* @param props - The request properties
|
|
55
|
+
* @param props.params - Path parameters (userName, assetName)
|
|
56
|
+
* @param props.query - Query parameters (pagination, sorting)
|
|
57
|
+
* @returns Promise resolving to a paginated list of comments
|
|
58
|
+
*/
|
|
59
|
+
export const listComments = async (client, props) => {
|
|
60
|
+
const { params, query } = listCommentPropsSchema.parse(props);
|
|
61
|
+
const path = buildPath('/comments/$userName/$assetName', params);
|
|
62
|
+
const response = await client.axios.get(path, {
|
|
63
|
+
params: query,
|
|
64
|
+
});
|
|
65
|
+
return parseResult(client, listCommentsResultSchema, response.data);
|
|
66
|
+
};
|
|
67
|
+
export const editCommentParamsSchema = commentParamsSchema;
|
|
68
|
+
export const editCommentBodySchema = z.strictObject({
|
|
69
|
+
text: commentTextSchema.describe('The updated comment text'),
|
|
70
|
+
});
|
|
71
|
+
export const editCommentPropsSchema = z
|
|
72
|
+
.object({ params: editCommentParamsSchema, body: editCommentBodySchema })
|
|
73
|
+
.strict();
|
|
74
|
+
/**
|
|
75
|
+
* Edits an existing comment.
|
|
76
|
+
*
|
|
77
|
+
* @operationId edit-comment
|
|
78
|
+
* @param client - The API client instance
|
|
79
|
+
* @param props - The request properties
|
|
80
|
+
* @param props.params - Path parameters (userName, assetName, commentId)
|
|
81
|
+
* @param props.body - Request body with updated comment text
|
|
82
|
+
* @returns Promise resolving to the updated comment
|
|
83
|
+
*/
|
|
84
|
+
export const editComment = async (client, props) => {
|
|
85
|
+
const { params, body } = editCommentPropsSchema.parse(props);
|
|
86
|
+
const path = buildPath('/comments/$userName/$assetName/$commentId', params);
|
|
87
|
+
const response = await client.axios.patch(path, body);
|
|
88
|
+
return parseResult(client, commentSchema, response.data);
|
|
89
|
+
};
|
|
90
|
+
export const deleteCommentParamsSchema = commentParamsSchema;
|
|
91
|
+
export const deleteCommentPropsSchema = z.object({ params: deleteCommentParamsSchema }).strict();
|
|
92
|
+
/**
|
|
93
|
+
* Deletes a comment.
|
|
94
|
+
*
|
|
95
|
+
* @operationId delete-comment
|
|
96
|
+
* @param client - The API client instance
|
|
97
|
+
* @param props - The request properties
|
|
98
|
+
* @param props.params - Path parameters (userName, assetName, commentId)
|
|
99
|
+
* @returns Promise that resolves when the comment is deleted
|
|
100
|
+
*/
|
|
101
|
+
export const deleteComment = async (client, props) => {
|
|
102
|
+
const { params } = deleteCommentPropsSchema.parse(props);
|
|
103
|
+
const path = buildPath('/comments/$userName/$assetName/$commentId', params);
|
|
104
|
+
await client.axios.delete(path);
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sources":["../../src/routes/comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,K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EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAGjG;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,MAAiB,EAAE,KAAyB,EAAiB,EAAE;IACjG,MAAM,EAAE,MAAM,EAAE,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,SAAS,CAAC,2CAA2C,EAAE,MAAM,CAAC,CAAC;IAC5E,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiClient } from '../client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Throws a test error for error handling testing.
|
|
4
|
+
*
|
|
5
|
+
* @operationId health-error
|
|
6
|
+
* @param client - The API client instance
|
|
7
|
+
* @returns Promise resolving to void
|
|
8
|
+
*/
|
|
9
|
+
export declare const errorCheck: (client: ApiClient) => Promise<void>;
|
|
10
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sources":["../../src/routes/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,WAAkB,SAAS,KAAG,OAAO,CAAC,IAAI,CAEhE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const errorPath = () => '/health/error';
|
|
2
|
+
/**
|
|
3
|
+
* Throws a test error for error handling testing.
|
|
4
|
+
*
|
|
5
|
+
* @operationId health-error
|
|
6
|
+
* @param client - The API client instance
|
|
7
|
+
* @returns Promise resolving to void
|
|
8
|
+
*/
|
|
9
|
+
export const errorCheck = async (client) => {
|
|
10
|
+
await client.axios.get(errorPath());
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sources":["../../src/routes/error.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,MAAiB,EAAiB,EAAE;IACnE,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from '../client.js';
|
|
3
|
+
import { type BinaryResponse, type BinaryResponseType } from '../lib/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* File path parameter schema
|
|
6
|
+
*/
|
|
7
|
+
export declare const fileParamsSchema: z.ZodObject<{
|
|
8
|
+
oid: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export type FileParams = z.infer<typeof fileParamsSchema>;
|
|
11
|
+
export declare const fileQuerySchema: z.ZodObject<{
|
|
12
|
+
name: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export type FileQuery = z.infer<typeof fileQuerySchema>;
|
|
15
|
+
export declare const getFilePropsSchema: z.ZodObject<{
|
|
16
|
+
params: z.ZodObject<{
|
|
17
|
+
oid: z.ZodString;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type GetFileProps = z.infer<typeof getFilePropsSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the path + search string for a storage file by OID (no host).
|
|
26
|
+
* Use for same-origin redirects (e.g. in API handlers) or to build a full URL by prefixing with a host.
|
|
27
|
+
*
|
|
28
|
+
* @param props - The request properties
|
|
29
|
+
* @param props.params - Path parameters (oid)
|
|
30
|
+
* @param props.query - Query parameters (name)
|
|
31
|
+
* @returns Path and query string, e.g. `/files/{oid}` or `/files/{oid}?name=...`
|
|
32
|
+
*/
|
|
33
|
+
export declare const getLocalFileUrl: (props: GetFileProps) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the URL for a storage file by OID.
|
|
36
|
+
*
|
|
37
|
+
* @param client - The API client instance
|
|
38
|
+
* @param props - The request properties
|
|
39
|
+
* @param props.params - Path parameters (oid)
|
|
40
|
+
* @param props.query - Query parameters (name)
|
|
41
|
+
* @returns URL object for the storage file
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const fileUrl = getFileUrl(client, {
|
|
45
|
+
* params: { oid: 'abc123...' },
|
|
46
|
+
* query: { name: 'my-asset' }
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const getFileUrl: (client: ApiClient, props: GetFileProps) => URL;
|
|
51
|
+
/**
|
|
52
|
+
* Gets a storage file as binary data.
|
|
53
|
+
*
|
|
54
|
+
* @operationId get-file
|
|
55
|
+
* @param client - The API client instance
|
|
56
|
+
* @param props - The request properties
|
|
57
|
+
* @param props.params - Path parameters (oid)
|
|
58
|
+
* @param props.query - Query parameters (name)
|
|
59
|
+
* @param binaryResponse - Optional binary response type configuration
|
|
60
|
+
* @returns Promise resolving to the file binary data
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const file = await getFile(client, {
|
|
64
|
+
* params: { oid: 'abc123...' },
|
|
65
|
+
* query: { name: 'my-asset' }
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const getFile: <T extends BinaryResponse>(client: ApiClient, props: GetFileProps, binaryResponse?: T) => Promise<BinaryResponseType<T>>;
|
|
70
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sources":["../../src/routes/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAyB,MAAM,iBAAiB,CAAC;AAGtG;;GAEG;AACH,eAAO,MAAM,gBAAgB;;kBAK3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,eAAe;;kBAE1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAGxD,eAAO,MAAM,kBAAkB;;;;;;;kBAKpB,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,MAKrD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,WAAY,SAAS,SAAS,YAAY,KAAG,GAAmD,CAAC;AAExH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,OAAO,GAAU,CAAC,SAAS,cAAc,UAC5C,SAAS,SACV,YAAY,yBAElB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAI/B,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildPath } from '../lib/buildPath.js';
|
|
3
|
+
import { fetchBinary } from '../lib/fetchBinary.js';
|
|
4
|
+
import { defaultBinaryResponse } from '../lib/types.js';
|
|
5
|
+
import { makeUrl } from '../lib/url.js';
|
|
6
|
+
/**
|
|
7
|
+
* File path parameter schema
|
|
8
|
+
*/
|
|
9
|
+
export const fileParamsSchema = z.strictObject({
|
|
10
|
+
oid: z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^[a-f0-9]{64}$/)
|
|
13
|
+
.describe('OID of the storage file'),
|
|
14
|
+
});
|
|
15
|
+
export const fileQuerySchema = z.strictObject({
|
|
16
|
+
name: z.string().optional().describe('Optional asset name to use in Content-Disposition header'),
|
|
17
|
+
});
|
|
18
|
+
// Composed props schema for SDK entry-point parsing
|
|
19
|
+
export const getFilePropsSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
params: fileParamsSchema,
|
|
22
|
+
query: fileQuerySchema.optional(),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
/**
|
|
26
|
+
* Gets the path + search string for a storage file by OID (no host).
|
|
27
|
+
* Use for same-origin redirects (e.g. in API handlers) or to build a full URL by prefixing with a host.
|
|
28
|
+
*
|
|
29
|
+
* @param props - The request properties
|
|
30
|
+
* @param props.params - Path parameters (oid)
|
|
31
|
+
* @param props.query - Query parameters (name)
|
|
32
|
+
* @returns Path and query string, e.g. `/files/{oid}` or `/files/{oid}?name=...`
|
|
33
|
+
*/
|
|
34
|
+
export const getLocalFileUrl = (props) => {
|
|
35
|
+
const { params, query } = getFilePropsSchema.parse(props);
|
|
36
|
+
const path = buildPath('/files/$oid', params);
|
|
37
|
+
const url = makeUrl('http://x', path, query);
|
|
38
|
+
return url.pathname + url.search;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Gets the URL for a storage file by OID.
|
|
42
|
+
*
|
|
43
|
+
* @param client - The API client instance
|
|
44
|
+
* @param props - The request properties
|
|
45
|
+
* @param props.params - Path parameters (oid)
|
|
46
|
+
* @param props.query - Query parameters (name)
|
|
47
|
+
* @returns URL object for the storage file
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const fileUrl = getFileUrl(client, {
|
|
51
|
+
* params: { oid: 'abc123...' },
|
|
52
|
+
* query: { name: 'my-asset' }
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export const getFileUrl = (client, props) => new URL(getLocalFileUrl(props), client.host);
|
|
57
|
+
/**
|
|
58
|
+
* Gets a storage file as binary data.
|
|
59
|
+
*
|
|
60
|
+
* @operationId get-file
|
|
61
|
+
* @param client - The API client instance
|
|
62
|
+
* @param props - The request properties
|
|
63
|
+
* @param props.params - Path parameters (oid)
|
|
64
|
+
* @param props.query - Query parameters (name)
|
|
65
|
+
* @param binaryResponse - Optional binary response type configuration
|
|
66
|
+
* @returns Promise resolving to the file binary data
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const file = await getFile(client, {
|
|
70
|
+
* params: { oid: 'abc123...' },
|
|
71
|
+
* query: { name: 'my-asset' }
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export const getFile = async (client, props, binaryResponse = defaultBinaryResponse()) => {
|
|
76
|
+
const url = getFileUrl(client, props);
|
|
77
|
+
const response = await fetchBinary(client.axios, url.toString(), { maxRedirects: 5 }, binaryResponse);
|
|
78
|
+
return response.data;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sources":["../../src/routes/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAgD,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7C,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,KAAK,CAAC,gBAAgB,CA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AG,MAAM,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IACtG,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiClient } from '../client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Performs a health check on the API.
|
|
4
|
+
*
|
|
5
|
+
* @operationId health
|
|
6
|
+
* @param client - The API client instance
|
|
7
|
+
* @returns Promise resolving to void
|
|
8
|
+
*/
|
|
9
|
+
export declare const healthCheck: (client: ApiClient) => Promise<void>;
|
|
10
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sources":["../../src/routes/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,WAAkB,SAAS,KAAG,OAAO,CAAC,IAAI,CAEjE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const healthPath = () => '/health';
|
|
2
|
+
/**
|
|
3
|
+
* Performs a health check on the API.
|
|
4
|
+
*
|
|
5
|
+
* @operationId health
|
|
6
|
+
* @param client - The API client instance
|
|
7
|
+
* @returns Promise resolving to void
|
|
8
|
+
*/
|
|
9
|
+
export const healthCheck = async (client) => {
|
|
10
|
+
await client.axios.get(healthPath());
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sources":["../../src/routes/health.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,MAAiB,EAAiB,EAAE;IACpE,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { ApiClient } from '../client.js';
|
|
3
|
+
export declare const getAssetMediaParamsSchema: z.ZodObject<{
|
|
4
|
+
userName: z.ZodString;
|
|
5
|
+
assetName: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type GetAssetMediaParams = z.infer<typeof getAssetMediaParamsSchema>;
|
|
8
|
+
export declare const mediaParamsSchema: z.ZodObject<{
|
|
9
|
+
userName: z.ZodString;
|
|
10
|
+
assetName: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type MediaParams = z.infer<typeof mediaParamsSchema>;
|
|
13
|
+
export declare const mediaOriginalQuerySchema: z.ZodObject<{
|
|
14
|
+
download: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCodec<z.ZodString, z.ZodBoolean>]>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type MediaOriginalQuery = z.infer<typeof mediaOriginalQuerySchema>;
|
|
17
|
+
/** GET /media/:userName/:assetName/original - original uploaded file */
|
|
18
|
+
export declare const getMediaOriginalUrl: (client: ApiClient, props: {
|
|
19
|
+
params: MediaParams;
|
|
20
|
+
query?: MediaOriginalQuery;
|
|
21
|
+
}) => URL;
|
|
22
|
+
//# sourceMappingURL=media.d.ts.map
|