@doist/comms-sdk 0.1.0-alpha.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/clients/add-comment-helper.js +17 -0
  3. package/dist/cjs/clients/base-client.js +3 -5
  4. package/dist/cjs/clients/channels-client.js +123 -6
  5. package/dist/cjs/clients/comments-client.js +75 -9
  6. package/dist/cjs/clients/conversation-messages-client.js +76 -5
  7. package/dist/cjs/clients/conversations-client.js +143 -3
  8. package/dist/cjs/clients/groups-client.js +98 -5
  9. package/dist/cjs/clients/inbox-client.js +87 -14
  10. package/dist/cjs/clients/reactions-client.js +40 -2
  11. package/dist/cjs/clients/search-client.js +50 -0
  12. package/dist/cjs/clients/threads-client.js +211 -16
  13. package/dist/cjs/clients/users-client.js +138 -11
  14. package/dist/cjs/clients/workspace-users-client.js +110 -10
  15. package/dist/cjs/clients/workspaces-client.js +80 -7
  16. package/dist/cjs/comms-api.js +1 -0
  17. package/dist/cjs/consts/endpoints.js +8 -3
  18. package/dist/cjs/testUtils/test-defaults.js +3 -1
  19. package/dist/cjs/types/api-version.js +8 -0
  20. package/dist/cjs/types/index.js +1 -0
  21. package/dist/cjs/types/requests.js +0 -1
  22. package/dist/esm/clients/add-comment-helper.js +17 -0
  23. package/dist/esm/clients/base-client.js +3 -5
  24. package/dist/esm/clients/channels-client.js +123 -6
  25. package/dist/esm/clients/comments-client.js +75 -9
  26. package/dist/esm/clients/conversation-messages-client.js +76 -5
  27. package/dist/esm/clients/conversations-client.js +143 -3
  28. package/dist/esm/clients/groups-client.js +98 -5
  29. package/dist/esm/clients/inbox-client.js +87 -14
  30. package/dist/esm/clients/reactions-client.js +40 -2
  31. package/dist/esm/clients/search-client.js +50 -0
  32. package/dist/esm/clients/threads-client.js +211 -16
  33. package/dist/esm/clients/users-client.js +138 -11
  34. package/dist/esm/clients/workspace-users-client.js +110 -10
  35. package/dist/esm/clients/workspaces-client.js +80 -7
  36. package/dist/esm/comms-api.js +1 -0
  37. package/dist/esm/consts/endpoints.js +8 -3
  38. package/dist/esm/testUtils/test-defaults.js +2 -0
  39. package/dist/esm/types/api-version.js +5 -0
  40. package/dist/esm/types/index.js +1 -0
  41. package/dist/esm/types/requests.js +0 -1
  42. package/dist/types/clients/add-comment-helper.d.ts +17 -0
  43. package/dist/types/clients/base-client.d.ts +4 -0
  44. package/dist/types/clients/channels-client.d.ts +123 -6
  45. package/dist/types/clients/comments-client.d.ts +73 -6
  46. package/dist/types/clients/conversation-messages-client.d.ts +76 -5
  47. package/dist/types/clients/conversations-client.d.ts +143 -3
  48. package/dist/types/clients/groups-client.d.ts +98 -5
  49. package/dist/types/clients/inbox-client.d.ts +81 -5
  50. package/dist/types/clients/reactions-client.d.ts +40 -2
  51. package/dist/types/clients/search-client.d.ts +50 -0
  52. package/dist/types/clients/threads-client.d.ts +200 -8
  53. package/dist/types/clients/users-client.d.ts +138 -11
  54. package/dist/types/clients/workspace-users-client.d.ts +110 -10
  55. package/dist/types/clients/workspaces-client.d.ts +80 -7
  56. package/dist/types/comms-api.d.ts +3 -0
  57. package/dist/types/consts/endpoints.d.ts +6 -1
  58. package/dist/types/testUtils/test-defaults.d.ts +1 -0
  59. package/dist/types/types/api-version.d.ts +6 -0
  60. package/dist/types/types/index.d.ts +1 -0
  61. package/dist/types/types/requests.d.ts +2 -21
  62. package/package.json +1 -1
@@ -64,28 +64,145 @@ export declare const ChannelListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
64
64
  * to keep an optimistic-UI ID stable through the round-trip.
65
65
  */
66
66
  export declare class ChannelsClient extends BaseClient {
67
- /** Lists channels in a workspace. */
67
+ /**
68
+ * Gets all channels for a given workspace.
69
+ *
70
+ * @param args - The arguments for getting channels.
71
+ * @param args.workspaceId - The workspace ID.
72
+ * @param args.archived - Optional flag to include archived channels.
73
+ * @returns An array of channel objects.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const channels = await api.channels.getChannels({ workspaceId: 123 })
78
+ * channels.forEach(ch => console.log(ch.name))
79
+ * ```
80
+ */
68
81
  getChannels(args: GetChannelsArgs): Promise<Channel[]>;
69
- /** Fetches a single channel by ID. */
82
+ /**
83
+ * Gets a single channel object by id.
84
+ *
85
+ * @param id - The channel ID.
86
+ * @returns The channel object.
87
+ */
70
88
  getChannel(id: string): Promise<Channel>;
71
- /** Creates a new channel. `id` is auto-generated if not supplied. */
89
+ /**
90
+ * Creates a new channel. `id` is auto-generated if not supplied — pass your
91
+ * own `id` to keep an optimistic-UI ID stable through the round-trip.
92
+ *
93
+ * @param args - The arguments for creating a channel.
94
+ * @param args.workspaceId - The workspace ID.
95
+ * @param args.name - The channel name.
96
+ * @param args.description - Optional channel description.
97
+ * @param args.color - Optional channel color.
98
+ * @param args.userIds - Optional array of user IDs to add to the channel.
99
+ * @param args.public - Optional flag to make the channel public.
100
+ * @returns The created channel object.
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const channel = await api.channels.createChannel({
105
+ * workspaceId: 123,
106
+ * name: 'Engineering',
107
+ * description: 'Engineering team channel',
108
+ * })
109
+ * ```
110
+ */
72
111
  createChannel(args: CreateChannelArgs): Promise<Channel>;
73
- /** Partial update of an existing channel. */
112
+ /**
113
+ * Partial update of an existing channel.
114
+ *
115
+ * @param args - The arguments for updating a channel.
116
+ * @param args.id - The channel ID.
117
+ * @param args.name - Optional new channel name.
118
+ * @param args.description - Optional new channel description.
119
+ * @param args.color - Optional new channel color.
120
+ * @param args.public - Optional flag to change channel visibility.
121
+ * @returns The updated channel object.
122
+ */
74
123
  updateChannel(args: UpdateChannelArgs): Promise<Channel>;
75
- /** Updates the channel's view filter (`only_open` / `all` / `only_closed`). */
124
+ /**
125
+ * Updates the channel's view filter (`only_open` / `all` / `only_closed`).
126
+ *
127
+ * @param args - The arguments for updating the channel filter.
128
+ * @param args.id - The channel ID.
129
+ * @param args.filterClosed - The new filter value.
130
+ */
76
131
  updateFilters(args: {
77
132
  id: string;
78
133
  filterClosed: 'only_open' | 'all' | 'only_closed';
79
134
  }): Promise<StatusOk>;
80
- /** Permanently deletes a channel. */
135
+ /**
136
+ * Permanently deletes a channel.
137
+ *
138
+ * @param id - The channel ID.
139
+ */
81
140
  deleteChannel(id: string): Promise<StatusOk>;
141
+ /**
142
+ * Archives a channel.
143
+ *
144
+ * @param id - The channel ID.
145
+ */
82
146
  archiveChannel(id: string): Promise<StatusOk>;
147
+ /**
148
+ * Unarchives a channel.
149
+ *
150
+ * @param id - The channel ID.
151
+ */
83
152
  unarchiveChannel(id: string): Promise<StatusOk>;
153
+ /**
154
+ * Favorites a channel.
155
+ *
156
+ * @param id - The channel ID.
157
+ */
84
158
  favoriteChannel(id: string): Promise<StatusOk>;
159
+ /**
160
+ * Unfavorites a channel.
161
+ *
162
+ * @param id - The channel ID.
163
+ */
85
164
  unfavoriteChannel(id: string): Promise<StatusOk>;
165
+ /**
166
+ * Adds a user to a channel.
167
+ *
168
+ * @param args - The arguments for adding a user.
169
+ * @param args.id - The channel ID.
170
+ * @param args.userId - The user ID to add.
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * await api.channels.addUser({ id: '7YpL3oZ4kZ9vP7Q1tR2sX44', userId: 101 })
175
+ * ```
176
+ */
86
177
  addUser(args: AddChannelUserArgs): Promise<Channel>;
178
+ /**
179
+ * Adds multiple users to a channel.
180
+ *
181
+ * @param args - The arguments for adding users.
182
+ * @param args.id - The channel ID.
183
+ * @param args.userIds - Array of user IDs to add.
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * await api.channels.addUsers({ id: '7YpL3oZ4kZ9vP7Q1tR2sX44', userIds: [101, 202] })
188
+ * ```
189
+ */
87
190
  addUsers(args: AddChannelUsersArgs): Promise<Channel>;
191
+ /**
192
+ * Removes a user from a channel.
193
+ *
194
+ * @param args - The arguments for removing a user.
195
+ * @param args.id - The channel ID.
196
+ * @param args.userId - The user ID to remove.
197
+ */
88
198
  removeUser(args: RemoveChannelUserArgs): Promise<Channel>;
199
+ /**
200
+ * Removes multiple users from a channel.
201
+ *
202
+ * @param args - The arguments for removing users.
203
+ * @param args.id - The channel ID.
204
+ * @param args.userIds - Array of user IDs to remove.
205
+ */
89
206
  removeUsers(args: RemoveChannelUsersArgs): Promise<Channel>;
90
207
  private simple;
91
208
  }
@@ -135,23 +135,90 @@ export declare const CommentListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
135
135
  */
136
136
  export declare class CommentsClient extends BaseClient {
137
137
  /**
138
- * Lists comments in a thread. `newerThan` / `olderThan` (`Date`) are
138
+ * Gets all comments for a thread. `newerThan` / `olderThan` (`Date`) are
139
139
  * converted to `newer_than_ts` / `older_than_ts` epoch seconds on the
140
140
  * wire.
141
+ *
142
+ * @param args - The arguments for getting comments.
143
+ * @param args.threadId - The thread ID.
144
+ * @param args.newerThan - Optional date to get comments newer than.
145
+ * @param args.olderThan - Optional date to get comments older than.
146
+ * @param args.limit - Optional limit on number of comments returned.
147
+ * @returns An array of comment objects.
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * const comments = await api.comments.getComments({
152
+ * threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
153
+ * newerThan: new Date('2024-01-01'),
154
+ * })
155
+ * comments.forEach(c => console.log(c.content))
156
+ * ```
141
157
  */
142
158
  getComments(args: GetCommentsArgs): Promise<Comment[]>;
143
- /** Fetches a single comment by ID. The API wraps it in `{comment: ...}`. */
159
+ /**
160
+ * Gets a single comment object by id. The API wraps it in `{comment: ...}`.
161
+ *
162
+ * @param id - The comment ID.
163
+ * @returns The comment object.
164
+ */
144
165
  getComment(id: string): Promise<Comment>;
145
166
  /**
146
- * Creates a new comment. `id` is auto-generated if not supplied.
167
+ * Creates a new comment on a thread. `id` is auto-generated if not supplied.
168
+ *
169
+ * @param args - The arguments for creating a comment.
170
+ * @param args.threadId - The thread ID.
171
+ * @param args.content - The comment content.
172
+ * @param args.recipients - Optional array of user IDs to notify directly.
173
+ * @param args.groups - Optional array of custom group IDs to notify.
174
+ * @param args.directMentions - Optional array of user IDs that were @-mentioned in
175
+ * `content`.
176
+ * @param args.notifyAudience - Optional broader audience to notify in addition to
177
+ * `recipients` and `groups`. `'channel'` notifies everyone in the channel;
178
+ * `'thread'` notifies everyone who has interacted with the thread.
179
+ * @param args.attachments - Optional array of {@link Attachment} objects.
180
+ * @returns The created comment object.
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * // Notify everyone who has interacted with the thread, plus two extra users.
185
+ * const comment = await api.comments.createComment({
186
+ * threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
187
+ * content: 'Great idea! Let\'s proceed.',
188
+ * notifyAudience: 'thread',
189
+ * recipients: [101, 202],
190
+ * })
191
+ * ```
147
192
  */
148
193
  createComment(args: CreateCommentArgs): Promise<Comment>;
149
- /** Updates a comment. */
194
+ /**
195
+ * Updates a comment's properties.
196
+ *
197
+ * @param args - The arguments for updating a comment.
198
+ * @param args.id - The comment ID.
199
+ * @param args.content - The new comment content.
200
+ * @returns The updated comment object.
201
+ */
150
202
  updateComment(args: UpdateCommentArgs): Promise<Comment>;
151
- /** Permanently deletes a comment. */
203
+ /**
204
+ * Permanently deletes a comment.
205
+ *
206
+ * @param id - The comment ID.
207
+ */
152
208
  deleteComment(id: string): Promise<StatusOk>;
153
209
  /**
154
- * Marks the user's read position in a thread. Comment IDs are strings.
210
+ * Marks the user's read position in a thread. Used to track where the user has read up to,
211
+ * so clients can scroll to this position and show a visual indicator (blue line).
212
+ * Comment IDs are strings.
213
+ *
214
+ * @param args - The arguments for marking read position.
215
+ * @param args.threadId - The thread ID.
216
+ * @param args.commentId - The comment ID to mark as the last read position.
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * await api.comments.markPosition({ threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z', commentId: '7YpL3oZ4kZ9vP7Q1tR2sX41' })
221
+ * ```
155
222
  */
156
223
  markPosition(args: MarkCommentPositionArgs): Promise<StatusOk>;
157
224
  }
@@ -113,15 +113,86 @@ export declare const ConversationMessageListSchema: z.ZodArray<z.ZodPipe<z.ZodOb
113
113
  * message `id` on `createMessage` when the caller doesn't supply one.
114
114
  */
115
115
  export declare class ConversationMessagesClient extends BaseClient {
116
- /** Lists messages in a conversation. */
116
+ /**
117
+ * Gets all messages in a conversation.
118
+ *
119
+ * @param args - The arguments for getting messages.
120
+ * @param args.conversationId - The conversation ID.
121
+ * @param args.newerThan - Optional date to get messages newer than.
122
+ * @param args.olderThan - Optional date to get messages older than.
123
+ * @param args.limit - Optional limit on number of messages returned.
124
+ * @param args.cursor - Optional cursor for pagination.
125
+ * @returns An array of message objects.
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * const messages = await api.conversationMessages.getMessages({
130
+ * conversationId: '7YpL3oZ4kZ9vP7Q1tR2sX42',
131
+ * newerThan: new Date('2024-01-01'),
132
+ * })
133
+ * ```
134
+ */
117
135
  getMessages(args: GetConversationMessagesArgs): Promise<ConversationMessage[]>;
118
- /** Fetches a single message by ID. */
136
+ /**
137
+ * Gets a single conversation message by id.
138
+ *
139
+ * @param id - The message ID.
140
+ * @returns The conversation message object.
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * const message = await api.conversationMessages.getMessage('7YpL3oZ4kZ9vP7Q1tR2sX43')
145
+ * ```
146
+ */
119
147
  getMessage(id: string): Promise<ConversationMessage>;
120
- /** Creates a new message. `id` is auto-generated if not supplied. */
148
+ /**
149
+ * Creates a new message in a conversation. `id` is auto-generated if not
150
+ * supplied.
151
+ *
152
+ * @param args - The arguments for creating a message.
153
+ * @param args.conversationId - The conversation ID.
154
+ * @param args.content - The message content.
155
+ * @param args.attachments - Optional array of {@link Attachment} objects.
156
+ * @param args.actions - Optional array of action objects.
157
+ * @returns The created message object.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * const message = await api.conversationMessages.createMessage({
162
+ * conversationId: '7YpL3oZ4kZ9vP7Q1tR2sX42',
163
+ * content: 'Thanks for the update!',
164
+ * })
165
+ * ```
166
+ */
121
167
  createMessage(args: CreateConversationMessageArgs): Promise<ConversationMessage>;
122
- /** Updates a message. */
168
+ /**
169
+ * Updates a conversation message.
170
+ *
171
+ * @param args - The arguments for updating a message.
172
+ * @param args.id - The message ID.
173
+ * @param args.content - The new message content.
174
+ * @param args.attachments - Optional array of {@link Attachment} objects.
175
+ * @returns The updated message object.
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * const message = await api.conversationMessages.updateMessage({
180
+ * id: '7YpL3oZ4kZ9vP7Q1tR2sX43',
181
+ * content: 'Updated message content',
182
+ * })
183
+ * ```
184
+ */
123
185
  updateMessage(args: UpdateConversationMessageArgs): Promise<ConversationMessage>;
124
- /** Permanently deletes a message. */
186
+ /**
187
+ * Permanently deletes a conversation message.
188
+ *
189
+ * @param id - The message ID.
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * await api.conversationMessages.deleteMessage('7YpL3oZ4kZ9vP7Q1tR2sX43')
194
+ * ```
195
+ */
125
196
  deleteMessage(id: string): Promise<StatusOk>;
126
197
  private simple;
127
198
  }
@@ -163,29 +163,141 @@ export declare const ConversationListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
163
163
  * already-assigned `id` and your generated one is silently dropped.
164
164
  */
165
165
  export declare class ConversationsClient extends BaseClient {
166
- /** Lists conversations in a workspace. */
166
+ /**
167
+ * Gets all conversations for a workspace.
168
+ *
169
+ * @param args - The arguments for getting conversations.
170
+ * @param args.workspaceId - The workspace ID.
171
+ * @param args.archived - Optional flag to include archived conversations.
172
+ * @returns An array of conversation objects.
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * const conversations = await api.conversations.getConversations({ workspaceId: 123 })
177
+ * conversations.forEach(c => console.log(c.title))
178
+ * ```
179
+ */
167
180
  getConversations(args: GetConversationsArgs): Promise<Conversation[]>;
168
- /** Fetches a single conversation by ID. */
181
+ /**
182
+ * Gets a single conversation object by id.
183
+ *
184
+ * @param id - The conversation ID.
185
+ * @returns The conversation object.
186
+ */
169
187
  getConversation(id: string): Promise<Conversation>;
170
188
  /**
171
189
  * Gets an existing 1:1 / group conversation with `userIds`, or creates a
172
190
  * new one. `id` is auto-generated if not supplied — on dedupe, the
173
191
  * backend returns the existing conversation's `id` instead.
192
+ *
193
+ * @param args - The arguments for getting or creating a conversation.
194
+ * @param args.workspaceId - The workspace ID.
195
+ * @param args.userIds - Array of user IDs to include in the conversation.
196
+ * @returns The conversation object (existing or newly created).
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * const conversation = await api.conversations.getOrCreateConversation({
201
+ * workspaceId: 123,
202
+ * userIds: [101, 202, 303],
203
+ * })
204
+ * ```
174
205
  */
175
206
  getOrCreateConversation(args: GetOrCreateConversationArgs): Promise<Conversation>;
176
- /** Updates a conversation's title. */
207
+ /**
208
+ * Updates a conversation's title.
209
+ *
210
+ * @param args - The arguments for updating a conversation.
211
+ * @param args.id - The conversation ID.
212
+ * @param args.title - The new title for the conversation.
213
+ * @param args.archived - Optional flag to archive/unarchive the conversation.
214
+ * @returns The updated conversation object.
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const conversation = await api.conversations.updateConversation({
219
+ * id: '7YpL3oZ4kZ9vP7Q1tR2sX42',
220
+ * title: 'New Title',
221
+ * })
222
+ * ```
223
+ */
177
224
  updateConversation(args: UpdateConversationArgs): Promise<Conversation>;
225
+ /**
226
+ * Archives a conversation.
227
+ *
228
+ * @param id - The conversation ID.
229
+ * @returns The updated conversation object.
230
+ */
178
231
  archiveConversation(id: string): Promise<Conversation>;
232
+ /**
233
+ * Unarchives a conversation.
234
+ *
235
+ * @param id - The conversation ID.
236
+ * @returns The updated conversation object.
237
+ */
179
238
  unarchiveConversation(id: string): Promise<Conversation>;
239
+ /**
240
+ * Adds a user to a conversation.
241
+ *
242
+ * @param args - The arguments for adding a user.
243
+ * @param args.id - The conversation ID.
244
+ * @param args.userId - The user ID to add.
245
+ * @returns The updated conversation object.
246
+ */
180
247
  addUser(args: AddConversationUserArgs): Promise<Conversation>;
248
+ /**
249
+ * Adds multiple users to a conversation.
250
+ *
251
+ * @param args - The arguments for adding users.
252
+ * @param args.id - The conversation ID.
253
+ * @param args.userIds - Array of user IDs to add.
254
+ * @returns The updated conversation object.
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * await api.conversations.addUsers({ id: '7YpL3oZ4kZ9vP7Q1tR2sX42', userIds: [101, 202] })
259
+ * ```
260
+ */
181
261
  addUsers(args: AddConversationUsersArgs): Promise<Conversation>;
262
+ /**
263
+ * Removes a user from a conversation.
264
+ *
265
+ * @param args - The arguments for removing a user.
266
+ * @param args.id - The conversation ID.
267
+ * @param args.userId - The user ID to remove.
268
+ * @returns The updated conversation object.
269
+ */
182
270
  removeUser(args: RemoveConversationUserArgs): Promise<Conversation>;
271
+ /**
272
+ * Removes multiple users from a conversation.
273
+ *
274
+ * @param args - The arguments for removing users.
275
+ * @param args.id - The conversation ID.
276
+ * @param args.userIds - Array of user IDs to remove.
277
+ * @returns The updated conversation object.
278
+ */
183
279
  removeUsers(args: RemoveConversationUsersArgs): Promise<Conversation>;
280
+ /**
281
+ * Marks a conversation as read.
282
+ *
283
+ * @param args - The arguments for marking as read.
284
+ * @param args.id - The conversation ID.
285
+ * @param args.objIndex - Optional index of the message to mark as last read.
286
+ * @param args.messageId - Optional message ID to mark as last read.
287
+ */
184
288
  markRead(args: {
185
289
  id: string;
186
290
  objIndex?: number;
187
291
  messageId?: string;
188
292
  }): Promise<StatusOk>;
293
+ /**
294
+ * Marks a conversation as unread.
295
+ *
296
+ * @param args - The arguments for marking as unread.
297
+ * @param args.id - The conversation ID.
298
+ * @param args.objIndex - Optional index of the message to mark as last unread.
299
+ * @param args.messageId - Optional message ID to mark as last unread.
300
+ */
189
301
  markUnread(args: {
190
302
  id: string;
191
303
  objIndex?: number;
@@ -194,13 +306,41 @@ export declare class ConversationsClient extends BaseClient {
194
306
  /**
195
307
  * Returns unread conversations for a workspace, paired with the unread
196
308
  * version counter.
309
+ *
310
+ * @param workspaceId - The workspace ID.
311
+ * @returns Object containing the array of unread conversation references and a version counter.
197
312
  */
198
313
  getUnread(workspaceId: number): Promise<{
199
314
  data: UnreadConversation[];
200
315
  version: number;
201
316
  }>;
317
+ /**
318
+ * Clears all unread conversations for a workspace.
319
+ *
320
+ * @param workspaceId - The workspace ID.
321
+ */
202
322
  clearUnread(workspaceId: number): Promise<StatusOk>;
323
+ /**
324
+ * Mutes a conversation for a specified number of minutes.
325
+ * The user will receive no notifications from this conversation during that period.
326
+ *
327
+ * @param args - The arguments for muting a conversation.
328
+ * @param args.id - The conversation ID.
329
+ * @param args.minutes - Number of minutes to mute the conversation.
330
+ * @returns The updated conversation object.
331
+ *
332
+ * @example
333
+ * ```typescript
334
+ * const conversation = await api.conversations.muteConversation({ id: '7YpL3oZ4kZ9vP7Q1tR2sX42', minutes: 30 })
335
+ * ```
336
+ */
203
337
  muteConversation(args: MuteConversationArgs): Promise<Conversation>;
338
+ /**
339
+ * Unmutes a conversation.
340
+ *
341
+ * @param id - The conversation ID.
342
+ * @returns The updated conversation object.
343
+ */
204
344
  unmuteConversation(id: string): Promise<Conversation>;
205
345
  private simple;
206
346
  }
@@ -20,14 +20,51 @@ export declare const GroupListSchema: z.ZodArray<z.ZodObject<{
20
20
  * `workspace_id` alongside the group `id`.
21
21
  */
22
22
  export declare class GroupsClient extends BaseClient {
23
- /** Lists groups in a workspace. */
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
+ */
24
35
  getGroups(workspaceId: number): Promise<Group[]>;
25
- /** Fetches a single group by ID (requires `workspaceId`). */
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
+ */
26
44
  getGroup(args: {
27
45
  id: string;
28
46
  workspaceId: number;
29
47
  }): Promise<Group>;
30
- /** Creates a new group. `id` is auto-generated if not supplied. */
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
+ */
31
68
  createGroup(args: {
32
69
  workspaceId: number;
33
70
  name: string;
@@ -35,21 +72,77 @@ export declare class GroupsClient extends BaseClient {
35
72
  description?: string;
36
73
  userIds?: number[];
37
74
  }): Promise<Group>;
38
- /** Updates a group. Requires `workspaceId`. */
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
+ */
39
85
  updateGroup(args: {
40
86
  id: string;
41
87
  workspaceId: number;
42
88
  name?: string;
43
89
  description?: string;
44
90
  }): Promise<Group>;
45
- /** Permanently deletes a group. Requires `workspaceId`. */
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
+ */
46
98
  deleteGroup(args: {
47
99
  id: string;
48
100
  workspaceId: number;
49
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
+ */
50
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
+ */
51
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
+ */
52
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
+ */
53
146
  removeUsers(args: RemoveGroupUsersArgs): Promise<StatusOk>;
54
147
  private simple;
55
148
  }