@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,148 @@
1
+ import { z } from 'zod';
2
+ import { type Group, type StatusOk } from '../types/entities.js';
3
+ import type { AddGroupUserArgs, AddGroupUsersArgs, RemoveGroupUserArgs, RemoveGroupUsersArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
+ export declare const GroupListSchema: z.ZodArray<z.ZodObject<{
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ workspaceId: z.ZodNumber;
10
+ userIds: z.ZodArray<z.ZodNumber>;
11
+ version: z.ZodNumber;
12
+ }, z.core.$strip>>;
13
+ /**
14
+ * Client for `/api/v1.0/groups/`. The broadcast markers `EVERYONE` /
15
+ * `EVERYONE_IN_THREAD` are NOT addressable through these endpoints — they
16
+ * only appear as members of `direct_group_mentions` / `groups` lists on
17
+ * thread/comment writes.
18
+ *
19
+ * `getone` / `update` / `remove` and the member-management ops all require
20
+ * `workspace_id` alongside the group `id`.
21
+ */
22
+ export declare class GroupsClient extends BaseClient {
23
+ /**
24
+ * Gets all groups for a given workspace.
25
+ *
26
+ * @param workspaceId - The workspace ID.
27
+ * @returns An array of group objects.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const groups = await api.groups.getGroups(123)
32
+ * groups.forEach(g => console.log(g.name))
33
+ * ```
34
+ */
35
+ getGroups(workspaceId: number): Promise<Group[]>;
36
+ /**
37
+ * Gets a single group object by id. Requires `workspaceId`.
38
+ *
39
+ * @param args - The arguments for getting a group.
40
+ * @param args.id - The group ID.
41
+ * @param args.workspaceId - The workspace ID.
42
+ * @returns The group object.
43
+ */
44
+ getGroup(args: {
45
+ id: string;
46
+ workspaceId: number;
47
+ }): Promise<Group>;
48
+ /**
49
+ * Creates a new group. `id` is auto-generated if not supplied.
50
+ *
51
+ * @param args - The arguments for creating a group.
52
+ * @param args.workspaceId - The workspace ID.
53
+ * @param args.name - The group name.
54
+ * @param args.id - Optional caller-supplied group ID (for optimistic-UI workflows).
55
+ * @param args.description - Optional group description.
56
+ * @param args.userIds - Optional array of user IDs to add to the group.
57
+ * @returns The created group object.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const group = await api.groups.createGroup({
62
+ * workspaceId: 123,
63
+ * name: 'Engineering Team',
64
+ * userIds: [1, 2, 3],
65
+ * })
66
+ * ```
67
+ */
68
+ createGroup(args: {
69
+ workspaceId: number;
70
+ name: string;
71
+ id?: string;
72
+ description?: string;
73
+ userIds?: number[];
74
+ }): Promise<Group>;
75
+ /**
76
+ * Updates a group's properties. Requires `workspaceId`.
77
+ *
78
+ * @param args - The arguments for updating a group.
79
+ * @param args.id - The group ID.
80
+ * @param args.workspaceId - The workspace ID.
81
+ * @param args.name - Optional new group name.
82
+ * @param args.description - Optional new group description.
83
+ * @returns The updated group object.
84
+ */
85
+ updateGroup(args: {
86
+ id: string;
87
+ workspaceId: number;
88
+ name?: string;
89
+ description?: string;
90
+ }): Promise<Group>;
91
+ /**
92
+ * Permanently deletes a group. Requires `workspaceId`.
93
+ *
94
+ * @param args - The arguments for deleting a group.
95
+ * @param args.id - The group ID.
96
+ * @param args.workspaceId - The workspace ID.
97
+ */
98
+ deleteGroup(args: {
99
+ id: string;
100
+ workspaceId: number;
101
+ }): Promise<StatusOk>;
102
+ /**
103
+ * Adds a user to a group.
104
+ *
105
+ * @param args - The arguments for adding a user.
106
+ * @param args.id - The group ID.
107
+ * @param args.workspaceId - The workspace ID.
108
+ * @param args.userId - The user ID to add.
109
+ */
110
+ addUser(args: AddGroupUserArgs): Promise<StatusOk>;
111
+ /**
112
+ * Adds multiple users to a group.
113
+ *
114
+ * @param args - The arguments for adding users.
115
+ * @param args.id - The group ID.
116
+ * @param args.workspaceId - The workspace ID.
117
+ * @param args.userIds - Array of user IDs to add.
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * await api.groups.addUsers({
122
+ * id: '7YpL3oZ4kZ9vP7Q1tR2sX45',
123
+ * workspaceId: 123,
124
+ * userIds: [101, 202, 303],
125
+ * })
126
+ * ```
127
+ */
128
+ addUsers(args: AddGroupUsersArgs): Promise<StatusOk>;
129
+ /**
130
+ * Removes a user from a group.
131
+ *
132
+ * @param args - The arguments for removing a user.
133
+ * @param args.id - The group ID.
134
+ * @param args.workspaceId - The workspace ID.
135
+ * @param args.userId - The user ID to remove.
136
+ */
137
+ removeUser(args: RemoveGroupUserArgs): Promise<StatusOk>;
138
+ /**
139
+ * Removes multiple users from a group.
140
+ *
141
+ * @param args - The arguments for removing users.
142
+ * @param args.id - The group ID.
143
+ * @param args.workspaceId - The workspace ID.
144
+ * @param args.userIds - Array of user IDs to remove.
145
+ */
146
+ removeUsers(args: RemoveGroupUsersArgs): Promise<StatusOk>;
147
+ private simple;
148
+ }
@@ -0,0 +1,29 @@
1
+ import { type HookSubscribeResponse, type StatusOk } from '../types/entities.js';
2
+ import type { SubscribeHookArgs, UnsubscribeHookArgs } from '../types/requests.js';
3
+ import { BaseClient } from './base-client.js';
4
+ /**
5
+ * Client for `/api/v1.0/hooks/`. REST hooks require Todoist OAuth bearer tokens
6
+ * that include Comms audience; session tokens are rejected by the backend.
7
+ */
8
+ export declare class HooksClient extends BaseClient {
9
+ /**
10
+ * Subscribes the current OAuth app to a REST hook event.
11
+ *
12
+ * @param args - The hook subscription parameters.
13
+ * @param args.targetUrl - HTTPS endpoint, up to 150 characters, that will receive webhook POSTs.
14
+ * @param args.event - Event name to subscribe to.
15
+ * @param args.workspaceId - Optional workspace filter.
16
+ * @param args.channelId - Optional channel filter.
17
+ * @param args.threadId - Optional thread filter.
18
+ * @param args.conversationId - Optional conversation filter for message events.
19
+ * @returns The `{ status: 'ok', id }` response for the subscription.
20
+ */
21
+ subscribe(args: SubscribeHookArgs): Promise<HookSubscribeResponse>;
22
+ /**
23
+ * Unsubscribes all hooks with the target URL for the current OAuth app.
24
+ *
25
+ * @param args - The hook unsubscribe parameters.
26
+ * @param args.targetUrl - Target URL to remove.
27
+ */
28
+ unsubscribe(args: UnsubscribeHookArgs): Promise<StatusOk>;
29
+ }
@@ -0,0 +1,478 @@
1
+ import { z } from 'zod';
2
+ import { type InboxThread } from '../types/entities.js';
3
+ import type { ArchiveAllArgs, GetInboxArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
+ export declare const InboxThreadListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
6
+ id: z.ZodString;
7
+ title: z.ZodString;
8
+ content: z.ZodString;
9
+ creator: z.ZodNumber;
10
+ creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ channelId: z.ZodString;
12
+ workspaceId: z.ZodNumber;
13
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
14
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
15
+ attachmentId: z.ZodString;
16
+ urlType: z.ZodString;
17
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
21
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
26
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
31
+ }, z.core.$loose>>>>;
32
+ commentCount: z.ZodNumber;
33
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
34
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
35
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
36
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
37
+ lastObjIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
38
+ lastUpdated: z.ZodDate;
39
+ mutedUntil: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
40
+ participants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
41
+ pinned: z.ZodOptional<z.ZodBoolean>;
42
+ pinnedDate: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
43
+ posted: z.ZodDate;
44
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodNumber>>>>;
45
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
46
+ snippet: z.ZodString;
47
+ snippetCreator: z.ZodNumber;
48
+ snippetMaskAvatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
51
+ isArchived: z.ZodBoolean;
52
+ inInbox: z.ZodBoolean;
53
+ isSaved: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
54
+ closed: z.ZodBoolean;
55
+ responders: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
56
+ lastComment: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
57
+ id: z.ZodString;
58
+ content: z.ZodString;
59
+ creator: z.ZodNumber;
60
+ threadId: z.ZodString;
61
+ workspaceId: z.ZodNumber;
62
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ posted: z.ZodDate;
64
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
65
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
66
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
67
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
68
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
69
+ attachmentId: z.ZodString;
70
+ urlType: z.ZodString;
71
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
75
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
78
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
79
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
85
+ }, z.core.$loose>>>>;
86
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
87
+ objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
88
+ creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ channelId: z.ZodString;
90
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
91
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
92
+ toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
93
+ deleted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
94
+ deletedBy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
95
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
96
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
97
+ }, z.core.$strip>, z.ZodTransform<{
98
+ url: string;
99
+ id: string;
100
+ content: string;
101
+ creator: number;
102
+ threadId: string;
103
+ workspaceId: number;
104
+ posted: Date;
105
+ channelId: string;
106
+ conversationId?: string | null | undefined;
107
+ lastEdited?: Date | null | undefined;
108
+ directMentions?: number[] | null | undefined;
109
+ directGroupMentions?: string[] | null | undefined;
110
+ systemMessage?: unknown;
111
+ attachments?: {
112
+ [x: string]: unknown;
113
+ attachmentId: string;
114
+ urlType: string;
115
+ title?: string | null | undefined;
116
+ url?: string | null | undefined;
117
+ fileName?: string | null | undefined;
118
+ fileSize?: number | null | undefined;
119
+ underlyingType?: string | null | undefined;
120
+ description?: string | null | undefined;
121
+ image?: string | null | undefined;
122
+ imageWidth?: number | null | undefined;
123
+ imageHeight?: number | null | undefined;
124
+ duration?: string | null | undefined;
125
+ uploadState?: string | null | undefined;
126
+ video?: string | null | undefined;
127
+ videoType?: string | null | undefined;
128
+ videoAutoPlay?: boolean | null | undefined;
129
+ }[] | null | undefined;
130
+ reactions?: Record<string, unknown> | null | undefined;
131
+ objIndex?: number | null | undefined;
132
+ creatorName?: string | null | undefined;
133
+ recipients?: number[] | null | undefined;
134
+ groups?: string[] | null | undefined;
135
+ toEmails?: string[] | null | undefined;
136
+ deleted?: boolean | null | undefined;
137
+ deletedBy?: number | null | undefined;
138
+ version?: number | null | undefined;
139
+ actions?: unknown[] | null | undefined;
140
+ }, {
141
+ id: string;
142
+ content: string;
143
+ creator: number;
144
+ threadId: string;
145
+ workspaceId: number;
146
+ posted: Date;
147
+ channelId: string;
148
+ conversationId?: string | null | undefined;
149
+ lastEdited?: Date | null | undefined;
150
+ directMentions?: number[] | null | undefined;
151
+ directGroupMentions?: string[] | null | undefined;
152
+ systemMessage?: unknown;
153
+ attachments?: {
154
+ [x: string]: unknown;
155
+ attachmentId: string;
156
+ urlType: string;
157
+ title?: string | null | undefined;
158
+ url?: string | null | undefined;
159
+ fileName?: string | null | undefined;
160
+ fileSize?: number | null | undefined;
161
+ underlyingType?: string | null | undefined;
162
+ description?: string | null | undefined;
163
+ image?: string | null | undefined;
164
+ imageWidth?: number | null | undefined;
165
+ imageHeight?: number | null | undefined;
166
+ duration?: string | null | undefined;
167
+ uploadState?: string | null | undefined;
168
+ video?: string | null | undefined;
169
+ videoType?: string | null | undefined;
170
+ videoAutoPlay?: boolean | null | undefined;
171
+ }[] | null | undefined;
172
+ reactions?: Record<string, unknown> | null | undefined;
173
+ objIndex?: number | null | undefined;
174
+ creatorName?: string | null | undefined;
175
+ recipients?: number[] | null | undefined;
176
+ groups?: string[] | null | undefined;
177
+ toEmails?: string[] | null | undefined;
178
+ deleted?: boolean | null | undefined;
179
+ deletedBy?: number | null | undefined;
180
+ version?: number | null | undefined;
181
+ actions?: unknown[] | null | undefined;
182
+ }>>>>;
183
+ toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
184
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
185
+ }, z.core.$strip>, z.ZodTransform<{
186
+ url: string;
187
+ id: string;
188
+ title: string;
189
+ content: string;
190
+ creator: number;
191
+ channelId: string;
192
+ workspaceId: number;
193
+ commentCount: number;
194
+ lastUpdated: Date;
195
+ posted: Date;
196
+ snippet: string;
197
+ snippetCreator: number;
198
+ isArchived: boolean;
199
+ inInbox: boolean;
200
+ closed: boolean;
201
+ creatorName?: string | null | undefined;
202
+ actions?: unknown[] | null | undefined;
203
+ attachments?: {
204
+ [x: string]: unknown;
205
+ attachmentId: string;
206
+ urlType: string;
207
+ title?: string | null | undefined;
208
+ url?: string | null | undefined;
209
+ fileName?: string | null | undefined;
210
+ fileSize?: number | null | undefined;
211
+ underlyingType?: string | null | undefined;
212
+ description?: string | null | undefined;
213
+ image?: string | null | undefined;
214
+ imageWidth?: number | null | undefined;
215
+ imageHeight?: number | null | undefined;
216
+ duration?: string | null | undefined;
217
+ uploadState?: string | null | undefined;
218
+ video?: string | null | undefined;
219
+ videoType?: string | null | undefined;
220
+ videoAutoPlay?: boolean | null | undefined;
221
+ }[] | null | undefined;
222
+ directGroupMentions?: string[] | null | undefined;
223
+ directMentions?: number[] | null | undefined;
224
+ groups?: string[] | null | undefined;
225
+ lastEdited?: Date | null | undefined;
226
+ lastObjIndex?: number | null | undefined;
227
+ mutedUntil?: Date | null | undefined;
228
+ participants?: number[] | null | undefined;
229
+ pinned?: boolean | undefined;
230
+ pinnedDate?: Date | null | undefined;
231
+ reactions?: Record<string, number[]> | null | undefined;
232
+ recipients?: number[] | null | undefined;
233
+ snippetMaskAvatarUrl?: string | null | undefined;
234
+ snippetMaskPoster?: string | null | undefined;
235
+ systemMessage?: unknown;
236
+ isSaved?: boolean | null | undefined;
237
+ responders?: number[] | null | undefined;
238
+ lastComment?: {
239
+ url: string;
240
+ id: string;
241
+ content: string;
242
+ creator: number;
243
+ threadId: string;
244
+ workspaceId: number;
245
+ posted: Date;
246
+ channelId: string;
247
+ conversationId?: string | null | undefined;
248
+ lastEdited?: Date | null | undefined;
249
+ directMentions?: number[] | null | undefined;
250
+ directGroupMentions?: string[] | null | undefined;
251
+ systemMessage?: unknown;
252
+ attachments?: {
253
+ [x: string]: unknown;
254
+ attachmentId: string;
255
+ urlType: string;
256
+ title?: string | null | undefined;
257
+ url?: string | null | undefined;
258
+ fileName?: string | null | undefined;
259
+ fileSize?: number | null | undefined;
260
+ underlyingType?: string | null | undefined;
261
+ description?: string | null | undefined;
262
+ image?: string | null | undefined;
263
+ imageWidth?: number | null | undefined;
264
+ imageHeight?: number | null | undefined;
265
+ duration?: string | null | undefined;
266
+ uploadState?: string | null | undefined;
267
+ video?: string | null | undefined;
268
+ videoType?: string | null | undefined;
269
+ videoAutoPlay?: boolean | null | undefined;
270
+ }[] | null | undefined;
271
+ reactions?: Record<string, unknown> | null | undefined;
272
+ objIndex?: number | null | undefined;
273
+ creatorName?: string | null | undefined;
274
+ recipients?: number[] | null | undefined;
275
+ groups?: string[] | null | undefined;
276
+ toEmails?: string[] | null | undefined;
277
+ deleted?: boolean | null | undefined;
278
+ deletedBy?: number | null | undefined;
279
+ version?: number | null | undefined;
280
+ actions?: unknown[] | null | undefined;
281
+ } | null | undefined;
282
+ toEmails?: string[] | null | undefined;
283
+ version?: number | null | undefined;
284
+ }, {
285
+ id: string;
286
+ title: string;
287
+ content: string;
288
+ creator: number;
289
+ channelId: string;
290
+ workspaceId: number;
291
+ commentCount: number;
292
+ lastUpdated: Date;
293
+ posted: Date;
294
+ snippet: string;
295
+ snippetCreator: number;
296
+ isArchived: boolean;
297
+ inInbox: boolean;
298
+ closed: boolean;
299
+ creatorName?: string | null | undefined;
300
+ actions?: unknown[] | null | undefined;
301
+ attachments?: {
302
+ [x: string]: unknown;
303
+ attachmentId: string;
304
+ urlType: string;
305
+ title?: string | null | undefined;
306
+ url?: string | null | undefined;
307
+ fileName?: string | null | undefined;
308
+ fileSize?: number | null | undefined;
309
+ underlyingType?: string | null | undefined;
310
+ description?: string | null | undefined;
311
+ image?: string | null | undefined;
312
+ imageWidth?: number | null | undefined;
313
+ imageHeight?: number | null | undefined;
314
+ duration?: string | null | undefined;
315
+ uploadState?: string | null | undefined;
316
+ video?: string | null | undefined;
317
+ videoType?: string | null | undefined;
318
+ videoAutoPlay?: boolean | null | undefined;
319
+ }[] | null | undefined;
320
+ directGroupMentions?: string[] | null | undefined;
321
+ directMentions?: number[] | null | undefined;
322
+ groups?: string[] | null | undefined;
323
+ lastEdited?: Date | null | undefined;
324
+ lastObjIndex?: number | null | undefined;
325
+ mutedUntil?: Date | null | undefined;
326
+ participants?: number[] | null | undefined;
327
+ pinned?: boolean | undefined;
328
+ pinnedDate?: Date | null | undefined;
329
+ reactions?: Record<string, number[]> | null | undefined;
330
+ recipients?: number[] | null | undefined;
331
+ snippetMaskAvatarUrl?: string | null | undefined;
332
+ snippetMaskPoster?: string | null | undefined;
333
+ systemMessage?: unknown;
334
+ isSaved?: boolean | null | undefined;
335
+ responders?: number[] | null | undefined;
336
+ lastComment?: {
337
+ url: string;
338
+ id: string;
339
+ content: string;
340
+ creator: number;
341
+ threadId: string;
342
+ workspaceId: number;
343
+ posted: Date;
344
+ channelId: string;
345
+ conversationId?: string | null | undefined;
346
+ lastEdited?: Date | null | undefined;
347
+ directMentions?: number[] | null | undefined;
348
+ directGroupMentions?: string[] | null | undefined;
349
+ systemMessage?: unknown;
350
+ attachments?: {
351
+ [x: string]: unknown;
352
+ attachmentId: string;
353
+ urlType: string;
354
+ title?: string | null | undefined;
355
+ url?: string | null | undefined;
356
+ fileName?: string | null | undefined;
357
+ fileSize?: number | null | undefined;
358
+ underlyingType?: string | null | undefined;
359
+ description?: string | null | undefined;
360
+ image?: string | null | undefined;
361
+ imageWidth?: number | null | undefined;
362
+ imageHeight?: number | null | undefined;
363
+ duration?: string | null | undefined;
364
+ uploadState?: string | null | undefined;
365
+ video?: string | null | undefined;
366
+ videoType?: string | null | undefined;
367
+ videoAutoPlay?: boolean | null | undefined;
368
+ }[] | null | undefined;
369
+ reactions?: Record<string, unknown> | null | undefined;
370
+ objIndex?: number | null | undefined;
371
+ creatorName?: string | null | undefined;
372
+ recipients?: number[] | null | undefined;
373
+ groups?: string[] | null | undefined;
374
+ toEmails?: string[] | null | undefined;
375
+ deleted?: boolean | null | undefined;
376
+ deletedBy?: number | null | undefined;
377
+ version?: number | null | undefined;
378
+ actions?: unknown[] | null | undefined;
379
+ } | null | undefined;
380
+ toEmails?: string[] | null | undefined;
381
+ version?: number | null | undefined;
382
+ }>>>;
383
+ /** Client for `/api/v1.0/inbox/`. */
384
+ export declare class InboxClient extends BaseClient {
385
+ private readonly linkBaseUrl;
386
+ private readonly inboxThreadSchema;
387
+ private readonly inboxThreadListSchema;
388
+ /**
389
+ * Gets inbox items (threads).
390
+ *
391
+ * @param args - The arguments for getting inbox.
392
+ * @param args.workspaceId - The workspace ID.
393
+ * @param args.newerThan - Optional date to get items newer than.
394
+ * @param args.olderThan - Optional date to get items older than.
395
+ * @param args.limit - Optional limit on number of items returned.
396
+ * @param args.cursor - Optional cursor for pagination.
397
+ * @param args.archiveFilter - Optional filter: 'active' (default), 'archived', or 'all'.
398
+ * @returns Inbox threads.
399
+ *
400
+ * @example
401
+ * ```typescript
402
+ * const inbox = await api.inbox.getInbox({
403
+ * workspaceId: 123,
404
+ * newerThan: new Date('2024-01-01'),
405
+ * })
406
+ *
407
+ * // Include archived (done) items alongside active ones
408
+ * const allInbox = await api.inbox.getInbox({
409
+ * workspaceId: 123,
410
+ * archiveFilter: 'all',
411
+ * })
412
+ * ```
413
+ */
414
+ getInbox(args: GetInboxArgs): Promise<InboxThread[]>;
415
+ /**
416
+ * Gets unread count for inbox.
417
+ *
418
+ * @param workspaceId - The workspace ID.
419
+ * @returns The unread count.
420
+ *
421
+ * @example
422
+ * ```typescript
423
+ * const count = await api.inbox.getCount(123)
424
+ * console.log(`Unread items: ${count}`)
425
+ * ```
426
+ */
427
+ getCount(workspaceId: number): Promise<number>;
428
+ /**
429
+ * Archives a thread in the inbox.
430
+ *
431
+ * @param id - The thread ID.
432
+ *
433
+ * @example
434
+ * ```typescript
435
+ * await api.inbox.archiveThread('7YpL3oZ4kZ9vP7Q1tR2sX3z')
436
+ * ```
437
+ */
438
+ archiveThread(id: string): Promise<void>;
439
+ /**
440
+ * Unarchives a thread in the inbox.
441
+ *
442
+ * @param id - The thread ID.
443
+ *
444
+ * @example
445
+ * ```typescript
446
+ * await api.inbox.unarchiveThread('7YpL3oZ4kZ9vP7Q1tR2sX3z')
447
+ * ```
448
+ */
449
+ unarchiveThread(id: string): Promise<void>;
450
+ /**
451
+ * Marks all inbox items as read in a workspace.
452
+ *
453
+ * @param workspaceId - The workspace ID.
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * await api.inbox.markAllRead(123)
458
+ * ```
459
+ */
460
+ markAllRead(workspaceId: number): Promise<void>;
461
+ /**
462
+ * Archives all inbox items in a workspace.
463
+ *
464
+ * @param args - The arguments for archiving all.
465
+ * @param args.workspaceId - The workspace ID.
466
+ * @param args.channelIds - Optional array of channel IDs to filter by.
467
+ * @param args.olderThan - Optional date to filter items older than.
468
+ *
469
+ * @example
470
+ * ```typescript
471
+ * await api.inbox.archiveAll({
472
+ * workspaceId: 123,
473
+ * olderThan: new Date('2024-01-01'),
474
+ * })
475
+ * ```
476
+ */
477
+ archiveAll(args: ArchiveAllArgs): Promise<void>;
478
+ }
@@ -0,0 +1,22 @@
1
+ import { type NotifyAudience } from '../types/enums.js';
2
+ /**
3
+ * Params bearing the group-targeting fields that can carry a `notifyAudience`.
4
+ * Shared by the comment-creating endpoints and thread creation.
5
+ */
6
+ type NotifyAudienceParams = {
7
+ groups?: string[] | null;
8
+ directGroupMentions?: string[] | null;
9
+ notifyAudience?: NotifyAudience | null;
10
+ };
11
+ /**
12
+ * Normalizes a `notifyAudience` flag into a sentinel `groups` entry
13
+ * (`EVERYONE` / `EVERYONE_IN_THREAD`) and rejects callers who put those
14
+ * reserved markers directly into `groups` / `directGroupMentions`.
15
+ *
16
+ * When `notifyAudience` is set it is stripped and its sentinel is appended to
17
+ * `groups`; the backend only understands the marker in `groups`. When it is
18
+ * unset only the empty flag is dropped, preserving any explicit
19
+ * `groups` / `directGroupMentions` (including a `null`) on the wire.
20
+ */
21
+ export declare function applyNotifyAudience<T extends NotifyAudienceParams>(params: T): Omit<T, 'notifyAudience'>;
22
+ export {};