@doist/twist-sdk 0.1.0-alpha.1 → 0.1.0-alpha.3

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 (66) hide show
  1. package/dist/authentication.d.ts +0 -1
  2. package/dist/batch-builder.d.ts +0 -1
  3. package/dist/clients/channels-client.d.ts +38 -19
  4. package/dist/clients/channels-client.js +8 -8
  5. package/dist/clients/comments-client.d.ts +10 -6
  6. package/dist/clients/comments-client.js +3 -3
  7. package/dist/clients/conversation-messages-client.d.ts +0 -1
  8. package/dist/clients/conversations-client.d.ts +59 -29
  9. package/dist/clients/conversations-client.js +14 -14
  10. package/dist/clients/groups-client.d.ts +37 -18
  11. package/dist/clients/groups-client.js +8 -8
  12. package/dist/clients/inbox-client.d.ts +0 -1
  13. package/dist/clients/reactions-client.d.ts +0 -1
  14. package/dist/clients/search-client.d.ts +0 -1
  15. package/dist/clients/threads-client.d.ts +46 -22
  16. package/dist/clients/threads-client.js +10 -10
  17. package/dist/clients/users-client.d.ts +0 -1
  18. package/dist/clients/workspace-users-client.d.ts +50 -26
  19. package/dist/clients/workspace-users-client.js +10 -10
  20. package/dist/clients/workspaces-client.d.ts +0 -1
  21. package/dist/consts/endpoints.d.ts +0 -1
  22. package/dist/index.d.ts +0 -1
  23. package/dist/rest-client.d.ts +0 -1
  24. package/dist/twist-api.d.ts +0 -1
  25. package/dist/types/batch.d.ts +0 -1
  26. package/dist/types/entities.d.ts +20 -21
  27. package/dist/types/entities.js +13 -39
  28. package/dist/types/enums.d.ts +0 -1
  29. package/dist/types/errors.d.ts +0 -1
  30. package/dist/types/http.d.ts +0 -1
  31. package/dist/types/index.d.ts +0 -1
  32. package/dist/types/requests.d.ts +0 -1
  33. package/dist/utils/case-conversion.d.ts +0 -1
  34. package/dist/utils/index.d.ts +0 -1
  35. package/dist/utils/timestamp-conversion.d.ts +0 -1
  36. package/dist/utils/url-helpers.d.ts +0 -1
  37. package/package.json +13 -8
  38. package/dist/authentication.d.ts.map +0 -1
  39. package/dist/batch-builder.d.ts.map +0 -1
  40. package/dist/clients/channels-client.d.ts.map +0 -1
  41. package/dist/clients/comments-client.d.ts.map +0 -1
  42. package/dist/clients/conversation-messages-client.d.ts.map +0 -1
  43. package/dist/clients/conversations-client.d.ts.map +0 -1
  44. package/dist/clients/groups-client.d.ts.map +0 -1
  45. package/dist/clients/inbox-client.d.ts.map +0 -1
  46. package/dist/clients/reactions-client.d.ts.map +0 -1
  47. package/dist/clients/search-client.d.ts.map +0 -1
  48. package/dist/clients/threads-client.d.ts.map +0 -1
  49. package/dist/clients/users-client.d.ts.map +0 -1
  50. package/dist/clients/workspace-users-client.d.ts.map +0 -1
  51. package/dist/clients/workspaces-client.d.ts.map +0 -1
  52. package/dist/consts/endpoints.d.ts.map +0 -1
  53. package/dist/index.d.ts.map +0 -1
  54. package/dist/rest-client.d.ts.map +0 -1
  55. package/dist/twist-api.d.ts.map +0 -1
  56. package/dist/types/batch.d.ts.map +0 -1
  57. package/dist/types/entities.d.ts.map +0 -1
  58. package/dist/types/enums.d.ts.map +0 -1
  59. package/dist/types/errors.d.ts.map +0 -1
  60. package/dist/types/http.d.ts.map +0 -1
  61. package/dist/types/index.d.ts.map +0 -1
  62. package/dist/types/requests.d.ts.map +0 -1
  63. package/dist/utils/case-conversion.d.ts.map +0 -1
  64. package/dist/utils/index.d.ts.map +0 -1
  65. package/dist/utils/timestamp-conversion.d.ts.map +0 -1
  66. package/dist/utils/url-helpers.d.ts.map +0 -1
@@ -1,6 +1,26 @@
1
1
  import type { BatchRequestDescriptor } from '../types/batch';
2
2
  import { Thread, UnreadThread } from '../types/entities';
3
3
  import { CreateThreadArgs, GetThreadsArgs, UpdateThreadArgs } from '../types/requests';
4
+ export type MoveThreadToChannelArgs = {
5
+ id: number;
6
+ toChannel: number;
7
+ };
8
+ export type MarkThreadReadArgs = {
9
+ id: number;
10
+ objIndex: number;
11
+ };
12
+ export type MarkThreadUnreadArgs = {
13
+ id: number;
14
+ objIndex: number;
15
+ };
16
+ export type MarkThreadUnreadForOthersArgs = {
17
+ id: number;
18
+ objIndex: number;
19
+ };
20
+ export type MuteThreadArgs = {
21
+ id: number;
22
+ minutes: number;
23
+ };
4
24
  /**
5
25
  * Client for interacting with Twist thread endpoints.
6
26
  */
@@ -180,53 +200,57 @@ export declare class ThreadsClient {
180
200
  /**
181
201
  * Moves a thread to a different channel.
182
202
  *
183
- * @param id - The thread ID.
184
- * @param toChannel - The target channel ID.
203
+ * @param args - The arguments for moving a thread.
204
+ * @param args.id - The thread ID.
205
+ * @param args.toChannel - The target channel ID.
185
206
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
186
207
  */
187
- moveToChannel(id: number, toChannel: number, options: {
208
+ moveToChannel(args: MoveThreadToChannelArgs, options: {
188
209
  batch: true;
189
210
  }): BatchRequestDescriptor<void>;
190
- moveToChannel(id: number, toChannel: number, options?: {
211
+ moveToChannel(args: MoveThreadToChannelArgs, options?: {
191
212
  batch?: false;
192
213
  }): Promise<void>;
193
214
  /**
194
215
  * Marks a thread as read.
195
216
  *
196
- * @param id - The thread ID.
197
- * @param objIndex - The index of the last known read message.
217
+ * @param args - The arguments for marking a thread as read.
218
+ * @param args.id - The thread ID.
219
+ * @param args.objIndex - The index of the last known read message.
198
220
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
199
221
  */
200
- markRead(id: number, objIndex: number, options: {
222
+ markRead(args: MarkThreadReadArgs, options: {
201
223
  batch: true;
202
224
  }): BatchRequestDescriptor<void>;
203
- markRead(id: number, objIndex: number, options?: {
225
+ markRead(args: MarkThreadReadArgs, options?: {
204
226
  batch?: false;
205
227
  }): Promise<void>;
206
228
  /**
207
229
  * Marks a thread as unread.
208
230
  *
209
- * @param id - The thread ID.
210
- * @param objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
231
+ * @param args - The arguments for marking a thread as unread.
232
+ * @param args.id - The thread ID.
233
+ * @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
211
234
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
212
235
  */
213
- markUnread(id: number, objIndex: number, options: {
236
+ markUnread(args: MarkThreadUnreadArgs, options: {
214
237
  batch: true;
215
238
  }): BatchRequestDescriptor<void>;
216
- markUnread(id: number, objIndex: number, options?: {
239
+ markUnread(args: MarkThreadUnreadArgs, options?: {
217
240
  batch?: false;
218
241
  }): Promise<void>;
219
242
  /**
220
243
  * Marks a thread as unread for others. Useful to notify others about thread changes.
221
244
  *
222
- * @param id - The thread ID.
223
- * @param objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
245
+ * @param args - The arguments for marking a thread as unread for others.
246
+ * @param args.id - The thread ID.
247
+ * @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
224
248
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
225
249
  */
226
- markUnreadForOthers(id: number, objIndex: number, options: {
250
+ markUnreadForOthers(args: MarkThreadUnreadForOthersArgs, options: {
227
251
  batch: true;
228
252
  }): BatchRequestDescriptor<void>;
229
- markUnreadForOthers(id: number, objIndex: number, options?: {
253
+ markUnreadForOthers(args: MarkThreadUnreadForOthersArgs, options?: {
230
254
  batch?: false;
231
255
  }): Promise<void>;
232
256
  /**
@@ -287,20 +311,21 @@ export declare class ThreadsClient {
287
311
  * Mutes a thread for a specified number of minutes.
288
312
  * When muted, you will not get notified in your inbox about new comments.
289
313
  *
290
- * @param id - The thread ID.
291
- * @param minutes - Number of minutes to mute the thread.
314
+ * @param args - The arguments for muting a thread.
315
+ * @param args.id - The thread ID.
316
+ * @param args.minutes - Number of minutes to mute the thread.
292
317
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
293
318
  * @returns The updated thread object.
294
319
  *
295
320
  * @example
296
321
  * ```typescript
297
- * const thread = await api.threads.muteThread(789, 30)
322
+ * const thread = await api.threads.muteThread({ id: 789, minutes: 30 })
298
323
  * ```
299
324
  */
300
- muteThread(id: number, minutes: number, options: {
325
+ muteThread(args: MuteThreadArgs, options: {
301
326
  batch: true;
302
327
  }): BatchRequestDescriptor<Thread>;
303
- muteThread(id: number, minutes: number, options?: {
328
+ muteThread(args: MuteThreadArgs, options?: {
304
329
  batch?: false;
305
330
  }): Promise<Thread>;
306
331
  /**
@@ -318,4 +343,3 @@ export declare class ThreadsClient {
318
343
  batch?: false;
319
344
  }): Promise<Thread>;
320
345
  }
321
- //# sourceMappingURL=threads-client.d.ts.map
@@ -117,37 +117,37 @@ var ThreadsClient = /** @class */ (function () {
117
117
  }
118
118
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
119
119
  };
120
- ThreadsClient.prototype.moveToChannel = function (id, toChannel, options) {
120
+ ThreadsClient.prototype.moveToChannel = function (args, options) {
121
121
  var method = 'POST';
122
122
  var url = "".concat(endpoints_1.ENDPOINT_THREADS, "/move_to_channel");
123
- var params = { id: id, toChannel: toChannel };
123
+ var params = { id: args.id, toChannel: args.toChannel };
124
124
  if (options === null || options === void 0 ? void 0 : options.batch) {
125
125
  return { method: method, url: url, params: params };
126
126
  }
127
127
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
128
128
  };
129
- ThreadsClient.prototype.markRead = function (id, objIndex, options) {
129
+ ThreadsClient.prototype.markRead = function (args, options) {
130
130
  var method = 'POST';
131
131
  var url = "".concat(endpoints_1.ENDPOINT_THREADS, "/mark_read");
132
- var params = { id: id, obj_index: objIndex };
132
+ var params = { id: args.id, obj_index: args.objIndex };
133
133
  if (options === null || options === void 0 ? void 0 : options.batch) {
134
134
  return { method: method, url: url, params: params };
135
135
  }
136
136
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
137
137
  };
138
- ThreadsClient.prototype.markUnread = function (id, objIndex, options) {
138
+ ThreadsClient.prototype.markUnread = function (args, options) {
139
139
  var method = 'POST';
140
140
  var url = "".concat(endpoints_1.ENDPOINT_THREADS, "/mark_unread");
141
- var params = { id: id, obj_index: objIndex };
141
+ var params = { id: args.id, obj_index: args.objIndex };
142
142
  if (options === null || options === void 0 ? void 0 : options.batch) {
143
143
  return { method: method, url: url, params: params };
144
144
  }
145
145
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
146
146
  };
147
- ThreadsClient.prototype.markUnreadForOthers = function (id, objIndex, options) {
147
+ ThreadsClient.prototype.markUnreadForOthers = function (args, options) {
148
148
  var method = 'POST';
149
149
  var url = "".concat(endpoints_1.ENDPOINT_THREADS, "/mark_unread_for_others");
150
- var params = { id: id, obj_index: objIndex };
150
+ var params = { id: args.id, obj_index: args.objIndex };
151
151
  if (options === null || options === void 0 ? void 0 : options.batch) {
152
152
  return { method: method, url: url, params: params };
153
153
  }
@@ -187,10 +187,10 @@ var ThreadsClient = /** @class */ (function () {
187
187
  }
188
188
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function (response) { return response.data.map(function (thread) { return entities_1.UnreadThreadSchema.parse(thread); }); });
189
189
  };
190
- ThreadsClient.prototype.muteThread = function (id, minutes, options) {
190
+ ThreadsClient.prototype.muteThread = function (args, options) {
191
191
  var method = 'POST';
192
192
  var url = "".concat(endpoints_1.ENDPOINT_THREADS, "/mute");
193
- var params = { id: id, minutes: minutes };
193
+ var params = { id: args.id, minutes: args.minutes };
194
194
  var schema = entities_1.ThreadSchema;
195
195
  if (options === null || options === void 0 ? void 0 : options.batch) {
196
196
  return { method: method, url: url, params: params, schema: schema };
@@ -251,4 +251,3 @@ export declare class UsersClient {
251
251
  }>;
252
252
  }
253
253
  export {};
254
- //# sourceMappingURL=users-client.d.ts.map
@@ -1,6 +1,26 @@
1
1
  import { BatchRequestDescriptor } from '../types/batch';
2
2
  import { WorkspaceUser } from '../types/entities';
3
3
  import { UserType } from '../types/enums';
4
+ export type GetWorkspaceUsersArgs = {
5
+ workspaceId: number;
6
+ archived?: boolean;
7
+ };
8
+ export type GetUserByIdArgs = {
9
+ workspaceId: number;
10
+ userId: number;
11
+ };
12
+ export type GetUserByEmailArgs = {
13
+ workspaceId: number;
14
+ email: string;
15
+ };
16
+ export type GetUserInfoArgs = {
17
+ workspaceId: number;
18
+ userId: number;
19
+ };
20
+ export type GetUserLocalTimeArgs = {
21
+ workspaceId: number;
22
+ userId: number;
23
+ };
4
24
  /**
5
25
  * Client for interacting with Twist workspace users endpoints (v4 API).
6
26
  */
@@ -12,21 +32,22 @@ export declare class WorkspaceUsersClient {
12
32
  /**
13
33
  * Returns a list of workspace user objects for the given workspace id.
14
34
  *
15
- * @param workspaceId - The workspace ID.
16
- * @param archived - Optional flag to filter archived users.
35
+ * @param args - The arguments for getting workspace users.
36
+ * @param args.workspaceId - The workspace ID.
37
+ * @param args.archived - Optional flag to filter archived users.
17
38
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
18
39
  * @returns An array of workspace user objects.
19
40
  *
20
41
  * @example
21
42
  * ```typescript
22
- * const users = await api.workspaceUsers.getWorkspaceUsers(123)
43
+ * const users = await api.workspaceUsers.getWorkspaceUsers({ workspaceId: 123 })
23
44
  * users.forEach(u => console.log(u.name, u.userType))
24
45
  * ```
25
46
  */
26
- getWorkspaceUsers(workspaceId: number, archived: boolean | undefined, options: {
47
+ getWorkspaceUsers(args: GetWorkspaceUsersArgs, options: {
27
48
  batch: true;
28
49
  }): BatchRequestDescriptor<WorkspaceUser[]>;
29
- getWorkspaceUsers(workspaceId: number, archived?: boolean, options?: {
50
+ getWorkspaceUsers(args: GetWorkspaceUsersArgs, options?: {
30
51
  batch?: false;
31
52
  }): Promise<WorkspaceUser[]>;
32
53
  /**
@@ -45,80 +66,84 @@ export declare class WorkspaceUsersClient {
45
66
  /**
46
67
  * Gets a user by id.
47
68
  *
48
- * @param workspaceId - The workspace ID.
49
- * @param userId - The user's ID.
69
+ * @param args - The arguments for getting a user by ID.
70
+ * @param args.workspaceId - The workspace ID.
71
+ * @param args.userId - The user's ID.
50
72
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
51
73
  * @returns The workspace user object or a batch request descriptor.
52
74
  *
53
75
  * @example
54
76
  * ```typescript
55
77
  * // Normal usage
56
- * const user = await api.workspaceUsers.getUserById(123, 456)
78
+ * const user = await api.workspaceUsers.getUserById({ workspaceId: 123, userId: 456 })
57
79
  * console.log(user.name, user.email)
58
80
  *
59
81
  * // Batch usage
60
82
  * const batch = api.createBatch()
61
- * batch.add((api) => api.workspaceUsers.getUserById(123, 456))
83
+ * batch.add((api) => api.workspaceUsers.getUserById({ workspaceId: 123, userId: 456 }))
62
84
  * const results = await batch.execute()
63
85
  * ```
64
86
  */
65
- getUserById(workspaceId: number, userId: number, options: {
87
+ getUserById(args: GetUserByIdArgs, options: {
66
88
  batch: true;
67
89
  }): BatchRequestDescriptor<WorkspaceUser>;
68
- getUserById(workspaceId: number, userId: number, options?: {
90
+ getUserById(args: GetUserByIdArgs, options?: {
69
91
  batch?: false;
70
92
  }): Promise<WorkspaceUser>;
71
93
  /**
72
94
  * Gets a user by email.
73
95
  *
74
- * @param workspaceId - The workspace ID.
75
- * @param email - The user's email.
96
+ * @param args - The arguments for getting a user by email.
97
+ * @param args.workspaceId - The workspace ID.
98
+ * @param args.email - The user's email.
76
99
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
77
100
  * @returns The workspace user object.
78
101
  *
79
102
  * @example
80
103
  * ```typescript
81
- * const user = await api.workspaceUsers.getUserByEmail(123, 'user@example.com')
104
+ * const user = await api.workspaceUsers.getUserByEmail({ workspaceId: 123, email: 'user@example.com' })
82
105
  * ```
83
106
  */
84
- getUserByEmail(workspaceId: number, email: string, options: {
107
+ getUserByEmail(args: GetUserByEmailArgs, options: {
85
108
  batch: true;
86
109
  }): BatchRequestDescriptor<WorkspaceUser>;
87
- getUserByEmail(workspaceId: number, email: string, options?: {
110
+ getUserByEmail(args: GetUserByEmailArgs, options?: {
88
111
  batch?: false;
89
112
  }): Promise<WorkspaceUser>;
90
113
  /**
91
114
  * Gets the user's info in the context of the workspace.
92
115
  *
93
- * @param workspaceId - The workspace ID.
94
- * @param userId - The user's ID.
116
+ * @param args - The arguments for getting user info.
117
+ * @param args.workspaceId - The workspace ID.
118
+ * @param args.userId - The user's ID.
95
119
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
96
120
  * @returns Information about the user in the workspace context.
97
121
  */
98
- getUserInfo(workspaceId: number, userId: number, options: {
122
+ getUserInfo(args: GetUserInfoArgs, options: {
99
123
  batch: true;
100
124
  }): BatchRequestDescriptor<Record<string, unknown>>;
101
- getUserInfo(workspaceId: number, userId: number, options?: {
125
+ getUserInfo(args: GetUserInfoArgs, options?: {
102
126
  batch?: false;
103
127
  }): Promise<Record<string, unknown>>;
104
128
  /**
105
129
  * Gets the user's local time.
106
130
  *
107
- * @param workspaceId - The workspace ID.
108
- * @param userId - The user's ID.
131
+ * @param args - The arguments for getting user local time.
132
+ * @param args.workspaceId - The workspace ID.
133
+ * @param args.userId - The user's ID.
109
134
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
110
135
  * @returns The user's local time as a string (e.g., "2017-05-10 07:55:40").
111
136
  *
112
137
  * @example
113
138
  * ```typescript
114
- * const localTime = await api.workspaceUsers.getUserLocalTime(123, 456)
139
+ * const localTime = await api.workspaceUsers.getUserLocalTime({ workspaceId: 123, userId: 456 })
115
140
  * console.log('User local time:', localTime)
116
141
  * ```
117
142
  */
118
- getUserLocalTime(workspaceId: number, userId: number, options: {
143
+ getUserLocalTime(args: GetUserLocalTimeArgs, options: {
119
144
  batch: true;
120
145
  }): BatchRequestDescriptor<string>;
121
- getUserLocalTime(workspaceId: number, userId: number, options?: {
146
+ getUserLocalTime(args: GetUserLocalTimeArgs, options?: {
122
147
  batch?: false;
123
148
  }): Promise<string>;
124
149
  /**
@@ -217,4 +242,3 @@ export declare class WorkspaceUsersClient {
217
242
  userId?: number;
218
243
  }): Promise<void>;
219
244
  }
220
- //# sourceMappingURL=workspace-users-client.d.ts.map
@@ -14,10 +14,10 @@ var WorkspaceUsersClient = /** @class */ (function () {
14
14
  WorkspaceUsersClient.prototype.getBaseUri = function () {
15
15
  return this.baseUrl ? "".concat(this.baseUrl, "/api/v4") : 'https://api.twist.com/api/v4/';
16
16
  };
17
- WorkspaceUsersClient.prototype.getWorkspaceUsers = function (workspaceId, archived, options) {
17
+ WorkspaceUsersClient.prototype.getWorkspaceUsers = function (args, options) {
18
18
  var method = 'GET';
19
19
  var url = 'workspace_users/get';
20
- var params = { id: workspaceId, archived: archived };
20
+ var params = { id: args.workspaceId, archived: args.archived };
21
21
  if (options === null || options === void 0 ? void 0 : options.batch) {
22
22
  return { method: method, url: url, params: params };
23
23
  }
@@ -32,39 +32,39 @@ var WorkspaceUsersClient = /** @class */ (function () {
32
32
  }
33
33
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function (response) { return response.data; });
34
34
  };
35
- WorkspaceUsersClient.prototype.getUserById = function (workspaceId, userId, options) {
35
+ WorkspaceUsersClient.prototype.getUserById = function (args, options) {
36
36
  var method = 'GET';
37
37
  var url = 'workspace_users/getone';
38
- var params = { id: workspaceId, user_id: userId };
38
+ var params = { id: args.workspaceId, user_id: args.userId };
39
39
  var schema = entities_1.WorkspaceUserSchema;
40
40
  if (options === null || options === void 0 ? void 0 : options.batch) {
41
41
  return { method: method, url: url, params: params, schema: schema };
42
42
  }
43
43
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function (response) { return schema.parse(response.data); });
44
44
  };
45
- WorkspaceUsersClient.prototype.getUserByEmail = function (workspaceId, email, options) {
45
+ WorkspaceUsersClient.prototype.getUserByEmail = function (args, options) {
46
46
  var method = 'GET';
47
47
  var url = 'workspace_users/get_by_email';
48
- var params = { id: workspaceId, email: email };
48
+ var params = { id: args.workspaceId, email: args.email };
49
49
  var schema = entities_1.WorkspaceUserSchema;
50
50
  if (options === null || options === void 0 ? void 0 : options.batch) {
51
51
  return { method: method, url: url, params: params, schema: schema };
52
52
  }
53
53
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function (response) { return schema.parse(response.data); });
54
54
  };
55
- WorkspaceUsersClient.prototype.getUserInfo = function (workspaceId, userId, options) {
55
+ WorkspaceUsersClient.prototype.getUserInfo = function (args, options) {
56
56
  var method = 'GET';
57
57
  var url = 'workspace_users/get_info';
58
- var params = { id: workspaceId, user_id: userId };
58
+ var params = { id: args.workspaceId, user_id: args.userId };
59
59
  if (options === null || options === void 0 ? void 0 : options.batch) {
60
60
  return { method: method, url: url, params: params };
61
61
  }
62
62
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function (response) { return response.data; });
63
63
  };
64
- WorkspaceUsersClient.prototype.getUserLocalTime = function (workspaceId, userId, options) {
64
+ WorkspaceUsersClient.prototype.getUserLocalTime = function (args, options) {
65
65
  var method = 'GET';
66
66
  var url = 'workspace_users/get_local_time';
67
- var params = { id: workspaceId, user_id: userId };
67
+ var params = { id: args.workspaceId, user_id: args.userId };
68
68
  if (options === null || options === void 0 ? void 0 : options.batch) {
69
69
  return { method: method, url: url, params: params };
70
70
  }
@@ -140,4 +140,3 @@ export declare class WorkspacesClient {
140
140
  batch?: false;
141
141
  }): Promise<Channel[]>;
142
142
  }
143
- //# sourceMappingURL=workspaces-client.d.ts.map
@@ -13,4 +13,3 @@ export declare const ENDPOINT_INBOX = "inbox";
13
13
  export declare const ENDPOINT_REACTIONS = "reactions";
14
14
  export declare const ENDPOINT_SEARCH = "search";
15
15
  export declare const ENDPOINT_CONVERSATION_MESSAGES = "conversation_messages";
16
- //# sourceMappingURL=endpoints.d.ts.map
package/dist/index.d.ts CHANGED
@@ -7,4 +7,3 @@ export { SearchClient } from './clients/search-client';
7
7
  export { TwistApi } from './twist-api';
8
8
  export * from './types/index';
9
9
  export * from './utils/index';
10
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@ import { HttpMethod, HttpResponse } from './types/http';
2
2
  export declare function paramsSerializer(params: Record<string, unknown>): string;
3
3
  export declare function request<T>(httpMethod: HttpMethod, baseUri: string, relativePath: string, apiToken?: string, payload?: Record<string, unknown>, requestId?: string): Promise<HttpResponse<T>>;
4
4
  export declare function isSuccess(response: HttpResponse): boolean;
5
- //# sourceMappingURL=rest-client.d.ts.map
@@ -61,4 +61,3 @@ export declare class TwistApi {
61
61
  */
62
62
  batch<T extends readonly BatchRequestDescriptor<unknown>[]>(...requests: T): Promise<BatchResponseArray<T>>;
63
63
  }
64
- //# sourceMappingURL=twist-api.d.ts.map
@@ -33,4 +33,3 @@ export type BatchApiResponse = {
33
33
  headers: string;
34
34
  body: string;
35
35
  };
36
- //# sourceMappingURL=batch.d.ts.map
@@ -2,15 +2,12 @@ import { z } from 'zod';
2
2
  export declare const SystemMessageSchema: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
3
3
  export declare const UserSchema: z.ZodObject<{
4
4
  id: z.ZodNumber;
5
- email: z.ZodString;
6
5
  name: z.ZodString;
7
6
  shortName: z.ZodString;
8
7
  firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
8
  contactInfo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
9
  bot: z.ZodBoolean;
11
10
  profession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
- snoozeDndStart: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
- clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
11
  timezone: z.ZodString;
15
12
  removed: z.ZodBoolean;
16
13
  avatarId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -20,21 +17,24 @@ export declare const UserSchema: z.ZodObject<{
20
17
  s195: z.ZodString;
21
18
  s640: z.ZodString;
22
19
  }, z.core.$strip>>>;
23
- cometChannel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
- lang: z.ZodString;
25
20
  awayMode: z.ZodOptional<z.ZodNullable<z.ZodObject<{
26
21
  dateFrom: z.ZodString;
27
22
  type: z.ZodString;
28
23
  dateTo: z.ZodString;
29
24
  }, z.core.$strip>>>;
25
+ restricted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
26
+ setupPending: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>>;
27
+ email: z.ZodEmail;
28
+ snoozeDndStart: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ cometChannel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ lang: z.ZodString;
30
32
  cometServer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
33
  offDays: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
32
- restricted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
33
34
  defaultWorkspace: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
34
35
  token: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
36
  snoozeDndEnd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
37
  snoozed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
37
- setupPending: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>>;
38
38
  snoozeUntil: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
39
39
  scheduledBanners: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
40
40
  }, z.core.$strip>;
@@ -214,14 +214,13 @@ export type Comment = z.infer<typeof CommentSchema>;
214
214
  export declare const WorkspaceUserSchema: z.ZodObject<{
215
215
  id: z.ZodNumber;
216
216
  name: z.ZodString;
217
- email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
218
- userType: z.ZodEnum<{
219
- USER: "USER";
220
- GUEST: "GUEST";
221
- ADMIN: "ADMIN";
222
- }>;
223
217
  shortName: z.ZodString;
224
218
  firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
219
+ contactInfo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
220
+ bot: z.ZodBoolean;
221
+ profession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
+ timezone: z.ZodString;
223
+ removed: z.ZodBoolean;
225
224
  avatarId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
226
225
  avatarUrls: z.ZodOptional<z.ZodNullable<z.ZodObject<{
227
226
  s35: z.ZodString;
@@ -234,17 +233,18 @@ export declare const WorkspaceUserSchema: z.ZodObject<{
234
233
  type: z.ZodString;
235
234
  dateTo: z.ZodString;
236
235
  }, z.core.$strip>>>;
237
- bot: z.ZodBoolean;
238
- contactInfo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
- dateFormat: z.ZodOptional<z.ZodNullable<z.ZodString>>;
240
- featureFlags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
241
- profession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
- removed: z.ZodBoolean;
243
236
  restricted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
244
237
  setupPending: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>>;
238
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
+ userType: z.ZodEnum<{
240
+ USER: "USER";
241
+ GUEST: "GUEST";
242
+ ADMIN: "ADMIN";
243
+ }>;
244
+ dateFormat: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
+ featureFlags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
245
246
  theme: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
247
  timeFormat: z.ZodOptional<z.ZodNullable<z.ZodString>>;
247
- timezone: z.ZodString;
248
248
  version: z.ZodNumber;
249
249
  }, z.core.$strip>;
250
250
  export type WorkspaceUser = z.infer<typeof WorkspaceUserSchema>;
@@ -364,4 +364,3 @@ export declare const SearchResultSchema: z.ZodObject<{
364
364
  closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
365
365
  }, z.core.$strip>;
366
366
  export type SearchResult = z.infer<typeof SearchResultSchema>;
367
- //# sourceMappingURL=entities.d.ts.map
@@ -5,18 +5,15 @@ var zod_1 = require("zod");
5
5
  var enums_1 = require("./enums");
6
6
  // Reusable schema for system messages that can be either a string or an object
7
7
  exports.SystemMessageSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.unknown()]).nullable().optional();
8
- // User entity from API
9
- exports.UserSchema = zod_1.z.object({
8
+ // Base user schema with common fields shared between User and WorkspaceUser
9
+ var BaseUserSchema = zod_1.z.object({
10
10
  id: zod_1.z.number(),
11
- email: zod_1.z.string().email(),
12
11
  name: zod_1.z.string(),
13
12
  shortName: zod_1.z.string(),
14
13
  firstName: zod_1.z.string().nullable().optional(),
15
14
  contactInfo: zod_1.z.string().nullable().optional(),
16
15
  bot: zod_1.z.boolean(),
17
16
  profession: zod_1.z.string().nullable().optional(),
18
- snoozeDndStart: zod_1.z.string().nullable().optional(),
19
- clientId: zod_1.z.string().nullable().optional(),
20
17
  timezone: zod_1.z.string(),
21
18
  removed: zod_1.z.boolean(),
22
19
  avatarId: zod_1.z.string().nullable().optional(),
@@ -29,8 +26,6 @@ exports.UserSchema = zod_1.z.object({
29
26
  })
30
27
  .nullable()
31
28
  .optional(),
32
- cometChannel: zod_1.z.string().nullable().optional(),
33
- lang: zod_1.z.string(),
34
29
  awayMode: zod_1.z
35
30
  .object({
36
31
  dateFrom: zod_1.z.string(),
@@ -39,14 +34,22 @@ exports.UserSchema = zod_1.z.object({
39
34
  })
40
35
  .nullable()
41
36
  .optional(),
37
+ restricted: zod_1.z.boolean().nullable().optional(),
38
+ setupPending: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number()]).nullable().optional(),
39
+ });
40
+ // User entity from API
41
+ exports.UserSchema = BaseUserSchema.extend({
42
+ email: zod_1.z.email(),
43
+ snoozeDndStart: zod_1.z.string().nullable().optional(),
44
+ clientId: zod_1.z.string().nullable().optional(),
45
+ cometChannel: zod_1.z.string().nullable().optional(),
46
+ lang: zod_1.z.string(),
42
47
  cometServer: zod_1.z.string().nullable().optional(),
43
48
  offDays: zod_1.z.array(zod_1.z.number()).nullable().optional(),
44
- restricted: zod_1.z.boolean().nullable().optional(),
45
49
  defaultWorkspace: zod_1.z.number().nullable().optional(),
46
50
  token: zod_1.z.string().nullable().optional(),
47
51
  snoozeDndEnd: zod_1.z.string().nullable().optional(),
48
52
  snoozed: zod_1.z.boolean().nullable().optional(),
49
- setupPending: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number()]).nullable().optional(),
50
53
  snoozeUntil: zod_1.z.number().nullable().optional(),
51
54
  scheduledBanners: zod_1.z.array(zod_1.z.string()).nullable().optional(),
52
55
  });
@@ -230,42 +233,13 @@ exports.CommentSchema = zod_1.z.object({
230
233
  actions: zod_1.z.array(zod_1.z.unknown()).nullable().optional(),
231
234
  });
232
235
  // WorkspaceUser entity from v4 API
233
- exports.WorkspaceUserSchema = zod_1.z.object({
234
- id: zod_1.z.number(),
235
- name: zod_1.z.string(),
236
+ exports.WorkspaceUserSchema = BaseUserSchema.extend({
236
237
  email: zod_1.z.string().nullable().optional(),
237
238
  userType: zod_1.z.enum(enums_1.USER_TYPES),
238
- shortName: zod_1.z.string(),
239
- firstName: zod_1.z.string().nullable().optional(),
240
- avatarId: zod_1.z.string().nullable().optional(),
241
- avatarUrls: zod_1.z
242
- .object({
243
- s35: zod_1.z.string(),
244
- s60: zod_1.z.string(),
245
- s195: zod_1.z.string(),
246
- s640: zod_1.z.string(),
247
- })
248
- .nullable()
249
- .optional(),
250
- awayMode: zod_1.z
251
- .object({
252
- dateFrom: zod_1.z.string(),
253
- type: zod_1.z.string(),
254
- dateTo: zod_1.z.string(),
255
- })
256
- .nullable()
257
- .optional(),
258
- bot: zod_1.z.boolean(),
259
- contactInfo: zod_1.z.string().nullable().optional(),
260
239
  dateFormat: zod_1.z.string().nullable().optional(),
261
240
  featureFlags: zod_1.z.array(zod_1.z.string()).nullable().optional(),
262
- profession: zod_1.z.string().nullable().optional(),
263
- removed: zod_1.z.boolean(),
264
- restricted: zod_1.z.boolean().nullable().optional(),
265
- setupPending: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number()]).nullable().optional(),
266
241
  theme: zod_1.z.string().nullable().optional(),
267
242
  timeFormat: zod_1.z.string().nullable().optional(),
268
- timezone: zod_1.z.string(),
269
243
  version: zod_1.z.number(),
270
244
  });
271
245
  // ConversationMessage entity from API