@stream-io/node-sdk 0.4.26 → 0.5.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.
- package/dist/index.cjs.js +6292 -3831
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.mjs +6290 -3832
- package/dist/index.es.mjs.map +1 -1
- package/dist/src/ApiClient.d.ts +15 -0
- package/dist/src/StreamCall.d.ts +2 -2
- package/dist/src/StreamClient.d.ts +10 -1
- package/dist/src/StreamFeed.d.ts +4 -0
- package/dist/src/StreamFeedsClient.d.ts +5 -0
- package/dist/src/StreamVideoClient.d.ts +3 -2
- package/dist/src/gen/chat/ChannelApi.d.ts +29 -30
- package/dist/src/gen/chat/ChatApi.d.ts +145 -180
- package/dist/src/gen/common/CommonApi.d.ts +120 -83
- package/dist/src/gen/feeds/FeedApi.d.ts +25 -0
- package/dist/src/gen/feeds/FeedsApi.d.ts +195 -0
- package/dist/src/gen/models/index.d.ts +1498 -17
- package/dist/src/gen/moderation/ModerationApi.d.ts +28 -27
- package/dist/src/gen/video/CallApi.d.ts +42 -43
- package/dist/src/gen/video/VideoApi.d.ts +90 -89
- package/dist/src/gen-imports.d.ts +5 -0
- package/index.ts +3 -1
- package/package.json +1 -1
- package/src/{BaseApi.ts → ApiClient.ts} +25 -6
- package/src/StreamCall.ts +2 -2
- package/src/StreamClient.ts +51 -14
- package/src/StreamFeed.ts +7 -0
- package/src/StreamFeedsClient.ts +8 -0
- package/src/StreamVideoClient.ts +9 -6
- package/src/gen/chat/ChannelApi.ts +74 -64
- package/src/gen/chat/ChatApi.ts +548 -681
- package/src/gen/common/CommonApi.ts +679 -271
- package/src/gen/feeds/FeedApi.ts +130 -0
- package/src/gen/feeds/FeedsApi.ts +1801 -0
- package/src/gen/model-decoders/{index.ts → decoders.ts} +2294 -276
- package/src/gen/models/index.ts +4233 -2028
- package/src/gen/moderation/ModerationApi.ts +159 -98
- package/src/gen/video/CallApi.ts +97 -108
- package/src/gen/video/VideoApi.ts +294 -207
- package/src/gen-imports.ts +5 -0
- package/dist/src/BaseApi.d.ts +0 -11
- /package/dist/src/gen/model-decoders/{index.d.ts → decoders.d.ts} +0 -0
package/src/gen/chat/ChatApi.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StreamResponse } from '../../types';
|
|
1
|
+
import { ApiClient, StreamResponse } from '../../gen-imports';
|
|
3
2
|
import {
|
|
4
3
|
CampaignResponse,
|
|
5
4
|
CastPollVoteRequest,
|
|
@@ -10,8 +9,6 @@ import {
|
|
|
10
9
|
CreateChannelTypeResponse,
|
|
11
10
|
CreateCommandRequest,
|
|
12
11
|
CreateCommandResponse,
|
|
13
|
-
CreatePollOptionRequest,
|
|
14
|
-
CreatePollRequest,
|
|
15
12
|
CreateReminderRequest,
|
|
16
13
|
DeleteChannelResponse,
|
|
17
14
|
DeleteChannelsRequest,
|
|
@@ -52,10 +49,7 @@ import {
|
|
|
52
49
|
MessageResponse,
|
|
53
50
|
MuteChannelRequest,
|
|
54
51
|
MuteChannelResponse,
|
|
55
|
-
PollOptionResponse,
|
|
56
|
-
PollResponse,
|
|
57
52
|
PollVoteResponse,
|
|
58
|
-
PollVotesResponse,
|
|
59
53
|
QueryBannedUsersPayload,
|
|
60
54
|
QueryBannedUsersResponse,
|
|
61
55
|
QueryCampaignsRequest,
|
|
@@ -69,9 +63,6 @@ import {
|
|
|
69
63
|
QueryMessageFlagsResponse,
|
|
70
64
|
QueryMessageHistoryRequest,
|
|
71
65
|
QueryMessageHistoryResponse,
|
|
72
|
-
QueryPollVotesRequest,
|
|
73
|
-
QueryPollsRequest,
|
|
74
|
-
QueryPollsResponse,
|
|
75
66
|
QueryReactionsRequest,
|
|
76
67
|
QueryReactionsResponse,
|
|
77
68
|
QueryRemindersRequest,
|
|
@@ -119,9 +110,6 @@ import {
|
|
|
119
110
|
UpdateMessagePartialResponse,
|
|
120
111
|
UpdateMessageRequest,
|
|
121
112
|
UpdateMessageResponse,
|
|
122
|
-
UpdatePollOptionRequest,
|
|
123
|
-
UpdatePollPartialRequest,
|
|
124
|
-
UpdatePollRequest,
|
|
125
113
|
UpdateReminderRequest,
|
|
126
114
|
UpdateReminderResponse,
|
|
127
115
|
UpdateThreadPartialRequest,
|
|
@@ -132,12 +120,14 @@ import {
|
|
|
132
120
|
UpsertPushTemplateResponse,
|
|
133
121
|
WrappedUnreadCountsResponse,
|
|
134
122
|
} from '../models';
|
|
135
|
-
import { decoders } from '../model-decoders';
|
|
123
|
+
import { decoders } from '../model-decoders/decoders';
|
|
136
124
|
|
|
137
|
-
export class ChatApi
|
|
138
|
-
|
|
125
|
+
export class ChatApi {
|
|
126
|
+
constructor(public readonly apiClient: ApiClient) {}
|
|
127
|
+
|
|
128
|
+
async queryCampaigns(
|
|
139
129
|
request?: QueryCampaignsRequest,
|
|
140
|
-
): Promise<StreamResponse<QueryCampaignsResponse>>
|
|
130
|
+
): Promise<StreamResponse<QueryCampaignsResponse>> {
|
|
141
131
|
const body = {
|
|
142
132
|
limit: request?.limit,
|
|
143
133
|
next: request?.next,
|
|
@@ -147,21 +137,28 @@ export class ChatApi extends BaseApi {
|
|
|
147
137
|
filter: request?.filter,
|
|
148
138
|
};
|
|
149
139
|
|
|
150
|
-
const response = await this.sendRequest<
|
|
140
|
+
const response = await this.apiClient.sendRequest<
|
|
151
141
|
StreamResponse<QueryCampaignsResponse>
|
|
152
|
-
>(
|
|
142
|
+
>(
|
|
143
|
+
'POST',
|
|
144
|
+
'/api/v2/chat/campaigns/query',
|
|
145
|
+
undefined,
|
|
146
|
+
undefined,
|
|
147
|
+
body,
|
|
148
|
+
'application/json',
|
|
149
|
+
);
|
|
153
150
|
|
|
154
151
|
decoders.QueryCampaignsResponse?.(response.body);
|
|
155
152
|
|
|
156
153
|
return { ...response.body, metadata: response.metadata };
|
|
157
|
-
}
|
|
154
|
+
}
|
|
158
155
|
|
|
159
|
-
|
|
156
|
+
async getCampaign(request: {
|
|
160
157
|
id: string;
|
|
161
158
|
prev?: string;
|
|
162
159
|
next?: string;
|
|
163
160
|
limit?: number;
|
|
164
|
-
}): Promise<StreamResponse<GetCampaignResponse>>
|
|
161
|
+
}): Promise<StreamResponse<GetCampaignResponse>> {
|
|
165
162
|
const queryParams = {
|
|
166
163
|
prev: request?.prev,
|
|
167
164
|
next: request?.next,
|
|
@@ -171,18 +168,18 @@ export class ChatApi extends BaseApi {
|
|
|
171
168
|
id: request?.id,
|
|
172
169
|
};
|
|
173
170
|
|
|
174
|
-
const response = await this.sendRequest<
|
|
171
|
+
const response = await this.apiClient.sendRequest<
|
|
175
172
|
StreamResponse<GetCampaignResponse>
|
|
176
173
|
>('GET', '/api/v2/chat/campaigns/{id}', pathParams, queryParams);
|
|
177
174
|
|
|
178
175
|
decoders.GetCampaignResponse?.(response.body);
|
|
179
176
|
|
|
180
177
|
return { ...response.body, metadata: response.metadata };
|
|
181
|
-
}
|
|
178
|
+
}
|
|
182
179
|
|
|
183
|
-
|
|
180
|
+
async startCampaign(
|
|
184
181
|
request: StartCampaignRequest & { id: string },
|
|
185
|
-
): Promise<StreamResponse<StartCampaignResponse>>
|
|
182
|
+
): Promise<StreamResponse<StartCampaignResponse>> {
|
|
186
183
|
const pathParams = {
|
|
187
184
|
id: request?.id,
|
|
188
185
|
};
|
|
@@ -191,39 +188,49 @@ export class ChatApi extends BaseApi {
|
|
|
191
188
|
stop_at: request?.stop_at,
|
|
192
189
|
};
|
|
193
190
|
|
|
194
|
-
const response = await this.sendRequest<
|
|
191
|
+
const response = await this.apiClient.sendRequest<
|
|
195
192
|
StreamResponse<StartCampaignResponse>
|
|
196
|
-
>(
|
|
193
|
+
>(
|
|
194
|
+
'POST',
|
|
195
|
+
'/api/v2/chat/campaigns/{id}/start',
|
|
196
|
+
pathParams,
|
|
197
|
+
undefined,
|
|
198
|
+
body,
|
|
199
|
+
'application/json',
|
|
200
|
+
);
|
|
197
201
|
|
|
198
202
|
decoders.StartCampaignResponse?.(response.body);
|
|
199
203
|
|
|
200
204
|
return { ...response.body, metadata: response.metadata };
|
|
201
|
-
}
|
|
205
|
+
}
|
|
202
206
|
|
|
203
|
-
|
|
207
|
+
async scheduleCampaign(
|
|
204
208
|
request: StopCampaignRequest & { id: string },
|
|
205
|
-
): Promise<StreamResponse<CampaignResponse>>
|
|
209
|
+
): Promise<StreamResponse<CampaignResponse>> {
|
|
206
210
|
const pathParams = {
|
|
207
211
|
id: request?.id,
|
|
208
212
|
};
|
|
209
213
|
const body = {};
|
|
210
214
|
|
|
211
|
-
const response = await this.sendRequest<
|
|
215
|
+
const response = await this.apiClient.sendRequest<
|
|
216
|
+
StreamResponse<CampaignResponse>
|
|
217
|
+
>(
|
|
212
218
|
'POST',
|
|
213
219
|
'/api/v2/chat/campaigns/{id}/stop',
|
|
214
220
|
pathParams,
|
|
215
221
|
undefined,
|
|
216
222
|
body,
|
|
223
|
+
'application/json',
|
|
217
224
|
);
|
|
218
225
|
|
|
219
226
|
decoders.CampaignResponse?.(response.body);
|
|
220
227
|
|
|
221
228
|
return { ...response.body, metadata: response.metadata };
|
|
222
|
-
}
|
|
229
|
+
}
|
|
223
230
|
|
|
224
|
-
|
|
231
|
+
async queryChannels(
|
|
225
232
|
request?: QueryChannelsRequest,
|
|
226
|
-
): Promise<StreamResponse<QueryChannelsResponse>>
|
|
233
|
+
): Promise<StreamResponse<QueryChannelsResponse>> {
|
|
227
234
|
const body = {
|
|
228
235
|
limit: request?.limit,
|
|
229
236
|
member_limit: request?.member_limit,
|
|
@@ -236,57 +243,74 @@ export class ChatApi extends BaseApi {
|
|
|
236
243
|
user: request?.user,
|
|
237
244
|
};
|
|
238
245
|
|
|
239
|
-
const response = await this.sendRequest<
|
|
246
|
+
const response = await this.apiClient.sendRequest<
|
|
240
247
|
StreamResponse<QueryChannelsResponse>
|
|
241
|
-
>(
|
|
248
|
+
>(
|
|
249
|
+
'POST',
|
|
250
|
+
'/api/v2/chat/channels',
|
|
251
|
+
undefined,
|
|
252
|
+
undefined,
|
|
253
|
+
body,
|
|
254
|
+
'application/json',
|
|
255
|
+
);
|
|
242
256
|
|
|
243
257
|
decoders.QueryChannelsResponse?.(response.body);
|
|
244
258
|
|
|
245
259
|
return { ...response.body, metadata: response.metadata };
|
|
246
|
-
}
|
|
260
|
+
}
|
|
247
261
|
|
|
248
|
-
|
|
262
|
+
async deleteChannels(
|
|
249
263
|
request: DeleteChannelsRequest,
|
|
250
|
-
): Promise<StreamResponse<DeleteChannelsResponse>>
|
|
264
|
+
): Promise<StreamResponse<DeleteChannelsResponse>> {
|
|
251
265
|
const body = {
|
|
252
266
|
cids: request?.cids,
|
|
253
267
|
hard_delete: request?.hard_delete,
|
|
254
268
|
};
|
|
255
269
|
|
|
256
|
-
const response = await this.sendRequest<
|
|
270
|
+
const response = await this.apiClient.sendRequest<
|
|
257
271
|
StreamResponse<DeleteChannelsResponse>
|
|
258
|
-
>(
|
|
272
|
+
>(
|
|
273
|
+
'POST',
|
|
274
|
+
'/api/v2/chat/channels/delete',
|
|
275
|
+
undefined,
|
|
276
|
+
undefined,
|
|
277
|
+
body,
|
|
278
|
+
'application/json',
|
|
279
|
+
);
|
|
259
280
|
|
|
260
281
|
decoders.DeleteChannelsResponse?.(response.body);
|
|
261
282
|
|
|
262
283
|
return { ...response.body, metadata: response.metadata };
|
|
263
|
-
}
|
|
284
|
+
}
|
|
264
285
|
|
|
265
|
-
|
|
286
|
+
async markChannelsRead(
|
|
266
287
|
request?: MarkChannelsReadRequest,
|
|
267
|
-
): Promise<StreamResponse<MarkReadResponse>>
|
|
288
|
+
): Promise<StreamResponse<MarkReadResponse>> {
|
|
268
289
|
const body = {
|
|
269
290
|
user_id: request?.user_id,
|
|
270
291
|
read_by_channel: request?.read_by_channel,
|
|
271
292
|
user: request?.user,
|
|
272
293
|
};
|
|
273
294
|
|
|
274
|
-
const response = await this.sendRequest<
|
|
295
|
+
const response = await this.apiClient.sendRequest<
|
|
296
|
+
StreamResponse<MarkReadResponse>
|
|
297
|
+
>(
|
|
275
298
|
'POST',
|
|
276
299
|
'/api/v2/chat/channels/read',
|
|
277
300
|
undefined,
|
|
278
301
|
undefined,
|
|
279
302
|
body,
|
|
303
|
+
'application/json',
|
|
280
304
|
);
|
|
281
305
|
|
|
282
306
|
decoders.MarkReadResponse?.(response.body);
|
|
283
307
|
|
|
284
308
|
return { ...response.body, metadata: response.metadata };
|
|
285
|
-
}
|
|
309
|
+
}
|
|
286
310
|
|
|
287
|
-
|
|
311
|
+
async getOrCreateDistinctChannel(
|
|
288
312
|
request: ChannelGetOrCreateRequest & { type: string },
|
|
289
|
-
): Promise<StreamResponse<ChannelStateResponse>>
|
|
313
|
+
): Promise<StreamResponse<ChannelStateResponse>> {
|
|
290
314
|
const pathParams = {
|
|
291
315
|
type: request?.type,
|
|
292
316
|
};
|
|
@@ -300,7 +324,7 @@ export class ChatApi extends BaseApi {
|
|
|
300
324
|
watchers: request?.watchers,
|
|
301
325
|
};
|
|
302
326
|
|
|
303
|
-
const response = await this.sendRequest<
|
|
327
|
+
const response = await this.apiClient.sendRequest<
|
|
304
328
|
StreamResponse<ChannelStateResponse>
|
|
305
329
|
>(
|
|
306
330
|
'POST',
|
|
@@ -308,18 +332,19 @@ export class ChatApi extends BaseApi {
|
|
|
308
332
|
pathParams,
|
|
309
333
|
undefined,
|
|
310
334
|
body,
|
|
335
|
+
'application/json',
|
|
311
336
|
);
|
|
312
337
|
|
|
313
338
|
decoders.ChannelStateResponse?.(response.body);
|
|
314
339
|
|
|
315
340
|
return { ...response.body, metadata: response.metadata };
|
|
316
|
-
}
|
|
341
|
+
}
|
|
317
342
|
|
|
318
|
-
|
|
343
|
+
async deleteChannel(request: {
|
|
319
344
|
type: string;
|
|
320
345
|
id: string;
|
|
321
346
|
hard_delete?: boolean;
|
|
322
|
-
}): Promise<StreamResponse<DeleteChannelResponse>>
|
|
347
|
+
}): Promise<StreamResponse<DeleteChannelResponse>> {
|
|
323
348
|
const queryParams = {
|
|
324
349
|
hard_delete: request?.hard_delete,
|
|
325
350
|
};
|
|
@@ -328,18 +353,18 @@ export class ChatApi extends BaseApi {
|
|
|
328
353
|
id: request?.id,
|
|
329
354
|
};
|
|
330
355
|
|
|
331
|
-
const response = await this.sendRequest<
|
|
356
|
+
const response = await this.apiClient.sendRequest<
|
|
332
357
|
StreamResponse<DeleteChannelResponse>
|
|
333
358
|
>('DELETE', '/api/v2/chat/channels/{type}/{id}', pathParams, queryParams);
|
|
334
359
|
|
|
335
360
|
decoders.DeleteChannelResponse?.(response.body);
|
|
336
361
|
|
|
337
362
|
return { ...response.body, metadata: response.metadata };
|
|
338
|
-
}
|
|
363
|
+
}
|
|
339
364
|
|
|
340
|
-
|
|
365
|
+
async updateChannelPartial(
|
|
341
366
|
request: UpdateChannelPartialRequest & { type: string; id: string },
|
|
342
|
-
): Promise<StreamResponse<UpdateChannelPartialResponse>>
|
|
367
|
+
): Promise<StreamResponse<UpdateChannelPartialResponse>> {
|
|
343
368
|
const pathParams = {
|
|
344
369
|
type: request?.type,
|
|
345
370
|
id: request?.id,
|
|
@@ -351,7 +376,7 @@ export class ChatApi extends BaseApi {
|
|
|
351
376
|
user: request?.user,
|
|
352
377
|
};
|
|
353
378
|
|
|
354
|
-
const response = await this.sendRequest<
|
|
379
|
+
const response = await this.apiClient.sendRequest<
|
|
355
380
|
StreamResponse<UpdateChannelPartialResponse>
|
|
356
381
|
>(
|
|
357
382
|
'PATCH',
|
|
@@ -359,16 +384,17 @@ export class ChatApi extends BaseApi {
|
|
|
359
384
|
pathParams,
|
|
360
385
|
undefined,
|
|
361
386
|
body,
|
|
387
|
+
'application/json',
|
|
362
388
|
);
|
|
363
389
|
|
|
364
390
|
decoders.UpdateChannelPartialResponse?.(response.body);
|
|
365
391
|
|
|
366
392
|
return { ...response.body, metadata: response.metadata };
|
|
367
|
-
}
|
|
393
|
+
}
|
|
368
394
|
|
|
369
|
-
|
|
395
|
+
async updateChannel(
|
|
370
396
|
request: UpdateChannelRequest & { type: string; id: string },
|
|
371
|
-
): Promise<StreamResponse<UpdateChannelResponse>>
|
|
397
|
+
): Promise<StreamResponse<UpdateChannelResponse>> {
|
|
372
398
|
const pathParams = {
|
|
373
399
|
type: request?.type,
|
|
374
400
|
id: request?.id,
|
|
@@ -391,21 +417,28 @@ export class ChatApi extends BaseApi {
|
|
|
391
417
|
user: request?.user,
|
|
392
418
|
};
|
|
393
419
|
|
|
394
|
-
const response = await this.sendRequest<
|
|
420
|
+
const response = await this.apiClient.sendRequest<
|
|
395
421
|
StreamResponse<UpdateChannelResponse>
|
|
396
|
-
>(
|
|
422
|
+
>(
|
|
423
|
+
'POST',
|
|
424
|
+
'/api/v2/chat/channels/{type}/{id}',
|
|
425
|
+
pathParams,
|
|
426
|
+
undefined,
|
|
427
|
+
body,
|
|
428
|
+
'application/json',
|
|
429
|
+
);
|
|
397
430
|
|
|
398
431
|
decoders.UpdateChannelResponse?.(response.body);
|
|
399
432
|
|
|
400
433
|
return { ...response.body, metadata: response.metadata };
|
|
401
|
-
}
|
|
434
|
+
}
|
|
402
435
|
|
|
403
|
-
|
|
436
|
+
async deleteDraft(request: {
|
|
404
437
|
type: string;
|
|
405
438
|
id: string;
|
|
406
439
|
parent_id?: string;
|
|
407
440
|
user_id?: string;
|
|
408
|
-
}): Promise<StreamResponse<Response>>
|
|
441
|
+
}): Promise<StreamResponse<Response>> {
|
|
409
442
|
const queryParams = {
|
|
410
443
|
parent_id: request?.parent_id,
|
|
411
444
|
user_id: request?.user_id,
|
|
@@ -415,7 +448,7 @@ export class ChatApi extends BaseApi {
|
|
|
415
448
|
id: request?.id,
|
|
416
449
|
};
|
|
417
450
|
|
|
418
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
451
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
419
452
|
'DELETE',
|
|
420
453
|
'/api/v2/chat/channels/{type}/{id}/draft',
|
|
421
454
|
pathParams,
|
|
@@ -425,14 +458,14 @@ export class ChatApi extends BaseApi {
|
|
|
425
458
|
decoders.Response?.(response.body);
|
|
426
459
|
|
|
427
460
|
return { ...response.body, metadata: response.metadata };
|
|
428
|
-
}
|
|
461
|
+
}
|
|
429
462
|
|
|
430
|
-
|
|
463
|
+
async getDraft(request: {
|
|
431
464
|
type: string;
|
|
432
465
|
id: string;
|
|
433
466
|
parent_id?: string;
|
|
434
467
|
user_id?: string;
|
|
435
|
-
}): Promise<StreamResponse<GetDraftResponse>>
|
|
468
|
+
}): Promise<StreamResponse<GetDraftResponse>> {
|
|
436
469
|
const queryParams = {
|
|
437
470
|
parent_id: request?.parent_id,
|
|
438
471
|
user_id: request?.user_id,
|
|
@@ -442,7 +475,9 @@ export class ChatApi extends BaseApi {
|
|
|
442
475
|
id: request?.id,
|
|
443
476
|
};
|
|
444
477
|
|
|
445
|
-
const response = await this.sendRequest<
|
|
478
|
+
const response = await this.apiClient.sendRequest<
|
|
479
|
+
StreamResponse<GetDraftResponse>
|
|
480
|
+
>(
|
|
446
481
|
'GET',
|
|
447
482
|
'/api/v2/chat/channels/{type}/{id}/draft',
|
|
448
483
|
pathParams,
|
|
@@ -452,11 +487,11 @@ export class ChatApi extends BaseApi {
|
|
|
452
487
|
decoders.GetDraftResponse?.(response.body);
|
|
453
488
|
|
|
454
489
|
return { ...response.body, metadata: response.metadata };
|
|
455
|
-
}
|
|
490
|
+
}
|
|
456
491
|
|
|
457
|
-
|
|
492
|
+
async sendEvent(
|
|
458
493
|
request: SendEventRequest & { type: string; id: string },
|
|
459
|
-
): Promise<StreamResponse<EventResponse>>
|
|
494
|
+
): Promise<StreamResponse<EventResponse>> {
|
|
460
495
|
const pathParams = {
|
|
461
496
|
type: request?.type,
|
|
462
497
|
id: request?.id,
|
|
@@ -465,24 +500,27 @@ export class ChatApi extends BaseApi {
|
|
|
465
500
|
event: request?.event,
|
|
466
501
|
};
|
|
467
502
|
|
|
468
|
-
const response = await this.sendRequest<
|
|
503
|
+
const response = await this.apiClient.sendRequest<
|
|
504
|
+
StreamResponse<EventResponse>
|
|
505
|
+
>(
|
|
469
506
|
'POST',
|
|
470
507
|
'/api/v2/chat/channels/{type}/{id}/event',
|
|
471
508
|
pathParams,
|
|
472
509
|
undefined,
|
|
473
510
|
body,
|
|
511
|
+
'application/json',
|
|
474
512
|
);
|
|
475
513
|
|
|
476
514
|
decoders.EventResponse?.(response.body);
|
|
477
515
|
|
|
478
516
|
return { ...response.body, metadata: response.metadata };
|
|
479
|
-
}
|
|
517
|
+
}
|
|
480
518
|
|
|
481
|
-
|
|
519
|
+
async deleteFile(request: {
|
|
482
520
|
type: string;
|
|
483
521
|
id: string;
|
|
484
522
|
url?: string;
|
|
485
|
-
}): Promise<StreamResponse<Response>>
|
|
523
|
+
}): Promise<StreamResponse<Response>> {
|
|
486
524
|
const queryParams = {
|
|
487
525
|
url: request?.url,
|
|
488
526
|
};
|
|
@@ -491,7 +529,7 @@ export class ChatApi extends BaseApi {
|
|
|
491
529
|
id: request?.id,
|
|
492
530
|
};
|
|
493
531
|
|
|
494
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
532
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
495
533
|
'DELETE',
|
|
496
534
|
'/api/v2/chat/channels/{type}/{id}/file',
|
|
497
535
|
pathParams,
|
|
@@ -501,11 +539,11 @@ export class ChatApi extends BaseApi {
|
|
|
501
539
|
decoders.Response?.(response.body);
|
|
502
540
|
|
|
503
541
|
return { ...response.body, metadata: response.metadata };
|
|
504
|
-
}
|
|
542
|
+
}
|
|
505
543
|
|
|
506
|
-
|
|
544
|
+
async uploadFile(
|
|
507
545
|
request: FileUploadRequest & { type: string; id: string },
|
|
508
|
-
): Promise<StreamResponse<FileUploadResponse>>
|
|
546
|
+
): Promise<StreamResponse<FileUploadResponse>> {
|
|
509
547
|
const pathParams = {
|
|
510
548
|
type: request?.type,
|
|
511
549
|
id: request?.id,
|
|
@@ -515,22 +553,25 @@ export class ChatApi extends BaseApi {
|
|
|
515
553
|
user: request?.user,
|
|
516
554
|
};
|
|
517
555
|
|
|
518
|
-
const response = await this.sendRequest<
|
|
556
|
+
const response = await this.apiClient.sendRequest<
|
|
557
|
+
StreamResponse<FileUploadResponse>
|
|
558
|
+
>(
|
|
519
559
|
'POST',
|
|
520
560
|
'/api/v2/chat/channels/{type}/{id}/file',
|
|
521
561
|
pathParams,
|
|
522
562
|
undefined,
|
|
523
563
|
body,
|
|
564
|
+
'multipart/form-data',
|
|
524
565
|
);
|
|
525
566
|
|
|
526
567
|
decoders.FileUploadResponse?.(response.body);
|
|
527
568
|
|
|
528
569
|
return { ...response.body, metadata: response.metadata };
|
|
529
|
-
}
|
|
570
|
+
}
|
|
530
571
|
|
|
531
|
-
|
|
572
|
+
async hideChannel(
|
|
532
573
|
request: HideChannelRequest & { type: string; id: string },
|
|
533
|
-
): Promise<StreamResponse<HideChannelResponse>>
|
|
574
|
+
): Promise<StreamResponse<HideChannelResponse>> {
|
|
534
575
|
const pathParams = {
|
|
535
576
|
type: request?.type,
|
|
536
577
|
id: request?.id,
|
|
@@ -541,7 +582,7 @@ export class ChatApi extends BaseApi {
|
|
|
541
582
|
user: request?.user,
|
|
542
583
|
};
|
|
543
584
|
|
|
544
|
-
const response = await this.sendRequest<
|
|
585
|
+
const response = await this.apiClient.sendRequest<
|
|
545
586
|
StreamResponse<HideChannelResponse>
|
|
546
587
|
>(
|
|
547
588
|
'POST',
|
|
@@ -549,18 +590,19 @@ export class ChatApi extends BaseApi {
|
|
|
549
590
|
pathParams,
|
|
550
591
|
undefined,
|
|
551
592
|
body,
|
|
593
|
+
'application/json',
|
|
552
594
|
);
|
|
553
595
|
|
|
554
596
|
decoders.HideChannelResponse?.(response.body);
|
|
555
597
|
|
|
556
598
|
return { ...response.body, metadata: response.metadata };
|
|
557
|
-
}
|
|
599
|
+
}
|
|
558
600
|
|
|
559
|
-
|
|
601
|
+
async deleteImage(request: {
|
|
560
602
|
type: string;
|
|
561
603
|
id: string;
|
|
562
604
|
url?: string;
|
|
563
|
-
}): Promise<StreamResponse<Response>>
|
|
605
|
+
}): Promise<StreamResponse<Response>> {
|
|
564
606
|
const queryParams = {
|
|
565
607
|
url: request?.url,
|
|
566
608
|
};
|
|
@@ -569,7 +611,7 @@ export class ChatApi extends BaseApi {
|
|
|
569
611
|
id: request?.id,
|
|
570
612
|
};
|
|
571
613
|
|
|
572
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
614
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
573
615
|
'DELETE',
|
|
574
616
|
'/api/v2/chat/channels/{type}/{id}/image',
|
|
575
617
|
pathParams,
|
|
@@ -579,11 +621,11 @@ export class ChatApi extends BaseApi {
|
|
|
579
621
|
decoders.Response?.(response.body);
|
|
580
622
|
|
|
581
623
|
return { ...response.body, metadata: response.metadata };
|
|
582
|
-
}
|
|
624
|
+
}
|
|
583
625
|
|
|
584
|
-
|
|
626
|
+
async uploadImage(
|
|
585
627
|
request: ImageUploadRequest & { type: string; id: string },
|
|
586
|
-
): Promise<StreamResponse<ImageUploadResponse>>
|
|
628
|
+
): Promise<StreamResponse<ImageUploadResponse>> {
|
|
587
629
|
const pathParams = {
|
|
588
630
|
type: request?.type,
|
|
589
631
|
id: request?.id,
|
|
@@ -594,7 +636,7 @@ export class ChatApi extends BaseApi {
|
|
|
594
636
|
user: request?.user,
|
|
595
637
|
};
|
|
596
638
|
|
|
597
|
-
const response = await this.sendRequest<
|
|
639
|
+
const response = await this.apiClient.sendRequest<
|
|
598
640
|
StreamResponse<ImageUploadResponse>
|
|
599
641
|
>(
|
|
600
642
|
'POST',
|
|
@@ -602,20 +644,21 @@ export class ChatApi extends BaseApi {
|
|
|
602
644
|
pathParams,
|
|
603
645
|
undefined,
|
|
604
646
|
body,
|
|
647
|
+
'multipart/form-data',
|
|
605
648
|
);
|
|
606
649
|
|
|
607
650
|
decoders.ImageUploadResponse?.(response.body);
|
|
608
651
|
|
|
609
652
|
return { ...response.body, metadata: response.metadata };
|
|
610
|
-
}
|
|
653
|
+
}
|
|
611
654
|
|
|
612
|
-
|
|
655
|
+
async updateMemberPartial(
|
|
613
656
|
request: UpdateMemberPartialRequest & {
|
|
614
657
|
type: string;
|
|
615
658
|
id: string;
|
|
616
659
|
user_id?: string;
|
|
617
660
|
},
|
|
618
|
-
): Promise<StreamResponse<UpdateMemberPartialResponse>>
|
|
661
|
+
): Promise<StreamResponse<UpdateMemberPartialResponse>> {
|
|
619
662
|
const queryParams = {
|
|
620
663
|
user_id: request?.user_id,
|
|
621
664
|
};
|
|
@@ -628,7 +671,7 @@ export class ChatApi extends BaseApi {
|
|
|
628
671
|
set: request?.set,
|
|
629
672
|
};
|
|
630
673
|
|
|
631
|
-
const response = await this.sendRequest<
|
|
674
|
+
const response = await this.apiClient.sendRequest<
|
|
632
675
|
StreamResponse<UpdateMemberPartialResponse>
|
|
633
676
|
>(
|
|
634
677
|
'PATCH',
|
|
@@ -636,16 +679,17 @@ export class ChatApi extends BaseApi {
|
|
|
636
679
|
pathParams,
|
|
637
680
|
queryParams,
|
|
638
681
|
body,
|
|
682
|
+
'application/json',
|
|
639
683
|
);
|
|
640
684
|
|
|
641
685
|
decoders.UpdateMemberPartialResponse?.(response.body);
|
|
642
686
|
|
|
643
687
|
return { ...response.body, metadata: response.metadata };
|
|
644
|
-
}
|
|
688
|
+
}
|
|
645
689
|
|
|
646
|
-
|
|
690
|
+
async sendMessage(
|
|
647
691
|
request: SendMessageRequest & { type: string; id: string },
|
|
648
|
-
): Promise<StreamResponse<SendMessageResponse>>
|
|
692
|
+
): Promise<StreamResponse<SendMessageResponse>> {
|
|
649
693
|
const pathParams = {
|
|
650
694
|
type: request?.type,
|
|
651
695
|
id: request?.id,
|
|
@@ -660,7 +704,7 @@ export class ChatApi extends BaseApi {
|
|
|
660
704
|
pending_message_metadata: request?.pending_message_metadata,
|
|
661
705
|
};
|
|
662
706
|
|
|
663
|
-
const response = await this.sendRequest<
|
|
707
|
+
const response = await this.apiClient.sendRequest<
|
|
664
708
|
StreamResponse<SendMessageResponse>
|
|
665
709
|
>(
|
|
666
710
|
'POST',
|
|
@@ -668,18 +712,19 @@ export class ChatApi extends BaseApi {
|
|
|
668
712
|
pathParams,
|
|
669
713
|
undefined,
|
|
670
714
|
body,
|
|
715
|
+
'application/json',
|
|
671
716
|
);
|
|
672
717
|
|
|
673
718
|
decoders.SendMessageResponse?.(response.body);
|
|
674
719
|
|
|
675
720
|
return { ...response.body, metadata: response.metadata };
|
|
676
|
-
}
|
|
721
|
+
}
|
|
677
722
|
|
|
678
|
-
|
|
723
|
+
async getManyMessages(request: {
|
|
679
724
|
type: string;
|
|
680
725
|
id: string;
|
|
681
726
|
ids: string[];
|
|
682
|
-
}): Promise<StreamResponse<GetManyMessagesResponse>>
|
|
727
|
+
}): Promise<StreamResponse<GetManyMessagesResponse>> {
|
|
683
728
|
const queryParams = {
|
|
684
729
|
ids: request?.ids,
|
|
685
730
|
};
|
|
@@ -688,7 +733,7 @@ export class ChatApi extends BaseApi {
|
|
|
688
733
|
id: request?.id,
|
|
689
734
|
};
|
|
690
735
|
|
|
691
|
-
const response = await this.sendRequest<
|
|
736
|
+
const response = await this.apiClient.sendRequest<
|
|
692
737
|
StreamResponse<GetManyMessagesResponse>
|
|
693
738
|
>(
|
|
694
739
|
'GET',
|
|
@@ -700,11 +745,11 @@ export class ChatApi extends BaseApi {
|
|
|
700
745
|
decoders.GetManyMessagesResponse?.(response.body);
|
|
701
746
|
|
|
702
747
|
return { ...response.body, metadata: response.metadata };
|
|
703
|
-
}
|
|
748
|
+
}
|
|
704
749
|
|
|
705
|
-
|
|
750
|
+
async getOrCreateChannel(
|
|
706
751
|
request: ChannelGetOrCreateRequest & { type: string; id: string },
|
|
707
|
-
): Promise<StreamResponse<ChannelStateResponse>>
|
|
752
|
+
): Promise<StreamResponse<ChannelStateResponse>> {
|
|
708
753
|
const pathParams = {
|
|
709
754
|
type: request?.type,
|
|
710
755
|
id: request?.id,
|
|
@@ -719,7 +764,7 @@ export class ChatApi extends BaseApi {
|
|
|
719
764
|
watchers: request?.watchers,
|
|
720
765
|
};
|
|
721
766
|
|
|
722
|
-
const response = await this.sendRequest<
|
|
767
|
+
const response = await this.apiClient.sendRequest<
|
|
723
768
|
StreamResponse<ChannelStateResponse>
|
|
724
769
|
>(
|
|
725
770
|
'POST',
|
|
@@ -727,16 +772,17 @@ export class ChatApi extends BaseApi {
|
|
|
727
772
|
pathParams,
|
|
728
773
|
undefined,
|
|
729
774
|
body,
|
|
775
|
+
'application/json',
|
|
730
776
|
);
|
|
731
777
|
|
|
732
778
|
decoders.ChannelStateResponse?.(response.body);
|
|
733
779
|
|
|
734
780
|
return { ...response.body, metadata: response.metadata };
|
|
735
|
-
}
|
|
781
|
+
}
|
|
736
782
|
|
|
737
|
-
|
|
783
|
+
async markRead(
|
|
738
784
|
request: MarkReadRequest & { type: string; id: string },
|
|
739
|
-
): Promise<StreamResponse<MarkReadResponse>>
|
|
785
|
+
): Promise<StreamResponse<MarkReadResponse>> {
|
|
740
786
|
const pathParams = {
|
|
741
787
|
type: request?.type,
|
|
742
788
|
id: request?.id,
|
|
@@ -748,22 +794,25 @@ export class ChatApi extends BaseApi {
|
|
|
748
794
|
user: request?.user,
|
|
749
795
|
};
|
|
750
796
|
|
|
751
|
-
const response = await this.sendRequest<
|
|
797
|
+
const response = await this.apiClient.sendRequest<
|
|
798
|
+
StreamResponse<MarkReadResponse>
|
|
799
|
+
>(
|
|
752
800
|
'POST',
|
|
753
801
|
'/api/v2/chat/channels/{type}/{id}/read',
|
|
754
802
|
pathParams,
|
|
755
803
|
undefined,
|
|
756
804
|
body,
|
|
805
|
+
'application/json',
|
|
757
806
|
);
|
|
758
807
|
|
|
759
808
|
decoders.MarkReadResponse?.(response.body);
|
|
760
809
|
|
|
761
810
|
return { ...response.body, metadata: response.metadata };
|
|
762
|
-
}
|
|
811
|
+
}
|
|
763
812
|
|
|
764
|
-
|
|
813
|
+
async showChannel(
|
|
765
814
|
request: ShowChannelRequest & { type: string; id: string },
|
|
766
|
-
): Promise<StreamResponse<ShowChannelResponse>>
|
|
815
|
+
): Promise<StreamResponse<ShowChannelResponse>> {
|
|
767
816
|
const pathParams = {
|
|
768
817
|
type: request?.type,
|
|
769
818
|
id: request?.id,
|
|
@@ -773,7 +822,7 @@ export class ChatApi extends BaseApi {
|
|
|
773
822
|
user: request?.user,
|
|
774
823
|
};
|
|
775
824
|
|
|
776
|
-
const response = await this.sendRequest<
|
|
825
|
+
const response = await this.apiClient.sendRequest<
|
|
777
826
|
StreamResponse<ShowChannelResponse>
|
|
778
827
|
>(
|
|
779
828
|
'POST',
|
|
@@ -781,16 +830,17 @@ export class ChatApi extends BaseApi {
|
|
|
781
830
|
pathParams,
|
|
782
831
|
undefined,
|
|
783
832
|
body,
|
|
833
|
+
'application/json',
|
|
784
834
|
);
|
|
785
835
|
|
|
786
836
|
decoders.ShowChannelResponse?.(response.body);
|
|
787
837
|
|
|
788
838
|
return { ...response.body, metadata: response.metadata };
|
|
789
|
-
}
|
|
839
|
+
}
|
|
790
840
|
|
|
791
|
-
|
|
841
|
+
async truncateChannel(
|
|
792
842
|
request: TruncateChannelRequest & { type: string; id: string },
|
|
793
|
-
): Promise<StreamResponse<TruncateChannelResponse>>
|
|
843
|
+
): Promise<StreamResponse<TruncateChannelResponse>> {
|
|
794
844
|
const pathParams = {
|
|
795
845
|
type: request?.type,
|
|
796
846
|
id: request?.id,
|
|
@@ -805,7 +855,7 @@ export class ChatApi extends BaseApi {
|
|
|
805
855
|
user: request?.user,
|
|
806
856
|
};
|
|
807
857
|
|
|
808
|
-
const response = await this.sendRequest<
|
|
858
|
+
const response = await this.apiClient.sendRequest<
|
|
809
859
|
StreamResponse<TruncateChannelResponse>
|
|
810
860
|
>(
|
|
811
861
|
'POST',
|
|
@@ -813,16 +863,17 @@ export class ChatApi extends BaseApi {
|
|
|
813
863
|
pathParams,
|
|
814
864
|
undefined,
|
|
815
865
|
body,
|
|
866
|
+
'application/json',
|
|
816
867
|
);
|
|
817
868
|
|
|
818
869
|
decoders.TruncateChannelResponse?.(response.body);
|
|
819
870
|
|
|
820
871
|
return { ...response.body, metadata: response.metadata };
|
|
821
|
-
}
|
|
872
|
+
}
|
|
822
873
|
|
|
823
|
-
|
|
874
|
+
async markUnread(
|
|
824
875
|
request: MarkUnreadRequest & { type: string; id: string },
|
|
825
|
-
): Promise<StreamResponse<Response>>
|
|
876
|
+
): Promise<StreamResponse<Response>> {
|
|
826
877
|
const pathParams = {
|
|
827
878
|
type: request?.type,
|
|
828
879
|
id: request?.id,
|
|
@@ -834,34 +885,33 @@ export class ChatApi extends BaseApi {
|
|
|
834
885
|
user: request?.user,
|
|
835
886
|
};
|
|
836
887
|
|
|
837
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
888
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
838
889
|
'POST',
|
|
839
890
|
'/api/v2/chat/channels/{type}/{id}/unread',
|
|
840
891
|
pathParams,
|
|
841
892
|
undefined,
|
|
842
893
|
body,
|
|
894
|
+
'application/json',
|
|
843
895
|
);
|
|
844
896
|
|
|
845
897
|
decoders.Response?.(response.body);
|
|
846
898
|
|
|
847
899
|
return { ...response.body, metadata: response.metadata };
|
|
848
|
-
}
|
|
900
|
+
}
|
|
849
901
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
> => {
|
|
853
|
-
const response = await this.sendRequest<
|
|
902
|
+
async listChannelTypes(): Promise<StreamResponse<ListChannelTypesResponse>> {
|
|
903
|
+
const response = await this.apiClient.sendRequest<
|
|
854
904
|
StreamResponse<ListChannelTypesResponse>
|
|
855
905
|
>('GET', '/api/v2/chat/channeltypes', undefined, undefined);
|
|
856
906
|
|
|
857
907
|
decoders.ListChannelTypesResponse?.(response.body);
|
|
858
908
|
|
|
859
909
|
return { ...response.body, metadata: response.metadata };
|
|
860
|
-
}
|
|
910
|
+
}
|
|
861
911
|
|
|
862
|
-
|
|
912
|
+
async createChannelType(
|
|
863
913
|
request: CreateChannelTypeRequest,
|
|
864
|
-
): Promise<StreamResponse<CreateChannelTypeResponse>>
|
|
914
|
+
): Promise<StreamResponse<CreateChannelTypeResponse>> {
|
|
865
915
|
const body = {
|
|
866
916
|
automod: request?.automod,
|
|
867
917
|
automod_behavior: request?.automod_behavior,
|
|
@@ -895,23 +945,30 @@ export class ChatApi extends BaseApi {
|
|
|
895
945
|
grants: request?.grants,
|
|
896
946
|
};
|
|
897
947
|
|
|
898
|
-
const response = await this.sendRequest<
|
|
948
|
+
const response = await this.apiClient.sendRequest<
|
|
899
949
|
StreamResponse<CreateChannelTypeResponse>
|
|
900
|
-
>(
|
|
950
|
+
>(
|
|
951
|
+
'POST',
|
|
952
|
+
'/api/v2/chat/channeltypes',
|
|
953
|
+
undefined,
|
|
954
|
+
undefined,
|
|
955
|
+
body,
|
|
956
|
+
'application/json',
|
|
957
|
+
);
|
|
901
958
|
|
|
902
959
|
decoders.CreateChannelTypeResponse?.(response.body);
|
|
903
960
|
|
|
904
961
|
return { ...response.body, metadata: response.metadata };
|
|
905
|
-
}
|
|
962
|
+
}
|
|
906
963
|
|
|
907
|
-
|
|
964
|
+
async deleteChannelType(request: {
|
|
908
965
|
name: string;
|
|
909
|
-
}): Promise<StreamResponse<Response>>
|
|
966
|
+
}): Promise<StreamResponse<Response>> {
|
|
910
967
|
const pathParams = {
|
|
911
968
|
name: request?.name,
|
|
912
969
|
};
|
|
913
970
|
|
|
914
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
971
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
915
972
|
'DELETE',
|
|
916
973
|
'/api/v2/chat/channeltypes/{name}',
|
|
917
974
|
pathParams,
|
|
@@ -921,27 +978,27 @@ export class ChatApi extends BaseApi {
|
|
|
921
978
|
decoders.Response?.(response.body);
|
|
922
979
|
|
|
923
980
|
return { ...response.body, metadata: response.metadata };
|
|
924
|
-
}
|
|
981
|
+
}
|
|
925
982
|
|
|
926
|
-
|
|
983
|
+
async getChannelType(request: {
|
|
927
984
|
name: string;
|
|
928
|
-
}): Promise<StreamResponse<GetChannelTypeResponse>>
|
|
985
|
+
}): Promise<StreamResponse<GetChannelTypeResponse>> {
|
|
929
986
|
const pathParams = {
|
|
930
987
|
name: request?.name,
|
|
931
988
|
};
|
|
932
989
|
|
|
933
|
-
const response = await this.sendRequest<
|
|
990
|
+
const response = await this.apiClient.sendRequest<
|
|
934
991
|
StreamResponse<GetChannelTypeResponse>
|
|
935
992
|
>('GET', '/api/v2/chat/channeltypes/{name}', pathParams, undefined);
|
|
936
993
|
|
|
937
994
|
decoders.GetChannelTypeResponse?.(response.body);
|
|
938
995
|
|
|
939
996
|
return { ...response.body, metadata: response.metadata };
|
|
940
|
-
}
|
|
997
|
+
}
|
|
941
998
|
|
|
942
|
-
|
|
999
|
+
async updateChannelType(
|
|
943
1000
|
request: UpdateChannelTypeRequest & { name: string },
|
|
944
|
-
): Promise<StreamResponse<UpdateChannelTypeResponse>>
|
|
1001
|
+
): Promise<StreamResponse<UpdateChannelTypeResponse>> {
|
|
945
1002
|
const pathParams = {
|
|
946
1003
|
name: request?.name,
|
|
947
1004
|
};
|
|
@@ -980,28 +1037,35 @@ export class ChatApi extends BaseApi {
|
|
|
980
1037
|
grants: request?.grants,
|
|
981
1038
|
};
|
|
982
1039
|
|
|
983
|
-
const response = await this.sendRequest<
|
|
1040
|
+
const response = await this.apiClient.sendRequest<
|
|
984
1041
|
StreamResponse<UpdateChannelTypeResponse>
|
|
985
|
-
>(
|
|
1042
|
+
>(
|
|
1043
|
+
'PUT',
|
|
1044
|
+
'/api/v2/chat/channeltypes/{name}',
|
|
1045
|
+
pathParams,
|
|
1046
|
+
undefined,
|
|
1047
|
+
body,
|
|
1048
|
+
'application/json',
|
|
1049
|
+
);
|
|
986
1050
|
|
|
987
1051
|
decoders.UpdateChannelTypeResponse?.(response.body);
|
|
988
1052
|
|
|
989
1053
|
return { ...response.body, metadata: response.metadata };
|
|
990
|
-
}
|
|
1054
|
+
}
|
|
991
1055
|
|
|
992
|
-
|
|
993
|
-
const response = await this.sendRequest<
|
|
1056
|
+
async listCommands(): Promise<StreamResponse<ListCommandsResponse>> {
|
|
1057
|
+
const response = await this.apiClient.sendRequest<
|
|
994
1058
|
StreamResponse<ListCommandsResponse>
|
|
995
1059
|
>('GET', '/api/v2/chat/commands', undefined, undefined);
|
|
996
1060
|
|
|
997
1061
|
decoders.ListCommandsResponse?.(response.body);
|
|
998
1062
|
|
|
999
1063
|
return { ...response.body, metadata: response.metadata };
|
|
1000
|
-
}
|
|
1064
|
+
}
|
|
1001
1065
|
|
|
1002
|
-
|
|
1066
|
+
async createCommand(
|
|
1003
1067
|
request: CreateCommandRequest,
|
|
1004
|
-
): Promise<StreamResponse<CreateCommandResponse>>
|
|
1068
|
+
): Promise<StreamResponse<CreateCommandResponse>> {
|
|
1005
1069
|
const body = {
|
|
1006
1070
|
description: request?.description,
|
|
1007
1071
|
name: request?.name,
|
|
@@ -1009,53 +1073,57 @@ export class ChatApi extends BaseApi {
|
|
|
1009
1073
|
set: request?.set,
|
|
1010
1074
|
};
|
|
1011
1075
|
|
|
1012
|
-
const response = await this.sendRequest<
|
|
1076
|
+
const response = await this.apiClient.sendRequest<
|
|
1013
1077
|
StreamResponse<CreateCommandResponse>
|
|
1014
|
-
>(
|
|
1078
|
+
>(
|
|
1079
|
+
'POST',
|
|
1080
|
+
'/api/v2/chat/commands',
|
|
1081
|
+
undefined,
|
|
1082
|
+
undefined,
|
|
1083
|
+
body,
|
|
1084
|
+
'application/json',
|
|
1085
|
+
);
|
|
1015
1086
|
|
|
1016
1087
|
decoders.CreateCommandResponse?.(response.body);
|
|
1017
1088
|
|
|
1018
1089
|
return { ...response.body, metadata: response.metadata };
|
|
1019
|
-
}
|
|
1090
|
+
}
|
|
1020
1091
|
|
|
1021
|
-
|
|
1092
|
+
async deleteCommand(request: {
|
|
1022
1093
|
name: string;
|
|
1023
|
-
}): Promise<StreamResponse<DeleteCommandResponse>>
|
|
1094
|
+
}): Promise<StreamResponse<DeleteCommandResponse>> {
|
|
1024
1095
|
const pathParams = {
|
|
1025
1096
|
name: request?.name,
|
|
1026
1097
|
};
|
|
1027
1098
|
|
|
1028
|
-
const response = await this.sendRequest<
|
|
1099
|
+
const response = await this.apiClient.sendRequest<
|
|
1029
1100
|
StreamResponse<DeleteCommandResponse>
|
|
1030
1101
|
>('DELETE', '/api/v2/chat/commands/{name}', pathParams, undefined);
|
|
1031
1102
|
|
|
1032
1103
|
decoders.DeleteCommandResponse?.(response.body);
|
|
1033
1104
|
|
|
1034
1105
|
return { ...response.body, metadata: response.metadata };
|
|
1035
|
-
}
|
|
1106
|
+
}
|
|
1036
1107
|
|
|
1037
|
-
|
|
1108
|
+
async getCommand(request: {
|
|
1038
1109
|
name: string;
|
|
1039
|
-
}): Promise<StreamResponse<GetCommandResponse>>
|
|
1110
|
+
}): Promise<StreamResponse<GetCommandResponse>> {
|
|
1040
1111
|
const pathParams = {
|
|
1041
1112
|
name: request?.name,
|
|
1042
1113
|
};
|
|
1043
1114
|
|
|
1044
|
-
const response = await this.sendRequest<
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
pathParams,
|
|
1048
|
-
undefined,
|
|
1049
|
-
);
|
|
1115
|
+
const response = await this.apiClient.sendRequest<
|
|
1116
|
+
StreamResponse<GetCommandResponse>
|
|
1117
|
+
>('GET', '/api/v2/chat/commands/{name}', pathParams, undefined);
|
|
1050
1118
|
|
|
1051
1119
|
decoders.GetCommandResponse?.(response.body);
|
|
1052
1120
|
|
|
1053
1121
|
return { ...response.body, metadata: response.metadata };
|
|
1054
|
-
}
|
|
1122
|
+
}
|
|
1055
1123
|
|
|
1056
|
-
|
|
1124
|
+
async updateCommand(
|
|
1057
1125
|
request: UpdateCommandRequest & { name: string },
|
|
1058
|
-
): Promise<StreamResponse<UpdateCommandResponse>>
|
|
1126
|
+
): Promise<StreamResponse<UpdateCommandResponse>> {
|
|
1059
1127
|
const pathParams = {
|
|
1060
1128
|
name: request?.name,
|
|
1061
1129
|
};
|
|
@@ -1065,18 +1133,25 @@ export class ChatApi extends BaseApi {
|
|
|
1065
1133
|
set: request?.set,
|
|
1066
1134
|
};
|
|
1067
1135
|
|
|
1068
|
-
const response = await this.sendRequest<
|
|
1136
|
+
const response = await this.apiClient.sendRequest<
|
|
1069
1137
|
StreamResponse<UpdateCommandResponse>
|
|
1070
|
-
>(
|
|
1138
|
+
>(
|
|
1139
|
+
'PUT',
|
|
1140
|
+
'/api/v2/chat/commands/{name}',
|
|
1141
|
+
pathParams,
|
|
1142
|
+
undefined,
|
|
1143
|
+
body,
|
|
1144
|
+
'application/json',
|
|
1145
|
+
);
|
|
1071
1146
|
|
|
1072
1147
|
decoders.UpdateCommandResponse?.(response.body);
|
|
1073
1148
|
|
|
1074
1149
|
return { ...response.body, metadata: response.metadata };
|
|
1075
|
-
}
|
|
1150
|
+
}
|
|
1076
1151
|
|
|
1077
|
-
|
|
1152
|
+
async queryDrafts(
|
|
1078
1153
|
request?: QueryDraftsRequest,
|
|
1079
|
-
): Promise<StreamResponse<QueryDraftsResponse>>
|
|
1154
|
+
): Promise<StreamResponse<QueryDraftsResponse>> {
|
|
1080
1155
|
const body = {
|
|
1081
1156
|
limit: request?.limit,
|
|
1082
1157
|
next: request?.next,
|
|
@@ -1087,18 +1162,25 @@ export class ChatApi extends BaseApi {
|
|
|
1087
1162
|
user: request?.user,
|
|
1088
1163
|
};
|
|
1089
1164
|
|
|
1090
|
-
const response = await this.sendRequest<
|
|
1165
|
+
const response = await this.apiClient.sendRequest<
|
|
1091
1166
|
StreamResponse<QueryDraftsResponse>
|
|
1092
|
-
>(
|
|
1167
|
+
>(
|
|
1168
|
+
'POST',
|
|
1169
|
+
'/api/v2/chat/drafts/query',
|
|
1170
|
+
undefined,
|
|
1171
|
+
undefined,
|
|
1172
|
+
body,
|
|
1173
|
+
'application/json',
|
|
1174
|
+
);
|
|
1093
1175
|
|
|
1094
1176
|
decoders.QueryDraftsResponse?.(response.body);
|
|
1095
1177
|
|
|
1096
1178
|
return { ...response.body, metadata: response.metadata };
|
|
1097
|
-
}
|
|
1179
|
+
}
|
|
1098
1180
|
|
|
1099
|
-
|
|
1181
|
+
async exportChannels(
|
|
1100
1182
|
request: ExportChannelsRequest,
|
|
1101
|
-
): Promise<StreamResponse<ExportChannelsResponse>>
|
|
1183
|
+
): Promise<StreamResponse<ExportChannelsResponse>> {
|
|
1102
1184
|
const body = {
|
|
1103
1185
|
channels: request?.channels,
|
|
1104
1186
|
clear_deleted_message_text: request?.clear_deleted_message_text,
|
|
@@ -1108,37 +1190,41 @@ export class ChatApi extends BaseApi {
|
|
|
1108
1190
|
version: request?.version,
|
|
1109
1191
|
};
|
|
1110
1192
|
|
|
1111
|
-
const response = await this.sendRequest<
|
|
1193
|
+
const response = await this.apiClient.sendRequest<
|
|
1112
1194
|
StreamResponse<ExportChannelsResponse>
|
|
1113
|
-
>(
|
|
1195
|
+
>(
|
|
1196
|
+
'POST',
|
|
1197
|
+
'/api/v2/chat/export_channels',
|
|
1198
|
+
undefined,
|
|
1199
|
+
undefined,
|
|
1200
|
+
body,
|
|
1201
|
+
'application/json',
|
|
1202
|
+
);
|
|
1114
1203
|
|
|
1115
1204
|
decoders.ExportChannelsResponse?.(response.body);
|
|
1116
1205
|
|
|
1117
1206
|
return { ...response.body, metadata: response.metadata };
|
|
1118
|
-
}
|
|
1207
|
+
}
|
|
1119
1208
|
|
|
1120
|
-
|
|
1209
|
+
async queryMembers(request?: {
|
|
1121
1210
|
payload?: QueryMembersPayload;
|
|
1122
|
-
}): Promise<StreamResponse<MembersResponse>>
|
|
1211
|
+
}): Promise<StreamResponse<MembersResponse>> {
|
|
1123
1212
|
const queryParams = {
|
|
1124
1213
|
payload: request?.payload,
|
|
1125
1214
|
};
|
|
1126
1215
|
|
|
1127
|
-
const response = await this.sendRequest<
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
undefined,
|
|
1131
|
-
queryParams,
|
|
1132
|
-
);
|
|
1216
|
+
const response = await this.apiClient.sendRequest<
|
|
1217
|
+
StreamResponse<MembersResponse>
|
|
1218
|
+
>('GET', '/api/v2/chat/members', undefined, queryParams);
|
|
1133
1219
|
|
|
1134
1220
|
decoders.MembersResponse?.(response.body);
|
|
1135
1221
|
|
|
1136
1222
|
return { ...response.body, metadata: response.metadata };
|
|
1137
|
-
}
|
|
1223
|
+
}
|
|
1138
1224
|
|
|
1139
|
-
|
|
1225
|
+
async queryMessageHistory(
|
|
1140
1226
|
request: QueryMessageHistoryRequest,
|
|
1141
|
-
): Promise<StreamResponse<QueryMessageHistoryResponse>>
|
|
1227
|
+
): Promise<StreamResponse<QueryMessageHistoryResponse>> {
|
|
1142
1228
|
const body = {
|
|
1143
1229
|
filter: request?.filter,
|
|
1144
1230
|
limit: request?.limit,
|
|
@@ -1147,20 +1233,27 @@ export class ChatApi extends BaseApi {
|
|
|
1147
1233
|
sort: request?.sort,
|
|
1148
1234
|
};
|
|
1149
1235
|
|
|
1150
|
-
const response = await this.sendRequest<
|
|
1236
|
+
const response = await this.apiClient.sendRequest<
|
|
1151
1237
|
StreamResponse<QueryMessageHistoryResponse>
|
|
1152
|
-
>(
|
|
1238
|
+
>(
|
|
1239
|
+
'POST',
|
|
1240
|
+
'/api/v2/chat/messages/history',
|
|
1241
|
+
undefined,
|
|
1242
|
+
undefined,
|
|
1243
|
+
body,
|
|
1244
|
+
'application/json',
|
|
1245
|
+
);
|
|
1153
1246
|
|
|
1154
1247
|
decoders.QueryMessageHistoryResponse?.(response.body);
|
|
1155
1248
|
|
|
1156
1249
|
return { ...response.body, metadata: response.metadata };
|
|
1157
|
-
}
|
|
1250
|
+
}
|
|
1158
1251
|
|
|
1159
|
-
|
|
1252
|
+
async deleteMessage(request: {
|
|
1160
1253
|
id: string;
|
|
1161
1254
|
hard?: boolean;
|
|
1162
1255
|
deleted_by?: string;
|
|
1163
|
-
}): Promise<StreamResponse<DeleteMessageResponse>>
|
|
1256
|
+
}): Promise<StreamResponse<DeleteMessageResponse>> {
|
|
1164
1257
|
const queryParams = {
|
|
1165
1258
|
hard: request?.hard,
|
|
1166
1259
|
deleted_by: request?.deleted_by,
|
|
@@ -1169,19 +1262,19 @@ export class ChatApi extends BaseApi {
|
|
|
1169
1262
|
id: request?.id,
|
|
1170
1263
|
};
|
|
1171
1264
|
|
|
1172
|
-
const response = await this.sendRequest<
|
|
1265
|
+
const response = await this.apiClient.sendRequest<
|
|
1173
1266
|
StreamResponse<DeleteMessageResponse>
|
|
1174
1267
|
>('DELETE', '/api/v2/chat/messages/{id}', pathParams, queryParams);
|
|
1175
1268
|
|
|
1176
1269
|
decoders.DeleteMessageResponse?.(response.body);
|
|
1177
1270
|
|
|
1178
1271
|
return { ...response.body, metadata: response.metadata };
|
|
1179
|
-
}
|
|
1272
|
+
}
|
|
1180
1273
|
|
|
1181
|
-
|
|
1274
|
+
async getMessage(request: {
|
|
1182
1275
|
id: string;
|
|
1183
1276
|
show_deleted_message?: boolean;
|
|
1184
|
-
}): Promise<StreamResponse<GetMessageResponse>>
|
|
1277
|
+
}): Promise<StreamResponse<GetMessageResponse>> {
|
|
1185
1278
|
const queryParams = {
|
|
1186
1279
|
show_deleted_message: request?.show_deleted_message,
|
|
1187
1280
|
};
|
|
@@ -1189,21 +1282,18 @@ export class ChatApi extends BaseApi {
|
|
|
1189
1282
|
id: request?.id,
|
|
1190
1283
|
};
|
|
1191
1284
|
|
|
1192
|
-
const response = await this.sendRequest<
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
pathParams,
|
|
1196
|
-
queryParams,
|
|
1197
|
-
);
|
|
1285
|
+
const response = await this.apiClient.sendRequest<
|
|
1286
|
+
StreamResponse<GetMessageResponse>
|
|
1287
|
+
>('GET', '/api/v2/chat/messages/{id}', pathParams, queryParams);
|
|
1198
1288
|
|
|
1199
1289
|
decoders.GetMessageResponse?.(response.body);
|
|
1200
1290
|
|
|
1201
1291
|
return { ...response.body, metadata: response.metadata };
|
|
1202
|
-
}
|
|
1292
|
+
}
|
|
1203
1293
|
|
|
1204
|
-
|
|
1294
|
+
async updateMessage(
|
|
1205
1295
|
request: UpdateMessageRequest & { id: string },
|
|
1206
|
-
): Promise<StreamResponse<UpdateMessageResponse>>
|
|
1296
|
+
): Promise<StreamResponse<UpdateMessageResponse>> {
|
|
1207
1297
|
const pathParams = {
|
|
1208
1298
|
id: request?.id,
|
|
1209
1299
|
};
|
|
@@ -1213,18 +1303,25 @@ export class ChatApi extends BaseApi {
|
|
|
1213
1303
|
skip_push: request?.skip_push,
|
|
1214
1304
|
};
|
|
1215
1305
|
|
|
1216
|
-
const response = await this.sendRequest<
|
|
1306
|
+
const response = await this.apiClient.sendRequest<
|
|
1217
1307
|
StreamResponse<UpdateMessageResponse>
|
|
1218
|
-
>(
|
|
1308
|
+
>(
|
|
1309
|
+
'POST',
|
|
1310
|
+
'/api/v2/chat/messages/{id}',
|
|
1311
|
+
pathParams,
|
|
1312
|
+
undefined,
|
|
1313
|
+
body,
|
|
1314
|
+
'application/json',
|
|
1315
|
+
);
|
|
1219
1316
|
|
|
1220
1317
|
decoders.UpdateMessageResponse?.(response.body);
|
|
1221
1318
|
|
|
1222
1319
|
return { ...response.body, metadata: response.metadata };
|
|
1223
|
-
}
|
|
1320
|
+
}
|
|
1224
1321
|
|
|
1225
|
-
|
|
1322
|
+
async updateMessagePartial(
|
|
1226
1323
|
request: UpdateMessagePartialRequest & { id: string },
|
|
1227
|
-
): Promise<StreamResponse<UpdateMessagePartialResponse>>
|
|
1324
|
+
): Promise<StreamResponse<UpdateMessagePartialResponse>> {
|
|
1228
1325
|
const pathParams = {
|
|
1229
1326
|
id: request?.id,
|
|
1230
1327
|
};
|
|
@@ -1236,18 +1333,25 @@ export class ChatApi extends BaseApi {
|
|
|
1236
1333
|
user: request?.user,
|
|
1237
1334
|
};
|
|
1238
1335
|
|
|
1239
|
-
const response = await this.sendRequest<
|
|
1336
|
+
const response = await this.apiClient.sendRequest<
|
|
1240
1337
|
StreamResponse<UpdateMessagePartialResponse>
|
|
1241
|
-
>(
|
|
1338
|
+
>(
|
|
1339
|
+
'PUT',
|
|
1340
|
+
'/api/v2/chat/messages/{id}',
|
|
1341
|
+
pathParams,
|
|
1342
|
+
undefined,
|
|
1343
|
+
body,
|
|
1344
|
+
'application/json',
|
|
1345
|
+
);
|
|
1242
1346
|
|
|
1243
1347
|
decoders.UpdateMessagePartialResponse?.(response.body);
|
|
1244
1348
|
|
|
1245
1349
|
return { ...response.body, metadata: response.metadata };
|
|
1246
|
-
}
|
|
1350
|
+
}
|
|
1247
1351
|
|
|
1248
|
-
|
|
1352
|
+
async runMessageAction(
|
|
1249
1353
|
request: MessageActionRequest & { id: string },
|
|
1250
|
-
): Promise<StreamResponse<MessageResponse>>
|
|
1354
|
+
): Promise<StreamResponse<MessageResponse>> {
|
|
1251
1355
|
const pathParams = {
|
|
1252
1356
|
id: request?.id,
|
|
1253
1357
|
};
|
|
@@ -1257,43 +1361,49 @@ export class ChatApi extends BaseApi {
|
|
|
1257
1361
|
user: request?.user,
|
|
1258
1362
|
};
|
|
1259
1363
|
|
|
1260
|
-
const response = await this.sendRequest<
|
|
1364
|
+
const response = await this.apiClient.sendRequest<
|
|
1365
|
+
StreamResponse<MessageResponse>
|
|
1366
|
+
>(
|
|
1261
1367
|
'POST',
|
|
1262
1368
|
'/api/v2/chat/messages/{id}/action',
|
|
1263
1369
|
pathParams,
|
|
1264
1370
|
undefined,
|
|
1265
1371
|
body,
|
|
1372
|
+
'application/json',
|
|
1266
1373
|
);
|
|
1267
1374
|
|
|
1268
1375
|
decoders.MessageResponse?.(response.body);
|
|
1269
1376
|
|
|
1270
1377
|
return { ...response.body, metadata: response.metadata };
|
|
1271
|
-
}
|
|
1378
|
+
}
|
|
1272
1379
|
|
|
1273
|
-
|
|
1380
|
+
async commitMessage(
|
|
1274
1381
|
request: CommitMessageRequest & { id: string },
|
|
1275
|
-
): Promise<StreamResponse<MessageResponse>>
|
|
1382
|
+
): Promise<StreamResponse<MessageResponse>> {
|
|
1276
1383
|
const pathParams = {
|
|
1277
1384
|
id: request?.id,
|
|
1278
1385
|
};
|
|
1279
1386
|
const body = {};
|
|
1280
1387
|
|
|
1281
|
-
const response = await this.sendRequest<
|
|
1388
|
+
const response = await this.apiClient.sendRequest<
|
|
1389
|
+
StreamResponse<MessageResponse>
|
|
1390
|
+
>(
|
|
1282
1391
|
'POST',
|
|
1283
1392
|
'/api/v2/chat/messages/{id}/commit',
|
|
1284
1393
|
pathParams,
|
|
1285
1394
|
undefined,
|
|
1286
1395
|
body,
|
|
1396
|
+
'application/json',
|
|
1287
1397
|
);
|
|
1288
1398
|
|
|
1289
1399
|
decoders.MessageResponse?.(response.body);
|
|
1290
1400
|
|
|
1291
1401
|
return { ...response.body, metadata: response.metadata };
|
|
1292
|
-
}
|
|
1402
|
+
}
|
|
1293
1403
|
|
|
1294
|
-
|
|
1404
|
+
async sendReaction(
|
|
1295
1405
|
request: SendReactionRequest & { id: string },
|
|
1296
|
-
): Promise<StreamResponse<SendReactionResponse>>
|
|
1406
|
+
): Promise<StreamResponse<SendReactionResponse>> {
|
|
1297
1407
|
const pathParams = {
|
|
1298
1408
|
id: request?.id,
|
|
1299
1409
|
};
|
|
@@ -1303,7 +1413,7 @@ export class ChatApi extends BaseApi {
|
|
|
1303
1413
|
skip_push: request?.skip_push,
|
|
1304
1414
|
};
|
|
1305
1415
|
|
|
1306
|
-
const response = await this.sendRequest<
|
|
1416
|
+
const response = await this.apiClient.sendRequest<
|
|
1307
1417
|
StreamResponse<SendReactionResponse>
|
|
1308
1418
|
>(
|
|
1309
1419
|
'POST',
|
|
@@ -1311,18 +1421,19 @@ export class ChatApi extends BaseApi {
|
|
|
1311
1421
|
pathParams,
|
|
1312
1422
|
undefined,
|
|
1313
1423
|
body,
|
|
1424
|
+
'application/json',
|
|
1314
1425
|
);
|
|
1315
1426
|
|
|
1316
1427
|
decoders.SendReactionResponse?.(response.body);
|
|
1317
1428
|
|
|
1318
1429
|
return { ...response.body, metadata: response.metadata };
|
|
1319
|
-
}
|
|
1430
|
+
}
|
|
1320
1431
|
|
|
1321
|
-
|
|
1432
|
+
async deleteReaction(request: {
|
|
1322
1433
|
id: string;
|
|
1323
1434
|
type: string;
|
|
1324
1435
|
user_id?: string;
|
|
1325
|
-
}): Promise<StreamResponse<DeleteReactionResponse>>
|
|
1436
|
+
}): Promise<StreamResponse<DeleteReactionResponse>> {
|
|
1326
1437
|
const queryParams = {
|
|
1327
1438
|
user_id: request?.user_id,
|
|
1328
1439
|
};
|
|
@@ -1331,7 +1442,7 @@ export class ChatApi extends BaseApi {
|
|
|
1331
1442
|
type: request?.type,
|
|
1332
1443
|
};
|
|
1333
1444
|
|
|
1334
|
-
const response = await this.sendRequest<
|
|
1445
|
+
const response = await this.apiClient.sendRequest<
|
|
1335
1446
|
StreamResponse<DeleteReactionResponse>
|
|
1336
1447
|
>(
|
|
1337
1448
|
'DELETE',
|
|
@@ -1343,13 +1454,13 @@ export class ChatApi extends BaseApi {
|
|
|
1343
1454
|
decoders.DeleteReactionResponse?.(response.body);
|
|
1344
1455
|
|
|
1345
1456
|
return { ...response.body, metadata: response.metadata };
|
|
1346
|
-
}
|
|
1457
|
+
}
|
|
1347
1458
|
|
|
1348
|
-
|
|
1459
|
+
async getReactions(request: {
|
|
1349
1460
|
id: string;
|
|
1350
1461
|
limit?: number;
|
|
1351
1462
|
offset?: number;
|
|
1352
|
-
}): Promise<StreamResponse<GetReactionsResponse>>
|
|
1463
|
+
}): Promise<StreamResponse<GetReactionsResponse>> {
|
|
1353
1464
|
const queryParams = {
|
|
1354
1465
|
limit: request?.limit,
|
|
1355
1466
|
offset: request?.offset,
|
|
@@ -1358,18 +1469,18 @@ export class ChatApi extends BaseApi {
|
|
|
1358
1469
|
id: request?.id,
|
|
1359
1470
|
};
|
|
1360
1471
|
|
|
1361
|
-
const response = await this.sendRequest<
|
|
1472
|
+
const response = await this.apiClient.sendRequest<
|
|
1362
1473
|
StreamResponse<GetReactionsResponse>
|
|
1363
1474
|
>('GET', '/api/v2/chat/messages/{id}/reactions', pathParams, queryParams);
|
|
1364
1475
|
|
|
1365
1476
|
decoders.GetReactionsResponse?.(response.body);
|
|
1366
1477
|
|
|
1367
1478
|
return { ...response.body, metadata: response.metadata };
|
|
1368
|
-
}
|
|
1479
|
+
}
|
|
1369
1480
|
|
|
1370
|
-
|
|
1481
|
+
async queryReactions(
|
|
1371
1482
|
request: QueryReactionsRequest & { id: string },
|
|
1372
|
-
): Promise<StreamResponse<QueryReactionsResponse>>
|
|
1483
|
+
): Promise<StreamResponse<QueryReactionsResponse>> {
|
|
1373
1484
|
const pathParams = {
|
|
1374
1485
|
id: request?.id,
|
|
1375
1486
|
};
|
|
@@ -1383,7 +1494,7 @@ export class ChatApi extends BaseApi {
|
|
|
1383
1494
|
user: request?.user,
|
|
1384
1495
|
};
|
|
1385
1496
|
|
|
1386
|
-
const response = await this.sendRequest<
|
|
1497
|
+
const response = await this.apiClient.sendRequest<
|
|
1387
1498
|
StreamResponse<QueryReactionsResponse>
|
|
1388
1499
|
>(
|
|
1389
1500
|
'POST',
|
|
@@ -1391,16 +1502,17 @@ export class ChatApi extends BaseApi {
|
|
|
1391
1502
|
pathParams,
|
|
1392
1503
|
undefined,
|
|
1393
1504
|
body,
|
|
1505
|
+
'application/json',
|
|
1394
1506
|
);
|
|
1395
1507
|
|
|
1396
1508
|
decoders.QueryReactionsResponse?.(response.body);
|
|
1397
1509
|
|
|
1398
1510
|
return { ...response.body, metadata: response.metadata };
|
|
1399
|
-
}
|
|
1511
|
+
}
|
|
1400
1512
|
|
|
1401
|
-
|
|
1513
|
+
async translateMessage(
|
|
1402
1514
|
request: TranslateMessageRequest & { id: string },
|
|
1403
|
-
): Promise<StreamResponse<MessageResponse>>
|
|
1515
|
+
): Promise<StreamResponse<MessageResponse>> {
|
|
1404
1516
|
const pathParams = {
|
|
1405
1517
|
id: request?.id,
|
|
1406
1518
|
};
|
|
@@ -1408,22 +1520,25 @@ export class ChatApi extends BaseApi {
|
|
|
1408
1520
|
language: request?.language,
|
|
1409
1521
|
};
|
|
1410
1522
|
|
|
1411
|
-
const response = await this.sendRequest<
|
|
1523
|
+
const response = await this.apiClient.sendRequest<
|
|
1524
|
+
StreamResponse<MessageResponse>
|
|
1525
|
+
>(
|
|
1412
1526
|
'POST',
|
|
1413
1527
|
'/api/v2/chat/messages/{id}/translate',
|
|
1414
1528
|
pathParams,
|
|
1415
1529
|
undefined,
|
|
1416
1530
|
body,
|
|
1531
|
+
'application/json',
|
|
1417
1532
|
);
|
|
1418
1533
|
|
|
1419
1534
|
decoders.MessageResponse?.(response.body);
|
|
1420
1535
|
|
|
1421
1536
|
return { ...response.body, metadata: response.metadata };
|
|
1422
|
-
}
|
|
1537
|
+
}
|
|
1423
1538
|
|
|
1424
|
-
|
|
1539
|
+
async undeleteMessage(
|
|
1425
1540
|
request: UpdateMessageRequest & { id: string },
|
|
1426
|
-
): Promise<StreamResponse<UpdateMessageResponse>>
|
|
1541
|
+
): Promise<StreamResponse<UpdateMessageResponse>> {
|
|
1427
1542
|
const pathParams = {
|
|
1428
1543
|
id: request?.id,
|
|
1429
1544
|
};
|
|
@@ -1433,7 +1548,7 @@ export class ChatApi extends BaseApi {
|
|
|
1433
1548
|
skip_push: request?.skip_push,
|
|
1434
1549
|
};
|
|
1435
1550
|
|
|
1436
|
-
const response = await this.sendRequest<
|
|
1551
|
+
const response = await this.apiClient.sendRequest<
|
|
1437
1552
|
StreamResponse<UpdateMessageResponse>
|
|
1438
1553
|
>(
|
|
1439
1554
|
'POST',
|
|
@@ -1441,16 +1556,17 @@ export class ChatApi extends BaseApi {
|
|
|
1441
1556
|
pathParams,
|
|
1442
1557
|
undefined,
|
|
1443
1558
|
body,
|
|
1559
|
+
'application/json',
|
|
1444
1560
|
);
|
|
1445
1561
|
|
|
1446
1562
|
decoders.UpdateMessageResponse?.(response.body);
|
|
1447
1563
|
|
|
1448
1564
|
return { ...response.body, metadata: response.metadata };
|
|
1449
|
-
}
|
|
1565
|
+
}
|
|
1450
1566
|
|
|
1451
|
-
|
|
1567
|
+
async castPollVote(
|
|
1452
1568
|
request: CastPollVoteRequest & { message_id: string; poll_id: string },
|
|
1453
|
-
): Promise<StreamResponse<PollVoteResponse>>
|
|
1569
|
+
): Promise<StreamResponse<PollVoteResponse>> {
|
|
1454
1570
|
const pathParams = {
|
|
1455
1571
|
message_id: request?.message_id,
|
|
1456
1572
|
poll_id: request?.poll_id,
|
|
@@ -1461,25 +1577,28 @@ export class ChatApi extends BaseApi {
|
|
|
1461
1577
|
vote: request?.vote,
|
|
1462
1578
|
};
|
|
1463
1579
|
|
|
1464
|
-
const response = await this.sendRequest<
|
|
1580
|
+
const response = await this.apiClient.sendRequest<
|
|
1581
|
+
StreamResponse<PollVoteResponse>
|
|
1582
|
+
>(
|
|
1465
1583
|
'POST',
|
|
1466
1584
|
'/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote',
|
|
1467
1585
|
pathParams,
|
|
1468
1586
|
undefined,
|
|
1469
1587
|
body,
|
|
1588
|
+
'application/json',
|
|
1470
1589
|
);
|
|
1471
1590
|
|
|
1472
1591
|
decoders.PollVoteResponse?.(response.body);
|
|
1473
1592
|
|
|
1474
1593
|
return { ...response.body, metadata: response.metadata };
|
|
1475
|
-
}
|
|
1594
|
+
}
|
|
1476
1595
|
|
|
1477
|
-
|
|
1596
|
+
async deletePollVote(request: {
|
|
1478
1597
|
message_id: string;
|
|
1479
1598
|
poll_id: string;
|
|
1480
1599
|
vote_id: string;
|
|
1481
1600
|
user_id?: string;
|
|
1482
|
-
}): Promise<StreamResponse<PollVoteResponse>>
|
|
1601
|
+
}): Promise<StreamResponse<PollVoteResponse>> {
|
|
1483
1602
|
const queryParams = {
|
|
1484
1603
|
user_id: request?.user_id,
|
|
1485
1604
|
};
|
|
@@ -1489,7 +1608,9 @@ export class ChatApi extends BaseApi {
|
|
|
1489
1608
|
vote_id: request?.vote_id,
|
|
1490
1609
|
};
|
|
1491
1610
|
|
|
1492
|
-
const response = await this.sendRequest<
|
|
1611
|
+
const response = await this.apiClient.sendRequest<
|
|
1612
|
+
StreamResponse<PollVoteResponse>
|
|
1613
|
+
>(
|
|
1493
1614
|
'DELETE',
|
|
1494
1615
|
'/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}',
|
|
1495
1616
|
pathParams,
|
|
@@ -1499,12 +1620,12 @@ export class ChatApi extends BaseApi {
|
|
|
1499
1620
|
decoders.PollVoteResponse?.(response.body);
|
|
1500
1621
|
|
|
1501
1622
|
return { ...response.body, metadata: response.metadata };
|
|
1502
|
-
}
|
|
1623
|
+
}
|
|
1503
1624
|
|
|
1504
|
-
|
|
1625
|
+
async deleteReminder(request: {
|
|
1505
1626
|
message_id: string;
|
|
1506
1627
|
user_id?: string;
|
|
1507
|
-
}): Promise<StreamResponse<DeleteReminderResponse>>
|
|
1628
|
+
}): Promise<StreamResponse<DeleteReminderResponse>> {
|
|
1508
1629
|
const queryParams = {
|
|
1509
1630
|
user_id: request?.user_id,
|
|
1510
1631
|
};
|
|
@@ -1512,7 +1633,7 @@ export class ChatApi extends BaseApi {
|
|
|
1512
1633
|
message_id: request?.message_id,
|
|
1513
1634
|
};
|
|
1514
1635
|
|
|
1515
|
-
const response = await this.sendRequest<
|
|
1636
|
+
const response = await this.apiClient.sendRequest<
|
|
1516
1637
|
StreamResponse<DeleteReminderResponse>
|
|
1517
1638
|
>(
|
|
1518
1639
|
'DELETE',
|
|
@@ -1524,11 +1645,11 @@ export class ChatApi extends BaseApi {
|
|
|
1524
1645
|
decoders.DeleteReminderResponse?.(response.body);
|
|
1525
1646
|
|
|
1526
1647
|
return { ...response.body, metadata: response.metadata };
|
|
1527
|
-
}
|
|
1648
|
+
}
|
|
1528
1649
|
|
|
1529
|
-
|
|
1650
|
+
async updateReminder(
|
|
1530
1651
|
request: UpdateReminderRequest & { message_id: string },
|
|
1531
|
-
): Promise<StreamResponse<UpdateReminderResponse>>
|
|
1652
|
+
): Promise<StreamResponse<UpdateReminderResponse>> {
|
|
1532
1653
|
const pathParams = {
|
|
1533
1654
|
message_id: request?.message_id,
|
|
1534
1655
|
};
|
|
@@ -1538,7 +1659,7 @@ export class ChatApi extends BaseApi {
|
|
|
1538
1659
|
user: request?.user,
|
|
1539
1660
|
};
|
|
1540
1661
|
|
|
1541
|
-
const response = await this.sendRequest<
|
|
1662
|
+
const response = await this.apiClient.sendRequest<
|
|
1542
1663
|
StreamResponse<UpdateReminderResponse>
|
|
1543
1664
|
>(
|
|
1544
1665
|
'PATCH',
|
|
@@ -1546,16 +1667,17 @@ export class ChatApi extends BaseApi {
|
|
|
1546
1667
|
pathParams,
|
|
1547
1668
|
undefined,
|
|
1548
1669
|
body,
|
|
1670
|
+
'application/json',
|
|
1549
1671
|
);
|
|
1550
1672
|
|
|
1551
1673
|
decoders.UpdateReminderResponse?.(response.body);
|
|
1552
1674
|
|
|
1553
1675
|
return { ...response.body, metadata: response.metadata };
|
|
1554
|
-
}
|
|
1676
|
+
}
|
|
1555
1677
|
|
|
1556
|
-
|
|
1678
|
+
async createReminder(
|
|
1557
1679
|
request: CreateReminderRequest & { message_id: string },
|
|
1558
|
-
): Promise<StreamResponse<ReminderResponseData>>
|
|
1680
|
+
): Promise<StreamResponse<ReminderResponseData>> {
|
|
1559
1681
|
const pathParams = {
|
|
1560
1682
|
message_id: request?.message_id,
|
|
1561
1683
|
};
|
|
@@ -1565,7 +1687,7 @@ export class ChatApi extends BaseApi {
|
|
|
1565
1687
|
user: request?.user,
|
|
1566
1688
|
};
|
|
1567
1689
|
|
|
1568
|
-
const response = await this.sendRequest<
|
|
1690
|
+
const response = await this.apiClient.sendRequest<
|
|
1569
1691
|
StreamResponse<ReminderResponseData>
|
|
1570
1692
|
>(
|
|
1571
1693
|
'POST',
|
|
@@ -1573,14 +1695,15 @@ export class ChatApi extends BaseApi {
|
|
|
1573
1695
|
pathParams,
|
|
1574
1696
|
undefined,
|
|
1575
1697
|
body,
|
|
1698
|
+
'application/json',
|
|
1576
1699
|
);
|
|
1577
1700
|
|
|
1578
1701
|
decoders.ReminderResponseData?.(response.body);
|
|
1579
1702
|
|
|
1580
1703
|
return { ...response.body, metadata: response.metadata };
|
|
1581
|
-
}
|
|
1704
|
+
}
|
|
1582
1705
|
|
|
1583
|
-
|
|
1706
|
+
async getReplies(request: {
|
|
1584
1707
|
parent_id: string;
|
|
1585
1708
|
limit?: number;
|
|
1586
1709
|
offset?: number;
|
|
@@ -1595,7 +1718,7 @@ export class ChatApi extends BaseApi {
|
|
|
1595
1718
|
id_around?: string;
|
|
1596
1719
|
created_at_around?: Date;
|
|
1597
1720
|
sort?: SortParamRequest[];
|
|
1598
|
-
}): Promise<StreamResponse<GetRepliesResponse>>
|
|
1721
|
+
}): Promise<StreamResponse<GetRepliesResponse>> {
|
|
1599
1722
|
const queryParams = {
|
|
1600
1723
|
limit: request?.limit,
|
|
1601
1724
|
offset: request?.offset,
|
|
@@ -1615,7 +1738,9 @@ export class ChatApi extends BaseApi {
|
|
|
1615
1738
|
parent_id: request?.parent_id,
|
|
1616
1739
|
};
|
|
1617
1740
|
|
|
1618
|
-
const response = await this.sendRequest<
|
|
1741
|
+
const response = await this.apiClient.sendRequest<
|
|
1742
|
+
StreamResponse<GetRepliesResponse>
|
|
1743
|
+
>(
|
|
1619
1744
|
'GET',
|
|
1620
1745
|
'/api/v2/chat/messages/{parent_id}/replies',
|
|
1621
1746
|
pathParams,
|
|
@@ -1625,27 +1750,27 @@ export class ChatApi extends BaseApi {
|
|
|
1625
1750
|
decoders.GetRepliesResponse?.(response.body);
|
|
1626
1751
|
|
|
1627
1752
|
return { ...response.body, metadata: response.metadata };
|
|
1628
|
-
}
|
|
1753
|
+
}
|
|
1629
1754
|
|
|
1630
|
-
|
|
1755
|
+
async queryMessageFlags(request?: {
|
|
1631
1756
|
payload?: QueryMessageFlagsPayload;
|
|
1632
|
-
}): Promise<StreamResponse<QueryMessageFlagsResponse>>
|
|
1757
|
+
}): Promise<StreamResponse<QueryMessageFlagsResponse>> {
|
|
1633
1758
|
const queryParams = {
|
|
1634
1759
|
payload: request?.payload,
|
|
1635
1760
|
};
|
|
1636
1761
|
|
|
1637
|
-
const response = await this.sendRequest<
|
|
1762
|
+
const response = await this.apiClient.sendRequest<
|
|
1638
1763
|
StreamResponse<QueryMessageFlagsResponse>
|
|
1639
1764
|
>('GET', '/api/v2/chat/moderation/flags/message', undefined, queryParams);
|
|
1640
1765
|
|
|
1641
1766
|
decoders.QueryMessageFlagsResponse?.(response.body);
|
|
1642
1767
|
|
|
1643
1768
|
return { ...response.body, metadata: response.metadata };
|
|
1644
|
-
}
|
|
1769
|
+
}
|
|
1645
1770
|
|
|
1646
|
-
|
|
1771
|
+
async muteChannel(
|
|
1647
1772
|
request?: MuteChannelRequest,
|
|
1648
|
-
): Promise<StreamResponse<MuteChannelResponse>>
|
|
1773
|
+
): Promise<StreamResponse<MuteChannelResponse>> {
|
|
1649
1774
|
const body = {
|
|
1650
1775
|
expiration: request?.expiration,
|
|
1651
1776
|
user_id: request?.user_id,
|
|
@@ -1653,7 +1778,7 @@ export class ChatApi extends BaseApi {
|
|
|
1653
1778
|
user: request?.user,
|
|
1654
1779
|
};
|
|
1655
1780
|
|
|
1656
|
-
const response = await this.sendRequest<
|
|
1781
|
+
const response = await this.apiClient.sendRequest<
|
|
1657
1782
|
StreamResponse<MuteChannelResponse>
|
|
1658
1783
|
>(
|
|
1659
1784
|
'POST',
|
|
@@ -1661,16 +1786,17 @@ export class ChatApi extends BaseApi {
|
|
|
1661
1786
|
undefined,
|
|
1662
1787
|
undefined,
|
|
1663
1788
|
body,
|
|
1789
|
+
'application/json',
|
|
1664
1790
|
);
|
|
1665
1791
|
|
|
1666
1792
|
decoders.MuteChannelResponse?.(response.body);
|
|
1667
1793
|
|
|
1668
1794
|
return { ...response.body, metadata: response.metadata };
|
|
1669
|
-
}
|
|
1795
|
+
}
|
|
1670
1796
|
|
|
1671
|
-
|
|
1797
|
+
async unmuteChannel(
|
|
1672
1798
|
request?: UnmuteChannelRequest,
|
|
1673
|
-
): Promise<StreamResponse<UnmuteResponse>>
|
|
1799
|
+
): Promise<StreamResponse<UnmuteResponse>> {
|
|
1674
1800
|
const body = {
|
|
1675
1801
|
expiration: request?.expiration,
|
|
1676
1802
|
user_id: request?.user_id,
|
|
@@ -1678,353 +1804,66 @@ export class ChatApi extends BaseApi {
|
|
|
1678
1804
|
user: request?.user,
|
|
1679
1805
|
};
|
|
1680
1806
|
|
|
1681
|
-
const response = await this.sendRequest<
|
|
1807
|
+
const response = await this.apiClient.sendRequest<
|
|
1808
|
+
StreamResponse<UnmuteResponse>
|
|
1809
|
+
>(
|
|
1682
1810
|
'POST',
|
|
1683
1811
|
'/api/v2/chat/moderation/unmute/channel',
|
|
1684
1812
|
undefined,
|
|
1685
1813
|
undefined,
|
|
1686
1814
|
body,
|
|
1815
|
+
'application/json',
|
|
1687
1816
|
);
|
|
1688
1817
|
|
|
1689
1818
|
decoders.UnmuteResponse?.(response.body);
|
|
1690
1819
|
|
|
1691
1820
|
return { ...response.body, metadata: response.metadata };
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
createPoll = async (
|
|
1695
|
-
request: CreatePollRequest,
|
|
1696
|
-
): Promise<StreamResponse<PollResponse>> => {
|
|
1697
|
-
const body = {
|
|
1698
|
-
name: request?.name,
|
|
1699
|
-
allow_answers: request?.allow_answers,
|
|
1700
|
-
allow_user_suggested_options: request?.allow_user_suggested_options,
|
|
1701
|
-
description: request?.description,
|
|
1702
|
-
enforce_unique_vote: request?.enforce_unique_vote,
|
|
1703
|
-
id: request?.id,
|
|
1704
|
-
is_closed: request?.is_closed,
|
|
1705
|
-
max_votes_allowed: request?.max_votes_allowed,
|
|
1706
|
-
user_id: request?.user_id,
|
|
1707
|
-
voting_visibility: request?.voting_visibility,
|
|
1708
|
-
options: request?.options,
|
|
1709
|
-
custom: request?.custom,
|
|
1710
|
-
user: request?.user,
|
|
1711
|
-
};
|
|
1712
|
-
|
|
1713
|
-
const response = await this.sendRequest<StreamResponse<PollResponse>>(
|
|
1714
|
-
'POST',
|
|
1715
|
-
'/api/v2/chat/polls',
|
|
1716
|
-
undefined,
|
|
1717
|
-
undefined,
|
|
1718
|
-
body,
|
|
1719
|
-
);
|
|
1720
|
-
|
|
1721
|
-
decoders.PollResponse?.(response.body);
|
|
1722
|
-
|
|
1723
|
-
return { ...response.body, metadata: response.metadata };
|
|
1724
|
-
};
|
|
1725
|
-
|
|
1726
|
-
updatePoll = async (
|
|
1727
|
-
request: UpdatePollRequest,
|
|
1728
|
-
): Promise<StreamResponse<PollResponse>> => {
|
|
1729
|
-
const body = {
|
|
1730
|
-
id: request?.id,
|
|
1731
|
-
name: request?.name,
|
|
1732
|
-
allow_answers: request?.allow_answers,
|
|
1733
|
-
allow_user_suggested_options: request?.allow_user_suggested_options,
|
|
1734
|
-
description: request?.description,
|
|
1735
|
-
enforce_unique_vote: request?.enforce_unique_vote,
|
|
1736
|
-
is_closed: request?.is_closed,
|
|
1737
|
-
max_votes_allowed: request?.max_votes_allowed,
|
|
1738
|
-
user_id: request?.user_id,
|
|
1739
|
-
voting_visibility: request?.voting_visibility,
|
|
1740
|
-
options: request?.options,
|
|
1741
|
-
custom: request?.custom,
|
|
1742
|
-
user: request?.user,
|
|
1743
|
-
};
|
|
1744
|
-
|
|
1745
|
-
const response = await this.sendRequest<StreamResponse<PollResponse>>(
|
|
1746
|
-
'PUT',
|
|
1747
|
-
'/api/v2/chat/polls',
|
|
1748
|
-
undefined,
|
|
1749
|
-
undefined,
|
|
1750
|
-
body,
|
|
1751
|
-
);
|
|
1752
|
-
|
|
1753
|
-
decoders.PollResponse?.(response.body);
|
|
1754
|
-
|
|
1755
|
-
return { ...response.body, metadata: response.metadata };
|
|
1756
|
-
};
|
|
1757
|
-
|
|
1758
|
-
queryPolls = async (
|
|
1759
|
-
request?: QueryPollsRequest & { user_id?: string },
|
|
1760
|
-
): Promise<StreamResponse<QueryPollsResponse>> => {
|
|
1761
|
-
const queryParams = {
|
|
1762
|
-
user_id: request?.user_id,
|
|
1763
|
-
};
|
|
1764
|
-
const body = {
|
|
1765
|
-
limit: request?.limit,
|
|
1766
|
-
next: request?.next,
|
|
1767
|
-
prev: request?.prev,
|
|
1768
|
-
sort: request?.sort,
|
|
1769
|
-
filter: request?.filter,
|
|
1770
|
-
};
|
|
1771
|
-
|
|
1772
|
-
const response = await this.sendRequest<StreamResponse<QueryPollsResponse>>(
|
|
1773
|
-
'POST',
|
|
1774
|
-
'/api/v2/chat/polls/query',
|
|
1775
|
-
undefined,
|
|
1776
|
-
queryParams,
|
|
1777
|
-
body,
|
|
1778
|
-
);
|
|
1779
|
-
|
|
1780
|
-
decoders.QueryPollsResponse?.(response.body);
|
|
1781
|
-
|
|
1782
|
-
return { ...response.body, metadata: response.metadata };
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
|
-
deletePoll = async (request: {
|
|
1786
|
-
poll_id: string;
|
|
1787
|
-
user_id?: string;
|
|
1788
|
-
}): Promise<StreamResponse<Response>> => {
|
|
1789
|
-
const queryParams = {
|
|
1790
|
-
user_id: request?.user_id,
|
|
1791
|
-
};
|
|
1792
|
-
const pathParams = {
|
|
1793
|
-
poll_id: request?.poll_id,
|
|
1794
|
-
};
|
|
1795
|
-
|
|
1796
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
1797
|
-
'DELETE',
|
|
1798
|
-
'/api/v2/chat/polls/{poll_id}',
|
|
1799
|
-
pathParams,
|
|
1800
|
-
queryParams,
|
|
1801
|
-
);
|
|
1802
|
-
|
|
1803
|
-
decoders.Response?.(response.body);
|
|
1804
|
-
|
|
1805
|
-
return { ...response.body, metadata: response.metadata };
|
|
1806
|
-
};
|
|
1807
|
-
|
|
1808
|
-
getPoll = async (request: {
|
|
1809
|
-
poll_id: string;
|
|
1810
|
-
user_id?: string;
|
|
1811
|
-
}): Promise<StreamResponse<PollResponse>> => {
|
|
1812
|
-
const queryParams = {
|
|
1813
|
-
user_id: request?.user_id,
|
|
1814
|
-
};
|
|
1815
|
-
const pathParams = {
|
|
1816
|
-
poll_id: request?.poll_id,
|
|
1817
|
-
};
|
|
1818
|
-
|
|
1819
|
-
const response = await this.sendRequest<StreamResponse<PollResponse>>(
|
|
1820
|
-
'GET',
|
|
1821
|
-
'/api/v2/chat/polls/{poll_id}',
|
|
1822
|
-
pathParams,
|
|
1823
|
-
queryParams,
|
|
1824
|
-
);
|
|
1825
|
-
|
|
1826
|
-
decoders.PollResponse?.(response.body);
|
|
1827
|
-
|
|
1828
|
-
return { ...response.body, metadata: response.metadata };
|
|
1829
|
-
};
|
|
1830
|
-
|
|
1831
|
-
updatePollPartial = async (
|
|
1832
|
-
request: UpdatePollPartialRequest & { poll_id: string },
|
|
1833
|
-
): Promise<StreamResponse<PollResponse>> => {
|
|
1834
|
-
const pathParams = {
|
|
1835
|
-
poll_id: request?.poll_id,
|
|
1836
|
-
};
|
|
1837
|
-
const body = {
|
|
1838
|
-
user_id: request?.user_id,
|
|
1839
|
-
unset: request?.unset,
|
|
1840
|
-
set: request?.set,
|
|
1841
|
-
user: request?.user,
|
|
1842
|
-
};
|
|
1821
|
+
}
|
|
1843
1822
|
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
pathParams,
|
|
1848
|
-
undefined,
|
|
1849
|
-
body,
|
|
1850
|
-
);
|
|
1851
|
-
|
|
1852
|
-
decoders.PollResponse?.(response.body);
|
|
1853
|
-
|
|
1854
|
-
return { ...response.body, metadata: response.metadata };
|
|
1855
|
-
};
|
|
1856
|
-
|
|
1857
|
-
createPollOption = async (
|
|
1858
|
-
request: CreatePollOptionRequest & { poll_id: string },
|
|
1859
|
-
): Promise<StreamResponse<PollOptionResponse>> => {
|
|
1860
|
-
const pathParams = {
|
|
1861
|
-
poll_id: request?.poll_id,
|
|
1862
|
-
};
|
|
1823
|
+
async updatePushNotificationPreferences(
|
|
1824
|
+
request: UpsertPushPreferencesRequest,
|
|
1825
|
+
): Promise<StreamResponse<UpsertPushPreferencesResponse>> {
|
|
1863
1826
|
const body = {
|
|
1864
|
-
|
|
1865
|
-
position: request?.position,
|
|
1866
|
-
user_id: request?.user_id,
|
|
1867
|
-
custom: request?.custom,
|
|
1868
|
-
user: request?.user,
|
|
1827
|
+
preferences: request?.preferences,
|
|
1869
1828
|
};
|
|
1870
1829
|
|
|
1871
|
-
const response = await this.sendRequest<
|
|
1830
|
+
const response = await this.apiClient.sendRequest<
|
|
1831
|
+
StreamResponse<UpsertPushPreferencesResponse>
|
|
1832
|
+
>(
|
|
1872
1833
|
'POST',
|
|
1873
|
-
'/api/v2/chat/
|
|
1874
|
-
pathParams,
|
|
1834
|
+
'/api/v2/chat/push_preferences',
|
|
1875
1835
|
undefined,
|
|
1876
|
-
body,
|
|
1877
|
-
);
|
|
1878
|
-
|
|
1879
|
-
decoders.PollOptionResponse?.(response.body);
|
|
1880
|
-
|
|
1881
|
-
return { ...response.body, metadata: response.metadata };
|
|
1882
|
-
};
|
|
1883
|
-
|
|
1884
|
-
updatePollOption = async (
|
|
1885
|
-
request: UpdatePollOptionRequest & { poll_id: string },
|
|
1886
|
-
): Promise<StreamResponse<PollOptionResponse>> => {
|
|
1887
|
-
const pathParams = {
|
|
1888
|
-
poll_id: request?.poll_id,
|
|
1889
|
-
};
|
|
1890
|
-
const body = {
|
|
1891
|
-
id: request?.id,
|
|
1892
|
-
text: request?.text,
|
|
1893
|
-
user_id: request?.user_id,
|
|
1894
|
-
custom: request?.custom,
|
|
1895
|
-
user: request?.user,
|
|
1896
|
-
};
|
|
1897
|
-
|
|
1898
|
-
const response = await this.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
1899
|
-
'PUT',
|
|
1900
|
-
'/api/v2/chat/polls/{poll_id}/options',
|
|
1901
|
-
pathParams,
|
|
1902
1836
|
undefined,
|
|
1903
1837
|
body,
|
|
1838
|
+
'application/json',
|
|
1904
1839
|
);
|
|
1905
1840
|
|
|
1906
|
-
decoders.PollOptionResponse?.(response.body);
|
|
1907
|
-
|
|
1908
|
-
return { ...response.body, metadata: response.metadata };
|
|
1909
|
-
};
|
|
1910
|
-
|
|
1911
|
-
deletePollOption = async (request: {
|
|
1912
|
-
poll_id: string;
|
|
1913
|
-
option_id: string;
|
|
1914
|
-
user_id?: string;
|
|
1915
|
-
}): Promise<StreamResponse<Response>> => {
|
|
1916
|
-
const queryParams = {
|
|
1917
|
-
user_id: request?.user_id,
|
|
1918
|
-
};
|
|
1919
|
-
const pathParams = {
|
|
1920
|
-
poll_id: request?.poll_id,
|
|
1921
|
-
option_id: request?.option_id,
|
|
1922
|
-
};
|
|
1923
|
-
|
|
1924
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
1925
|
-
'DELETE',
|
|
1926
|
-
'/api/v2/chat/polls/{poll_id}/options/{option_id}',
|
|
1927
|
-
pathParams,
|
|
1928
|
-
queryParams,
|
|
1929
|
-
);
|
|
1930
|
-
|
|
1931
|
-
decoders.Response?.(response.body);
|
|
1932
|
-
|
|
1933
|
-
return { ...response.body, metadata: response.metadata };
|
|
1934
|
-
};
|
|
1935
|
-
|
|
1936
|
-
getPollOption = async (request: {
|
|
1937
|
-
poll_id: string;
|
|
1938
|
-
option_id: string;
|
|
1939
|
-
user_id?: string;
|
|
1940
|
-
}): Promise<StreamResponse<PollOptionResponse>> => {
|
|
1941
|
-
const queryParams = {
|
|
1942
|
-
user_id: request?.user_id,
|
|
1943
|
-
};
|
|
1944
|
-
const pathParams = {
|
|
1945
|
-
poll_id: request?.poll_id,
|
|
1946
|
-
option_id: request?.option_id,
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1949
|
-
const response = await this.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
1950
|
-
'GET',
|
|
1951
|
-
'/api/v2/chat/polls/{poll_id}/options/{option_id}',
|
|
1952
|
-
pathParams,
|
|
1953
|
-
queryParams,
|
|
1954
|
-
);
|
|
1955
|
-
|
|
1956
|
-
decoders.PollOptionResponse?.(response.body);
|
|
1957
|
-
|
|
1958
|
-
return { ...response.body, metadata: response.metadata };
|
|
1959
|
-
};
|
|
1960
|
-
|
|
1961
|
-
queryPollVotes = async (
|
|
1962
|
-
request: QueryPollVotesRequest & { poll_id: string; user_id?: string },
|
|
1963
|
-
): Promise<StreamResponse<PollVotesResponse>> => {
|
|
1964
|
-
const queryParams = {
|
|
1965
|
-
user_id: request?.user_id,
|
|
1966
|
-
};
|
|
1967
|
-
const pathParams = {
|
|
1968
|
-
poll_id: request?.poll_id,
|
|
1969
|
-
};
|
|
1970
|
-
const body = {
|
|
1971
|
-
limit: request?.limit,
|
|
1972
|
-
next: request?.next,
|
|
1973
|
-
prev: request?.prev,
|
|
1974
|
-
sort: request?.sort,
|
|
1975
|
-
filter: request?.filter,
|
|
1976
|
-
};
|
|
1977
|
-
|
|
1978
|
-
const response = await this.sendRequest<StreamResponse<PollVotesResponse>>(
|
|
1979
|
-
'POST',
|
|
1980
|
-
'/api/v2/chat/polls/{poll_id}/votes',
|
|
1981
|
-
pathParams,
|
|
1982
|
-
queryParams,
|
|
1983
|
-
body,
|
|
1984
|
-
);
|
|
1985
|
-
|
|
1986
|
-
decoders.PollVotesResponse?.(response.body);
|
|
1987
|
-
|
|
1988
|
-
return { ...response.body, metadata: response.metadata };
|
|
1989
|
-
};
|
|
1990
|
-
|
|
1991
|
-
updatePushNotificationPreferences = async (
|
|
1992
|
-
request: UpsertPushPreferencesRequest,
|
|
1993
|
-
): Promise<StreamResponse<UpsertPushPreferencesResponse>> => {
|
|
1994
|
-
const body = {
|
|
1995
|
-
preferences: request?.preferences,
|
|
1996
|
-
};
|
|
1997
|
-
|
|
1998
|
-
const response = await this.sendRequest<
|
|
1999
|
-
StreamResponse<UpsertPushPreferencesResponse>
|
|
2000
|
-
>('POST', '/api/v2/chat/push_preferences', undefined, undefined, body);
|
|
2001
|
-
|
|
2002
1841
|
decoders.UpsertPushPreferencesResponse?.(response.body);
|
|
2003
1842
|
|
|
2004
1843
|
return { ...response.body, metadata: response.metadata };
|
|
2005
|
-
}
|
|
1844
|
+
}
|
|
2006
1845
|
|
|
2007
|
-
|
|
1846
|
+
async getPushTemplates(request: {
|
|
2008
1847
|
push_provider_type: string;
|
|
2009
1848
|
push_provider_name?: string;
|
|
2010
|
-
}): Promise<StreamResponse<GetPushTemplatesResponse>>
|
|
1849
|
+
}): Promise<StreamResponse<GetPushTemplatesResponse>> {
|
|
2011
1850
|
const queryParams = {
|
|
2012
1851
|
push_provider_type: request?.push_provider_type,
|
|
2013
1852
|
push_provider_name: request?.push_provider_name,
|
|
2014
1853
|
};
|
|
2015
1854
|
|
|
2016
|
-
const response = await this.sendRequest<
|
|
1855
|
+
const response = await this.apiClient.sendRequest<
|
|
2017
1856
|
StreamResponse<GetPushTemplatesResponse>
|
|
2018
1857
|
>('GET', '/api/v2/chat/push_templates', undefined, queryParams);
|
|
2019
1858
|
|
|
2020
1859
|
decoders.GetPushTemplatesResponse?.(response.body);
|
|
2021
1860
|
|
|
2022
1861
|
return { ...response.body, metadata: response.metadata };
|
|
2023
|
-
}
|
|
1862
|
+
}
|
|
2024
1863
|
|
|
2025
|
-
|
|
1864
|
+
async upsertPushTemplate(
|
|
2026
1865
|
request: UpsertPushTemplateRequest,
|
|
2027
|
-
): Promise<StreamResponse<UpsertPushTemplateResponse>>
|
|
1866
|
+
): Promise<StreamResponse<UpsertPushTemplateResponse>> {
|
|
2028
1867
|
const body = {
|
|
2029
1868
|
event_type: request?.event_type,
|
|
2030
1869
|
push_provider_type: request?.push_provider_type,
|
|
@@ -2033,34 +1872,41 @@ export class ChatApi extends BaseApi {
|
|
|
2033
1872
|
template: request?.template,
|
|
2034
1873
|
};
|
|
2035
1874
|
|
|
2036
|
-
const response = await this.sendRequest<
|
|
1875
|
+
const response = await this.apiClient.sendRequest<
|
|
2037
1876
|
StreamResponse<UpsertPushTemplateResponse>
|
|
2038
|
-
>(
|
|
1877
|
+
>(
|
|
1878
|
+
'POST',
|
|
1879
|
+
'/api/v2/chat/push_templates',
|
|
1880
|
+
undefined,
|
|
1881
|
+
undefined,
|
|
1882
|
+
body,
|
|
1883
|
+
'application/json',
|
|
1884
|
+
);
|
|
2039
1885
|
|
|
2040
1886
|
decoders.UpsertPushTemplateResponse?.(response.body);
|
|
2041
1887
|
|
|
2042
1888
|
return { ...response.body, metadata: response.metadata };
|
|
2043
|
-
}
|
|
1889
|
+
}
|
|
2044
1890
|
|
|
2045
|
-
|
|
1891
|
+
async queryBannedUsers(request?: {
|
|
2046
1892
|
payload?: QueryBannedUsersPayload;
|
|
2047
|
-
}): Promise<StreamResponse<QueryBannedUsersResponse>>
|
|
1893
|
+
}): Promise<StreamResponse<QueryBannedUsersResponse>> {
|
|
2048
1894
|
const queryParams = {
|
|
2049
1895
|
payload: request?.payload,
|
|
2050
1896
|
};
|
|
2051
1897
|
|
|
2052
|
-
const response = await this.sendRequest<
|
|
1898
|
+
const response = await this.apiClient.sendRequest<
|
|
2053
1899
|
StreamResponse<QueryBannedUsersResponse>
|
|
2054
1900
|
>('GET', '/api/v2/chat/query_banned_users', undefined, queryParams);
|
|
2055
1901
|
|
|
2056
1902
|
decoders.QueryBannedUsersResponse?.(response.body);
|
|
2057
1903
|
|
|
2058
1904
|
return { ...response.body, metadata: response.metadata };
|
|
2059
|
-
}
|
|
1905
|
+
}
|
|
2060
1906
|
|
|
2061
|
-
|
|
1907
|
+
async queryReminders(
|
|
2062
1908
|
request?: QueryRemindersRequest,
|
|
2063
|
-
): Promise<StreamResponse<QueryRemindersResponse>>
|
|
1909
|
+
): Promise<StreamResponse<QueryRemindersResponse>> {
|
|
2064
1910
|
const body = {
|
|
2065
1911
|
limit: request?.limit,
|
|
2066
1912
|
next: request?.next,
|
|
@@ -2071,37 +1917,41 @@ export class ChatApi extends BaseApi {
|
|
|
2071
1917
|
user: request?.user,
|
|
2072
1918
|
};
|
|
2073
1919
|
|
|
2074
|
-
const response = await this.sendRequest<
|
|
1920
|
+
const response = await this.apiClient.sendRequest<
|
|
2075
1921
|
StreamResponse<QueryRemindersResponse>
|
|
2076
|
-
>(
|
|
1922
|
+
>(
|
|
1923
|
+
'POST',
|
|
1924
|
+
'/api/v2/chat/reminders/query',
|
|
1925
|
+
undefined,
|
|
1926
|
+
undefined,
|
|
1927
|
+
body,
|
|
1928
|
+
'application/json',
|
|
1929
|
+
);
|
|
2077
1930
|
|
|
2078
1931
|
decoders.QueryRemindersResponse?.(response.body);
|
|
2079
1932
|
|
|
2080
1933
|
return { ...response.body, metadata: response.metadata };
|
|
2081
|
-
}
|
|
1934
|
+
}
|
|
2082
1935
|
|
|
2083
|
-
|
|
1936
|
+
async search(request?: {
|
|
2084
1937
|
payload?: SearchPayload;
|
|
2085
|
-
}): Promise<StreamResponse<SearchResponse>>
|
|
1938
|
+
}): Promise<StreamResponse<SearchResponse>> {
|
|
2086
1939
|
const queryParams = {
|
|
2087
1940
|
payload: request?.payload,
|
|
2088
1941
|
};
|
|
2089
1942
|
|
|
2090
|
-
const response = await this.sendRequest<
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
undefined,
|
|
2094
|
-
queryParams,
|
|
2095
|
-
);
|
|
1943
|
+
const response = await this.apiClient.sendRequest<
|
|
1944
|
+
StreamResponse<SearchResponse>
|
|
1945
|
+
>('GET', '/api/v2/chat/search', undefined, queryParams);
|
|
2096
1946
|
|
|
2097
1947
|
decoders.SearchResponse?.(response.body);
|
|
2098
1948
|
|
|
2099
1949
|
return { ...response.body, metadata: response.metadata };
|
|
2100
|
-
}
|
|
1950
|
+
}
|
|
2101
1951
|
|
|
2102
|
-
|
|
1952
|
+
async querySegments(
|
|
2103
1953
|
request: QuerySegmentsRequest,
|
|
2104
|
-
): Promise<StreamResponse<QuerySegmentsResponse>>
|
|
1954
|
+
): Promise<StreamResponse<QuerySegmentsResponse>> {
|
|
2105
1955
|
const body = {
|
|
2106
1956
|
filter: request?.filter,
|
|
2107
1957
|
limit: request?.limit,
|
|
@@ -2110,23 +1960,30 @@ export class ChatApi extends BaseApi {
|
|
|
2110
1960
|
sort: request?.sort,
|
|
2111
1961
|
};
|
|
2112
1962
|
|
|
2113
|
-
const response = await this.sendRequest<
|
|
1963
|
+
const response = await this.apiClient.sendRequest<
|
|
2114
1964
|
StreamResponse<QuerySegmentsResponse>
|
|
2115
|
-
>(
|
|
1965
|
+
>(
|
|
1966
|
+
'POST',
|
|
1967
|
+
'/api/v2/chat/segments/query',
|
|
1968
|
+
undefined,
|
|
1969
|
+
undefined,
|
|
1970
|
+
body,
|
|
1971
|
+
'application/json',
|
|
1972
|
+
);
|
|
2116
1973
|
|
|
2117
1974
|
decoders.QuerySegmentsResponse?.(response.body);
|
|
2118
1975
|
|
|
2119
1976
|
return { ...response.body, metadata: response.metadata };
|
|
2120
|
-
}
|
|
1977
|
+
}
|
|
2121
1978
|
|
|
2122
|
-
|
|
1979
|
+
async deleteSegment(request: {
|
|
2123
1980
|
id: string;
|
|
2124
|
-
}): Promise<StreamResponse<Response>>
|
|
1981
|
+
}): Promise<StreamResponse<Response>> {
|
|
2125
1982
|
const pathParams = {
|
|
2126
1983
|
id: request?.id,
|
|
2127
1984
|
};
|
|
2128
1985
|
|
|
2129
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
1986
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2130
1987
|
'DELETE',
|
|
2131
1988
|
'/api/v2/chat/segments/{id}',
|
|
2132
1989
|
pathParams,
|
|
@@ -2136,30 +1993,27 @@ export class ChatApi extends BaseApi {
|
|
|
2136
1993
|
decoders.Response?.(response.body);
|
|
2137
1994
|
|
|
2138
1995
|
return { ...response.body, metadata: response.metadata };
|
|
2139
|
-
}
|
|
1996
|
+
}
|
|
2140
1997
|
|
|
2141
|
-
|
|
1998
|
+
async getSegment(request: {
|
|
2142
1999
|
id: string;
|
|
2143
|
-
}): Promise<StreamResponse<GetSegmentResponse>>
|
|
2000
|
+
}): Promise<StreamResponse<GetSegmentResponse>> {
|
|
2144
2001
|
const pathParams = {
|
|
2145
2002
|
id: request?.id,
|
|
2146
2003
|
};
|
|
2147
2004
|
|
|
2148
|
-
const response = await this.sendRequest<
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
pathParams,
|
|
2152
|
-
undefined,
|
|
2153
|
-
);
|
|
2005
|
+
const response = await this.apiClient.sendRequest<
|
|
2006
|
+
StreamResponse<GetSegmentResponse>
|
|
2007
|
+
>('GET', '/api/v2/chat/segments/{id}', pathParams, undefined);
|
|
2154
2008
|
|
|
2155
2009
|
decoders.GetSegmentResponse?.(response.body);
|
|
2156
2010
|
|
|
2157
2011
|
return { ...response.body, metadata: response.metadata };
|
|
2158
|
-
}
|
|
2012
|
+
}
|
|
2159
2013
|
|
|
2160
|
-
|
|
2014
|
+
async deleteSegmentTargets(
|
|
2161
2015
|
request: DeleteSegmentTargetsRequest & { id: string },
|
|
2162
|
-
): Promise<StreamResponse<Response>>
|
|
2016
|
+
): Promise<StreamResponse<Response>> {
|
|
2163
2017
|
const pathParams = {
|
|
2164
2018
|
id: request?.id,
|
|
2165
2019
|
};
|
|
@@ -2167,29 +2021,30 @@ export class ChatApi extends BaseApi {
|
|
|
2167
2021
|
target_ids: request?.target_ids,
|
|
2168
2022
|
};
|
|
2169
2023
|
|
|
2170
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
2024
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2171
2025
|
'POST',
|
|
2172
2026
|
'/api/v2/chat/segments/{id}/deletetargets',
|
|
2173
2027
|
pathParams,
|
|
2174
2028
|
undefined,
|
|
2175
2029
|
body,
|
|
2030
|
+
'application/json',
|
|
2176
2031
|
);
|
|
2177
2032
|
|
|
2178
2033
|
decoders.Response?.(response.body);
|
|
2179
2034
|
|
|
2180
2035
|
return { ...response.body, metadata: response.metadata };
|
|
2181
|
-
}
|
|
2036
|
+
}
|
|
2182
2037
|
|
|
2183
|
-
|
|
2038
|
+
async segmentTargetExists(request: {
|
|
2184
2039
|
id: string;
|
|
2185
2040
|
target_id: string;
|
|
2186
|
-
}): Promise<StreamResponse<Response>>
|
|
2041
|
+
}): Promise<StreamResponse<Response>> {
|
|
2187
2042
|
const pathParams = {
|
|
2188
2043
|
id: request?.id,
|
|
2189
2044
|
target_id: request?.target_id,
|
|
2190
2045
|
};
|
|
2191
2046
|
|
|
2192
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
2047
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2193
2048
|
'GET',
|
|
2194
2049
|
'/api/v2/chat/segments/{id}/target/{target_id}',
|
|
2195
2050
|
pathParams,
|
|
@@ -2199,11 +2054,11 @@ export class ChatApi extends BaseApi {
|
|
|
2199
2054
|
decoders.Response?.(response.body);
|
|
2200
2055
|
|
|
2201
2056
|
return { ...response.body, metadata: response.metadata };
|
|
2202
|
-
}
|
|
2057
|
+
}
|
|
2203
2058
|
|
|
2204
|
-
|
|
2059
|
+
async querySegmentTargets(
|
|
2205
2060
|
request: QuerySegmentTargetsRequest & { id: string },
|
|
2206
|
-
): Promise<StreamResponse<QuerySegmentTargetsResponse>>
|
|
2061
|
+
): Promise<StreamResponse<QuerySegmentTargetsResponse>> {
|
|
2207
2062
|
const pathParams = {
|
|
2208
2063
|
id: request?.id,
|
|
2209
2064
|
};
|
|
@@ -2215,7 +2070,7 @@ export class ChatApi extends BaseApi {
|
|
|
2215
2070
|
filter: request?.filter,
|
|
2216
2071
|
};
|
|
2217
2072
|
|
|
2218
|
-
const response = await this.sendRequest<
|
|
2073
|
+
const response = await this.apiClient.sendRequest<
|
|
2219
2074
|
StreamResponse<QuerySegmentTargetsResponse>
|
|
2220
2075
|
>(
|
|
2221
2076
|
'POST',
|
|
@@ -2223,16 +2078,17 @@ export class ChatApi extends BaseApi {
|
|
|
2223
2078
|
pathParams,
|
|
2224
2079
|
undefined,
|
|
2225
2080
|
body,
|
|
2081
|
+
'application/json',
|
|
2226
2082
|
);
|
|
2227
2083
|
|
|
2228
2084
|
decoders.QuerySegmentTargetsResponse?.(response.body);
|
|
2229
2085
|
|
|
2230
2086
|
return { ...response.body, metadata: response.metadata };
|
|
2231
|
-
}
|
|
2087
|
+
}
|
|
2232
2088
|
|
|
2233
|
-
|
|
2089
|
+
async queryThreads(
|
|
2234
2090
|
request?: QueryThreadsRequest,
|
|
2235
|
-
): Promise<StreamResponse<QueryThreadsResponse>>
|
|
2091
|
+
): Promise<StreamResponse<QueryThreadsResponse>> {
|
|
2236
2092
|
const body = {
|
|
2237
2093
|
limit: request?.limit,
|
|
2238
2094
|
member_limit: request?.member_limit,
|
|
@@ -2246,21 +2102,28 @@ export class ChatApi extends BaseApi {
|
|
|
2246
2102
|
user: request?.user,
|
|
2247
2103
|
};
|
|
2248
2104
|
|
|
2249
|
-
const response = await this.sendRequest<
|
|
2105
|
+
const response = await this.apiClient.sendRequest<
|
|
2250
2106
|
StreamResponse<QueryThreadsResponse>
|
|
2251
|
-
>(
|
|
2107
|
+
>(
|
|
2108
|
+
'POST',
|
|
2109
|
+
'/api/v2/chat/threads',
|
|
2110
|
+
undefined,
|
|
2111
|
+
undefined,
|
|
2112
|
+
body,
|
|
2113
|
+
'application/json',
|
|
2114
|
+
);
|
|
2252
2115
|
|
|
2253
2116
|
decoders.QueryThreadsResponse?.(response.body);
|
|
2254
2117
|
|
|
2255
2118
|
return { ...response.body, metadata: response.metadata };
|
|
2256
|
-
}
|
|
2119
|
+
}
|
|
2257
2120
|
|
|
2258
|
-
|
|
2121
|
+
async getThread(request: {
|
|
2259
2122
|
message_id: string;
|
|
2260
2123
|
reply_limit?: number;
|
|
2261
2124
|
participant_limit?: number;
|
|
2262
2125
|
member_limit?: number;
|
|
2263
|
-
}): Promise<StreamResponse<GetThreadResponse>>
|
|
2126
|
+
}): Promise<StreamResponse<GetThreadResponse>> {
|
|
2264
2127
|
const queryParams = {
|
|
2265
2128
|
reply_limit: request?.reply_limit,
|
|
2266
2129
|
participant_limit: request?.participant_limit,
|
|
@@ -2270,21 +2133,18 @@ export class ChatApi extends BaseApi {
|
|
|
2270
2133
|
message_id: request?.message_id,
|
|
2271
2134
|
};
|
|
2272
2135
|
|
|
2273
|
-
const response = await this.sendRequest<
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
pathParams,
|
|
2277
|
-
queryParams,
|
|
2278
|
-
);
|
|
2136
|
+
const response = await this.apiClient.sendRequest<
|
|
2137
|
+
StreamResponse<GetThreadResponse>
|
|
2138
|
+
>('GET', '/api/v2/chat/threads/{message_id}', pathParams, queryParams);
|
|
2279
2139
|
|
|
2280
2140
|
decoders.GetThreadResponse?.(response.body);
|
|
2281
2141
|
|
|
2282
2142
|
return { ...response.body, metadata: response.metadata };
|
|
2283
|
-
}
|
|
2143
|
+
}
|
|
2284
2144
|
|
|
2285
|
-
|
|
2145
|
+
async updateThreadPartial(
|
|
2286
2146
|
request: UpdateThreadPartialRequest & { message_id: string },
|
|
2287
|
-
): Promise<StreamResponse<UpdateThreadPartialResponse>>
|
|
2147
|
+
): Promise<StreamResponse<UpdateThreadPartialResponse>> {
|
|
2288
2148
|
const pathParams = {
|
|
2289
2149
|
message_id: request?.message_id,
|
|
2290
2150
|
};
|
|
@@ -2295,7 +2155,7 @@ export class ChatApi extends BaseApi {
|
|
|
2295
2155
|
user: request?.user,
|
|
2296
2156
|
};
|
|
2297
2157
|
|
|
2298
|
-
const response = await this.sendRequest<
|
|
2158
|
+
const response = await this.apiClient.sendRequest<
|
|
2299
2159
|
StreamResponse<UpdateThreadPartialResponse>
|
|
2300
2160
|
>(
|
|
2301
2161
|
'PATCH',
|
|
@@ -2303,44 +2163,50 @@ export class ChatApi extends BaseApi {
|
|
|
2303
2163
|
pathParams,
|
|
2304
2164
|
undefined,
|
|
2305
2165
|
body,
|
|
2166
|
+
'application/json',
|
|
2306
2167
|
);
|
|
2307
2168
|
|
|
2308
2169
|
decoders.UpdateThreadPartialResponse?.(response.body);
|
|
2309
2170
|
|
|
2310
2171
|
return { ...response.body, metadata: response.metadata };
|
|
2311
|
-
}
|
|
2172
|
+
}
|
|
2312
2173
|
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
> => {
|
|
2316
|
-
const response = await this.sendRequest<
|
|
2174
|
+
async unreadCounts(): Promise<StreamResponse<WrappedUnreadCountsResponse>> {
|
|
2175
|
+
const response = await this.apiClient.sendRequest<
|
|
2317
2176
|
StreamResponse<WrappedUnreadCountsResponse>
|
|
2318
2177
|
>('GET', '/api/v2/chat/unread', undefined, undefined);
|
|
2319
2178
|
|
|
2320
2179
|
decoders.WrappedUnreadCountsResponse?.(response.body);
|
|
2321
2180
|
|
|
2322
2181
|
return { ...response.body, metadata: response.metadata };
|
|
2323
|
-
}
|
|
2182
|
+
}
|
|
2324
2183
|
|
|
2325
|
-
|
|
2184
|
+
async unreadCountsBatch(
|
|
2326
2185
|
request: UnreadCountsBatchRequest,
|
|
2327
|
-
): Promise<StreamResponse<UnreadCountsBatchResponse>>
|
|
2186
|
+
): Promise<StreamResponse<UnreadCountsBatchResponse>> {
|
|
2328
2187
|
const body = {
|
|
2329
2188
|
user_ids: request?.user_ids,
|
|
2330
2189
|
};
|
|
2331
2190
|
|
|
2332
|
-
const response = await this.sendRequest<
|
|
2191
|
+
const response = await this.apiClient.sendRequest<
|
|
2333
2192
|
StreamResponse<UnreadCountsBatchResponse>
|
|
2334
|
-
>(
|
|
2193
|
+
>(
|
|
2194
|
+
'POST',
|
|
2195
|
+
'/api/v2/chat/unread_batch',
|
|
2196
|
+
undefined,
|
|
2197
|
+
undefined,
|
|
2198
|
+
body,
|
|
2199
|
+
'application/json',
|
|
2200
|
+
);
|
|
2335
2201
|
|
|
2336
2202
|
decoders.UnreadCountsBatchResponse?.(response.body);
|
|
2337
2203
|
|
|
2338
2204
|
return { ...response.body, metadata: response.metadata };
|
|
2339
|
-
}
|
|
2205
|
+
}
|
|
2340
2206
|
|
|
2341
|
-
|
|
2207
|
+
async sendUserCustomEvent(
|
|
2342
2208
|
request: SendUserCustomEventRequest & { user_id: string },
|
|
2343
|
-
): Promise<StreamResponse<Response>>
|
|
2209
|
+
): Promise<StreamResponse<Response>> {
|
|
2344
2210
|
const pathParams = {
|
|
2345
2211
|
user_id: request?.user_id,
|
|
2346
2212
|
};
|
|
@@ -2348,16 +2214,17 @@ export class ChatApi extends BaseApi {
|
|
|
2348
2214
|
event: request?.event,
|
|
2349
2215
|
};
|
|
2350
2216
|
|
|
2351
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
2217
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2352
2218
|
'POST',
|
|
2353
2219
|
'/api/v2/chat/users/{user_id}/event',
|
|
2354
2220
|
pathParams,
|
|
2355
2221
|
undefined,
|
|
2356
2222
|
body,
|
|
2223
|
+
'application/json',
|
|
2357
2224
|
);
|
|
2358
2225
|
|
|
2359
2226
|
decoders.Response?.(response.body);
|
|
2360
2227
|
|
|
2361
2228
|
return { ...response.body, metadata: response.metadata };
|
|
2362
|
-
}
|
|
2229
|
+
}
|
|
2363
2230
|
}
|