@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
@@ -76,4 +76,3 @@ export declare function getAuthStateParameter(): string;
76
76
  export declare function getAuthorizationUrl(clientId: string, scopes: TwistScope[], state: string, redirectUri?: string, baseUrl?: string): string;
77
77
  export declare function getAuthToken(args: AuthTokenRequestArgs, baseUrl?: string): Promise<AuthTokenResponse>;
78
78
  export declare function revokeAuthToken(args: RevokeAuthTokenRequestArgs, baseUrl?: string): Promise<boolean>;
79
- //# sourceMappingURL=authentication.d.ts.map
@@ -24,4 +24,3 @@ export declare class BatchBuilder {
24
24
  */
25
25
  execute<T extends readonly BatchRequestDescriptor<unknown>[]>(requests: T): Promise<BatchResponseArray<T>>;
26
26
  }
27
- //# sourceMappingURL=batch-builder.d.ts.map
@@ -1,6 +1,22 @@
1
1
  import type { BatchRequestDescriptor } from '../types/batch';
2
2
  import { Channel } from '../types/entities';
3
3
  import { CreateChannelArgs, GetChannelsArgs, UpdateChannelArgs } from '../types/requests';
4
+ export type AddChannelUserArgs = {
5
+ id: number;
6
+ userId: number;
7
+ };
8
+ export type AddChannelUsersArgs = {
9
+ id: number;
10
+ userIds: number[];
11
+ };
12
+ export type RemoveChannelUserArgs = {
13
+ id: number;
14
+ userId: number;
15
+ };
16
+ export type RemoveChannelUsersArgs = {
17
+ id: number;
18
+ userIds: number[];
19
+ };
4
20
  /**
5
21
  * Client for interacting with Twist channel endpoints.
6
22
  */
@@ -152,64 +168,67 @@ export declare class ChannelsClient {
152
168
  /**
153
169
  * Adds a user to a channel.
154
170
  *
155
- * @param id - The channel ID.
156
- * @param userId - The user ID to add.
171
+ * @param args - The arguments for adding a user.
172
+ * @param args.id - The channel ID.
173
+ * @param args.userId - The user ID to add.
157
174
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
158
175
  *
159
176
  * @example
160
177
  * ```typescript
161
- * await api.channels.addUser(456, 789)
178
+ * await api.channels.addUser({ id: 456, userId: 789 })
162
179
  * ```
163
180
  */
164
- addUser(id: number, userId: number, options: {
181
+ addUser(args: AddChannelUserArgs, options: {
165
182
  batch: true;
166
183
  }): BatchRequestDescriptor<void>;
167
- addUser(id: number, userId: number, options?: {
184
+ addUser(args: AddChannelUserArgs, options?: {
168
185
  batch?: false;
169
186
  }): Promise<void>;
170
187
  /**
171
188
  * Adds multiple users to a channel.
172
189
  *
173
- * @param id - The channel ID.
174
- * @param userIds - Array of user IDs to add.
190
+ * @param args - The arguments for adding users.
191
+ * @param args.id - The channel ID.
192
+ * @param args.userIds - Array of user IDs to add.
175
193
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
176
194
  *
177
195
  * @example
178
196
  * ```typescript
179
- * await api.channels.addUsers(456, [789, 790, 791])
197
+ * await api.channels.addUsers({ id: 456, userIds: [789, 790, 791] })
180
198
  * ```
181
199
  */
182
- addUsers(id: number, userIds: number[], options: {
200
+ addUsers(args: AddChannelUsersArgs, options: {
183
201
  batch: true;
184
202
  }): BatchRequestDescriptor<void>;
185
- addUsers(id: number, userIds: number[], options?: {
203
+ addUsers(args: AddChannelUsersArgs, options?: {
186
204
  batch?: false;
187
205
  }): Promise<void>;
188
206
  /**
189
207
  * Removes a user from a channel.
190
208
  *
191
- * @param id - The channel ID.
192
- * @param userId - The user ID to remove.
209
+ * @param args - The arguments for removing a user.
210
+ * @param args.id - The channel ID.
211
+ * @param args.userId - The user ID to remove.
193
212
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
194
213
  */
195
- removeUser(id: number, userId: number, options: {
214
+ removeUser(args: RemoveChannelUserArgs, options: {
196
215
  batch: true;
197
216
  }): BatchRequestDescriptor<void>;
198
- removeUser(id: number, userId: number, options?: {
217
+ removeUser(args: RemoveChannelUserArgs, options?: {
199
218
  batch?: false;
200
219
  }): Promise<void>;
201
220
  /**
202
221
  * Removes multiple users from a channel.
203
222
  *
204
- * @param id - The channel ID.
205
- * @param userIds - Array of user IDs to remove.
223
+ * @param args - The arguments for removing users.
224
+ * @param args.id - The channel ID.
225
+ * @param args.userIds - Array of user IDs to remove.
206
226
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
207
227
  */
208
- removeUsers(id: number, userIds: number[], options: {
228
+ removeUsers(args: RemoveChannelUsersArgs, options: {
209
229
  batch: true;
210
230
  }): BatchRequestDescriptor<void>;
211
- removeUsers(id: number, userIds: number[], options?: {
231
+ removeUsers(args: RemoveChannelUsersArgs, options?: {
212
232
  batch?: false;
213
233
  }): Promise<void>;
214
234
  }
215
- //# sourceMappingURL=channels-client.d.ts.map
@@ -99,37 +99,37 @@ var ChannelsClient = /** @class */ (function () {
99
99
  }
100
100
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
101
101
  };
102
- ChannelsClient.prototype.addUser = function (id, userId, options) {
102
+ ChannelsClient.prototype.addUser = function (args, options) {
103
103
  var method = 'POST';
104
104
  var url = "".concat(endpoints_1.ENDPOINT_CHANNELS, "/add_user");
105
- var params = { id: id, userId: userId };
105
+ var params = { id: args.id, userId: args.userId };
106
106
  if (options === null || options === void 0 ? void 0 : options.batch) {
107
107
  return { method: method, url: url, params: params };
108
108
  }
109
109
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
110
110
  };
111
- ChannelsClient.prototype.addUsers = function (id, userIds, options) {
111
+ ChannelsClient.prototype.addUsers = function (args, options) {
112
112
  var method = 'POST';
113
113
  var url = "".concat(endpoints_1.ENDPOINT_CHANNELS, "/add_users");
114
- var params = { id: id, userIds: userIds };
114
+ var params = { id: args.id, userIds: args.userIds };
115
115
  if (options === null || options === void 0 ? void 0 : options.batch) {
116
116
  return { method: method, url: url, params: params };
117
117
  }
118
118
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
119
119
  };
120
- ChannelsClient.prototype.removeUser = function (id, userId, options) {
120
+ ChannelsClient.prototype.removeUser = function (args, options) {
121
121
  var method = 'POST';
122
122
  var url = "".concat(endpoints_1.ENDPOINT_CHANNELS, "/remove_user");
123
- var params = { id: id, userId: userId };
123
+ var params = { id: args.id, userId: args.userId };
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
- ChannelsClient.prototype.removeUsers = function (id, userIds, options) {
129
+ ChannelsClient.prototype.removeUsers = function (args, options) {
130
130
  var method = 'POST';
131
131
  var url = "".concat(endpoints_1.ENDPOINT_CHANNELS, "/remove_users");
132
- var params = { id: id, userIds: userIds };
132
+ var params = { id: args.id, userIds: args.userIds };
133
133
  if (options === null || options === void 0 ? void 0 : options.batch) {
134
134
  return { method: method, url: url, params: params };
135
135
  }
@@ -1,6 +1,10 @@
1
1
  import type { BatchRequestDescriptor } from '../types/batch';
2
2
  import { Comment } from '../types/entities';
3
3
  import { CreateCommentArgs, GetCommentsArgs, UpdateCommentArgs } from '../types/requests';
4
+ export type MarkCommentPositionArgs = {
5
+ threadId: number;
6
+ commentId: number;
7
+ };
4
8
  /**
5
9
  * Client for interacting with Twist comment endpoints.
6
10
  */
@@ -106,20 +110,20 @@ export declare class CommentsClient {
106
110
  * Marks the user's read position in a thread. Used to track where the user has read up to,
107
111
  * so clients can scroll to this position and show a visual indicator (blue line).
108
112
  *
109
- * @param threadId - The thread ID.
110
- * @param commentId - The comment ID to mark as the last read position.
113
+ * @param args - The arguments for marking read position.
114
+ * @param args.threadId - The thread ID.
115
+ * @param args.commentId - The comment ID to mark as the last read position.
111
116
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
112
117
  *
113
118
  * @example
114
119
  * ```typescript
115
- * await api.comments.markPosition(789, 206113)
120
+ * await api.comments.markPosition({ threadId: 789, commentId: 206113 })
116
121
  * ```
117
122
  */
118
- markPosition(threadId: number, commentId: number, options: {
123
+ markPosition(args: MarkCommentPositionArgs, options: {
119
124
  batch: true;
120
125
  }): BatchRequestDescriptor<void>;
121
- markPosition(threadId: number, commentId: number, options?: {
126
+ markPosition(args: MarkCommentPositionArgs, options?: {
122
127
  batch?: false;
123
128
  }): Promise<void>;
124
129
  }
125
- //# sourceMappingURL=comments-client.d.ts.map
@@ -69,12 +69,12 @@ var CommentsClient = /** @class */ (function () {
69
69
  }
70
70
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
71
71
  };
72
- CommentsClient.prototype.markPosition = function (threadId, commentId, options) {
72
+ CommentsClient.prototype.markPosition = function (args, options) {
73
73
  var method = 'POST';
74
74
  var url = "".concat(endpoints_1.ENDPOINT_COMMENTS, "/mark_position");
75
75
  var params = {
76
- thread_id: threadId,
77
- comment_id: commentId,
76
+ thread_id: args.threadId,
77
+ comment_id: args.commentId,
78
78
  };
79
79
  if (options === null || options === void 0 ? void 0 : options.batch) {
80
80
  return { method: method, url: url, params: params };
@@ -138,4 +138,3 @@ export declare class ConversationMessagesClient {
138
138
  }): Promise<void>;
139
139
  }
140
140
  export {};
141
- //# sourceMappingURL=conversation-messages-client.d.ts.map
@@ -1,6 +1,31 @@
1
1
  import type { BatchRequestDescriptor } from '../types/batch';
2
2
  import { Conversation, UnreadConversation } from '../types/entities';
3
3
  import { GetConversationsArgs, GetOrCreateConversationArgs } from '../types/requests';
4
+ export type UpdateConversationArgs = {
5
+ id: number;
6
+ title: string;
7
+ archived?: boolean;
8
+ };
9
+ export type AddConversationUserArgs = {
10
+ id: number;
11
+ userId: number;
12
+ };
13
+ export type AddConversationUsersArgs = {
14
+ id: number;
15
+ userIds: number[];
16
+ };
17
+ export type RemoveConversationUserArgs = {
18
+ id: number;
19
+ userId: number;
20
+ };
21
+ export type RemoveConversationUsersArgs = {
22
+ id: number;
23
+ userIds: number[];
24
+ };
25
+ export type MuteConversationArgs = {
26
+ id: number;
27
+ minutes: number;
28
+ };
4
29
  /**
5
30
  * Client for interacting with Twist conversation endpoints.
6
31
  */
@@ -69,21 +94,22 @@ export declare class ConversationsClient {
69
94
  /**
70
95
  * Updates a conversation.
71
96
  *
72
- * @param id - The conversation ID.
73
- * @param title - The new title for the conversation.
74
- * @param archived - Optional flag to archive/unarchive the conversation.
97
+ * @param args - The arguments for updating a conversation.
98
+ * @param args.id - The conversation ID.
99
+ * @param args.title - The new title for the conversation.
100
+ * @param args.archived - Optional flag to archive/unarchive the conversation.
75
101
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
76
102
  * @returns The updated conversation object.
77
103
  *
78
104
  * @example
79
105
  * ```typescript
80
- * const conversation = await api.conversations.updateConversation(123, 'New Title')
106
+ * const conversation = await api.conversations.updateConversation({ id: 123, title: 'New Title' })
81
107
  * ```
82
108
  */
83
- updateConversation(id: number, title: string, archived: boolean | undefined, options: {
109
+ updateConversation(args: UpdateConversationArgs, options: {
84
110
  batch: true;
85
111
  }): BatchRequestDescriptor<Conversation>;
86
- updateConversation(id: number, title: string, archived?: boolean, options?: {
112
+ updateConversation(args: UpdateConversationArgs, options?: {
87
113
  batch?: false;
88
114
  }): Promise<Conversation>;
89
115
  /**
@@ -113,58 +139,62 @@ export declare class ConversationsClient {
113
139
  /**
114
140
  * Adds a user to a conversation.
115
141
  *
116
- * @param id - The conversation ID.
117
- * @param userId - The user ID to add.
142
+ * @param args - The arguments for adding a user.
143
+ * @param args.id - The conversation ID.
144
+ * @param args.userId - The user ID to add.
118
145
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
119
146
  */
120
- addUser(id: number, userId: number, options: {
147
+ addUser(args: AddConversationUserArgs, options: {
121
148
  batch: true;
122
149
  }): BatchRequestDescriptor<void>;
123
- addUser(id: number, userId: number, options?: {
150
+ addUser(args: AddConversationUserArgs, options?: {
124
151
  batch?: false;
125
152
  }): Promise<void>;
126
153
  /**
127
154
  * Adds multiple users to a conversation.
128
155
  *
129
- * @param id - The conversation ID.
130
- * @param userIds - Array of user IDs to add.
156
+ * @param args - The arguments for adding users.
157
+ * @param args.id - The conversation ID.
158
+ * @param args.userIds - Array of user IDs to add.
131
159
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
132
160
  *
133
161
  * @example
134
162
  * ```typescript
135
- * await api.conversations.addUsers(123, [456, 789, 101])
163
+ * await api.conversations.addUsers({ id: 123, userIds: [456, 789, 101] })
136
164
  * ```
137
165
  */
138
- addUsers(id: number, userIds: number[], options: {
166
+ addUsers(args: AddConversationUsersArgs, options: {
139
167
  batch: true;
140
168
  }): BatchRequestDescriptor<void>;
141
- addUsers(id: number, userIds: number[], options?: {
169
+ addUsers(args: AddConversationUsersArgs, options?: {
142
170
  batch?: false;
143
171
  }): Promise<void>;
144
172
  /**
145
173
  * Removes a user from a conversation.
146
174
  *
147
- * @param id - The conversation ID.
148
- * @param userId - The user ID to remove.
175
+ * @param args - The arguments for removing a user.
176
+ * @param args.id - The conversation ID.
177
+ * @param args.userId - The user ID to remove.
149
178
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
150
179
  */
151
- removeUser(id: number, userId: number, options: {
180
+ removeUser(args: RemoveConversationUserArgs, options: {
152
181
  batch: true;
153
182
  }): BatchRequestDescriptor<void>;
154
- removeUser(id: number, userId: number, options?: {
183
+ removeUser(args: RemoveConversationUserArgs, options?: {
155
184
  batch?: false;
156
185
  }): Promise<void>;
157
186
  /**
158
187
  * Removes multiple users from a conversation.
159
188
  *
160
- * @param id - The conversation ID.
161
- * @param userIds - Array of user IDs to remove.
189
+ * @param args - The arguments for removing users.
190
+ * @param args.id - The conversation ID.
191
+ * @param args.userIds - Array of user IDs to remove.
162
192
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
163
193
  */
164
- removeUsers(id: number, userIds: number[], options: {
194
+ removeUsers(args: RemoveConversationUsersArgs, options: {
165
195
  batch: true;
166
196
  }): BatchRequestDescriptor<void>;
167
- removeUsers(id: number, userIds: number[], options?: {
197
+ removeUsers(args: RemoveConversationUsersArgs, options?: {
168
198
  batch?: false;
169
199
  }): Promise<void>;
170
200
  /**
@@ -230,20 +260,21 @@ export declare class ConversationsClient {
230
260
  * Mutes a conversation for a specified number of minutes.
231
261
  * The user will receive no notifications from this conversation during that period.
232
262
  *
233
- * @param id - The conversation ID.
234
- * @param minutes - Number of minutes to mute the conversation.
263
+ * @param args - The arguments for muting a conversation.
264
+ * @param args.id - The conversation ID.
265
+ * @param args.minutes - Number of minutes to mute the conversation.
235
266
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
236
267
  * @returns The updated conversation object.
237
268
  *
238
269
  * @example
239
270
  * ```typescript
240
- * const conversation = await api.conversations.muteConversation(123, 30)
271
+ * const conversation = await api.conversations.muteConversation({ id: 123, minutes: 30 })
241
272
  * ```
242
273
  */
243
- muteConversation(id: number, minutes: number, options: {
274
+ muteConversation(args: MuteConversationArgs, options: {
244
275
  batch: true;
245
276
  }): BatchRequestDescriptor<Conversation>;
246
- muteConversation(id: number, minutes: number, options?: {
277
+ muteConversation(args: MuteConversationArgs, options?: {
247
278
  batch?: false;
248
279
  }): Promise<Conversation>;
249
280
  /**
@@ -260,4 +291,3 @@ export declare class ConversationsClient {
260
291
  batch?: false;
261
292
  }): Promise<Conversation>;
262
293
  }
263
- //# sourceMappingURL=conversations-client.d.ts.map
@@ -46,10 +46,10 @@ var ConversationsClient = /** @class */ (function () {
46
46
  }
47
47
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function (response) { return schema.parse(response.data); });
48
48
  };
49
- ConversationsClient.prototype.updateConversation = function (id, title, archived, options) {
50
- var params = { id: id, title: title };
51
- if (archived !== undefined)
52
- params.archived = archived;
49
+ ConversationsClient.prototype.updateConversation = function (args, options) {
50
+ var params = { id: args.id, title: args.title };
51
+ if (args.archived !== undefined)
52
+ params.archived = args.archived;
53
53
  var method = 'POST';
54
54
  var url = "".concat(endpoints_1.ENDPOINT_CONVERSATIONS, "/update");
55
55
  var schema = entities_1.ConversationSchema;
@@ -76,37 +76,37 @@ var ConversationsClient = /** @class */ (function () {
76
76
  }
77
77
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
78
78
  };
79
- ConversationsClient.prototype.addUser = function (id, userId, options) {
79
+ ConversationsClient.prototype.addUser = function (args, options) {
80
80
  var method = 'POST';
81
81
  var url = "".concat(endpoints_1.ENDPOINT_CONVERSATIONS, "/add_user");
82
- var params = { id: id, userId: userId };
82
+ var params = { id: args.id, userId: args.userId };
83
83
  if (options === null || options === void 0 ? void 0 : options.batch) {
84
84
  return { method: method, url: url, params: params };
85
85
  }
86
86
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
87
87
  };
88
- ConversationsClient.prototype.addUsers = function (id, userIds, options) {
88
+ ConversationsClient.prototype.addUsers = function (args, options) {
89
89
  var method = 'POST';
90
90
  var url = "".concat(endpoints_1.ENDPOINT_CONVERSATIONS, "/add_users");
91
- var params = { id: id, userIds: userIds };
91
+ var params = { id: args.id, userIds: args.userIds };
92
92
  if (options === null || options === void 0 ? void 0 : options.batch) {
93
93
  return { method: method, url: url, params: params };
94
94
  }
95
95
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
96
96
  };
97
- ConversationsClient.prototype.removeUser = function (id, userId, options) {
97
+ ConversationsClient.prototype.removeUser = function (args, options) {
98
98
  var method = 'POST';
99
99
  var url = "".concat(endpoints_1.ENDPOINT_CONVERSATIONS, "/remove_user");
100
- var params = { id: id, userId: userId };
100
+ var params = { id: args.id, userId: args.userId };
101
101
  if (options === null || options === void 0 ? void 0 : options.batch) {
102
102
  return { method: method, url: url, params: params };
103
103
  }
104
104
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
105
105
  };
106
- ConversationsClient.prototype.removeUsers = function (id, userIds, options) {
106
+ ConversationsClient.prototype.removeUsers = function (args, options) {
107
107
  var method = 'POST';
108
108
  var url = "".concat(endpoints_1.ENDPOINT_CONVERSATIONS, "/remove_users");
109
- var params = { id: id, userIds: userIds };
109
+ var params = { id: args.id, userIds: args.userIds };
110
110
  if (options === null || options === void 0 ? void 0 : options.batch) {
111
111
  return { method: method, url: url, params: params };
112
112
  }
@@ -149,10 +149,10 @@ var ConversationsClient = /** @class */ (function () {
149
149
  return response.data.map(function (conversation) { return entities_1.UnreadConversationSchema.parse(conversation); });
150
150
  });
151
151
  };
152
- ConversationsClient.prototype.muteConversation = function (id, minutes, options) {
152
+ ConversationsClient.prototype.muteConversation = function (args, options) {
153
153
  var method = 'POST';
154
154
  var url = "".concat(endpoints_1.ENDPOINT_CONVERSATIONS, "/mute");
155
- var params = { id: id, minutes: minutes };
155
+ var params = { id: args.id, minutes: args.minutes };
156
156
  var schema = entities_1.ConversationSchema;
157
157
  if (options === null || options === void 0 ? void 0 : options.batch) {
158
158
  return { method: method, url: url, params: params, schema: schema };
@@ -1,5 +1,21 @@
1
1
  import type { BatchRequestDescriptor } from '../types/batch';
2
2
  import { Group } from '../types/entities';
3
+ export type AddGroupUserArgs = {
4
+ id: number;
5
+ userId: number;
6
+ };
7
+ export type AddGroupUsersArgs = {
8
+ id: number;
9
+ userIds: number[];
10
+ };
11
+ export type RemoveGroupUserArgs = {
12
+ id: number;
13
+ userId: number;
14
+ };
15
+ export type RemoveGroupUsersArgs = {
16
+ id: number;
17
+ userIds: number[];
18
+ };
3
19
  /**
4
20
  * Client for interacting with Twist group endpoints.
5
21
  */
@@ -117,59 +133,62 @@ export declare class GroupsClient {
117
133
  /**
118
134
  * Adds a user to a group.
119
135
  *
120
- * @param id - The group ID.
121
- * @param userId - The user ID to add.
136
+ * @param args - The arguments for adding a user.
137
+ * @param args.id - The group ID.
138
+ * @param args.userId - The user ID to add.
122
139
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
123
140
  */
124
- addUserToGroup(id: number, userId: number, options: {
141
+ addUserToGroup(args: AddGroupUserArgs, options: {
125
142
  batch: true;
126
143
  }): BatchRequestDescriptor<void>;
127
- addUserToGroup(id: number, userId: number, options?: {
144
+ addUserToGroup(args: AddGroupUserArgs, options?: {
128
145
  batch?: false;
129
146
  }): Promise<void>;
130
147
  /**
131
148
  * Adds multiple users to a group.
132
149
  *
133
- * @param id - The group ID.
134
- * @param userIds - Array of user IDs to add.
150
+ * @param args - The arguments for adding users.
151
+ * @param args.id - The group ID.
152
+ * @param args.userIds - Array of user IDs to add.
135
153
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
136
154
  *
137
155
  * @example
138
156
  * ```typescript
139
- * await api.groups.addUsers(123, [456, 789, 101])
157
+ * await api.groups.addUsers({ id: 123, userIds: [456, 789, 101] })
140
158
  * ```
141
159
  */
142
- addUsers(id: number, userIds: number[], options: {
160
+ addUsers(args: AddGroupUsersArgs, options: {
143
161
  batch: true;
144
162
  }): BatchRequestDescriptor<void>;
145
- addUsers(id: number, userIds: number[], options?: {
163
+ addUsers(args: AddGroupUsersArgs, options?: {
146
164
  batch?: false;
147
165
  }): Promise<void>;
148
166
  /**
149
167
  * Removes a user from a group.
150
168
  *
151
- * @param id - The group ID.
152
- * @param userId - The user ID to remove.
169
+ * @param args - The arguments for removing a user.
170
+ * @param args.id - The group ID.
171
+ * @param args.userId - The user ID to remove.
153
172
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
154
173
  */
155
- removeUser(id: number, userId: number, options: {
174
+ removeUser(args: RemoveGroupUserArgs, options: {
156
175
  batch: true;
157
176
  }): BatchRequestDescriptor<void>;
158
- removeUser(id: number, userId: number, options?: {
177
+ removeUser(args: RemoveGroupUserArgs, options?: {
159
178
  batch?: false;
160
179
  }): Promise<void>;
161
180
  /**
162
181
  * Removes multiple users from a group.
163
182
  *
164
- * @param id - The group ID.
165
- * @param userIds - Array of user IDs to remove.
183
+ * @param args - The arguments for removing users.
184
+ * @param args.id - The group ID.
185
+ * @param args.userIds - Array of user IDs to remove.
166
186
  * @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
167
187
  */
168
- removeUsers(id: number, userIds: number[], options: {
188
+ removeUsers(args: RemoveGroupUsersArgs, options: {
169
189
  batch: true;
170
190
  }): BatchRequestDescriptor<void>;
171
- removeUsers(id: number, userIds: number[], options?: {
191
+ removeUsers(args: RemoveGroupUsersArgs, options?: {
172
192
  batch?: false;
173
193
  }): Promise<void>;
174
194
  }
175
- //# sourceMappingURL=groups-client.d.ts.map
@@ -63,37 +63,37 @@ var GroupsClient = /** @class */ (function () {
63
63
  }
64
64
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
65
65
  };
66
- GroupsClient.prototype.addUserToGroup = function (id, userId, options) {
66
+ GroupsClient.prototype.addUserToGroup = function (args, options) {
67
67
  var method = 'POST';
68
68
  var url = "".concat(endpoints_1.ENDPOINT_GROUPS, "/add_user");
69
- var params = { id: id, userId: userId };
69
+ var params = { id: args.id, userId: args.userId };
70
70
  if (options === null || options === void 0 ? void 0 : options.batch) {
71
71
  return { method: method, url: url, params: params };
72
72
  }
73
73
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
74
74
  };
75
- GroupsClient.prototype.addUsers = function (id, userIds, options) {
75
+ GroupsClient.prototype.addUsers = function (args, options) {
76
76
  var method = 'POST';
77
77
  var url = "".concat(endpoints_1.ENDPOINT_GROUPS, "/add_users");
78
- var params = { id: id, userIds: userIds };
78
+ var params = { id: args.id, userIds: args.userIds };
79
79
  if (options === null || options === void 0 ? void 0 : options.batch) {
80
80
  return { method: method, url: url, params: params };
81
81
  }
82
82
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
83
83
  };
84
- GroupsClient.prototype.removeUser = function (id, userId, options) {
84
+ GroupsClient.prototype.removeUser = function (args, options) {
85
85
  var method = 'POST';
86
86
  var url = "".concat(endpoints_1.ENDPOINT_GROUPS, "/remove_user");
87
- var params = { id: id, userId: userId };
87
+ var params = { id: args.id, userId: args.userId };
88
88
  if (options === null || options === void 0 ? void 0 : options.batch) {
89
89
  return { method: method, url: url, params: params };
90
90
  }
91
91
  return (0, rest_client_1.request)(method, this.getBaseUri(), url, this.apiToken, params).then(function () { return undefined; });
92
92
  };
93
- GroupsClient.prototype.removeUsers = function (id, userIds, options) {
93
+ GroupsClient.prototype.removeUsers = function (args, options) {
94
94
  var method = 'POST';
95
95
  var url = "".concat(endpoints_1.ENDPOINT_GROUPS, "/remove_users");
96
- var params = { id: id, userIds: userIds };
96
+ var params = { id: args.id, userIds: args.userIds };
97
97
  if (options === null || options === void 0 ? void 0 : options.batch) {
98
98
  return { method: method, url: url, params: params };
99
99
  }
@@ -143,4 +143,3 @@ export declare class InboxClient {
143
143
  }): Promise<void>;
144
144
  }
145
145
  export {};
146
- //# sourceMappingURL=inbox-client.d.ts.map
@@ -95,4 +95,3 @@ export declare class ReactionsClient {
95
95
  }): Promise<void>;
96
96
  }
97
97
  export {};
98
- //# sourceMappingURL=reactions-client.d.ts.map
@@ -125,4 +125,3 @@ export declare class SearchClient {
125
125
  }): Promise<SearchConversationResponse>;
126
126
  }
127
127
  export {};
128
- //# sourceMappingURL=search-client.d.ts.map