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 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sources":["../../src/routes/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAM9C,eAAO,MAAM,yBAAyB;;;kBAAoB,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAO5E,eAAO,MAAM,iBAAiB;;;kBAAoB,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,wBAAwB;;iBAAuD,CAAC;AAC7F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,WACtB,SAAS,SACV;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAAE,KACzD,GAGF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { buildPath } from '../lib/buildPath.js';
|
|
3
|
+
import { assetParamsSchema, booleanPropSchema } from '../lib/schemas.js';
|
|
4
|
+
import { makeUrl } from '../lib/url.js';
|
|
5
|
+
// Alias retained for API route schema imports.
|
|
6
|
+
export const getAssetMediaParamsSchema = assetParamsSchema;
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Media API (read-only original file passthrough)
|
|
9
|
+
// Path pattern: /media/:userName/:assetName/original
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export const mediaParamsSchema = assetParamsSchema;
|
|
12
|
+
export const mediaOriginalQuerySchema = z.object({ download: booleanPropSchema.optional() });
|
|
13
|
+
/** GET /media/:userName/:assetName/original - original uploaded file */
|
|
14
|
+
export const getMediaOriginalUrl = (client, props) => {
|
|
15
|
+
const path = buildPath('/media/$userName/$assetName/original', props.params);
|
|
16
|
+
return makeUrl(client.host, path, props.query);
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sources":["../../src/routes/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAG3D,8EAA8E;AAC9E,kDAAkD;AAClD,qDAAqD;AACrD,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAGnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAG7F,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAAiB,EACjB,KAA0D,EACrD,EAAE;IACP,MAAM,IAAI,GAAG,SAAS,CAAC,sCAAsC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7E,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { ApiClient } from '../client.js';
|
|
3
|
+
import type { SortingFromFields } from '../lib/list.js';
|
|
4
|
+
export declare const notificationSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodNumber;
|
|
6
|
+
title: z.ZodString;
|
|
7
|
+
body: z.ZodString;
|
|
8
|
+
createdAt: z.ZodISODateTime;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
READ: "READ";
|
|
11
|
+
UNREAD: "UNREAD";
|
|
12
|
+
}>;
|
|
13
|
+
topic: z.ZodEnum<{
|
|
14
|
+
ASSET_LIKED: "ASSET_LIKED";
|
|
15
|
+
ASSET_MODERATED: "ASSET_MODERATED";
|
|
16
|
+
COMMENT_LIKED: "COMMENT_LIKED";
|
|
17
|
+
COMMENT_MENTIONED: "COMMENT_MENTIONED";
|
|
18
|
+
COMMENT_MODERATED: "COMMENT_MODERATED";
|
|
19
|
+
EXTERNAL_AUTH_APPROVED: "EXTERNAL_AUTH_APPROVED";
|
|
20
|
+
NEW_ASSET: "NEW_ASSET";
|
|
21
|
+
NEW_ASSET_VERSION: "NEW_ASSET_VERSION";
|
|
22
|
+
NEW_COMMENT: "NEW_COMMENT";
|
|
23
|
+
}>;
|
|
24
|
+
imageUrl: z.ZodNullable<z.ZodString>;
|
|
25
|
+
link: z.ZodNullable<z.ZodString>;
|
|
26
|
+
userId: z.ZodNumber;
|
|
27
|
+
userName: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type Notification = z.infer<typeof notificationSchema>;
|
|
30
|
+
export declare const listNotificationsSortFields: readonly ['createdAt', 'status'];
|
|
31
|
+
export declare const listNotificationsQuerySchema: z.ZodObject<{
|
|
32
|
+
pageOffset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
33
|
+
pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
34
|
+
sortBy: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
createdAt: "createdAt";
|
|
36
|
+
status: "status";
|
|
37
|
+
}>>;
|
|
38
|
+
sortDir: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
asc: "asc";
|
|
40
|
+
desc: "desc";
|
|
41
|
+
}>>;
|
|
42
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
READ: "READ";
|
|
44
|
+
UNREAD: "UNREAD";
|
|
45
|
+
}>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type ListNotificationQuery = z.infer<typeof listNotificationsQuerySchema>;
|
|
48
|
+
export declare const listNotificationsResultSchema: z.ZodObject<{
|
|
49
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
50
|
+
id: z.ZodNumber;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
body: z.ZodString;
|
|
53
|
+
createdAt: z.ZodISODateTime;
|
|
54
|
+
status: z.ZodEnum<{
|
|
55
|
+
READ: "READ";
|
|
56
|
+
UNREAD: "UNREAD";
|
|
57
|
+
}>;
|
|
58
|
+
topic: z.ZodEnum<{
|
|
59
|
+
ASSET_LIKED: "ASSET_LIKED";
|
|
60
|
+
ASSET_MODERATED: "ASSET_MODERATED";
|
|
61
|
+
COMMENT_LIKED: "COMMENT_LIKED";
|
|
62
|
+
COMMENT_MENTIONED: "COMMENT_MENTIONED";
|
|
63
|
+
COMMENT_MODERATED: "COMMENT_MODERATED";
|
|
64
|
+
EXTERNAL_AUTH_APPROVED: "EXTERNAL_AUTH_APPROVED";
|
|
65
|
+
NEW_ASSET: "NEW_ASSET";
|
|
66
|
+
NEW_ASSET_VERSION: "NEW_ASSET_VERSION";
|
|
67
|
+
NEW_COMMENT: "NEW_COMMENT";
|
|
68
|
+
}>;
|
|
69
|
+
imageUrl: z.ZodNullable<z.ZodString>;
|
|
70
|
+
link: z.ZodNullable<z.ZodString>;
|
|
71
|
+
userId: z.ZodNumber;
|
|
72
|
+
userName: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
rowCount: z.ZodInt;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type ListNotificationResult = z.infer<typeof listNotificationsResultSchema>;
|
|
77
|
+
export declare const listNotificationPropsSchema: z.ZodObject<{
|
|
78
|
+
query: z.ZodObject<{
|
|
79
|
+
pageOffset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
80
|
+
pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
|
+
sortBy: z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
createdAt: "createdAt";
|
|
83
|
+
status: "status";
|
|
84
|
+
}>>;
|
|
85
|
+
sortDir: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
asc: "asc";
|
|
87
|
+
desc: "desc";
|
|
88
|
+
}>>;
|
|
89
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
READ: "READ";
|
|
91
|
+
UNREAD: "UNREAD";
|
|
92
|
+
}>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export type ListNotificationProps = z.infer<typeof listNotificationPropsSchema>;
|
|
96
|
+
/** @internal */
|
|
97
|
+
export declare const listNotificationSortFields: readonly ["createdAt", "status"];
|
|
98
|
+
/** @internal */
|
|
99
|
+
export declare const listNotificationDefaultSort: SortingFromFields<typeof listNotificationSortFields>;
|
|
100
|
+
export type ListNotificationSortField = (typeof listNotificationSortFields)[number];
|
|
101
|
+
/**
|
|
102
|
+
* Lists notifications for the authenticated user.
|
|
103
|
+
*
|
|
104
|
+
* @operationId list-notifications
|
|
105
|
+
* @param client - The API client instance
|
|
106
|
+
* @param props - The request properties
|
|
107
|
+
* @param props.query - Query parameters for filtering, pagination, and sorting
|
|
108
|
+
* @returns Promise resolving to a paginated list of notifications
|
|
109
|
+
*/
|
|
110
|
+
export declare const listNotifications: (client: ApiClient, props: ListNotificationProps) => Promise<ListNotificationResult>;
|
|
111
|
+
export declare const markNotificationAsReadParamsSchema: z.ZodObject<{
|
|
112
|
+
notificationId: z.ZodCoercedNumber<unknown>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export type MarkNotificationAsReadParams = z.infer<typeof markNotificationAsReadParamsSchema>;
|
|
115
|
+
export declare const markNotificationAsReadBodySchema: z.ZodObject<{
|
|
116
|
+
status: z.ZodLiteral<"READ">;
|
|
117
|
+
}, z.core.$strict>;
|
|
118
|
+
export type MarkNotificationAsReadBody = z.infer<typeof markNotificationAsReadBodySchema>;
|
|
119
|
+
export declare const markNotificationAsReadResultSchema: z.ZodVoid;
|
|
120
|
+
export declare const markNotificationAsReadPropsSchema: z.ZodObject<{
|
|
121
|
+
params: z.ZodObject<{
|
|
122
|
+
notificationId: z.ZodCoercedNumber<unknown>;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
body: z.ZodObject<{
|
|
125
|
+
status: z.ZodLiteral<"READ">;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export type MarkNotificationAsReadProps = z.infer<typeof markNotificationAsReadPropsSchema>;
|
|
129
|
+
/**
|
|
130
|
+
* Marks a specific notification as read.
|
|
131
|
+
*
|
|
132
|
+
* @operationId mark-notification-as-read
|
|
133
|
+
* @param client - The API client instance
|
|
134
|
+
* @param props - The request properties
|
|
135
|
+
* @param props.params - Path parameters (notificationId)
|
|
136
|
+
* @param props.body - Request body with status
|
|
137
|
+
* @returns Promise that resolves when the notification is marked as read
|
|
138
|
+
*/
|
|
139
|
+
export declare const markNotificationAsRead: (client: ApiClient, props: MarkNotificationAsReadProps) => Promise<void>;
|
|
140
|
+
export declare const markAllNotificationsAsReadBodySchema: z.ZodObject<{
|
|
141
|
+
status: z.ZodLiteral<"READ">;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
export type MarkAllNotificationsAsReadBody = z.infer<typeof markAllNotificationsAsReadBodySchema>;
|
|
144
|
+
export declare const markAllNotificationsAsReadResultSchema: z.ZodObject<{
|
|
145
|
+
success: z.ZodBoolean;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
export type MarkAllNotificationsAsReadResult = z.infer<typeof markAllNotificationsAsReadResultSchema>;
|
|
148
|
+
export declare const markAllNotificationsAsReadPropsSchema: z.ZodObject<{
|
|
149
|
+
body: z.ZodObject<{
|
|
150
|
+
status: z.ZodLiteral<"READ">;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
}, z.core.$strict>;
|
|
153
|
+
export type MarkAllNotificationsAsReadProps = z.infer<typeof markAllNotificationsAsReadPropsSchema>;
|
|
154
|
+
/**
|
|
155
|
+
* Marks all notifications as read for the authenticated user.
|
|
156
|
+
*
|
|
157
|
+
* @operationId mark-all-notifications-as-read
|
|
158
|
+
* @param client - The API client instance
|
|
159
|
+
* @param props - The request properties
|
|
160
|
+
* @param props.body - Request body with status
|
|
161
|
+
* @returns Promise resolving to a success indicator
|
|
162
|
+
*/
|
|
163
|
+
export declare const markAllNotificationsAsRead: (client: ApiClient, props: MarkAllNotificationsAsReadProps) => Promise<MarkAllNotificationsAsReadResult>;
|
|
164
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0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,CAAC;AAEF,eAAO,MAAM,kCAAkC;;kBAE7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,eAAO,MAAM,gCAAgC;;kBAE3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,iCAAiC;;;;;;;kBAEnC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,WAAkB,SAAS,SAAS,2BAA2B,KAAG,OAAO,CAAC,IAAI,CAIhH,CAAC;AAEF,eAAO,MAAM,oCAAoC;;kBAE/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,eAAO,MAAM,sCAAsC;;kBAEjD,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC;AAEtG,eAAO,MAAM,qCAAqC;;;;kBAAoE,CAAC;AACvH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,WAC7B,SAAS,SACV,+BAA+B,KACrC,OAAO,CAAC,gCAAgC,CAK1C,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { parseResult } from '../client.js';
|
|
3
|
+
import { buildPath } from '../lib/buildPath.js';
|
|
4
|
+
import { Enums } from '../lib/enums.js';
|
|
5
|
+
import { createSortingOptionalSchema, listResultSchema, paginationOptionalSchema } from '../lib/list.js';
|
|
6
|
+
export const notificationSchema = z.object({
|
|
7
|
+
id: z.number().int().describe('The ID of the notification'),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
body: z.string().describe('The body of the notification'),
|
|
10
|
+
createdAt: z.iso.datetime().describe('The date and time the notification was created'),
|
|
11
|
+
status: z.enum(Enums.NotificationStatus).describe('The status of the notification'),
|
|
12
|
+
topic: z.enum(Enums.NotificationTopic).describe('The topic/type of the notification'),
|
|
13
|
+
imageUrl: z.string().nullable().describe('The URL of the image in the notification'),
|
|
14
|
+
link: z.string().nullable().describe('The link in the notification'),
|
|
15
|
+
userId: z.number().int().describe('The ID of the user who received the notification'),
|
|
16
|
+
userName: z.string().describe('The username of the user who received the notification'),
|
|
17
|
+
});
|
|
18
|
+
export const listNotificationsSortFields = ['createdAt', 'status'];
|
|
19
|
+
export const listNotificationsQuerySchema = paginationOptionalSchema
|
|
20
|
+
.merge(createSortingOptionalSchema(listNotificationsSortFields))
|
|
21
|
+
.extend({
|
|
22
|
+
status: z.enum(Enums.NotificationStatus).optional().describe('Filter by status (UNREAD or READ)'),
|
|
23
|
+
});
|
|
24
|
+
export const listNotificationsResultSchema = listResultSchema(notificationSchema);
|
|
25
|
+
export const listNotificationPropsSchema = z.object({ query: listNotificationsQuerySchema }).strict();
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const listNotificationSortFields = listNotificationsSortFields;
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const listNotificationDefaultSort = {
|
|
30
|
+
sortBy: 'createdAt',
|
|
31
|
+
sortDir: 'desc',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Lists notifications for the authenticated user.
|
|
35
|
+
*
|
|
36
|
+
* @operationId list-notifications
|
|
37
|
+
* @param client - The API client instance
|
|
38
|
+
* @param props - The request properties
|
|
39
|
+
* @param props.query - Query parameters for filtering, pagination, and sorting
|
|
40
|
+
* @returns Promise resolving to a paginated list of notifications
|
|
41
|
+
*/
|
|
42
|
+
export const listNotifications = async (client, props) => {
|
|
43
|
+
const { query } = listNotificationPropsSchema.parse(props);
|
|
44
|
+
const path = '/notifications';
|
|
45
|
+
const response = await client.axios.get(path, {
|
|
46
|
+
params: query,
|
|
47
|
+
});
|
|
48
|
+
return parseResult(client, listNotificationsResultSchema, response.data);
|
|
49
|
+
};
|
|
50
|
+
export const markNotificationAsReadParamsSchema = z.strictObject({
|
|
51
|
+
notificationId: z.coerce.number().int(),
|
|
52
|
+
});
|
|
53
|
+
export const markNotificationAsReadBodySchema = z.strictObject({
|
|
54
|
+
status: z.literal('READ'),
|
|
55
|
+
});
|
|
56
|
+
export const markNotificationAsReadResultSchema = z.void();
|
|
57
|
+
export const markNotificationAsReadPropsSchema = z
|
|
58
|
+
.object({ params: markNotificationAsReadParamsSchema, body: markNotificationAsReadBodySchema })
|
|
59
|
+
.strict();
|
|
60
|
+
/**
|
|
61
|
+
* Marks a specific notification as read.
|
|
62
|
+
*
|
|
63
|
+
* @operationId mark-notification-as-read
|
|
64
|
+
* @param client - The API client instance
|
|
65
|
+
* @param props - The request properties
|
|
66
|
+
* @param props.params - Path parameters (notificationId)
|
|
67
|
+
* @param props.body - Request body with status
|
|
68
|
+
* @returns Promise that resolves when the notification is marked as read
|
|
69
|
+
*/
|
|
70
|
+
export const markNotificationAsRead = async (client, props) => {
|
|
71
|
+
const { params, body } = markNotificationAsReadPropsSchema.parse(props);
|
|
72
|
+
const path = buildPath('/notifications/$notificationId', params);
|
|
73
|
+
await client.axios.patch(path, body);
|
|
74
|
+
};
|
|
75
|
+
export const markAllNotificationsAsReadBodySchema = z.strictObject({
|
|
76
|
+
status: z.literal('READ'),
|
|
77
|
+
});
|
|
78
|
+
export const markAllNotificationsAsReadResultSchema = z.strictObject({
|
|
79
|
+
success: z.boolean(),
|
|
80
|
+
});
|
|
81
|
+
export const markAllNotificationsAsReadPropsSchema = z.object({ body: markAllNotificationsAsReadBodySchema }).strict();
|
|
82
|
+
/**
|
|
83
|
+
* Marks all notifications as read for the authenticated user.
|
|
84
|
+
*
|
|
85
|
+
* @operationId mark-all-notifications-as-read
|
|
86
|
+
* @param client - The API client instance
|
|
87
|
+
* @param props - The request properties
|
|
88
|
+
* @param props.body - Request body with status
|
|
89
|
+
* @returns Promise resolving to a success indicator
|
|
90
|
+
*/
|
|
91
|
+
export const markAllNotificationsAsRead = async (client, props) => {
|
|
92
|
+
const { body } = markAllNotificationsAsReadPropsSchema.parse(props);
|
|
93
|
+
const path = '/notifications';
|
|
94
|
+
const response = await client.axios.patch(path, body);
|
|
95
|
+
return parseResult(client, markAllNotificationsAsReadResultSchema, response.data);
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sources":["../../src/routes/notifications.ts"],"names":[],"mappings":"AAAA,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;AAEzG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACzD,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;IACtF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAA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ACjE,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;CAC1B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,YAAY,CAAC;IACnE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,oCAAoC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAGvH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAAiB,EACjB,KAAsC,EACK,EAAE;IAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,qCAAqC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,gBAAgB,CAAC;IAC9B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,OAAO,WAAW,CAAC,MAAM,EAAE,sCAAsC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { ApiClient } from '../client.js';
|
|
3
|
+
export declare const getOEmbedQuerySchema: z.ZodObject<{
|
|
4
|
+
url: z.ZodURL;
|
|
5
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
json: "json";
|
|
7
|
+
xml: "xml";
|
|
8
|
+
}>>>;
|
|
9
|
+
maxwidth: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
10
|
+
maxheight: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type GetOEmbedQuery = z.infer<typeof getOEmbedQuerySchema>;
|
|
13
|
+
export declare const oEmbedResponseSchema: z.ZodObject<{
|
|
14
|
+
version: z.ZodLiteral<"1.0">;
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
link: "link";
|
|
17
|
+
photo: "photo";
|
|
18
|
+
rich: "rich";
|
|
19
|
+
video: "video";
|
|
20
|
+
}>;
|
|
21
|
+
provider_name: z.ZodString;
|
|
22
|
+
provider_url: z.ZodURL;
|
|
23
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
24
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
title: z.ZodOptional<z.ZodString>;
|
|
27
|
+
author_name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
author_url: z.ZodOptional<z.ZodURL>;
|
|
29
|
+
thumbnail_url: z.ZodOptional<z.ZodURL>;
|
|
30
|
+
thumbnail_width: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
thumbnail_height: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
html: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type OEmbedResponse = z.infer<typeof oEmbedResponseSchema>;
|
|
35
|
+
export type GetOEmbedResult = OEmbedResponse;
|
|
36
|
+
export declare const getOEmbedPropsSchema: z.ZodObject<{
|
|
37
|
+
query: z.ZodObject<{
|
|
38
|
+
url: z.ZodURL;
|
|
39
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
json: "json";
|
|
41
|
+
xml: "xml";
|
|
42
|
+
}>>>;
|
|
43
|
+
maxwidth: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
44
|
+
maxheight: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type GetOEmbedProps = z.infer<typeof getOEmbedPropsSchema>;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the URL for the oEmbed endpoint.
|
|
50
|
+
*
|
|
51
|
+
* @param client - The API client instance
|
|
52
|
+
* @param props - The request properties
|
|
53
|
+
* @param props.query - Query parameters (url, format, maxwidth, maxheight)
|
|
54
|
+
* @returns URL object for the oEmbed endpoint
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const oembedUrl = getOEmbedUrl(client, {
|
|
58
|
+
* query: { url: 'https://example.com/org/my-org', format: 'json' }
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const getOEmbedUrl: (client: ApiClient, props: GetOEmbedProps) => URL;
|
|
63
|
+
/**
|
|
64
|
+
* Gets oEmbed data for a URL.
|
|
65
|
+
* Returns structured metadata about the resource following the oEmbed specification.
|
|
66
|
+
*
|
|
67
|
+
* @operationId get-oembed
|
|
68
|
+
* @param client - The API client instance
|
|
69
|
+
* @param props - The request properties
|
|
70
|
+
* @param props.query - Query parameters (url, format, maxwidth, maxheight)
|
|
71
|
+
* @returns Promise resolving to oEmbed response data
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const oembed = await getOEmbed(client, {
|
|
75
|
+
* query: { url: 'https://example.com/org/my-org', format: 'json' }
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare const getOEmbed: (client: ApiClient, props: GetOEmbedProps) => Promise<GetOEmbedResult>;
|
|
80
|
+
//# sourceMappingURL=oembed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oembed.d.ts","sources":["../../src/routes/oembed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,eAAO,MAAM,oBAAoB;;;;;;;;kBAWtB,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;iBAiBgC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC;AAE7C,eAAO,MAAM,oBAAoB;;;;;;;;;;kBAAqD,CAAC;AACvF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,WAAY,SAAS,SAAS,cAAc,KAAG,GAGvE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,WAAkB,SAAS,SAAS,cAAc,KAAG,OAAO,CAAC,eAAe,CAIjG,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { parseResult } from '../client.js';
|
|
3
|
+
import { makeUrl } from '../lib/url.js';
|
|
4
|
+
export const getOEmbedQuerySchema = z
|
|
5
|
+
.object({
|
|
6
|
+
url: z.url().describe('The URL to generate oEmbed data for'),
|
|
7
|
+
format: z
|
|
8
|
+
.enum(['json', 'xml'])
|
|
9
|
+
.optional()
|
|
10
|
+
.default('json')
|
|
11
|
+
.describe('Response format (only "json" is currently supported)'),
|
|
12
|
+
maxwidth: z.coerce.number().int().positive().optional().describe('Maximum width for embedded content in pixels'),
|
|
13
|
+
maxheight: z.coerce.number().int().positive().optional().describe('Maximum height for embedded content in pixels'),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
export const oEmbedResponseSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
version: z.literal('1.0').describe('The oEmbed version number'),
|
|
19
|
+
type: z.enum(['photo', 'video', 'link', 'rich']).describe('The resource type'),
|
|
20
|
+
provider_name: z.string().describe('The name of the resource provider'),
|
|
21
|
+
provider_url: z.url().describe('The URL of the resource provider'),
|
|
22
|
+
url: z.url().optional().describe('The URL of the resource (for photo/video types)'),
|
|
23
|
+
width: z.number().int().positive().optional().describe('The width in pixels'),
|
|
24
|
+
height: z.number().int().positive().optional().describe('The height in pixels'),
|
|
25
|
+
title: z.string().optional().describe('The title of the resource'),
|
|
26
|
+
author_name: z.string().optional().describe('The name of the resource author'),
|
|
27
|
+
author_url: z.url().optional().describe('The URL of the resource author'),
|
|
28
|
+
thumbnail_url: z.url().optional().describe('The URL of a thumbnail image'),
|
|
29
|
+
thumbnail_width: z.number().int().positive().optional().describe('The width of the thumbnail in pixels'),
|
|
30
|
+
thumbnail_height: z.number().int().positive().optional().describe('The height of the thumbnail in pixels'),
|
|
31
|
+
html: z.string().optional().describe('The HTML required to embed the resource (for rich/video types)'),
|
|
32
|
+
})
|
|
33
|
+
.describe('oEmbed response following the oEmbed specification');
|
|
34
|
+
export const getOEmbedPropsSchema = z.object({ query: getOEmbedQuerySchema }).strict();
|
|
35
|
+
/**
|
|
36
|
+
* Gets the URL for the oEmbed endpoint.
|
|
37
|
+
*
|
|
38
|
+
* @param client - The API client instance
|
|
39
|
+
* @param props - The request properties
|
|
40
|
+
* @param props.query - Query parameters (url, format, maxwidth, maxheight)
|
|
41
|
+
* @returns URL object for the oEmbed endpoint
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const oembedUrl = getOEmbedUrl(client, {
|
|
45
|
+
* query: { url: 'https://example.com/org/my-org', format: 'json' }
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const getOEmbedUrl = (client, props) => {
|
|
50
|
+
const { query } = getOEmbedPropsSchema.parse(props);
|
|
51
|
+
return makeUrl(client.host, '/oembed', query);
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Gets oEmbed data for a URL.
|
|
55
|
+
* Returns structured metadata about the resource following the oEmbed specification.
|
|
56
|
+
*
|
|
57
|
+
* @operationId get-oembed
|
|
58
|
+
* @param client - The API client instance
|
|
59
|
+
* @param props - The request properties
|
|
60
|
+
* @param props.query - Query parameters (url, format, maxwidth, maxheight)
|
|
61
|
+
* @returns Promise resolving to oEmbed response data
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const oembed = await getOEmbed(client, {
|
|
65
|
+
* query: { url: 'https://example.com/org/my-org', format: 'json' }
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export const getOEmbed = async (client, props) => {
|
|
70
|
+
const url = getOEmbedUrl(client, props);
|
|
71
|
+
const response = await client.axios.get(url.toString());
|
|
72
|
+
return parseResult(client, oEmbedResponseSchema, response.data);
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=oembed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oembed.js","sources":["../../src/routes/oembed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAC5D,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACrB,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,sDAAsD,CAAC;IACnE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ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