@todoist/comms-sdk 0.0.1 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -39
  3. package/dist/esm/authentication.js +247 -0
  4. package/dist/esm/clients/add-comment-helper.js +41 -0
  5. package/dist/esm/clients/attachments-client.js +99 -0
  6. package/dist/esm/clients/base-client.js +30 -0
  7. package/dist/esm/clients/channels-client.js +209 -0
  8. package/dist/esm/clients/comments-client.js +177 -0
  9. package/dist/esm/clients/conversation-messages-client.js +167 -0
  10. package/dist/esm/clients/conversations-client.js +281 -0
  11. package/dist/esm/clients/groups-client.js +170 -0
  12. package/dist/esm/clients/hooks-client.js +50 -0
  13. package/dist/esm/clients/inbox-client.js +186 -0
  14. package/dist/esm/clients/notify-audience.js +43 -0
  15. package/dist/esm/clients/reactions-client.js +96 -0
  16. package/dist/esm/clients/search-client.js +140 -0
  17. package/dist/esm/clients/threads-client.js +363 -0
  18. package/dist/esm/clients/users-client.js +368 -0
  19. package/dist/esm/clients/workspace-users-client.js +299 -0
  20. package/dist/esm/clients/workspaces-client.js +177 -0
  21. package/dist/esm/comms-api.js +67 -0
  22. package/dist/esm/consts/endpoints.js +31 -0
  23. package/dist/esm/index.js +20 -0
  24. package/dist/esm/migration.js +92 -0
  25. package/dist/esm/testUtils/msw-handlers.js +45 -0
  26. package/dist/esm/testUtils/msw-setup.js +32 -0
  27. package/dist/esm/testUtils/obsidian-fetch-adapter.js +50 -0
  28. package/dist/esm/testUtils/test-defaults.js +103 -0
  29. package/dist/esm/transport/fetch-with-retry.js +240 -0
  30. package/dist/esm/transport/http-client.js +53 -0
  31. package/dist/esm/transport/http-dispatcher.js +149 -0
  32. package/dist/esm/types/api-version.js +5 -0
  33. package/dist/esm/types/entities.js +515 -0
  34. package/dist/esm/types/enums.js +34 -0
  35. package/dist/esm/types/errors.js +82 -0
  36. package/dist/esm/types/http.js +1 -0
  37. package/dist/esm/types/index.js +6 -0
  38. package/dist/esm/types/requests.js +184 -0
  39. package/dist/esm/utils/case-conversion.js +47 -0
  40. package/dist/esm/utils/conversation-title.js +110 -0
  41. package/dist/esm/utils/headers.js +29 -0
  42. package/dist/esm/utils/index.js +5 -0
  43. package/dist/esm/utils/multipart-upload.js +198 -0
  44. package/dist/esm/utils/reply-recipients.js +111 -0
  45. package/dist/esm/utils/timestamp-conversion.js +54 -0
  46. package/dist/esm/utils/url-helpers.js +202 -0
  47. package/dist/esm/utils/uuidv7.js +170 -0
  48. package/dist/types/authentication.d.ts +183 -0
  49. package/dist/types/clients/add-comment-helper.d.ts +32 -0
  50. package/dist/types/clients/attachments-client.d.ts +55 -0
  51. package/dist/types/clients/base-client.d.ts +37 -0
  52. package/dist/types/clients/channels-client.d.ts +211 -0
  53. package/dist/types/clients/comments-client.d.ts +228 -0
  54. package/dist/types/clients/conversation-messages-client.d.ts +201 -0
  55. package/dist/types/clients/conversations-client.d.ts +366 -0
  56. package/dist/types/clients/groups-client.d.ts +148 -0
  57. package/dist/types/clients/hooks-client.d.ts +29 -0
  58. package/dist/types/clients/inbox-client.d.ts +478 -0
  59. package/dist/types/clients/notify-audience.d.ts +22 -0
  60. package/dist/types/clients/reactions-client.d.ts +57 -0
  61. package/dist/types/clients/search-client.d.ts +71 -0
  62. package/dist/types/clients/threads-client.d.ts +547 -0
  63. package/dist/types/clients/users-client.d.ts +280 -0
  64. package/dist/types/clients/workspace-users-client.d.ts +172 -0
  65. package/dist/types/clients/workspaces-client.d.ts +154 -0
  66. package/dist/types/comms-api.d.ts +73 -0
  67. package/dist/types/consts/endpoints.d.ts +27 -0
  68. package/dist/types/index.d.ts +21 -0
  69. package/dist/types/migration.d.ts +78 -0
  70. package/dist/types/testUtils/msw-handlers.d.ts +28 -0
  71. package/dist/types/testUtils/msw-setup.d.ts +1 -0
  72. package/dist/types/testUtils/obsidian-fetch-adapter.d.ts +29 -0
  73. package/dist/types/testUtils/test-defaults.d.ts +17 -0
  74. package/dist/types/transport/fetch-with-retry.d.ts +4 -0
  75. package/dist/types/transport/http-client.d.ts +14 -0
  76. package/dist/types/transport/http-dispatcher.d.ts +46 -0
  77. package/dist/types/types/api-version.d.ts +6 -0
  78. package/dist/types/types/entities.d.ts +3081 -0
  79. package/dist/types/types/enums.d.ts +55 -0
  80. package/dist/types/types/errors.d.ts +57 -0
  81. package/dist/types/types/http.d.ts +60 -0
  82. package/dist/types/types/index.d.ts +6 -0
  83. package/dist/types/types/requests.d.ts +604 -0
  84. package/dist/types/utils/case-conversion.d.ts +8 -0
  85. package/dist/types/utils/conversation-title.d.ts +84 -0
  86. package/dist/types/utils/headers.d.ts +13 -0
  87. package/dist/types/utils/index.d.ts +6 -0
  88. package/dist/types/utils/multipart-upload.d.ts +59 -0
  89. package/dist/types/utils/reply-recipients.d.ts +60 -0
  90. package/dist/types/utils/timestamp-conversion.d.ts +13 -0
  91. package/dist/types/utils/url-helpers.d.ts +129 -0
  92. package/dist/types/utils/uuidv7.d.ts +42 -0
  93. package/package.json +80 -8
@@ -0,0 +1,604 @@
1
+ import { z } from 'zod';
2
+ import { type Attachment } from './entities.js';
3
+ /**
4
+ * Create-side requests require an `id` on the wire. The SDK clients accept
5
+ * `id` as optional and auto-generate one via
6
+ * {@link import('../utils/uuidv7.js').generateId} when the caller doesn't pass
7
+ * one — callers can still mint their own ID locally (e.g. for optimistic
8
+ * UI) and have it stick.
9
+ */
10
+ export declare const CreateChannelArgsSchema: z.ZodObject<{
11
+ workspaceId: z.ZodNumber;
12
+ name: z.ZodString;
13
+ id: z.ZodOptional<z.ZodString>;
14
+ userIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
15
+ color: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
16
+ public: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
17
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ useDefaultRecipients: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
19
+ defaultGroups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
20
+ defaultRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
21
+ isFavorited: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
22
+ icon: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
23
+ }, z.core.$strip>;
24
+ export type CreateChannelArgs = z.infer<typeof CreateChannelArgsSchema>;
25
+ export declare const UpdateChannelArgsSchema: z.ZodObject<{
26
+ id: z.ZodString;
27
+ name: z.ZodString;
28
+ color: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
29
+ public: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
30
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ useDefaultRecipients: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
32
+ defaultGroups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
33
+ defaultRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
34
+ isFavorited: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
35
+ icon: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
36
+ }, z.core.$strip>;
37
+ export type UpdateChannelArgs = z.infer<typeof UpdateChannelArgsSchema>;
38
+ export declare const CreateThreadArgsSchema: z.ZodObject<{
39
+ channelId: z.ZodString;
40
+ content: z.ZodString;
41
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ id: z.ZodOptional<z.ZodString>;
43
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
44
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
45
+ notifyAudience: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
46
+ channel: "channel";
47
+ thread: "thread";
48
+ }>>>;
49
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
50
+ attachmentId: z.ZodString;
51
+ urlType: z.ZodString;
52
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
56
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
60
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
61
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
66
+ }, z.core.$strip>>>>;
67
+ }, z.core.$strip>;
68
+ export type CreateThreadArgs = z.infer<typeof CreateThreadArgsSchema>;
69
+ export declare const UpdateThreadArgsSchema: z.ZodObject<{
70
+ id: z.ZodString;
71
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ }, z.core.$strip>;
74
+ export type UpdateThreadArgs = z.infer<typeof UpdateThreadArgsSchema>;
75
+ export declare const CreateCommentArgsSchema: z.ZodObject<{
76
+ threadId: z.ZodString;
77
+ content: z.ZodString;
78
+ id: z.ZodOptional<z.ZodString>;
79
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
80
+ attachmentId: z.ZodString;
81
+ urlType: z.ZodString;
82
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
86
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
90
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
91
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
93
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
95
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
96
+ }, z.core.$strip>>>>;
97
+ actions: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
98
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
99
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
100
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
101
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
102
+ notifyAudience: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
103
+ channel: "channel";
104
+ thread: "thread";
105
+ }>>>;
106
+ }, z.core.$strip>;
107
+ export type CreateCommentArgs = z.infer<typeof CreateCommentArgsSchema>;
108
+ export declare const UpdateCommentArgsSchema: z.ZodObject<{
109
+ id: z.ZodString;
110
+ content: z.ZodString;
111
+ }, z.core.$strip>;
112
+ export type UpdateCommentArgs = z.infer<typeof UpdateCommentArgsSchema>;
113
+ export declare const CreateConversationArgsSchema: z.ZodObject<{
114
+ workspaceId: z.ZodNumber;
115
+ recipients: z.ZodArray<z.ZodNumber>;
116
+ id: z.ZodOptional<z.ZodString>;
117
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
+ }, z.core.$strip>;
119
+ export type CreateConversationArgs = z.infer<typeof CreateConversationArgsSchema>;
120
+ export declare const CreateMessageArgsSchema: z.ZodObject<{
121
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ content: z.ZodString;
124
+ id: z.ZodOptional<z.ZodString>;
125
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
126
+ attachmentId: z.ZodString;
127
+ urlType: z.ZodString;
128
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
132
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
136
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
137
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
140
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
142
+ }, z.core.$strip>>>>;
143
+ }, z.core.$strip>;
144
+ export type CreateMessageArgs = z.infer<typeof CreateMessageArgsSchema>;
145
+ export declare const GetChannelsArgsSchema: z.ZodObject<{
146
+ workspaceId: z.ZodNumber;
147
+ archived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
148
+ }, z.core.$strip>;
149
+ export type GetChannelsArgs = z.infer<typeof GetChannelsArgsSchema>;
150
+ export declare const GetThreadsArgsSchema: z.ZodObject<{
151
+ workspaceId: z.ZodNumber;
152
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
153
+ archived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
154
+ newerThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
155
+ olderThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
156
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
157
+ }, z.core.$strip>;
158
+ export type GetThreadsArgs = z.infer<typeof GetThreadsArgsSchema>;
159
+ export declare const GetCommentsArgsSchema: z.ZodObject<{
160
+ threadId: z.ZodString;
161
+ newerThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
162
+ olderThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
163
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
164
+ }, z.core.$strip>;
165
+ export type GetCommentsArgs = z.infer<typeof GetCommentsArgsSchema>;
166
+ export declare const GetConversationsArgsSchema: z.ZodObject<{
167
+ workspaceId: z.ZodNumber;
168
+ archived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
169
+ olderThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
170
+ beforeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
172
+ }, z.core.$strip>;
173
+ export type GetConversationsArgs = z.infer<typeof GetConversationsArgsSchema>;
174
+ export declare const GetOrCreateConversationArgsSchema: z.ZodObject<{
175
+ workspaceId: z.ZodNumber;
176
+ userIds: z.ZodArray<z.ZodNumber>;
177
+ id: z.ZodOptional<z.ZodString>;
178
+ }, z.core.$strip>;
179
+ export type GetOrCreateConversationArgs = z.infer<typeof GetOrCreateConversationArgsSchema>;
180
+ export type UpdateUserArgs = {
181
+ name?: string;
182
+ password?: string;
183
+ timezone?: string;
184
+ lang?: string;
185
+ dateFormat?: string;
186
+ timeFormat?: string;
187
+ /** Theme ID (0-12). String aliases like `'dark'` are also accepted. */
188
+ theme?: number | string;
189
+ };
190
+ type StatusEffectArgs = {
191
+ scope?: {
192
+ mode?: 'all';
193
+ };
194
+ };
195
+ /** Only supplied fields change. Null removes optional fields and effects. */
196
+ export type SetStatusArgs = {
197
+ /** 1 to 80 characters once trimmed. Required when creating a status; omission preserves it. */
198
+ message?: string;
199
+ emoji?: string | null;
200
+ /** Must be in the future; null removes expiry, omission preserves it. Dates are sent as ISO strings. */
201
+ activeUntil?: Date | string | null;
202
+ /** Supplied effects are merged; null clears all effects, omission or {} preserves them. */
203
+ effects?: {
204
+ /** Holds back Comms notifications. Null removes it; {} preserves its configuration or enables it with defaults. */
205
+ pauseNotifications?: StatusEffectArgs | null;
206
+ /** Pauses Todoist Karma and streaks. Null removes it; {} preserves its configuration or enables it with defaults. */
207
+ pauseActivity?: StatusEffectArgs | null;
208
+ } | null;
209
+ };
210
+ export declare const SEARCH_TYPES: readonly ["threads", "messages", "conversations", "all"];
211
+ export type SearchType = (typeof SEARCH_TYPES)[number];
212
+ type SearchArgsCommon = {
213
+ workspaceId: number;
214
+ type?: SearchType;
215
+ channelIds?: string[];
216
+ authorIds?: number[];
217
+ dateFrom?: string;
218
+ dateTo?: string;
219
+ limit?: number;
220
+ cursor?: string;
221
+ };
222
+ export type SearchArgs = (SearchArgsCommon & {
223
+ query: string;
224
+ mentionSelf?: boolean;
225
+ }) | (SearchArgsCommon & {
226
+ query?: string;
227
+ mentionSelf: true;
228
+ });
229
+ export type SearchThreadArgs = {
230
+ query: string;
231
+ threadId: string;
232
+ limit?: number;
233
+ cursor?: string;
234
+ };
235
+ export type SearchConversationArgs = {
236
+ query: string;
237
+ conversationId: string;
238
+ limit?: number;
239
+ cursor?: string;
240
+ };
241
+ export type GetConversationMessagesArgs = {
242
+ conversationId: string;
243
+ newerThan?: Date;
244
+ olderThan?: Date;
245
+ limit?: number;
246
+ cursor?: string;
247
+ };
248
+ export type CreateConversationMessageArgs = {
249
+ conversationId: string;
250
+ content: string;
251
+ /** Caller-supplied ID. Auto-generated if omitted. */
252
+ id?: string;
253
+ attachments?: Attachment[];
254
+ actions?: unknown[];
255
+ directMentions?: number[];
256
+ directGroupMentions?: string[];
257
+ notify?: boolean;
258
+ };
259
+ export type UpdateConversationMessageArgs = {
260
+ id: string;
261
+ content: string;
262
+ attachments?: Attachment[];
263
+ actions?: unknown[];
264
+ directMentions?: number[];
265
+ directGroupMentions?: string[];
266
+ };
267
+ export declare const ARCHIVE_FILTER_VALUES: readonly ["active", "archived", "all"];
268
+ export type ArchiveFilter = (typeof ARCHIVE_FILTER_VALUES)[number];
269
+ export type GetInboxArgs = {
270
+ workspaceId: number;
271
+ newerThan?: Date;
272
+ olderThan?: Date;
273
+ limit?: number;
274
+ cursor?: string;
275
+ archiveFilter?: ArchiveFilter;
276
+ };
277
+ export type ArchiveAllArgs = {
278
+ workspaceId: number;
279
+ channelIds?: string[];
280
+ olderThan?: Date;
281
+ };
282
+ export type AddReactionArgs = {
283
+ threadId?: string;
284
+ commentId?: string;
285
+ messageId?: string;
286
+ reaction: string;
287
+ };
288
+ export type RemoveReactionArgs = {
289
+ threadId?: string;
290
+ commentId?: string;
291
+ messageId?: string;
292
+ reaction: string;
293
+ };
294
+ export type GetReactionsArgs = {
295
+ threadId?: string;
296
+ commentId?: string;
297
+ messageId?: string;
298
+ };
299
+ export declare const NON_MESSAGE_HOOK_EVENTS: readonly ["workspace_added", "workspace_updated", "workspace_deleted", "workspace_user_added", "workspace_user_updated", "workspace_user_removed", "channel_added", "channel_updated", "channel_deleted", "channel_user_added", "channel_user_removed", "thread_added", "thread_updated", "thread_deleted", "comment_added", "comment_updated", "comment_deleted", "group_added", "group_updated", "group_deleted", "group_user_added", "group_user_removed"];
300
+ export type NonMessageHookEvent = (typeof NON_MESSAGE_HOOK_EVENTS)[number];
301
+ export declare const MESSAGE_HOOK_EVENTS: readonly ["message_added", "message_updated"];
302
+ export type MessageHookEvent = (typeof MESSAGE_HOOK_EVENTS)[number];
303
+ export declare const HOOK_EVENTS: readonly ["workspace_added", "workspace_updated", "workspace_deleted", "workspace_user_added", "workspace_user_updated", "workspace_user_removed", "channel_added", "channel_updated", "channel_deleted", "channel_user_added", "channel_user_removed", "thread_added", "thread_updated", "thread_deleted", "comment_added", "comment_updated", "comment_deleted", "group_added", "group_updated", "group_deleted", "group_user_added", "group_user_removed", "message_added", "message_updated"];
304
+ export type HookEvent = (typeof HOOK_EVENTS)[number];
305
+ export declare const NonMessageHookEventSchema: z.ZodEnum<{
306
+ workspace_added: "workspace_added";
307
+ workspace_updated: "workspace_updated";
308
+ workspace_deleted: "workspace_deleted";
309
+ workspace_user_added: "workspace_user_added";
310
+ workspace_user_updated: "workspace_user_updated";
311
+ workspace_user_removed: "workspace_user_removed";
312
+ channel_added: "channel_added";
313
+ channel_updated: "channel_updated";
314
+ channel_deleted: "channel_deleted";
315
+ channel_user_added: "channel_user_added";
316
+ channel_user_removed: "channel_user_removed";
317
+ thread_added: "thread_added";
318
+ thread_updated: "thread_updated";
319
+ thread_deleted: "thread_deleted";
320
+ comment_added: "comment_added";
321
+ comment_updated: "comment_updated";
322
+ comment_deleted: "comment_deleted";
323
+ group_added: "group_added";
324
+ group_updated: "group_updated";
325
+ group_deleted: "group_deleted";
326
+ group_user_added: "group_user_added";
327
+ group_user_removed: "group_user_removed";
328
+ }>;
329
+ export declare const MessageHookEventSchema: z.ZodEnum<{
330
+ message_added: "message_added";
331
+ message_updated: "message_updated";
332
+ }>;
333
+ export declare const HookEventSchema: z.ZodEnum<{
334
+ workspace_added: "workspace_added";
335
+ workspace_updated: "workspace_updated";
336
+ workspace_deleted: "workspace_deleted";
337
+ workspace_user_added: "workspace_user_added";
338
+ workspace_user_updated: "workspace_user_updated";
339
+ workspace_user_removed: "workspace_user_removed";
340
+ channel_added: "channel_added";
341
+ channel_updated: "channel_updated";
342
+ channel_deleted: "channel_deleted";
343
+ channel_user_added: "channel_user_added";
344
+ channel_user_removed: "channel_user_removed";
345
+ thread_added: "thread_added";
346
+ thread_updated: "thread_updated";
347
+ thread_deleted: "thread_deleted";
348
+ comment_added: "comment_added";
349
+ comment_updated: "comment_updated";
350
+ comment_deleted: "comment_deleted";
351
+ group_added: "group_added";
352
+ group_updated: "group_updated";
353
+ group_deleted: "group_deleted";
354
+ group_user_added: "group_user_added";
355
+ group_user_removed: "group_user_removed";
356
+ message_added: "message_added";
357
+ message_updated: "message_updated";
358
+ }>;
359
+ export declare const HookTargetUrlSchema: z.ZodURL;
360
+ export declare const SubscribeHookArgsBaseSchema: z.ZodObject<{
361
+ targetUrl: z.ZodURL;
362
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
363
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
364
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
365
+ }, z.core.$strip>;
366
+ export declare const SubscribeNonMessageHookArgsSchema: z.ZodObject<{
367
+ targetUrl: z.ZodURL;
368
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
369
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
370
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
371
+ event: z.ZodEnum<{
372
+ workspace_added: "workspace_added";
373
+ workspace_updated: "workspace_updated";
374
+ workspace_deleted: "workspace_deleted";
375
+ workspace_user_added: "workspace_user_added";
376
+ workspace_user_updated: "workspace_user_updated";
377
+ workspace_user_removed: "workspace_user_removed";
378
+ channel_added: "channel_added";
379
+ channel_updated: "channel_updated";
380
+ channel_deleted: "channel_deleted";
381
+ channel_user_added: "channel_user_added";
382
+ channel_user_removed: "channel_user_removed";
383
+ thread_added: "thread_added";
384
+ thread_updated: "thread_updated";
385
+ thread_deleted: "thread_deleted";
386
+ comment_added: "comment_added";
387
+ comment_updated: "comment_updated";
388
+ comment_deleted: "comment_deleted";
389
+ group_added: "group_added";
390
+ group_updated: "group_updated";
391
+ group_deleted: "group_deleted";
392
+ group_user_added: "group_user_added";
393
+ group_user_removed: "group_user_removed";
394
+ }>;
395
+ conversationId: z.ZodOptional<z.ZodNever>;
396
+ }, z.core.$strip>;
397
+ export declare const SubscribeMessageHookArgsSchema: z.ZodObject<{
398
+ targetUrl: z.ZodURL;
399
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
400
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
401
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
402
+ event: z.ZodEnum<{
403
+ message_added: "message_added";
404
+ message_updated: "message_updated";
405
+ }>;
406
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
407
+ }, z.core.$strip>;
408
+ export declare const SubscribeHookArgsSchema: z.ZodUnion<readonly [z.ZodObject<{
409
+ targetUrl: z.ZodURL;
410
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
411
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
412
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
413
+ event: z.ZodEnum<{
414
+ workspace_added: "workspace_added";
415
+ workspace_updated: "workspace_updated";
416
+ workspace_deleted: "workspace_deleted";
417
+ workspace_user_added: "workspace_user_added";
418
+ workspace_user_updated: "workspace_user_updated";
419
+ workspace_user_removed: "workspace_user_removed";
420
+ channel_added: "channel_added";
421
+ channel_updated: "channel_updated";
422
+ channel_deleted: "channel_deleted";
423
+ channel_user_added: "channel_user_added";
424
+ channel_user_removed: "channel_user_removed";
425
+ thread_added: "thread_added";
426
+ thread_updated: "thread_updated";
427
+ thread_deleted: "thread_deleted";
428
+ comment_added: "comment_added";
429
+ comment_updated: "comment_updated";
430
+ comment_deleted: "comment_deleted";
431
+ group_added: "group_added";
432
+ group_updated: "group_updated";
433
+ group_deleted: "group_deleted";
434
+ group_user_added: "group_user_added";
435
+ group_user_removed: "group_user_removed";
436
+ }>;
437
+ conversationId: z.ZodOptional<z.ZodNever>;
438
+ }, z.core.$strip>, z.ZodObject<{
439
+ targetUrl: z.ZodURL;
440
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
441
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
442
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
443
+ event: z.ZodEnum<{
444
+ message_added: "message_added";
445
+ message_updated: "message_updated";
446
+ }>;
447
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
448
+ }, z.core.$strip>]>;
449
+ export type SubscribeHookArgs = z.infer<typeof SubscribeHookArgsSchema>;
450
+ export declare const UnsubscribeHookArgsSchema: z.ZodObject<{
451
+ targetUrl: z.ZodURL;
452
+ }, z.core.$strip>;
453
+ export type UnsubscribeHookArgs = z.infer<typeof UnsubscribeHookArgsSchema>;
454
+ export type AddChannelUserArgs = {
455
+ id: string;
456
+ userId: number;
457
+ };
458
+ export type AddChannelUsersArgs = {
459
+ id: string;
460
+ userIds: number[];
461
+ };
462
+ export type RemoveChannelUserArgs = {
463
+ id: string;
464
+ userId: number;
465
+ };
466
+ export type RemoveChannelUsersArgs = {
467
+ id: string;
468
+ userIds: number[];
469
+ };
470
+ export declare const THREAD_ACTIONS: readonly ["close", "reopen"];
471
+ export type ThreadAction = (typeof THREAD_ACTIONS)[number];
472
+ /**
473
+ * Shared shape for endpoints that post a comment as part of a thread action
474
+ * (close, reopen). Identical to {@link CreateCommentArgs} except the target
475
+ * is identified by `id` (the thread ID) instead of `threadId`.
476
+ */
477
+ type ThreadActionCommentArgs = Omit<CreateCommentArgs, 'threadId'> & {
478
+ id: string;
479
+ };
480
+ export type CloseThreadArgs = ThreadActionCommentArgs;
481
+ export type ReopenThreadArgs = ThreadActionCommentArgs;
482
+ export type MoveThreadToChannelArgs = {
483
+ id: string;
484
+ toChannel: string;
485
+ };
486
+ export type MarkThreadReadArgs = {
487
+ id: string;
488
+ objIndex: number;
489
+ };
490
+ export type MarkThreadUnreadArgs = {
491
+ id: string;
492
+ objIndex: number;
493
+ };
494
+ export type MarkThreadUnreadForOthersArgs = {
495
+ id: string;
496
+ objIndex: number;
497
+ };
498
+ export type MuteThreadArgs = {
499
+ id: string;
500
+ minutes: number;
501
+ };
502
+ export type MarkCommentPositionArgs = {
503
+ threadId: string;
504
+ commentId: string;
505
+ };
506
+ export type UpdateConversationArgs = {
507
+ id: string;
508
+ title: string;
509
+ archived?: boolean;
510
+ };
511
+ export type AddConversationUserArgs = {
512
+ id: string;
513
+ userId: number;
514
+ };
515
+ export type AddConversationUsersArgs = {
516
+ id: string;
517
+ userIds: number[];
518
+ };
519
+ export type RemoveConversationUserArgs = {
520
+ id: string;
521
+ userId: number;
522
+ };
523
+ export type RemoveConversationUsersArgs = {
524
+ id: string;
525
+ userIds: number[];
526
+ };
527
+ export type MuteConversationArgs = {
528
+ id: string;
529
+ minutes: number;
530
+ };
531
+ export type AddGroupUserArgs = {
532
+ id: string;
533
+ workspaceId: number;
534
+ userId: number;
535
+ };
536
+ export type AddGroupUsersArgs = {
537
+ id: string;
538
+ workspaceId: number;
539
+ userIds: number[];
540
+ };
541
+ export type RemoveGroupUserArgs = {
542
+ id: string;
543
+ workspaceId: number;
544
+ userId: number;
545
+ };
546
+ export type RemoveGroupUsersArgs = {
547
+ id: string;
548
+ workspaceId: number;
549
+ userIds: number[];
550
+ };
551
+ export type GetWorkspaceUsersArgs = {
552
+ workspaceId: number;
553
+ archived?: boolean;
554
+ /**
555
+ * Include users who have been removed from the workspace. Defaults to `false`.
556
+ * The Comms API always returns removed users, so the SDK filters them client-side.
557
+ */
558
+ includeRemoved?: boolean;
559
+ };
560
+ export type GetUserByIdArgs = {
561
+ workspaceId: number;
562
+ userId: number;
563
+ };
564
+ export type GetUsersByIdsArgs = {
565
+ workspaceId: number;
566
+ userIds: number[];
567
+ };
568
+ export type GetUserByEmailArgs = {
569
+ workspaceId: number;
570
+ email: string;
571
+ };
572
+ export type GetUserInfoArgs = {
573
+ workspaceId: number;
574
+ userId: number;
575
+ };
576
+ export type GetUserLocalTimeArgs = {
577
+ workspaceId: number;
578
+ userId: number;
579
+ };
580
+ type UploadAttachmentCommonArgs = {
581
+ /** The workspace the file belongs to. Its plan sets the largest file it accepts. */
582
+ workspaceId: number;
583
+ /** MIME type. Defaults to the `Blob`'s type or one inferred from the file extension. */
584
+ contentType?: string;
585
+ /** Attachment ID to use. A random ID is generated when omitted. */
586
+ attachmentId?: string;
587
+ };
588
+ /**
589
+ * Arguments for `attachments.upload`. A discriminated union on `file` enforces, at
590
+ * compile time, that raw `Uint8Array` bytes are accompanied by a `fileName` (there is
591
+ * no name to infer), while a `Blob`/`File` may omit it.
592
+ */
593
+ export type UploadAttachmentArgs = UploadAttachmentCommonArgs & ({
594
+ /** The file to upload — a `Blob`/`File` (browser, or any runtime with a global `Blob`). */
595
+ file: Blob;
596
+ /** File name. Inferred from the `File.name` when omitted. */
597
+ fileName?: string;
598
+ } | {
599
+ /** Raw bytes to upload. A Node `Buffer` is a `Uint8Array`, so `await readFile(path)` works directly. */
600
+ file: Uint8Array;
601
+ /** File name. Required for raw bytes — there is no name to infer. */
602
+ fileName: string;
603
+ });
604
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare function camelCaseKeys(obj: unknown): unknown;
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare function snakeCaseKeys(obj: unknown): unknown;