@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
@@ -20,19 +20,40 @@ const GetUnreadResponseSchema = zod_1.z.object({
20
20
  */
21
21
  class ThreadsClient extends base_client_1.BaseClient {
22
22
  /**
23
- * Lists threads. At least one of `channelId` / `workspaceId` is required.
23
+ * Gets threads. At least one of `channelId` / `workspaceId` is required.
24
24
  * `newerThan` / `olderThan` (`Date`) are converted to the
25
25
  * `newer_than_ts` / `older_than_ts` epoch-second params on the wire.
26
+ *
27
+ * @param args - The arguments for getting threads.
28
+ * @param args.workspaceId - The workspace ID.
29
+ * @param args.channelId - Optional channel ID to narrow to a single channel.
30
+ * @param args.archived - Optional flag to include archived threads.
31
+ * @param args.newerThan - Optional date to get threads newer than.
32
+ * @param args.olderThan - Optional date to get threads older than.
33
+ * @param args.limit - Optional limit on number of threads returned.
34
+ * @returns An array of thread objects.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const threads = await api.threads.getThreads({
39
+ * workspaceId: 123,
40
+ * channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44',
41
+ * })
42
+ * threads.forEach(t => console.log(t.title))
43
+ * ```
26
44
  */
27
45
  getThreads(args) {
28
- const { newerThan, olderThan, newer_than_ts, older_than_ts, ...rest } = args;
29
- const resolvedNewerThan = newerThan ? Math.floor(newerThan.getTime() / 1000) : newer_than_ts;
30
- const resolvedOlderThan = olderThan ? Math.floor(olderThan.getTime() / 1000) : older_than_ts;
31
- const params = {
32
- ...rest,
33
- ...(resolvedNewerThan != null ? { newer_than_ts: resolvedNewerThan } : {}),
34
- ...(resolvedOlderThan != null ? { older_than_ts: resolvedOlderThan } : {}),
35
- };
46
+ const params = { workspaceId: args.workspaceId };
47
+ if (args.channelId != null)
48
+ params.channelId = args.channelId;
49
+ if (args.archived != null)
50
+ params.archived = args.archived;
51
+ if (args.limit != null)
52
+ params.limit = args.limit;
53
+ if (args.newerThan)
54
+ params.newer_than_ts = Math.floor(args.newerThan.getTime() / 1000);
55
+ if (args.olderThan)
56
+ params.older_than_ts = Math.floor(args.olderThan.getTime() / 1000);
36
57
  return (0, http_client_1.request)({
37
58
  httpMethod: 'GET',
38
59
  baseUri: this.getBaseUri(),
@@ -42,52 +63,147 @@ class ThreadsClient extends base_client_1.BaseClient {
42
63
  customFetch: this.customFetch,
43
64
  }).then((response) => exports.ThreadListSchema.parse(response.data));
44
65
  }
45
- /** Fetches a single thread by ID. */
66
+ /**
67
+ * Gets a single thread object by id.
68
+ *
69
+ * @param id - The thread ID.
70
+ * @returns The thread object.
71
+ */
46
72
  getThread(id) {
47
73
  return this.simple('GET', 'getone', { id }, entities_1.ThreadSchema);
48
74
  }
49
- /** Creates a new thread. `id` is auto-generated if not supplied. */
75
+ /**
76
+ * Creates a new thread in a channel. `id` is auto-generated if not supplied.
77
+ *
78
+ * @param args - The arguments for creating a thread.
79
+ * @param args.channelId - The channel ID.
80
+ * @param args.title - Optional thread title.
81
+ * @param args.content - The thread content.
82
+ * @param args.recipients - Optional array of user IDs to notify.
83
+ * @param args.groups - Optional array of custom group IDs to notify.
84
+ * @returns The created thread object.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const thread = await api.threads.createThread({
89
+ * channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44',
90
+ * title: 'New Feature Discussion',
91
+ * content: 'Let\'s discuss the new feature...',
92
+ * })
93
+ * ```
94
+ */
50
95
  createThread(args) {
51
96
  return this.simple('POST', 'add', { ...args, id: (0, uuidv7_1.resolveCreateId)(args.id) }, entities_1.ThreadSchema);
52
97
  }
53
- /** Partial update of an existing thread. */
98
+ /**
99
+ * Partial update of an existing thread.
100
+ *
101
+ * @param args - The arguments for updating a thread.
102
+ * @param args.id - The thread ID.
103
+ * @param args.title - Optional new thread title.
104
+ * @param args.content - Optional new thread content.
105
+ * @returns The updated thread object.
106
+ */
54
107
  updateThread(args) {
55
108
  return this.simple('POST', 'update', { ...args }, entities_1.ThreadSchema);
56
109
  }
57
- /** Permanently deletes a thread. */
110
+ /**
111
+ * Permanently deletes a thread.
112
+ *
113
+ * @param id - The thread ID.
114
+ */
58
115
  deleteThread(id) {
59
116
  return this.simple('POST', 'remove', { id }, entities_1.StatusOkSchema);
60
117
  }
61
- /** Saves a thread (formerly "star"). */
118
+ /**
119
+ * Saves a thread (formerly "star").
120
+ *
121
+ * @param id - The thread ID.
122
+ */
62
123
  saveThread(id) {
63
124
  return this.simple('GET', 'save', { id }, entities_1.StatusOkSchema);
64
125
  }
65
- /** Unsaves a thread (formerly "unstar"). */
126
+ /**
127
+ * Unsaves a thread (formerly "unstar").
128
+ *
129
+ * @param id - The thread ID.
130
+ */
66
131
  unsaveThread(id) {
67
132
  return this.simple('GET', 'unsave', { id }, entities_1.StatusOkSchema);
68
133
  }
134
+ /**
135
+ * Pins a thread.
136
+ *
137
+ * @param id - The thread ID.
138
+ */
69
139
  pinThread(id) {
70
140
  return this.simple('GET', 'pin', { id }, entities_1.StatusOkSchema);
71
141
  }
142
+ /**
143
+ * Unpins a thread.
144
+ *
145
+ * @param id - The thread ID.
146
+ */
72
147
  unpinThread(id) {
73
148
  return this.simple('GET', 'unpin', { id }, entities_1.StatusOkSchema);
74
149
  }
75
- /** Moves a thread to another channel. */
150
+ /**
151
+ * Moves a thread to another channel.
152
+ *
153
+ * @param args - The arguments for moving a thread.
154
+ * @param args.id - The thread ID.
155
+ * @param args.toChannel - The target channel ID.
156
+ * @returns The updated thread object.
157
+ */
76
158
  moveToChannel(args) {
77
159
  return this.simple('GET', 'move_to_channel', { ...args }, entities_1.ThreadSchema);
78
160
  }
161
+ /**
162
+ * Marks a thread as read.
163
+ *
164
+ * @param args - The arguments for marking a thread as read.
165
+ * @param args.id - The thread ID.
166
+ * @param args.objIndex - The index of the last known read message.
167
+ */
79
168
  markRead(args) {
80
169
  return this.simple('POST', 'mark_read', { ...args }, entities_1.StatusOkSchema);
81
170
  }
171
+ /**
172
+ * Marks a thread as unread.
173
+ *
174
+ * @param args - The arguments for marking a thread as unread.
175
+ * @param args.id - The thread ID.
176
+ * @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
177
+ */
82
178
  markUnread(args) {
83
179
  return this.simple('POST', 'mark_unread', { ...args }, entities_1.StatusOkSchema);
84
180
  }
181
+ /**
182
+ * Marks a thread as unread for others. Useful to notify others about thread changes.
183
+ *
184
+ * @param args - The arguments for marking a thread as unread for others.
185
+ * @param args.id - The thread ID.
186
+ * @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
187
+ */
85
188
  markUnreadForOthers(args) {
86
189
  return this.simple('POST', 'mark_unread_for_others', { ...args }, entities_1.StatusOkSchema);
87
190
  }
88
191
  /**
89
192
  * Marks every thread in a workspace or channel as read. Exactly one of
90
193
  * `workspaceId` / `channelId` should be set.
194
+ *
195
+ * @param args - Either workspaceId or channelId (one is required).
196
+ * @param args.workspaceId - The workspace ID.
197
+ * @param args.channelId - The channel ID.
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * // Mark all in workspace
202
+ * await api.threads.markAllRead({ workspaceId: 123 })
203
+ *
204
+ * // Mark all in channel
205
+ * await api.threads.markAllRead({ channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44' })
206
+ * ```
91
207
  */
92
208
  markAllRead(args) {
93
209
  if (!args.workspaceId && !args.channelId) {
@@ -95,25 +211,104 @@ class ThreadsClient extends base_client_1.BaseClient {
95
211
  }
96
212
  return this.simple('POST', 'mark_all_read', { ...args }, entities_1.StatusOkSchema);
97
213
  }
214
+ /**
215
+ * Clears unread threads in a workspace.
216
+ *
217
+ * @param workspaceId - The workspace ID.
218
+ */
98
219
  clearUnread(workspaceId) {
99
220
  return this.simple('GET', 'clear_unread', { workspaceId }, entities_1.StatusOkSchema);
100
221
  }
101
222
  /**
102
223
  * Returns unread threads for a workspace, paired with the unread version
103
224
  * counter and (optionally) the inbox unread count.
225
+ *
226
+ * @param workspaceId - The workspace ID.
227
+ * @returns Object containing the array of unread thread references, a version counter, and optionally the inbox unread count.
104
228
  */
105
229
  getUnread(workspaceId) {
106
230
  return this.simple('GET', 'get_unread', { workspaceId }, GetUnreadResponseSchema);
107
231
  }
232
+ /**
233
+ * Mutes a thread for a specified number of minutes.
234
+ * When muted, you will not get notified in your inbox about new comments.
235
+ *
236
+ * @param args - The arguments for muting a thread.
237
+ * @param args.id - The thread ID.
238
+ * @param args.minutes - Number of minutes to mute the thread.
239
+ * @returns The updated thread object.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * const thread = await api.threads.muteThread({ id: '7YpL3oZ4kZ9vP7Q1tR2sX3z', minutes: 30 })
244
+ * ```
245
+ */
108
246
  muteThread(args) {
109
247
  return this.simple('GET', 'mute', { ...args }, entities_1.ThreadSchema);
110
248
  }
249
+ /**
250
+ * Unmutes a thread.
251
+ * You will start to see notifications in your inbox again when new comments are added.
252
+ *
253
+ * @param id - The thread ID.
254
+ * @returns The updated thread object.
255
+ */
111
256
  unmuteThread(id) {
112
257
  return this.simple('GET', 'unmute', { id }, entities_1.ThreadSchema);
113
258
  }
259
+ /**
260
+ * Closes a thread by adding a comment with a close action.
261
+ *
262
+ * @param args - The arguments for closing a thread.
263
+ * @param args.id - The thread ID.
264
+ * @param args.content - The comment content.
265
+ * @param args.attachments - Optional array of {@link Attachment} objects.
266
+ * @param args.actions - Optional array of action objects.
267
+ * @param args.recipients - Optional array of user IDs to notify directly.
268
+ * @param args.groups - Optional array of custom group IDs to notify.
269
+ * @param args.directMentions - Optional array of user IDs that were @-mentioned in
270
+ * `content`.
271
+ * @param args.notifyAudience - Optional broader audience to notify in addition to
272
+ * `recipients` and `groups`. `'channel'` notifies everyone in the channel;
273
+ * `'thread'` notifies everyone who has interacted with the thread.
274
+ * @returns The created comment object.
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * const comment = await api.threads.closeThread({
279
+ * id: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
280
+ * content: 'Closing this thread — resolved.',
281
+ * })
282
+ * ```
283
+ */
114
284
  closeThread(args) {
115
285
  return this.addCommentWithAction(args, 'close');
116
286
  }
287
+ /**
288
+ * Reopens a thread by adding a comment with a reopen action.
289
+ *
290
+ * @param args - The arguments for reopening a thread.
291
+ * @param args.id - The thread ID.
292
+ * @param args.content - The comment content.
293
+ * @param args.attachments - Optional array of {@link Attachment} objects.
294
+ * @param args.actions - Optional array of action objects.
295
+ * @param args.recipients - Optional array of user IDs to notify directly.
296
+ * @param args.groups - Optional array of custom group IDs to notify.
297
+ * @param args.directMentions - Optional array of user IDs that were @-mentioned in
298
+ * `content`.
299
+ * @param args.notifyAudience - Optional broader audience to notify in addition to
300
+ * `recipients` and `groups`. `'channel'` notifies everyone in the channel;
301
+ * `'thread'` notifies everyone who has interacted with the thread.
302
+ * @returns The created comment object.
303
+ *
304
+ * @example
305
+ * ```typescript
306
+ * const comment = await api.threads.reopenThread({
307
+ * id: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
308
+ * content: 'Reopening — need further discussion.',
309
+ * })
310
+ * ```
311
+ */
117
312
  reopenThread(args) {
118
313
  return this.addCommentWithAction(args, 'reopen');
119
314
  }
@@ -11,17 +11,45 @@ const base_client_1 = require("./base-client");
11
11
  * `loginWithTodoist` are the available entry points.
12
12
  */
13
13
  class UsersClient extends base_client_1.BaseClient {
14
- /** Registers a new user via the Todoist-ID bridge. */
14
+ /**
15
+ * Registers a new user via the Todoist-ID bridge.
16
+ *
17
+ * @param args - Registration arguments.
18
+ * @param args.name - The new user's full name.
19
+ * @param args.email - The new user's email.
20
+ * @param args.password - The new user's password.
21
+ * @param args.lang - Optional preferred language.
22
+ * @param args.acceptTerms - Optional flag confirming the user accepts the terms of service.
23
+ * @returns The newly registered user object.
24
+ */
15
25
  register(args) {
16
26
  return this.post(`${endpoints_1.ENDPOINT_USERS}/register`, args, entities_1.UserSchema, { authed: false });
17
27
  }
18
- /** Logs in an existing user. */
28
+ /**
29
+ * Logs in an existing user.
30
+ *
31
+ * @param args - Login credentials.
32
+ * @param args.email - The user's email.
33
+ * @param args.password - The user's password.
34
+ * @param args.setSessionCookie - Optional flag to set a session cookie (default: true).
35
+ * @returns The authenticated user object.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const user = await api.users.login({
40
+ * email: 'user@example.com',
41
+ * password: 'secret',
42
+ * })
43
+ * ```
44
+ */
19
45
  login(args) {
20
46
  return this.post(`${endpoints_1.ENDPOINT_USERS}/login`, args, entities_1.UserSchema, { authed: false });
21
47
  }
22
48
  /**
23
49
  * Logs in using a valid token (sent via Authorization header). The SDK
24
50
  * client is already configured with the token, so no args are needed.
51
+ *
52
+ * @returns The authenticated user object.
25
53
  */
26
54
  loginWithToken() {
27
55
  return this.post(`${endpoints_1.ENDPOINT_USERS}/login_with_token`, undefined, entities_1.UserSchema);
@@ -30,17 +58,35 @@ class UsersClient extends base_client_1.BaseClient {
30
58
  * Exchanges the browser's Todoist web-session cookie for a Comms session.
31
59
  * Only useful when running in a browser context on the shared Todoist
32
60
  * registrable domain — the cookie is sent automatically by the browser.
61
+ *
62
+ * @returns The authenticated user object.
33
63
  */
34
64
  loginWithTodoist() {
35
65
  return this.post(`${endpoints_1.ENDPOINT_USERS}/login_with_todoist`, {}, entities_1.UserSchema, { authed: false });
36
66
  }
37
- /** Logs in (and auto-signs-up) via a Google ID token. */
67
+ /**
68
+ * Logs in (and auto-signs-up) via a Google ID token.
69
+ *
70
+ * @param args - Google login arguments.
71
+ * @param args.idToken - The Google ID token.
72
+ * @param args.nonce - The nonce that was sent to Google.
73
+ * @param args.timezone - Optional user timezone.
74
+ * @param args.lang - Optional preferred language.
75
+ * @param args.mfaToken - Optional MFA token from a prior `mfaChallenge` response.
76
+ * @returns The authenticated user object.
77
+ */
38
78
  loginWithGoogle(args) {
39
79
  return this.post(`${endpoints_1.ENDPOINT_USERS}/login_with_google`, args, entities_1.UserSchema, { authed: false });
40
80
  }
41
81
  /**
42
82
  * Completes an MFA challenge issued by `loginWithGoogle` (returns an MFA
43
83
  * token to pass back to `loginWithGoogle.mfaToken`).
84
+ *
85
+ * @param args - MFA challenge arguments.
86
+ * @param args.challengeId - The challenge ID from the prior login attempt.
87
+ * @param args.factor - The MFA factor identifier.
88
+ * @param args.methodType - The MFA method type.
89
+ * @returns The MFA token to forward to `loginWithGoogle`.
44
90
  */
45
91
  mfaChallenge(args) {
46
92
  return (0, http_client_1.request)({
@@ -63,7 +109,17 @@ class UsersClient extends base_client_1.BaseClient {
63
109
  customFetch: this.customFetch,
64
110
  }).then(() => undefined);
65
111
  }
66
- /** Returns the user associated with the current access token. */
112
+ /**
113
+ * Gets the user associated with the current access token.
114
+ *
115
+ * @returns The authenticated user's information.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const user = await api.users.getSessionUser()
120
+ * console.log(user.fullName, user.email)
121
+ * ```
122
+ */
67
123
  getSessionUser() {
68
124
  return this.get(`${endpoints_1.ENDPOINT_USERS}/get_session_user`, undefined, entities_1.UserSchema);
69
125
  }
@@ -71,32 +127,74 @@ class UsersClient extends base_client_1.BaseClient {
71
127
  * Fetches a single user. Defaults to the session user when no `id` is
72
128
  * passed. Cross-workspace lookups require that the caller and the target
73
129
  * share a workspace.
130
+ *
131
+ * @param args - Optional lookup arguments.
132
+ * @param args.id - The user ID. Defaults to the session user.
133
+ * @param args.workspaceId - Optional workspace ID for cross-workspace lookups.
134
+ * @param args.asList - Optional flag controlling list-style response.
135
+ * @returns The user object.
74
136
  */
75
137
  getUser(args) {
76
138
  return this.get(`${endpoints_1.ENDPOINT_USERS}/getone`, args ?? {}, entities_1.UserSchema);
77
139
  }
78
- /** Looks up a user by their email address. */
140
+ /**
141
+ * Looks up a user by their email address.
142
+ *
143
+ * @param email - The email to look up.
144
+ * @returns The user object.
145
+ */
79
146
  getUserByEmail(email) {
80
147
  return this.get(`${endpoints_1.ENDPOINT_USERS}/get_by_email`, { email }, entities_1.UserSchema);
81
148
  }
82
149
  /**
83
150
  * Updates the logged-in user's profile. Most fields are proxied to
84
151
  * Todoist (full name, password, language, timezone, etc.).
152
+ *
153
+ * @param args - The user properties to update.
154
+ * @returns The updated user object.
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * const user = await api.users.update({
159
+ * name: 'John Doe',
160
+ * timezone: 'America/New_York',
161
+ * })
162
+ * ```
85
163
  */
86
164
  update(args) {
87
165
  return this.post(`${endpoints_1.ENDPOINT_USERS}/update`, args, entities_1.UserSchema);
88
166
  }
89
- /** Updates the user's password. Requires `currentPassword`. */
167
+ /**
168
+ * Updates the user's password.
169
+ *
170
+ * @param args - Password update arguments.
171
+ * @param args.newPassword - The new password.
172
+ * @param args.currentPassword - The user's existing password. Optional — sent for
173
+ * re-authentication when the account has a password set.
174
+ * @returns The updated user object.
175
+ */
90
176
  updatePassword(args) {
91
177
  return this.post(`${endpoints_1.ENDPOINT_USERS}/update_password`, args, entities_1.UserSchema);
92
178
  }
93
- /** Removes the user's avatar. */
179
+ /**
180
+ * Removes the user's avatar.
181
+ *
182
+ * @returns The updated user object.
183
+ */
94
184
  removeAvatar() {
95
185
  return this.post(`${endpoints_1.ENDPOINT_USERS}/remove_avatar`, undefined, entities_1.UserSchema);
96
186
  }
97
187
  /**
98
188
  * Invalidates the current API token and returns the user with a fresh
99
189
  * token.
190
+ *
191
+ * @returns The user object with the new token.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * const user = await api.users.invalidateToken()
196
+ * console.log('New token:', user.token)
197
+ * ```
100
198
  */
101
199
  invalidateToken() {
102
200
  return this.post(`${endpoints_1.ENDPOINT_USERS}/invalidate_token`, undefined, entities_1.UserSchema);
@@ -105,6 +203,8 @@ class UsersClient extends base_client_1.BaseClient {
105
203
  * Validates that an arbitrary token is still active. Note this is sent
106
204
  * as a GET — the token is read from the query string, not the
107
205
  * Authorization header.
206
+ *
207
+ * @param token - The token to validate.
108
208
  */
109
209
  validateToken(token) {
110
210
  return (0, http_client_1.request)({
@@ -116,7 +216,18 @@ class UsersClient extends base_client_1.BaseClient {
116
216
  customFetch: this.customFetch,
117
217
  }).then(() => undefined);
118
218
  }
119
- /** Marks the user as active on a workspace (presence beacon). */
219
+ /**
220
+ * Marks the user as active on a workspace (presence beacon).
221
+ *
222
+ * @param args - Heartbeat arguments.
223
+ * @param args.workspaceId - The workspace ID.
224
+ * @param args.platform - The platform identifier (e.g., 'mobile', 'desktop', 'api').
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * await api.users.heartbeat({ workspaceId: 123, platform: 'api' })
229
+ * ```
230
+ */
120
231
  heartbeat(args) {
121
232
  return (0, http_client_1.request)({
122
233
  httpMethod: 'GET',
@@ -127,7 +238,11 @@ class UsersClient extends base_client_1.BaseClient {
127
238
  customFetch: this.customFetch,
128
239
  }).then(() => undefined);
129
240
  }
130
- /** Resets the user's presence for a workspace. */
241
+ /**
242
+ * Resets the user's presence for a workspace (marks the user as inactive).
243
+ *
244
+ * @param workspaceId - The workspace ID.
245
+ */
131
246
  resetPresence(workspaceId) {
132
247
  return (0, http_client_1.request)({
133
248
  httpMethod: 'POST',
@@ -138,7 +253,12 @@ class UsersClient extends base_client_1.BaseClient {
138
253
  customFetch: this.customFetch,
139
254
  }).then(() => undefined);
140
255
  }
141
- /** Checks whether an email address is registered (and verified). */
256
+ /**
257
+ * Checks whether an email address is registered (and verified).
258
+ *
259
+ * @param email - The email to check.
260
+ * @returns Object indicating whether the email exists and is verified.
261
+ */
142
262
  checkEmail(email) {
143
263
  return (0, http_client_1.request)({
144
264
  httpMethod: 'POST',
@@ -152,6 +272,8 @@ class UsersClient extends base_client_1.BaseClient {
152
272
  /**
153
273
  * Returns the current per-channel mail unsubscribe settings for the
154
274
  * caller's primary email.
275
+ *
276
+ * @returns Object mapping email-type keys to their opt-out flag.
155
277
  */
156
278
  getUnsubscribeSettings() {
157
279
  return (0, http_client_1.request)({
@@ -163,7 +285,12 @@ class UsersClient extends base_client_1.BaseClient {
163
285
  customFetch: this.customFetch,
164
286
  }).then((response) => response.data);
165
287
  }
166
- /** Toggles per-email-type opt-out settings. */
288
+ /**
289
+ * Toggles per-email-type opt-out settings.
290
+ *
291
+ * @param settings - Object mapping email-type keys to their opt-out flag.
292
+ * @returns Status object with `"ok"` status.
293
+ */
167
294
  updateUnsubscribeSettings(settings) {
168
295
  return (0, http_client_1.request)({
169
296
  httpMethod: 'POST',