@stream-io/node-sdk 0.4.25 → 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 +6265 -3834
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.mjs +6263 -3835
- 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 +122 -79
- 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 +1750 -47
- 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 +91 -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 +550 -681
- package/src/gen/common/CommonApi.ts +712 -262
- 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} +2248 -336
- package/src/gen/models/index.ts +4668 -2088
- package/src/gen/moderation/ModerationApi.ts +159 -98
- package/src/gen/video/CallApi.ts +97 -108
- package/src/gen/video/VideoApi.ts +303 -203
- 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,
|
|
@@ -882,6 +932,7 @@ export class ChatApi extends BaseApi {
|
|
|
882
932
|
read_events: request?.read_events,
|
|
883
933
|
replies: request?.replies,
|
|
884
934
|
search: request?.search,
|
|
935
|
+
shared_locations: request?.shared_locations,
|
|
885
936
|
skip_last_msg_update_for_system_msgs:
|
|
886
937
|
request?.skip_last_msg_update_for_system_msgs,
|
|
887
938
|
typing_events: request?.typing_events,
|
|
@@ -894,23 +945,30 @@ export class ChatApi extends BaseApi {
|
|
|
894
945
|
grants: request?.grants,
|
|
895
946
|
};
|
|
896
947
|
|
|
897
|
-
const response = await this.sendRequest<
|
|
948
|
+
const response = await this.apiClient.sendRequest<
|
|
898
949
|
StreamResponse<CreateChannelTypeResponse>
|
|
899
|
-
>(
|
|
950
|
+
>(
|
|
951
|
+
'POST',
|
|
952
|
+
'/api/v2/chat/channeltypes',
|
|
953
|
+
undefined,
|
|
954
|
+
undefined,
|
|
955
|
+
body,
|
|
956
|
+
'application/json',
|
|
957
|
+
);
|
|
900
958
|
|
|
901
959
|
decoders.CreateChannelTypeResponse?.(response.body);
|
|
902
960
|
|
|
903
961
|
return { ...response.body, metadata: response.metadata };
|
|
904
|
-
}
|
|
962
|
+
}
|
|
905
963
|
|
|
906
|
-
|
|
964
|
+
async deleteChannelType(request: {
|
|
907
965
|
name: string;
|
|
908
|
-
}): Promise<StreamResponse<Response>>
|
|
966
|
+
}): Promise<StreamResponse<Response>> {
|
|
909
967
|
const pathParams = {
|
|
910
968
|
name: request?.name,
|
|
911
969
|
};
|
|
912
970
|
|
|
913
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
971
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
914
972
|
'DELETE',
|
|
915
973
|
'/api/v2/chat/channeltypes/{name}',
|
|
916
974
|
pathParams,
|
|
@@ -920,27 +978,27 @@ export class ChatApi extends BaseApi {
|
|
|
920
978
|
decoders.Response?.(response.body);
|
|
921
979
|
|
|
922
980
|
return { ...response.body, metadata: response.metadata };
|
|
923
|
-
}
|
|
981
|
+
}
|
|
924
982
|
|
|
925
|
-
|
|
983
|
+
async getChannelType(request: {
|
|
926
984
|
name: string;
|
|
927
|
-
}): Promise<StreamResponse<GetChannelTypeResponse>>
|
|
985
|
+
}): Promise<StreamResponse<GetChannelTypeResponse>> {
|
|
928
986
|
const pathParams = {
|
|
929
987
|
name: request?.name,
|
|
930
988
|
};
|
|
931
989
|
|
|
932
|
-
const response = await this.sendRequest<
|
|
990
|
+
const response = await this.apiClient.sendRequest<
|
|
933
991
|
StreamResponse<GetChannelTypeResponse>
|
|
934
992
|
>('GET', '/api/v2/chat/channeltypes/{name}', pathParams, undefined);
|
|
935
993
|
|
|
936
994
|
decoders.GetChannelTypeResponse?.(response.body);
|
|
937
995
|
|
|
938
996
|
return { ...response.body, metadata: response.metadata };
|
|
939
|
-
}
|
|
997
|
+
}
|
|
940
998
|
|
|
941
|
-
|
|
999
|
+
async updateChannelType(
|
|
942
1000
|
request: UpdateChannelTypeRequest & { name: string },
|
|
943
|
-
): Promise<StreamResponse<UpdateChannelTypeResponse>>
|
|
1001
|
+
): Promise<StreamResponse<UpdateChannelTypeResponse>> {
|
|
944
1002
|
const pathParams = {
|
|
945
1003
|
name: request?.name,
|
|
946
1004
|
};
|
|
@@ -964,6 +1022,7 @@ export class ChatApi extends BaseApi {
|
|
|
964
1022
|
reminders: request?.reminders,
|
|
965
1023
|
replies: request?.replies,
|
|
966
1024
|
search: request?.search,
|
|
1025
|
+
shared_locations: request?.shared_locations,
|
|
967
1026
|
skip_last_msg_update_for_system_msgs:
|
|
968
1027
|
request?.skip_last_msg_update_for_system_msgs,
|
|
969
1028
|
typing_events: request?.typing_events,
|
|
@@ -978,28 +1037,35 @@ export class ChatApi extends BaseApi {
|
|
|
978
1037
|
grants: request?.grants,
|
|
979
1038
|
};
|
|
980
1039
|
|
|
981
|
-
const response = await this.sendRequest<
|
|
1040
|
+
const response = await this.apiClient.sendRequest<
|
|
982
1041
|
StreamResponse<UpdateChannelTypeResponse>
|
|
983
|
-
>(
|
|
1042
|
+
>(
|
|
1043
|
+
'PUT',
|
|
1044
|
+
'/api/v2/chat/channeltypes/{name}',
|
|
1045
|
+
pathParams,
|
|
1046
|
+
undefined,
|
|
1047
|
+
body,
|
|
1048
|
+
'application/json',
|
|
1049
|
+
);
|
|
984
1050
|
|
|
985
1051
|
decoders.UpdateChannelTypeResponse?.(response.body);
|
|
986
1052
|
|
|
987
1053
|
return { ...response.body, metadata: response.metadata };
|
|
988
|
-
}
|
|
1054
|
+
}
|
|
989
1055
|
|
|
990
|
-
|
|
991
|
-
const response = await this.sendRequest<
|
|
1056
|
+
async listCommands(): Promise<StreamResponse<ListCommandsResponse>> {
|
|
1057
|
+
const response = await this.apiClient.sendRequest<
|
|
992
1058
|
StreamResponse<ListCommandsResponse>
|
|
993
1059
|
>('GET', '/api/v2/chat/commands', undefined, undefined);
|
|
994
1060
|
|
|
995
1061
|
decoders.ListCommandsResponse?.(response.body);
|
|
996
1062
|
|
|
997
1063
|
return { ...response.body, metadata: response.metadata };
|
|
998
|
-
}
|
|
1064
|
+
}
|
|
999
1065
|
|
|
1000
|
-
|
|
1066
|
+
async createCommand(
|
|
1001
1067
|
request: CreateCommandRequest,
|
|
1002
|
-
): Promise<StreamResponse<CreateCommandResponse>>
|
|
1068
|
+
): Promise<StreamResponse<CreateCommandResponse>> {
|
|
1003
1069
|
const body = {
|
|
1004
1070
|
description: request?.description,
|
|
1005
1071
|
name: request?.name,
|
|
@@ -1007,53 +1073,57 @@ export class ChatApi extends BaseApi {
|
|
|
1007
1073
|
set: request?.set,
|
|
1008
1074
|
};
|
|
1009
1075
|
|
|
1010
|
-
const response = await this.sendRequest<
|
|
1076
|
+
const response = await this.apiClient.sendRequest<
|
|
1011
1077
|
StreamResponse<CreateCommandResponse>
|
|
1012
|
-
>(
|
|
1078
|
+
>(
|
|
1079
|
+
'POST',
|
|
1080
|
+
'/api/v2/chat/commands',
|
|
1081
|
+
undefined,
|
|
1082
|
+
undefined,
|
|
1083
|
+
body,
|
|
1084
|
+
'application/json',
|
|
1085
|
+
);
|
|
1013
1086
|
|
|
1014
1087
|
decoders.CreateCommandResponse?.(response.body);
|
|
1015
1088
|
|
|
1016
1089
|
return { ...response.body, metadata: response.metadata };
|
|
1017
|
-
}
|
|
1090
|
+
}
|
|
1018
1091
|
|
|
1019
|
-
|
|
1092
|
+
async deleteCommand(request: {
|
|
1020
1093
|
name: string;
|
|
1021
|
-
}): Promise<StreamResponse<DeleteCommandResponse>>
|
|
1094
|
+
}): Promise<StreamResponse<DeleteCommandResponse>> {
|
|
1022
1095
|
const pathParams = {
|
|
1023
1096
|
name: request?.name,
|
|
1024
1097
|
};
|
|
1025
1098
|
|
|
1026
|
-
const response = await this.sendRequest<
|
|
1099
|
+
const response = await this.apiClient.sendRequest<
|
|
1027
1100
|
StreamResponse<DeleteCommandResponse>
|
|
1028
1101
|
>('DELETE', '/api/v2/chat/commands/{name}', pathParams, undefined);
|
|
1029
1102
|
|
|
1030
1103
|
decoders.DeleteCommandResponse?.(response.body);
|
|
1031
1104
|
|
|
1032
1105
|
return { ...response.body, metadata: response.metadata };
|
|
1033
|
-
}
|
|
1106
|
+
}
|
|
1034
1107
|
|
|
1035
|
-
|
|
1108
|
+
async getCommand(request: {
|
|
1036
1109
|
name: string;
|
|
1037
|
-
}): Promise<StreamResponse<GetCommandResponse>>
|
|
1110
|
+
}): Promise<StreamResponse<GetCommandResponse>> {
|
|
1038
1111
|
const pathParams = {
|
|
1039
1112
|
name: request?.name,
|
|
1040
1113
|
};
|
|
1041
1114
|
|
|
1042
|
-
const response = await this.sendRequest<
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
pathParams,
|
|
1046
|
-
undefined,
|
|
1047
|
-
);
|
|
1115
|
+
const response = await this.apiClient.sendRequest<
|
|
1116
|
+
StreamResponse<GetCommandResponse>
|
|
1117
|
+
>('GET', '/api/v2/chat/commands/{name}', pathParams, undefined);
|
|
1048
1118
|
|
|
1049
1119
|
decoders.GetCommandResponse?.(response.body);
|
|
1050
1120
|
|
|
1051
1121
|
return { ...response.body, metadata: response.metadata };
|
|
1052
|
-
}
|
|
1122
|
+
}
|
|
1053
1123
|
|
|
1054
|
-
|
|
1124
|
+
async updateCommand(
|
|
1055
1125
|
request: UpdateCommandRequest & { name: string },
|
|
1056
|
-
): Promise<StreamResponse<UpdateCommandResponse>>
|
|
1126
|
+
): Promise<StreamResponse<UpdateCommandResponse>> {
|
|
1057
1127
|
const pathParams = {
|
|
1058
1128
|
name: request?.name,
|
|
1059
1129
|
};
|
|
@@ -1063,18 +1133,25 @@ export class ChatApi extends BaseApi {
|
|
|
1063
1133
|
set: request?.set,
|
|
1064
1134
|
};
|
|
1065
1135
|
|
|
1066
|
-
const response = await this.sendRequest<
|
|
1136
|
+
const response = await this.apiClient.sendRequest<
|
|
1067
1137
|
StreamResponse<UpdateCommandResponse>
|
|
1068
|
-
>(
|
|
1138
|
+
>(
|
|
1139
|
+
'PUT',
|
|
1140
|
+
'/api/v2/chat/commands/{name}',
|
|
1141
|
+
pathParams,
|
|
1142
|
+
undefined,
|
|
1143
|
+
body,
|
|
1144
|
+
'application/json',
|
|
1145
|
+
);
|
|
1069
1146
|
|
|
1070
1147
|
decoders.UpdateCommandResponse?.(response.body);
|
|
1071
1148
|
|
|
1072
1149
|
return { ...response.body, metadata: response.metadata };
|
|
1073
|
-
}
|
|
1150
|
+
}
|
|
1074
1151
|
|
|
1075
|
-
|
|
1152
|
+
async queryDrafts(
|
|
1076
1153
|
request?: QueryDraftsRequest,
|
|
1077
|
-
): Promise<StreamResponse<QueryDraftsResponse>>
|
|
1154
|
+
): Promise<StreamResponse<QueryDraftsResponse>> {
|
|
1078
1155
|
const body = {
|
|
1079
1156
|
limit: request?.limit,
|
|
1080
1157
|
next: request?.next,
|
|
@@ -1085,18 +1162,25 @@ export class ChatApi extends BaseApi {
|
|
|
1085
1162
|
user: request?.user,
|
|
1086
1163
|
};
|
|
1087
1164
|
|
|
1088
|
-
const response = await this.sendRequest<
|
|
1165
|
+
const response = await this.apiClient.sendRequest<
|
|
1089
1166
|
StreamResponse<QueryDraftsResponse>
|
|
1090
|
-
>(
|
|
1167
|
+
>(
|
|
1168
|
+
'POST',
|
|
1169
|
+
'/api/v2/chat/drafts/query',
|
|
1170
|
+
undefined,
|
|
1171
|
+
undefined,
|
|
1172
|
+
body,
|
|
1173
|
+
'application/json',
|
|
1174
|
+
);
|
|
1091
1175
|
|
|
1092
1176
|
decoders.QueryDraftsResponse?.(response.body);
|
|
1093
1177
|
|
|
1094
1178
|
return { ...response.body, metadata: response.metadata };
|
|
1095
|
-
}
|
|
1179
|
+
}
|
|
1096
1180
|
|
|
1097
|
-
|
|
1181
|
+
async exportChannels(
|
|
1098
1182
|
request: ExportChannelsRequest,
|
|
1099
|
-
): Promise<StreamResponse<ExportChannelsResponse>>
|
|
1183
|
+
): Promise<StreamResponse<ExportChannelsResponse>> {
|
|
1100
1184
|
const body = {
|
|
1101
1185
|
channels: request?.channels,
|
|
1102
1186
|
clear_deleted_message_text: request?.clear_deleted_message_text,
|
|
@@ -1106,37 +1190,41 @@ export class ChatApi extends BaseApi {
|
|
|
1106
1190
|
version: request?.version,
|
|
1107
1191
|
};
|
|
1108
1192
|
|
|
1109
|
-
const response = await this.sendRequest<
|
|
1193
|
+
const response = await this.apiClient.sendRequest<
|
|
1110
1194
|
StreamResponse<ExportChannelsResponse>
|
|
1111
|
-
>(
|
|
1195
|
+
>(
|
|
1196
|
+
'POST',
|
|
1197
|
+
'/api/v2/chat/export_channels',
|
|
1198
|
+
undefined,
|
|
1199
|
+
undefined,
|
|
1200
|
+
body,
|
|
1201
|
+
'application/json',
|
|
1202
|
+
);
|
|
1112
1203
|
|
|
1113
1204
|
decoders.ExportChannelsResponse?.(response.body);
|
|
1114
1205
|
|
|
1115
1206
|
return { ...response.body, metadata: response.metadata };
|
|
1116
|
-
}
|
|
1207
|
+
}
|
|
1117
1208
|
|
|
1118
|
-
|
|
1209
|
+
async queryMembers(request?: {
|
|
1119
1210
|
payload?: QueryMembersPayload;
|
|
1120
|
-
}): Promise<StreamResponse<MembersResponse>>
|
|
1211
|
+
}): Promise<StreamResponse<MembersResponse>> {
|
|
1121
1212
|
const queryParams = {
|
|
1122
1213
|
payload: request?.payload,
|
|
1123
1214
|
};
|
|
1124
1215
|
|
|
1125
|
-
const response = await this.sendRequest<
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
undefined,
|
|
1129
|
-
queryParams,
|
|
1130
|
-
);
|
|
1216
|
+
const response = await this.apiClient.sendRequest<
|
|
1217
|
+
StreamResponse<MembersResponse>
|
|
1218
|
+
>('GET', '/api/v2/chat/members', undefined, queryParams);
|
|
1131
1219
|
|
|
1132
1220
|
decoders.MembersResponse?.(response.body);
|
|
1133
1221
|
|
|
1134
1222
|
return { ...response.body, metadata: response.metadata };
|
|
1135
|
-
}
|
|
1223
|
+
}
|
|
1136
1224
|
|
|
1137
|
-
|
|
1225
|
+
async queryMessageHistory(
|
|
1138
1226
|
request: QueryMessageHistoryRequest,
|
|
1139
|
-
): Promise<StreamResponse<QueryMessageHistoryResponse>>
|
|
1227
|
+
): Promise<StreamResponse<QueryMessageHistoryResponse>> {
|
|
1140
1228
|
const body = {
|
|
1141
1229
|
filter: request?.filter,
|
|
1142
1230
|
limit: request?.limit,
|
|
@@ -1145,20 +1233,27 @@ export class ChatApi extends BaseApi {
|
|
|
1145
1233
|
sort: request?.sort,
|
|
1146
1234
|
};
|
|
1147
1235
|
|
|
1148
|
-
const response = await this.sendRequest<
|
|
1236
|
+
const response = await this.apiClient.sendRequest<
|
|
1149
1237
|
StreamResponse<QueryMessageHistoryResponse>
|
|
1150
|
-
>(
|
|
1238
|
+
>(
|
|
1239
|
+
'POST',
|
|
1240
|
+
'/api/v2/chat/messages/history',
|
|
1241
|
+
undefined,
|
|
1242
|
+
undefined,
|
|
1243
|
+
body,
|
|
1244
|
+
'application/json',
|
|
1245
|
+
);
|
|
1151
1246
|
|
|
1152
1247
|
decoders.QueryMessageHistoryResponse?.(response.body);
|
|
1153
1248
|
|
|
1154
1249
|
return { ...response.body, metadata: response.metadata };
|
|
1155
|
-
}
|
|
1250
|
+
}
|
|
1156
1251
|
|
|
1157
|
-
|
|
1252
|
+
async deleteMessage(request: {
|
|
1158
1253
|
id: string;
|
|
1159
1254
|
hard?: boolean;
|
|
1160
1255
|
deleted_by?: string;
|
|
1161
|
-
}): Promise<StreamResponse<DeleteMessageResponse>>
|
|
1256
|
+
}): Promise<StreamResponse<DeleteMessageResponse>> {
|
|
1162
1257
|
const queryParams = {
|
|
1163
1258
|
hard: request?.hard,
|
|
1164
1259
|
deleted_by: request?.deleted_by,
|
|
@@ -1167,19 +1262,19 @@ export class ChatApi extends BaseApi {
|
|
|
1167
1262
|
id: request?.id,
|
|
1168
1263
|
};
|
|
1169
1264
|
|
|
1170
|
-
const response = await this.sendRequest<
|
|
1265
|
+
const response = await this.apiClient.sendRequest<
|
|
1171
1266
|
StreamResponse<DeleteMessageResponse>
|
|
1172
1267
|
>('DELETE', '/api/v2/chat/messages/{id}', pathParams, queryParams);
|
|
1173
1268
|
|
|
1174
1269
|
decoders.DeleteMessageResponse?.(response.body);
|
|
1175
1270
|
|
|
1176
1271
|
return { ...response.body, metadata: response.metadata };
|
|
1177
|
-
}
|
|
1272
|
+
}
|
|
1178
1273
|
|
|
1179
|
-
|
|
1274
|
+
async getMessage(request: {
|
|
1180
1275
|
id: string;
|
|
1181
1276
|
show_deleted_message?: boolean;
|
|
1182
|
-
}): Promise<StreamResponse<GetMessageResponse>>
|
|
1277
|
+
}): Promise<StreamResponse<GetMessageResponse>> {
|
|
1183
1278
|
const queryParams = {
|
|
1184
1279
|
show_deleted_message: request?.show_deleted_message,
|
|
1185
1280
|
};
|
|
@@ -1187,21 +1282,18 @@ export class ChatApi extends BaseApi {
|
|
|
1187
1282
|
id: request?.id,
|
|
1188
1283
|
};
|
|
1189
1284
|
|
|
1190
|
-
const response = await this.sendRequest<
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
pathParams,
|
|
1194
|
-
queryParams,
|
|
1195
|
-
);
|
|
1285
|
+
const response = await this.apiClient.sendRequest<
|
|
1286
|
+
StreamResponse<GetMessageResponse>
|
|
1287
|
+
>('GET', '/api/v2/chat/messages/{id}', pathParams, queryParams);
|
|
1196
1288
|
|
|
1197
1289
|
decoders.GetMessageResponse?.(response.body);
|
|
1198
1290
|
|
|
1199
1291
|
return { ...response.body, metadata: response.metadata };
|
|
1200
|
-
}
|
|
1292
|
+
}
|
|
1201
1293
|
|
|
1202
|
-
|
|
1294
|
+
async updateMessage(
|
|
1203
1295
|
request: UpdateMessageRequest & { id: string },
|
|
1204
|
-
): Promise<StreamResponse<UpdateMessageResponse>>
|
|
1296
|
+
): Promise<StreamResponse<UpdateMessageResponse>> {
|
|
1205
1297
|
const pathParams = {
|
|
1206
1298
|
id: request?.id,
|
|
1207
1299
|
};
|
|
@@ -1211,18 +1303,25 @@ export class ChatApi extends BaseApi {
|
|
|
1211
1303
|
skip_push: request?.skip_push,
|
|
1212
1304
|
};
|
|
1213
1305
|
|
|
1214
|
-
const response = await this.sendRequest<
|
|
1306
|
+
const response = await this.apiClient.sendRequest<
|
|
1215
1307
|
StreamResponse<UpdateMessageResponse>
|
|
1216
|
-
>(
|
|
1308
|
+
>(
|
|
1309
|
+
'POST',
|
|
1310
|
+
'/api/v2/chat/messages/{id}',
|
|
1311
|
+
pathParams,
|
|
1312
|
+
undefined,
|
|
1313
|
+
body,
|
|
1314
|
+
'application/json',
|
|
1315
|
+
);
|
|
1217
1316
|
|
|
1218
1317
|
decoders.UpdateMessageResponse?.(response.body);
|
|
1219
1318
|
|
|
1220
1319
|
return { ...response.body, metadata: response.metadata };
|
|
1221
|
-
}
|
|
1320
|
+
}
|
|
1222
1321
|
|
|
1223
|
-
|
|
1322
|
+
async updateMessagePartial(
|
|
1224
1323
|
request: UpdateMessagePartialRequest & { id: string },
|
|
1225
|
-
): Promise<StreamResponse<UpdateMessagePartialResponse>>
|
|
1324
|
+
): Promise<StreamResponse<UpdateMessagePartialResponse>> {
|
|
1226
1325
|
const pathParams = {
|
|
1227
1326
|
id: request?.id,
|
|
1228
1327
|
};
|
|
@@ -1234,18 +1333,25 @@ export class ChatApi extends BaseApi {
|
|
|
1234
1333
|
user: request?.user,
|
|
1235
1334
|
};
|
|
1236
1335
|
|
|
1237
|
-
const response = await this.sendRequest<
|
|
1336
|
+
const response = await this.apiClient.sendRequest<
|
|
1238
1337
|
StreamResponse<UpdateMessagePartialResponse>
|
|
1239
|
-
>(
|
|
1338
|
+
>(
|
|
1339
|
+
'PUT',
|
|
1340
|
+
'/api/v2/chat/messages/{id}',
|
|
1341
|
+
pathParams,
|
|
1342
|
+
undefined,
|
|
1343
|
+
body,
|
|
1344
|
+
'application/json',
|
|
1345
|
+
);
|
|
1240
1346
|
|
|
1241
1347
|
decoders.UpdateMessagePartialResponse?.(response.body);
|
|
1242
1348
|
|
|
1243
1349
|
return { ...response.body, metadata: response.metadata };
|
|
1244
|
-
}
|
|
1350
|
+
}
|
|
1245
1351
|
|
|
1246
|
-
|
|
1352
|
+
async runMessageAction(
|
|
1247
1353
|
request: MessageActionRequest & { id: string },
|
|
1248
|
-
): Promise<StreamResponse<MessageResponse>>
|
|
1354
|
+
): Promise<StreamResponse<MessageResponse>> {
|
|
1249
1355
|
const pathParams = {
|
|
1250
1356
|
id: request?.id,
|
|
1251
1357
|
};
|
|
@@ -1255,43 +1361,49 @@ export class ChatApi extends BaseApi {
|
|
|
1255
1361
|
user: request?.user,
|
|
1256
1362
|
};
|
|
1257
1363
|
|
|
1258
|
-
const response = await this.sendRequest<
|
|
1364
|
+
const response = await this.apiClient.sendRequest<
|
|
1365
|
+
StreamResponse<MessageResponse>
|
|
1366
|
+
>(
|
|
1259
1367
|
'POST',
|
|
1260
1368
|
'/api/v2/chat/messages/{id}/action',
|
|
1261
1369
|
pathParams,
|
|
1262
1370
|
undefined,
|
|
1263
1371
|
body,
|
|
1372
|
+
'application/json',
|
|
1264
1373
|
);
|
|
1265
1374
|
|
|
1266
1375
|
decoders.MessageResponse?.(response.body);
|
|
1267
1376
|
|
|
1268
1377
|
return { ...response.body, metadata: response.metadata };
|
|
1269
|
-
}
|
|
1378
|
+
}
|
|
1270
1379
|
|
|
1271
|
-
|
|
1380
|
+
async commitMessage(
|
|
1272
1381
|
request: CommitMessageRequest & { id: string },
|
|
1273
|
-
): Promise<StreamResponse<MessageResponse>>
|
|
1382
|
+
): Promise<StreamResponse<MessageResponse>> {
|
|
1274
1383
|
const pathParams = {
|
|
1275
1384
|
id: request?.id,
|
|
1276
1385
|
};
|
|
1277
1386
|
const body = {};
|
|
1278
1387
|
|
|
1279
|
-
const response = await this.sendRequest<
|
|
1388
|
+
const response = await this.apiClient.sendRequest<
|
|
1389
|
+
StreamResponse<MessageResponse>
|
|
1390
|
+
>(
|
|
1280
1391
|
'POST',
|
|
1281
1392
|
'/api/v2/chat/messages/{id}/commit',
|
|
1282
1393
|
pathParams,
|
|
1283
1394
|
undefined,
|
|
1284
1395
|
body,
|
|
1396
|
+
'application/json',
|
|
1285
1397
|
);
|
|
1286
1398
|
|
|
1287
1399
|
decoders.MessageResponse?.(response.body);
|
|
1288
1400
|
|
|
1289
1401
|
return { ...response.body, metadata: response.metadata };
|
|
1290
|
-
}
|
|
1402
|
+
}
|
|
1291
1403
|
|
|
1292
|
-
|
|
1404
|
+
async sendReaction(
|
|
1293
1405
|
request: SendReactionRequest & { id: string },
|
|
1294
|
-
): Promise<StreamResponse<SendReactionResponse>>
|
|
1406
|
+
): Promise<StreamResponse<SendReactionResponse>> {
|
|
1295
1407
|
const pathParams = {
|
|
1296
1408
|
id: request?.id,
|
|
1297
1409
|
};
|
|
@@ -1301,7 +1413,7 @@ export class ChatApi extends BaseApi {
|
|
|
1301
1413
|
skip_push: request?.skip_push,
|
|
1302
1414
|
};
|
|
1303
1415
|
|
|
1304
|
-
const response = await this.sendRequest<
|
|
1416
|
+
const response = await this.apiClient.sendRequest<
|
|
1305
1417
|
StreamResponse<SendReactionResponse>
|
|
1306
1418
|
>(
|
|
1307
1419
|
'POST',
|
|
@@ -1309,18 +1421,19 @@ export class ChatApi extends BaseApi {
|
|
|
1309
1421
|
pathParams,
|
|
1310
1422
|
undefined,
|
|
1311
1423
|
body,
|
|
1424
|
+
'application/json',
|
|
1312
1425
|
);
|
|
1313
1426
|
|
|
1314
1427
|
decoders.SendReactionResponse?.(response.body);
|
|
1315
1428
|
|
|
1316
1429
|
return { ...response.body, metadata: response.metadata };
|
|
1317
|
-
}
|
|
1430
|
+
}
|
|
1318
1431
|
|
|
1319
|
-
|
|
1432
|
+
async deleteReaction(request: {
|
|
1320
1433
|
id: string;
|
|
1321
1434
|
type: string;
|
|
1322
1435
|
user_id?: string;
|
|
1323
|
-
}): Promise<StreamResponse<DeleteReactionResponse>>
|
|
1436
|
+
}): Promise<StreamResponse<DeleteReactionResponse>> {
|
|
1324
1437
|
const queryParams = {
|
|
1325
1438
|
user_id: request?.user_id,
|
|
1326
1439
|
};
|
|
@@ -1329,7 +1442,7 @@ export class ChatApi extends BaseApi {
|
|
|
1329
1442
|
type: request?.type,
|
|
1330
1443
|
};
|
|
1331
1444
|
|
|
1332
|
-
const response = await this.sendRequest<
|
|
1445
|
+
const response = await this.apiClient.sendRequest<
|
|
1333
1446
|
StreamResponse<DeleteReactionResponse>
|
|
1334
1447
|
>(
|
|
1335
1448
|
'DELETE',
|
|
@@ -1341,13 +1454,13 @@ export class ChatApi extends BaseApi {
|
|
|
1341
1454
|
decoders.DeleteReactionResponse?.(response.body);
|
|
1342
1455
|
|
|
1343
1456
|
return { ...response.body, metadata: response.metadata };
|
|
1344
|
-
}
|
|
1457
|
+
}
|
|
1345
1458
|
|
|
1346
|
-
|
|
1459
|
+
async getReactions(request: {
|
|
1347
1460
|
id: string;
|
|
1348
1461
|
limit?: number;
|
|
1349
1462
|
offset?: number;
|
|
1350
|
-
}): Promise<StreamResponse<GetReactionsResponse>>
|
|
1463
|
+
}): Promise<StreamResponse<GetReactionsResponse>> {
|
|
1351
1464
|
const queryParams = {
|
|
1352
1465
|
limit: request?.limit,
|
|
1353
1466
|
offset: request?.offset,
|
|
@@ -1356,18 +1469,18 @@ export class ChatApi extends BaseApi {
|
|
|
1356
1469
|
id: request?.id,
|
|
1357
1470
|
};
|
|
1358
1471
|
|
|
1359
|
-
const response = await this.sendRequest<
|
|
1472
|
+
const response = await this.apiClient.sendRequest<
|
|
1360
1473
|
StreamResponse<GetReactionsResponse>
|
|
1361
1474
|
>('GET', '/api/v2/chat/messages/{id}/reactions', pathParams, queryParams);
|
|
1362
1475
|
|
|
1363
1476
|
decoders.GetReactionsResponse?.(response.body);
|
|
1364
1477
|
|
|
1365
1478
|
return { ...response.body, metadata: response.metadata };
|
|
1366
|
-
}
|
|
1479
|
+
}
|
|
1367
1480
|
|
|
1368
|
-
|
|
1481
|
+
async queryReactions(
|
|
1369
1482
|
request: QueryReactionsRequest & { id: string },
|
|
1370
|
-
): Promise<StreamResponse<QueryReactionsResponse>>
|
|
1483
|
+
): Promise<StreamResponse<QueryReactionsResponse>> {
|
|
1371
1484
|
const pathParams = {
|
|
1372
1485
|
id: request?.id,
|
|
1373
1486
|
};
|
|
@@ -1381,7 +1494,7 @@ export class ChatApi extends BaseApi {
|
|
|
1381
1494
|
user: request?.user,
|
|
1382
1495
|
};
|
|
1383
1496
|
|
|
1384
|
-
const response = await this.sendRequest<
|
|
1497
|
+
const response = await this.apiClient.sendRequest<
|
|
1385
1498
|
StreamResponse<QueryReactionsResponse>
|
|
1386
1499
|
>(
|
|
1387
1500
|
'POST',
|
|
@@ -1389,16 +1502,17 @@ export class ChatApi extends BaseApi {
|
|
|
1389
1502
|
pathParams,
|
|
1390
1503
|
undefined,
|
|
1391
1504
|
body,
|
|
1505
|
+
'application/json',
|
|
1392
1506
|
);
|
|
1393
1507
|
|
|
1394
1508
|
decoders.QueryReactionsResponse?.(response.body);
|
|
1395
1509
|
|
|
1396
1510
|
return { ...response.body, metadata: response.metadata };
|
|
1397
|
-
}
|
|
1511
|
+
}
|
|
1398
1512
|
|
|
1399
|
-
|
|
1513
|
+
async translateMessage(
|
|
1400
1514
|
request: TranslateMessageRequest & { id: string },
|
|
1401
|
-
): Promise<StreamResponse<MessageResponse>>
|
|
1515
|
+
): Promise<StreamResponse<MessageResponse>> {
|
|
1402
1516
|
const pathParams = {
|
|
1403
1517
|
id: request?.id,
|
|
1404
1518
|
};
|
|
@@ -1406,22 +1520,25 @@ export class ChatApi extends BaseApi {
|
|
|
1406
1520
|
language: request?.language,
|
|
1407
1521
|
};
|
|
1408
1522
|
|
|
1409
|
-
const response = await this.sendRequest<
|
|
1523
|
+
const response = await this.apiClient.sendRequest<
|
|
1524
|
+
StreamResponse<MessageResponse>
|
|
1525
|
+
>(
|
|
1410
1526
|
'POST',
|
|
1411
1527
|
'/api/v2/chat/messages/{id}/translate',
|
|
1412
1528
|
pathParams,
|
|
1413
1529
|
undefined,
|
|
1414
1530
|
body,
|
|
1531
|
+
'application/json',
|
|
1415
1532
|
);
|
|
1416
1533
|
|
|
1417
1534
|
decoders.MessageResponse?.(response.body);
|
|
1418
1535
|
|
|
1419
1536
|
return { ...response.body, metadata: response.metadata };
|
|
1420
|
-
}
|
|
1537
|
+
}
|
|
1421
1538
|
|
|
1422
|
-
|
|
1539
|
+
async undeleteMessage(
|
|
1423
1540
|
request: UpdateMessageRequest & { id: string },
|
|
1424
|
-
): Promise<StreamResponse<UpdateMessageResponse>>
|
|
1541
|
+
): Promise<StreamResponse<UpdateMessageResponse>> {
|
|
1425
1542
|
const pathParams = {
|
|
1426
1543
|
id: request?.id,
|
|
1427
1544
|
};
|
|
@@ -1431,7 +1548,7 @@ export class ChatApi extends BaseApi {
|
|
|
1431
1548
|
skip_push: request?.skip_push,
|
|
1432
1549
|
};
|
|
1433
1550
|
|
|
1434
|
-
const response = await this.sendRequest<
|
|
1551
|
+
const response = await this.apiClient.sendRequest<
|
|
1435
1552
|
StreamResponse<UpdateMessageResponse>
|
|
1436
1553
|
>(
|
|
1437
1554
|
'POST',
|
|
@@ -1439,16 +1556,17 @@ export class ChatApi extends BaseApi {
|
|
|
1439
1556
|
pathParams,
|
|
1440
1557
|
undefined,
|
|
1441
1558
|
body,
|
|
1559
|
+
'application/json',
|
|
1442
1560
|
);
|
|
1443
1561
|
|
|
1444
1562
|
decoders.UpdateMessageResponse?.(response.body);
|
|
1445
1563
|
|
|
1446
1564
|
return { ...response.body, metadata: response.metadata };
|
|
1447
|
-
}
|
|
1565
|
+
}
|
|
1448
1566
|
|
|
1449
|
-
|
|
1567
|
+
async castPollVote(
|
|
1450
1568
|
request: CastPollVoteRequest & { message_id: string; poll_id: string },
|
|
1451
|
-
): Promise<StreamResponse<PollVoteResponse>>
|
|
1569
|
+
): Promise<StreamResponse<PollVoteResponse>> {
|
|
1452
1570
|
const pathParams = {
|
|
1453
1571
|
message_id: request?.message_id,
|
|
1454
1572
|
poll_id: request?.poll_id,
|
|
@@ -1459,25 +1577,28 @@ export class ChatApi extends BaseApi {
|
|
|
1459
1577
|
vote: request?.vote,
|
|
1460
1578
|
};
|
|
1461
1579
|
|
|
1462
|
-
const response = await this.sendRequest<
|
|
1580
|
+
const response = await this.apiClient.sendRequest<
|
|
1581
|
+
StreamResponse<PollVoteResponse>
|
|
1582
|
+
>(
|
|
1463
1583
|
'POST',
|
|
1464
1584
|
'/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote',
|
|
1465
1585
|
pathParams,
|
|
1466
1586
|
undefined,
|
|
1467
1587
|
body,
|
|
1588
|
+
'application/json',
|
|
1468
1589
|
);
|
|
1469
1590
|
|
|
1470
1591
|
decoders.PollVoteResponse?.(response.body);
|
|
1471
1592
|
|
|
1472
1593
|
return { ...response.body, metadata: response.metadata };
|
|
1473
|
-
}
|
|
1594
|
+
}
|
|
1474
1595
|
|
|
1475
|
-
|
|
1596
|
+
async deletePollVote(request: {
|
|
1476
1597
|
message_id: string;
|
|
1477
1598
|
poll_id: string;
|
|
1478
1599
|
vote_id: string;
|
|
1479
1600
|
user_id?: string;
|
|
1480
|
-
}): Promise<StreamResponse<PollVoteResponse>>
|
|
1601
|
+
}): Promise<StreamResponse<PollVoteResponse>> {
|
|
1481
1602
|
const queryParams = {
|
|
1482
1603
|
user_id: request?.user_id,
|
|
1483
1604
|
};
|
|
@@ -1487,7 +1608,9 @@ export class ChatApi extends BaseApi {
|
|
|
1487
1608
|
vote_id: request?.vote_id,
|
|
1488
1609
|
};
|
|
1489
1610
|
|
|
1490
|
-
const response = await this.sendRequest<
|
|
1611
|
+
const response = await this.apiClient.sendRequest<
|
|
1612
|
+
StreamResponse<PollVoteResponse>
|
|
1613
|
+
>(
|
|
1491
1614
|
'DELETE',
|
|
1492
1615
|
'/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}',
|
|
1493
1616
|
pathParams,
|
|
@@ -1497,12 +1620,12 @@ export class ChatApi extends BaseApi {
|
|
|
1497
1620
|
decoders.PollVoteResponse?.(response.body);
|
|
1498
1621
|
|
|
1499
1622
|
return { ...response.body, metadata: response.metadata };
|
|
1500
|
-
}
|
|
1623
|
+
}
|
|
1501
1624
|
|
|
1502
|
-
|
|
1625
|
+
async deleteReminder(request: {
|
|
1503
1626
|
message_id: string;
|
|
1504
1627
|
user_id?: string;
|
|
1505
|
-
}): Promise<StreamResponse<DeleteReminderResponse>>
|
|
1628
|
+
}): Promise<StreamResponse<DeleteReminderResponse>> {
|
|
1506
1629
|
const queryParams = {
|
|
1507
1630
|
user_id: request?.user_id,
|
|
1508
1631
|
};
|
|
@@ -1510,7 +1633,7 @@ export class ChatApi extends BaseApi {
|
|
|
1510
1633
|
message_id: request?.message_id,
|
|
1511
1634
|
};
|
|
1512
1635
|
|
|
1513
|
-
const response = await this.sendRequest<
|
|
1636
|
+
const response = await this.apiClient.sendRequest<
|
|
1514
1637
|
StreamResponse<DeleteReminderResponse>
|
|
1515
1638
|
>(
|
|
1516
1639
|
'DELETE',
|
|
@@ -1522,11 +1645,11 @@ export class ChatApi extends BaseApi {
|
|
|
1522
1645
|
decoders.DeleteReminderResponse?.(response.body);
|
|
1523
1646
|
|
|
1524
1647
|
return { ...response.body, metadata: response.metadata };
|
|
1525
|
-
}
|
|
1648
|
+
}
|
|
1526
1649
|
|
|
1527
|
-
|
|
1650
|
+
async updateReminder(
|
|
1528
1651
|
request: UpdateReminderRequest & { message_id: string },
|
|
1529
|
-
): Promise<StreamResponse<UpdateReminderResponse>>
|
|
1652
|
+
): Promise<StreamResponse<UpdateReminderResponse>> {
|
|
1530
1653
|
const pathParams = {
|
|
1531
1654
|
message_id: request?.message_id,
|
|
1532
1655
|
};
|
|
@@ -1536,7 +1659,7 @@ export class ChatApi extends BaseApi {
|
|
|
1536
1659
|
user: request?.user,
|
|
1537
1660
|
};
|
|
1538
1661
|
|
|
1539
|
-
const response = await this.sendRequest<
|
|
1662
|
+
const response = await this.apiClient.sendRequest<
|
|
1540
1663
|
StreamResponse<UpdateReminderResponse>
|
|
1541
1664
|
>(
|
|
1542
1665
|
'PATCH',
|
|
@@ -1544,16 +1667,17 @@ export class ChatApi extends BaseApi {
|
|
|
1544
1667
|
pathParams,
|
|
1545
1668
|
undefined,
|
|
1546
1669
|
body,
|
|
1670
|
+
'application/json',
|
|
1547
1671
|
);
|
|
1548
1672
|
|
|
1549
1673
|
decoders.UpdateReminderResponse?.(response.body);
|
|
1550
1674
|
|
|
1551
1675
|
return { ...response.body, metadata: response.metadata };
|
|
1552
|
-
}
|
|
1676
|
+
}
|
|
1553
1677
|
|
|
1554
|
-
|
|
1678
|
+
async createReminder(
|
|
1555
1679
|
request: CreateReminderRequest & { message_id: string },
|
|
1556
|
-
): Promise<StreamResponse<ReminderResponseData>>
|
|
1680
|
+
): Promise<StreamResponse<ReminderResponseData>> {
|
|
1557
1681
|
const pathParams = {
|
|
1558
1682
|
message_id: request?.message_id,
|
|
1559
1683
|
};
|
|
@@ -1563,7 +1687,7 @@ export class ChatApi extends BaseApi {
|
|
|
1563
1687
|
user: request?.user,
|
|
1564
1688
|
};
|
|
1565
1689
|
|
|
1566
|
-
const response = await this.sendRequest<
|
|
1690
|
+
const response = await this.apiClient.sendRequest<
|
|
1567
1691
|
StreamResponse<ReminderResponseData>
|
|
1568
1692
|
>(
|
|
1569
1693
|
'POST',
|
|
@@ -1571,14 +1695,15 @@ export class ChatApi extends BaseApi {
|
|
|
1571
1695
|
pathParams,
|
|
1572
1696
|
undefined,
|
|
1573
1697
|
body,
|
|
1698
|
+
'application/json',
|
|
1574
1699
|
);
|
|
1575
1700
|
|
|
1576
1701
|
decoders.ReminderResponseData?.(response.body);
|
|
1577
1702
|
|
|
1578
1703
|
return { ...response.body, metadata: response.metadata };
|
|
1579
|
-
}
|
|
1704
|
+
}
|
|
1580
1705
|
|
|
1581
|
-
|
|
1706
|
+
async getReplies(request: {
|
|
1582
1707
|
parent_id: string;
|
|
1583
1708
|
limit?: number;
|
|
1584
1709
|
offset?: number;
|
|
@@ -1593,7 +1718,7 @@ export class ChatApi extends BaseApi {
|
|
|
1593
1718
|
id_around?: string;
|
|
1594
1719
|
created_at_around?: Date;
|
|
1595
1720
|
sort?: SortParamRequest[];
|
|
1596
|
-
}): Promise<StreamResponse<GetRepliesResponse>>
|
|
1721
|
+
}): Promise<StreamResponse<GetRepliesResponse>> {
|
|
1597
1722
|
const queryParams = {
|
|
1598
1723
|
limit: request?.limit,
|
|
1599
1724
|
offset: request?.offset,
|
|
@@ -1613,7 +1738,9 @@ export class ChatApi extends BaseApi {
|
|
|
1613
1738
|
parent_id: request?.parent_id,
|
|
1614
1739
|
};
|
|
1615
1740
|
|
|
1616
|
-
const response = await this.sendRequest<
|
|
1741
|
+
const response = await this.apiClient.sendRequest<
|
|
1742
|
+
StreamResponse<GetRepliesResponse>
|
|
1743
|
+
>(
|
|
1617
1744
|
'GET',
|
|
1618
1745
|
'/api/v2/chat/messages/{parent_id}/replies',
|
|
1619
1746
|
pathParams,
|
|
@@ -1623,27 +1750,27 @@ export class ChatApi extends BaseApi {
|
|
|
1623
1750
|
decoders.GetRepliesResponse?.(response.body);
|
|
1624
1751
|
|
|
1625
1752
|
return { ...response.body, metadata: response.metadata };
|
|
1626
|
-
}
|
|
1753
|
+
}
|
|
1627
1754
|
|
|
1628
|
-
|
|
1755
|
+
async queryMessageFlags(request?: {
|
|
1629
1756
|
payload?: QueryMessageFlagsPayload;
|
|
1630
|
-
}): Promise<StreamResponse<QueryMessageFlagsResponse>>
|
|
1757
|
+
}): Promise<StreamResponse<QueryMessageFlagsResponse>> {
|
|
1631
1758
|
const queryParams = {
|
|
1632
1759
|
payload: request?.payload,
|
|
1633
1760
|
};
|
|
1634
1761
|
|
|
1635
|
-
const response = await this.sendRequest<
|
|
1762
|
+
const response = await this.apiClient.sendRequest<
|
|
1636
1763
|
StreamResponse<QueryMessageFlagsResponse>
|
|
1637
1764
|
>('GET', '/api/v2/chat/moderation/flags/message', undefined, queryParams);
|
|
1638
1765
|
|
|
1639
1766
|
decoders.QueryMessageFlagsResponse?.(response.body);
|
|
1640
1767
|
|
|
1641
1768
|
return { ...response.body, metadata: response.metadata };
|
|
1642
|
-
}
|
|
1769
|
+
}
|
|
1643
1770
|
|
|
1644
|
-
|
|
1771
|
+
async muteChannel(
|
|
1645
1772
|
request?: MuteChannelRequest,
|
|
1646
|
-
): Promise<StreamResponse<MuteChannelResponse>>
|
|
1773
|
+
): Promise<StreamResponse<MuteChannelResponse>> {
|
|
1647
1774
|
const body = {
|
|
1648
1775
|
expiration: request?.expiration,
|
|
1649
1776
|
user_id: request?.user_id,
|
|
@@ -1651,7 +1778,7 @@ export class ChatApi extends BaseApi {
|
|
|
1651
1778
|
user: request?.user,
|
|
1652
1779
|
};
|
|
1653
1780
|
|
|
1654
|
-
const response = await this.sendRequest<
|
|
1781
|
+
const response = await this.apiClient.sendRequest<
|
|
1655
1782
|
StreamResponse<MuteChannelResponse>
|
|
1656
1783
|
>(
|
|
1657
1784
|
'POST',
|
|
@@ -1659,16 +1786,17 @@ export class ChatApi extends BaseApi {
|
|
|
1659
1786
|
undefined,
|
|
1660
1787
|
undefined,
|
|
1661
1788
|
body,
|
|
1789
|
+
'application/json',
|
|
1662
1790
|
);
|
|
1663
1791
|
|
|
1664
1792
|
decoders.MuteChannelResponse?.(response.body);
|
|
1665
1793
|
|
|
1666
1794
|
return { ...response.body, metadata: response.metadata };
|
|
1667
|
-
}
|
|
1795
|
+
}
|
|
1668
1796
|
|
|
1669
|
-
|
|
1797
|
+
async unmuteChannel(
|
|
1670
1798
|
request?: UnmuteChannelRequest,
|
|
1671
|
-
): Promise<StreamResponse<UnmuteResponse>>
|
|
1799
|
+
): Promise<StreamResponse<UnmuteResponse>> {
|
|
1672
1800
|
const body = {
|
|
1673
1801
|
expiration: request?.expiration,
|
|
1674
1802
|
user_id: request?.user_id,
|
|
@@ -1676,353 +1804,66 @@ export class ChatApi extends BaseApi {
|
|
|
1676
1804
|
user: request?.user,
|
|
1677
1805
|
};
|
|
1678
1806
|
|
|
1679
|
-
const response = await this.sendRequest<
|
|
1807
|
+
const response = await this.apiClient.sendRequest<
|
|
1808
|
+
StreamResponse<UnmuteResponse>
|
|
1809
|
+
>(
|
|
1680
1810
|
'POST',
|
|
1681
1811
|
'/api/v2/chat/moderation/unmute/channel',
|
|
1682
1812
|
undefined,
|
|
1683
1813
|
undefined,
|
|
1684
1814
|
body,
|
|
1815
|
+
'application/json',
|
|
1685
1816
|
);
|
|
1686
1817
|
|
|
1687
1818
|
decoders.UnmuteResponse?.(response.body);
|
|
1688
1819
|
|
|
1689
1820
|
return { ...response.body, metadata: response.metadata };
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
createPoll = async (
|
|
1693
|
-
request: CreatePollRequest,
|
|
1694
|
-
): Promise<StreamResponse<PollResponse>> => {
|
|
1695
|
-
const body = {
|
|
1696
|
-
name: request?.name,
|
|
1697
|
-
allow_answers: request?.allow_answers,
|
|
1698
|
-
allow_user_suggested_options: request?.allow_user_suggested_options,
|
|
1699
|
-
description: request?.description,
|
|
1700
|
-
enforce_unique_vote: request?.enforce_unique_vote,
|
|
1701
|
-
id: request?.id,
|
|
1702
|
-
is_closed: request?.is_closed,
|
|
1703
|
-
max_votes_allowed: request?.max_votes_allowed,
|
|
1704
|
-
user_id: request?.user_id,
|
|
1705
|
-
voting_visibility: request?.voting_visibility,
|
|
1706
|
-
options: request?.options,
|
|
1707
|
-
custom: request?.custom,
|
|
1708
|
-
user: request?.user,
|
|
1709
|
-
};
|
|
1710
|
-
|
|
1711
|
-
const response = await this.sendRequest<StreamResponse<PollResponse>>(
|
|
1712
|
-
'POST',
|
|
1713
|
-
'/api/v2/chat/polls',
|
|
1714
|
-
undefined,
|
|
1715
|
-
undefined,
|
|
1716
|
-
body,
|
|
1717
|
-
);
|
|
1718
|
-
|
|
1719
|
-
decoders.PollResponse?.(response.body);
|
|
1720
|
-
|
|
1721
|
-
return { ...response.body, metadata: response.metadata };
|
|
1722
|
-
};
|
|
1723
|
-
|
|
1724
|
-
updatePoll = async (
|
|
1725
|
-
request: UpdatePollRequest,
|
|
1726
|
-
): Promise<StreamResponse<PollResponse>> => {
|
|
1727
|
-
const body = {
|
|
1728
|
-
id: request?.id,
|
|
1729
|
-
name: request?.name,
|
|
1730
|
-
allow_answers: request?.allow_answers,
|
|
1731
|
-
allow_user_suggested_options: request?.allow_user_suggested_options,
|
|
1732
|
-
description: request?.description,
|
|
1733
|
-
enforce_unique_vote: request?.enforce_unique_vote,
|
|
1734
|
-
is_closed: request?.is_closed,
|
|
1735
|
-
max_votes_allowed: request?.max_votes_allowed,
|
|
1736
|
-
user_id: request?.user_id,
|
|
1737
|
-
voting_visibility: request?.voting_visibility,
|
|
1738
|
-
options: request?.options,
|
|
1739
|
-
custom: request?.custom,
|
|
1740
|
-
user: request?.user,
|
|
1741
|
-
};
|
|
1742
|
-
|
|
1743
|
-
const response = await this.sendRequest<StreamResponse<PollResponse>>(
|
|
1744
|
-
'PUT',
|
|
1745
|
-
'/api/v2/chat/polls',
|
|
1746
|
-
undefined,
|
|
1747
|
-
undefined,
|
|
1748
|
-
body,
|
|
1749
|
-
);
|
|
1750
|
-
|
|
1751
|
-
decoders.PollResponse?.(response.body);
|
|
1752
|
-
|
|
1753
|
-
return { ...response.body, metadata: response.metadata };
|
|
1754
|
-
};
|
|
1755
|
-
|
|
1756
|
-
queryPolls = async (
|
|
1757
|
-
request?: QueryPollsRequest & { user_id?: string },
|
|
1758
|
-
): Promise<StreamResponse<QueryPollsResponse>> => {
|
|
1759
|
-
const queryParams = {
|
|
1760
|
-
user_id: request?.user_id,
|
|
1761
|
-
};
|
|
1762
|
-
const body = {
|
|
1763
|
-
limit: request?.limit,
|
|
1764
|
-
next: request?.next,
|
|
1765
|
-
prev: request?.prev,
|
|
1766
|
-
sort: request?.sort,
|
|
1767
|
-
filter: request?.filter,
|
|
1768
|
-
};
|
|
1769
|
-
|
|
1770
|
-
const response = await this.sendRequest<StreamResponse<QueryPollsResponse>>(
|
|
1771
|
-
'POST',
|
|
1772
|
-
'/api/v2/chat/polls/query',
|
|
1773
|
-
undefined,
|
|
1774
|
-
queryParams,
|
|
1775
|
-
body,
|
|
1776
|
-
);
|
|
1777
|
-
|
|
1778
|
-
decoders.QueryPollsResponse?.(response.body);
|
|
1779
|
-
|
|
1780
|
-
return { ...response.body, metadata: response.metadata };
|
|
1781
|
-
};
|
|
1782
|
-
|
|
1783
|
-
deletePoll = async (request: {
|
|
1784
|
-
poll_id: string;
|
|
1785
|
-
user_id?: string;
|
|
1786
|
-
}): Promise<StreamResponse<Response>> => {
|
|
1787
|
-
const queryParams = {
|
|
1788
|
-
user_id: request?.user_id,
|
|
1789
|
-
};
|
|
1790
|
-
const pathParams = {
|
|
1791
|
-
poll_id: request?.poll_id,
|
|
1792
|
-
};
|
|
1793
|
-
|
|
1794
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
1795
|
-
'DELETE',
|
|
1796
|
-
'/api/v2/chat/polls/{poll_id}',
|
|
1797
|
-
pathParams,
|
|
1798
|
-
queryParams,
|
|
1799
|
-
);
|
|
1800
|
-
|
|
1801
|
-
decoders.Response?.(response.body);
|
|
1802
|
-
|
|
1803
|
-
return { ...response.body, metadata: response.metadata };
|
|
1804
|
-
};
|
|
1805
|
-
|
|
1806
|
-
getPoll = async (request: {
|
|
1807
|
-
poll_id: string;
|
|
1808
|
-
user_id?: string;
|
|
1809
|
-
}): Promise<StreamResponse<PollResponse>> => {
|
|
1810
|
-
const queryParams = {
|
|
1811
|
-
user_id: request?.user_id,
|
|
1812
|
-
};
|
|
1813
|
-
const pathParams = {
|
|
1814
|
-
poll_id: request?.poll_id,
|
|
1815
|
-
};
|
|
1816
|
-
|
|
1817
|
-
const response = await this.sendRequest<StreamResponse<PollResponse>>(
|
|
1818
|
-
'GET',
|
|
1819
|
-
'/api/v2/chat/polls/{poll_id}',
|
|
1820
|
-
pathParams,
|
|
1821
|
-
queryParams,
|
|
1822
|
-
);
|
|
1823
|
-
|
|
1824
|
-
decoders.PollResponse?.(response.body);
|
|
1825
|
-
|
|
1826
|
-
return { ...response.body, metadata: response.metadata };
|
|
1827
|
-
};
|
|
1828
|
-
|
|
1829
|
-
updatePollPartial = async (
|
|
1830
|
-
request: UpdatePollPartialRequest & { poll_id: string },
|
|
1831
|
-
): Promise<StreamResponse<PollResponse>> => {
|
|
1832
|
-
const pathParams = {
|
|
1833
|
-
poll_id: request?.poll_id,
|
|
1834
|
-
};
|
|
1835
|
-
const body = {
|
|
1836
|
-
user_id: request?.user_id,
|
|
1837
|
-
unset: request?.unset,
|
|
1838
|
-
set: request?.set,
|
|
1839
|
-
user: request?.user,
|
|
1840
|
-
};
|
|
1821
|
+
}
|
|
1841
1822
|
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
pathParams,
|
|
1846
|
-
undefined,
|
|
1847
|
-
body,
|
|
1848
|
-
);
|
|
1849
|
-
|
|
1850
|
-
decoders.PollResponse?.(response.body);
|
|
1851
|
-
|
|
1852
|
-
return { ...response.body, metadata: response.metadata };
|
|
1853
|
-
};
|
|
1854
|
-
|
|
1855
|
-
createPollOption = async (
|
|
1856
|
-
request: CreatePollOptionRequest & { poll_id: string },
|
|
1857
|
-
): Promise<StreamResponse<PollOptionResponse>> => {
|
|
1858
|
-
const pathParams = {
|
|
1859
|
-
poll_id: request?.poll_id,
|
|
1860
|
-
};
|
|
1823
|
+
async updatePushNotificationPreferences(
|
|
1824
|
+
request: UpsertPushPreferencesRequest,
|
|
1825
|
+
): Promise<StreamResponse<UpsertPushPreferencesResponse>> {
|
|
1861
1826
|
const body = {
|
|
1862
|
-
|
|
1863
|
-
position: request?.position,
|
|
1864
|
-
user_id: request?.user_id,
|
|
1865
|
-
custom: request?.custom,
|
|
1866
|
-
user: request?.user,
|
|
1827
|
+
preferences: request?.preferences,
|
|
1867
1828
|
};
|
|
1868
1829
|
|
|
1869
|
-
const response = await this.sendRequest<
|
|
1830
|
+
const response = await this.apiClient.sendRequest<
|
|
1831
|
+
StreamResponse<UpsertPushPreferencesResponse>
|
|
1832
|
+
>(
|
|
1870
1833
|
'POST',
|
|
1871
|
-
'/api/v2/chat/
|
|
1872
|
-
pathParams,
|
|
1834
|
+
'/api/v2/chat/push_preferences',
|
|
1873
1835
|
undefined,
|
|
1874
|
-
body,
|
|
1875
|
-
);
|
|
1876
|
-
|
|
1877
|
-
decoders.PollOptionResponse?.(response.body);
|
|
1878
|
-
|
|
1879
|
-
return { ...response.body, metadata: response.metadata };
|
|
1880
|
-
};
|
|
1881
|
-
|
|
1882
|
-
updatePollOption = async (
|
|
1883
|
-
request: UpdatePollOptionRequest & { poll_id: string },
|
|
1884
|
-
): Promise<StreamResponse<PollOptionResponse>> => {
|
|
1885
|
-
const pathParams = {
|
|
1886
|
-
poll_id: request?.poll_id,
|
|
1887
|
-
};
|
|
1888
|
-
const body = {
|
|
1889
|
-
id: request?.id,
|
|
1890
|
-
text: request?.text,
|
|
1891
|
-
user_id: request?.user_id,
|
|
1892
|
-
custom: request?.custom,
|
|
1893
|
-
user: request?.user,
|
|
1894
|
-
};
|
|
1895
|
-
|
|
1896
|
-
const response = await this.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
1897
|
-
'PUT',
|
|
1898
|
-
'/api/v2/chat/polls/{poll_id}/options',
|
|
1899
|
-
pathParams,
|
|
1900
1836
|
undefined,
|
|
1901
1837
|
body,
|
|
1838
|
+
'application/json',
|
|
1902
1839
|
);
|
|
1903
1840
|
|
|
1904
|
-
decoders.PollOptionResponse?.(response.body);
|
|
1905
|
-
|
|
1906
|
-
return { ...response.body, metadata: response.metadata };
|
|
1907
|
-
};
|
|
1908
|
-
|
|
1909
|
-
deletePollOption = async (request: {
|
|
1910
|
-
poll_id: string;
|
|
1911
|
-
option_id: string;
|
|
1912
|
-
user_id?: string;
|
|
1913
|
-
}): Promise<StreamResponse<Response>> => {
|
|
1914
|
-
const queryParams = {
|
|
1915
|
-
user_id: request?.user_id,
|
|
1916
|
-
};
|
|
1917
|
-
const pathParams = {
|
|
1918
|
-
poll_id: request?.poll_id,
|
|
1919
|
-
option_id: request?.option_id,
|
|
1920
|
-
};
|
|
1921
|
-
|
|
1922
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
1923
|
-
'DELETE',
|
|
1924
|
-
'/api/v2/chat/polls/{poll_id}/options/{option_id}',
|
|
1925
|
-
pathParams,
|
|
1926
|
-
queryParams,
|
|
1927
|
-
);
|
|
1928
|
-
|
|
1929
|
-
decoders.Response?.(response.body);
|
|
1930
|
-
|
|
1931
|
-
return { ...response.body, metadata: response.metadata };
|
|
1932
|
-
};
|
|
1933
|
-
|
|
1934
|
-
getPollOption = async (request: {
|
|
1935
|
-
poll_id: string;
|
|
1936
|
-
option_id: string;
|
|
1937
|
-
user_id?: string;
|
|
1938
|
-
}): Promise<StreamResponse<PollOptionResponse>> => {
|
|
1939
|
-
const queryParams = {
|
|
1940
|
-
user_id: request?.user_id,
|
|
1941
|
-
};
|
|
1942
|
-
const pathParams = {
|
|
1943
|
-
poll_id: request?.poll_id,
|
|
1944
|
-
option_id: request?.option_id,
|
|
1945
|
-
};
|
|
1946
|
-
|
|
1947
|
-
const response = await this.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
1948
|
-
'GET',
|
|
1949
|
-
'/api/v2/chat/polls/{poll_id}/options/{option_id}',
|
|
1950
|
-
pathParams,
|
|
1951
|
-
queryParams,
|
|
1952
|
-
);
|
|
1953
|
-
|
|
1954
|
-
decoders.PollOptionResponse?.(response.body);
|
|
1955
|
-
|
|
1956
|
-
return { ...response.body, metadata: response.metadata };
|
|
1957
|
-
};
|
|
1958
|
-
|
|
1959
|
-
queryPollVotes = async (
|
|
1960
|
-
request: QueryPollVotesRequest & { poll_id: string; user_id?: string },
|
|
1961
|
-
): Promise<StreamResponse<PollVotesResponse>> => {
|
|
1962
|
-
const queryParams = {
|
|
1963
|
-
user_id: request?.user_id,
|
|
1964
|
-
};
|
|
1965
|
-
const pathParams = {
|
|
1966
|
-
poll_id: request?.poll_id,
|
|
1967
|
-
};
|
|
1968
|
-
const body = {
|
|
1969
|
-
limit: request?.limit,
|
|
1970
|
-
next: request?.next,
|
|
1971
|
-
prev: request?.prev,
|
|
1972
|
-
sort: request?.sort,
|
|
1973
|
-
filter: request?.filter,
|
|
1974
|
-
};
|
|
1975
|
-
|
|
1976
|
-
const response = await this.sendRequest<StreamResponse<PollVotesResponse>>(
|
|
1977
|
-
'POST',
|
|
1978
|
-
'/api/v2/chat/polls/{poll_id}/votes',
|
|
1979
|
-
pathParams,
|
|
1980
|
-
queryParams,
|
|
1981
|
-
body,
|
|
1982
|
-
);
|
|
1983
|
-
|
|
1984
|
-
decoders.PollVotesResponse?.(response.body);
|
|
1985
|
-
|
|
1986
|
-
return { ...response.body, metadata: response.metadata };
|
|
1987
|
-
};
|
|
1988
|
-
|
|
1989
|
-
updatePushNotificationPreferences = async (
|
|
1990
|
-
request: UpsertPushPreferencesRequest,
|
|
1991
|
-
): Promise<StreamResponse<UpsertPushPreferencesResponse>> => {
|
|
1992
|
-
const body = {
|
|
1993
|
-
preferences: request?.preferences,
|
|
1994
|
-
};
|
|
1995
|
-
|
|
1996
|
-
const response = await this.sendRequest<
|
|
1997
|
-
StreamResponse<UpsertPushPreferencesResponse>
|
|
1998
|
-
>('POST', '/api/v2/chat/push_preferences', undefined, undefined, body);
|
|
1999
|
-
|
|
2000
1841
|
decoders.UpsertPushPreferencesResponse?.(response.body);
|
|
2001
1842
|
|
|
2002
1843
|
return { ...response.body, metadata: response.metadata };
|
|
2003
|
-
}
|
|
1844
|
+
}
|
|
2004
1845
|
|
|
2005
|
-
|
|
1846
|
+
async getPushTemplates(request: {
|
|
2006
1847
|
push_provider_type: string;
|
|
2007
1848
|
push_provider_name?: string;
|
|
2008
|
-
}): Promise<StreamResponse<GetPushTemplatesResponse>>
|
|
1849
|
+
}): Promise<StreamResponse<GetPushTemplatesResponse>> {
|
|
2009
1850
|
const queryParams = {
|
|
2010
1851
|
push_provider_type: request?.push_provider_type,
|
|
2011
1852
|
push_provider_name: request?.push_provider_name,
|
|
2012
1853
|
};
|
|
2013
1854
|
|
|
2014
|
-
const response = await this.sendRequest<
|
|
1855
|
+
const response = await this.apiClient.sendRequest<
|
|
2015
1856
|
StreamResponse<GetPushTemplatesResponse>
|
|
2016
1857
|
>('GET', '/api/v2/chat/push_templates', undefined, queryParams);
|
|
2017
1858
|
|
|
2018
1859
|
decoders.GetPushTemplatesResponse?.(response.body);
|
|
2019
1860
|
|
|
2020
1861
|
return { ...response.body, metadata: response.metadata };
|
|
2021
|
-
}
|
|
1862
|
+
}
|
|
2022
1863
|
|
|
2023
|
-
|
|
1864
|
+
async upsertPushTemplate(
|
|
2024
1865
|
request: UpsertPushTemplateRequest,
|
|
2025
|
-
): Promise<StreamResponse<UpsertPushTemplateResponse>>
|
|
1866
|
+
): Promise<StreamResponse<UpsertPushTemplateResponse>> {
|
|
2026
1867
|
const body = {
|
|
2027
1868
|
event_type: request?.event_type,
|
|
2028
1869
|
push_provider_type: request?.push_provider_type,
|
|
@@ -2031,34 +1872,41 @@ export class ChatApi extends BaseApi {
|
|
|
2031
1872
|
template: request?.template,
|
|
2032
1873
|
};
|
|
2033
1874
|
|
|
2034
|
-
const response = await this.sendRequest<
|
|
1875
|
+
const response = await this.apiClient.sendRequest<
|
|
2035
1876
|
StreamResponse<UpsertPushTemplateResponse>
|
|
2036
|
-
>(
|
|
1877
|
+
>(
|
|
1878
|
+
'POST',
|
|
1879
|
+
'/api/v2/chat/push_templates',
|
|
1880
|
+
undefined,
|
|
1881
|
+
undefined,
|
|
1882
|
+
body,
|
|
1883
|
+
'application/json',
|
|
1884
|
+
);
|
|
2037
1885
|
|
|
2038
1886
|
decoders.UpsertPushTemplateResponse?.(response.body);
|
|
2039
1887
|
|
|
2040
1888
|
return { ...response.body, metadata: response.metadata };
|
|
2041
|
-
}
|
|
1889
|
+
}
|
|
2042
1890
|
|
|
2043
|
-
|
|
1891
|
+
async queryBannedUsers(request?: {
|
|
2044
1892
|
payload?: QueryBannedUsersPayload;
|
|
2045
|
-
}): Promise<StreamResponse<QueryBannedUsersResponse>>
|
|
1893
|
+
}): Promise<StreamResponse<QueryBannedUsersResponse>> {
|
|
2046
1894
|
const queryParams = {
|
|
2047
1895
|
payload: request?.payload,
|
|
2048
1896
|
};
|
|
2049
1897
|
|
|
2050
|
-
const response = await this.sendRequest<
|
|
1898
|
+
const response = await this.apiClient.sendRequest<
|
|
2051
1899
|
StreamResponse<QueryBannedUsersResponse>
|
|
2052
1900
|
>('GET', '/api/v2/chat/query_banned_users', undefined, queryParams);
|
|
2053
1901
|
|
|
2054
1902
|
decoders.QueryBannedUsersResponse?.(response.body);
|
|
2055
1903
|
|
|
2056
1904
|
return { ...response.body, metadata: response.metadata };
|
|
2057
|
-
}
|
|
1905
|
+
}
|
|
2058
1906
|
|
|
2059
|
-
|
|
1907
|
+
async queryReminders(
|
|
2060
1908
|
request?: QueryRemindersRequest,
|
|
2061
|
-
): Promise<StreamResponse<QueryRemindersResponse>>
|
|
1909
|
+
): Promise<StreamResponse<QueryRemindersResponse>> {
|
|
2062
1910
|
const body = {
|
|
2063
1911
|
limit: request?.limit,
|
|
2064
1912
|
next: request?.next,
|
|
@@ -2069,37 +1917,41 @@ export class ChatApi extends BaseApi {
|
|
|
2069
1917
|
user: request?.user,
|
|
2070
1918
|
};
|
|
2071
1919
|
|
|
2072
|
-
const response = await this.sendRequest<
|
|
1920
|
+
const response = await this.apiClient.sendRequest<
|
|
2073
1921
|
StreamResponse<QueryRemindersResponse>
|
|
2074
|
-
>(
|
|
1922
|
+
>(
|
|
1923
|
+
'POST',
|
|
1924
|
+
'/api/v2/chat/reminders/query',
|
|
1925
|
+
undefined,
|
|
1926
|
+
undefined,
|
|
1927
|
+
body,
|
|
1928
|
+
'application/json',
|
|
1929
|
+
);
|
|
2075
1930
|
|
|
2076
1931
|
decoders.QueryRemindersResponse?.(response.body);
|
|
2077
1932
|
|
|
2078
1933
|
return { ...response.body, metadata: response.metadata };
|
|
2079
|
-
}
|
|
1934
|
+
}
|
|
2080
1935
|
|
|
2081
|
-
|
|
1936
|
+
async search(request?: {
|
|
2082
1937
|
payload?: SearchPayload;
|
|
2083
|
-
}): Promise<StreamResponse<SearchResponse>>
|
|
1938
|
+
}): Promise<StreamResponse<SearchResponse>> {
|
|
2084
1939
|
const queryParams = {
|
|
2085
1940
|
payload: request?.payload,
|
|
2086
1941
|
};
|
|
2087
1942
|
|
|
2088
|
-
const response = await this.sendRequest<
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
undefined,
|
|
2092
|
-
queryParams,
|
|
2093
|
-
);
|
|
1943
|
+
const response = await this.apiClient.sendRequest<
|
|
1944
|
+
StreamResponse<SearchResponse>
|
|
1945
|
+
>('GET', '/api/v2/chat/search', undefined, queryParams);
|
|
2094
1946
|
|
|
2095
1947
|
decoders.SearchResponse?.(response.body);
|
|
2096
1948
|
|
|
2097
1949
|
return { ...response.body, metadata: response.metadata };
|
|
2098
|
-
}
|
|
1950
|
+
}
|
|
2099
1951
|
|
|
2100
|
-
|
|
1952
|
+
async querySegments(
|
|
2101
1953
|
request: QuerySegmentsRequest,
|
|
2102
|
-
): Promise<StreamResponse<QuerySegmentsResponse>>
|
|
1954
|
+
): Promise<StreamResponse<QuerySegmentsResponse>> {
|
|
2103
1955
|
const body = {
|
|
2104
1956
|
filter: request?.filter,
|
|
2105
1957
|
limit: request?.limit,
|
|
@@ -2108,23 +1960,30 @@ export class ChatApi extends BaseApi {
|
|
|
2108
1960
|
sort: request?.sort,
|
|
2109
1961
|
};
|
|
2110
1962
|
|
|
2111
|
-
const response = await this.sendRequest<
|
|
1963
|
+
const response = await this.apiClient.sendRequest<
|
|
2112
1964
|
StreamResponse<QuerySegmentsResponse>
|
|
2113
|
-
>(
|
|
1965
|
+
>(
|
|
1966
|
+
'POST',
|
|
1967
|
+
'/api/v2/chat/segments/query',
|
|
1968
|
+
undefined,
|
|
1969
|
+
undefined,
|
|
1970
|
+
body,
|
|
1971
|
+
'application/json',
|
|
1972
|
+
);
|
|
2114
1973
|
|
|
2115
1974
|
decoders.QuerySegmentsResponse?.(response.body);
|
|
2116
1975
|
|
|
2117
1976
|
return { ...response.body, metadata: response.metadata };
|
|
2118
|
-
}
|
|
1977
|
+
}
|
|
2119
1978
|
|
|
2120
|
-
|
|
1979
|
+
async deleteSegment(request: {
|
|
2121
1980
|
id: string;
|
|
2122
|
-
}): Promise<StreamResponse<Response>>
|
|
1981
|
+
}): Promise<StreamResponse<Response>> {
|
|
2123
1982
|
const pathParams = {
|
|
2124
1983
|
id: request?.id,
|
|
2125
1984
|
};
|
|
2126
1985
|
|
|
2127
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
1986
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2128
1987
|
'DELETE',
|
|
2129
1988
|
'/api/v2/chat/segments/{id}',
|
|
2130
1989
|
pathParams,
|
|
@@ -2134,30 +1993,27 @@ export class ChatApi extends BaseApi {
|
|
|
2134
1993
|
decoders.Response?.(response.body);
|
|
2135
1994
|
|
|
2136
1995
|
return { ...response.body, metadata: response.metadata };
|
|
2137
|
-
}
|
|
1996
|
+
}
|
|
2138
1997
|
|
|
2139
|
-
|
|
1998
|
+
async getSegment(request: {
|
|
2140
1999
|
id: string;
|
|
2141
|
-
}): Promise<StreamResponse<GetSegmentResponse>>
|
|
2000
|
+
}): Promise<StreamResponse<GetSegmentResponse>> {
|
|
2142
2001
|
const pathParams = {
|
|
2143
2002
|
id: request?.id,
|
|
2144
2003
|
};
|
|
2145
2004
|
|
|
2146
|
-
const response = await this.sendRequest<
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
pathParams,
|
|
2150
|
-
undefined,
|
|
2151
|
-
);
|
|
2005
|
+
const response = await this.apiClient.sendRequest<
|
|
2006
|
+
StreamResponse<GetSegmentResponse>
|
|
2007
|
+
>('GET', '/api/v2/chat/segments/{id}', pathParams, undefined);
|
|
2152
2008
|
|
|
2153
2009
|
decoders.GetSegmentResponse?.(response.body);
|
|
2154
2010
|
|
|
2155
2011
|
return { ...response.body, metadata: response.metadata };
|
|
2156
|
-
}
|
|
2012
|
+
}
|
|
2157
2013
|
|
|
2158
|
-
|
|
2014
|
+
async deleteSegmentTargets(
|
|
2159
2015
|
request: DeleteSegmentTargetsRequest & { id: string },
|
|
2160
|
-
): Promise<StreamResponse<Response>>
|
|
2016
|
+
): Promise<StreamResponse<Response>> {
|
|
2161
2017
|
const pathParams = {
|
|
2162
2018
|
id: request?.id,
|
|
2163
2019
|
};
|
|
@@ -2165,29 +2021,30 @@ export class ChatApi extends BaseApi {
|
|
|
2165
2021
|
target_ids: request?.target_ids,
|
|
2166
2022
|
};
|
|
2167
2023
|
|
|
2168
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
2024
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2169
2025
|
'POST',
|
|
2170
2026
|
'/api/v2/chat/segments/{id}/deletetargets',
|
|
2171
2027
|
pathParams,
|
|
2172
2028
|
undefined,
|
|
2173
2029
|
body,
|
|
2030
|
+
'application/json',
|
|
2174
2031
|
);
|
|
2175
2032
|
|
|
2176
2033
|
decoders.Response?.(response.body);
|
|
2177
2034
|
|
|
2178
2035
|
return { ...response.body, metadata: response.metadata };
|
|
2179
|
-
}
|
|
2036
|
+
}
|
|
2180
2037
|
|
|
2181
|
-
|
|
2038
|
+
async segmentTargetExists(request: {
|
|
2182
2039
|
id: string;
|
|
2183
2040
|
target_id: string;
|
|
2184
|
-
}): Promise<StreamResponse<Response>>
|
|
2041
|
+
}): Promise<StreamResponse<Response>> {
|
|
2185
2042
|
const pathParams = {
|
|
2186
2043
|
id: request?.id,
|
|
2187
2044
|
target_id: request?.target_id,
|
|
2188
2045
|
};
|
|
2189
2046
|
|
|
2190
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
2047
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2191
2048
|
'GET',
|
|
2192
2049
|
'/api/v2/chat/segments/{id}/target/{target_id}',
|
|
2193
2050
|
pathParams,
|
|
@@ -2197,11 +2054,11 @@ export class ChatApi extends BaseApi {
|
|
|
2197
2054
|
decoders.Response?.(response.body);
|
|
2198
2055
|
|
|
2199
2056
|
return { ...response.body, metadata: response.metadata };
|
|
2200
|
-
}
|
|
2057
|
+
}
|
|
2201
2058
|
|
|
2202
|
-
|
|
2059
|
+
async querySegmentTargets(
|
|
2203
2060
|
request: QuerySegmentTargetsRequest & { id: string },
|
|
2204
|
-
): Promise<StreamResponse<QuerySegmentTargetsResponse>>
|
|
2061
|
+
): Promise<StreamResponse<QuerySegmentTargetsResponse>> {
|
|
2205
2062
|
const pathParams = {
|
|
2206
2063
|
id: request?.id,
|
|
2207
2064
|
};
|
|
@@ -2213,7 +2070,7 @@ export class ChatApi extends BaseApi {
|
|
|
2213
2070
|
filter: request?.filter,
|
|
2214
2071
|
};
|
|
2215
2072
|
|
|
2216
|
-
const response = await this.sendRequest<
|
|
2073
|
+
const response = await this.apiClient.sendRequest<
|
|
2217
2074
|
StreamResponse<QuerySegmentTargetsResponse>
|
|
2218
2075
|
>(
|
|
2219
2076
|
'POST',
|
|
@@ -2221,16 +2078,17 @@ export class ChatApi extends BaseApi {
|
|
|
2221
2078
|
pathParams,
|
|
2222
2079
|
undefined,
|
|
2223
2080
|
body,
|
|
2081
|
+
'application/json',
|
|
2224
2082
|
);
|
|
2225
2083
|
|
|
2226
2084
|
decoders.QuerySegmentTargetsResponse?.(response.body);
|
|
2227
2085
|
|
|
2228
2086
|
return { ...response.body, metadata: response.metadata };
|
|
2229
|
-
}
|
|
2087
|
+
}
|
|
2230
2088
|
|
|
2231
|
-
|
|
2089
|
+
async queryThreads(
|
|
2232
2090
|
request?: QueryThreadsRequest,
|
|
2233
|
-
): Promise<StreamResponse<QueryThreadsResponse>>
|
|
2091
|
+
): Promise<StreamResponse<QueryThreadsResponse>> {
|
|
2234
2092
|
const body = {
|
|
2235
2093
|
limit: request?.limit,
|
|
2236
2094
|
member_limit: request?.member_limit,
|
|
@@ -2244,21 +2102,28 @@ export class ChatApi extends BaseApi {
|
|
|
2244
2102
|
user: request?.user,
|
|
2245
2103
|
};
|
|
2246
2104
|
|
|
2247
|
-
const response = await this.sendRequest<
|
|
2105
|
+
const response = await this.apiClient.sendRequest<
|
|
2248
2106
|
StreamResponse<QueryThreadsResponse>
|
|
2249
|
-
>(
|
|
2107
|
+
>(
|
|
2108
|
+
'POST',
|
|
2109
|
+
'/api/v2/chat/threads',
|
|
2110
|
+
undefined,
|
|
2111
|
+
undefined,
|
|
2112
|
+
body,
|
|
2113
|
+
'application/json',
|
|
2114
|
+
);
|
|
2250
2115
|
|
|
2251
2116
|
decoders.QueryThreadsResponse?.(response.body);
|
|
2252
2117
|
|
|
2253
2118
|
return { ...response.body, metadata: response.metadata };
|
|
2254
|
-
}
|
|
2119
|
+
}
|
|
2255
2120
|
|
|
2256
|
-
|
|
2121
|
+
async getThread(request: {
|
|
2257
2122
|
message_id: string;
|
|
2258
2123
|
reply_limit?: number;
|
|
2259
2124
|
participant_limit?: number;
|
|
2260
2125
|
member_limit?: number;
|
|
2261
|
-
}): Promise<StreamResponse<GetThreadResponse>>
|
|
2126
|
+
}): Promise<StreamResponse<GetThreadResponse>> {
|
|
2262
2127
|
const queryParams = {
|
|
2263
2128
|
reply_limit: request?.reply_limit,
|
|
2264
2129
|
participant_limit: request?.participant_limit,
|
|
@@ -2268,21 +2133,18 @@ export class ChatApi extends BaseApi {
|
|
|
2268
2133
|
message_id: request?.message_id,
|
|
2269
2134
|
};
|
|
2270
2135
|
|
|
2271
|
-
const response = await this.sendRequest<
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
pathParams,
|
|
2275
|
-
queryParams,
|
|
2276
|
-
);
|
|
2136
|
+
const response = await this.apiClient.sendRequest<
|
|
2137
|
+
StreamResponse<GetThreadResponse>
|
|
2138
|
+
>('GET', '/api/v2/chat/threads/{message_id}', pathParams, queryParams);
|
|
2277
2139
|
|
|
2278
2140
|
decoders.GetThreadResponse?.(response.body);
|
|
2279
2141
|
|
|
2280
2142
|
return { ...response.body, metadata: response.metadata };
|
|
2281
|
-
}
|
|
2143
|
+
}
|
|
2282
2144
|
|
|
2283
|
-
|
|
2145
|
+
async updateThreadPartial(
|
|
2284
2146
|
request: UpdateThreadPartialRequest & { message_id: string },
|
|
2285
|
-
): Promise<StreamResponse<UpdateThreadPartialResponse>>
|
|
2147
|
+
): Promise<StreamResponse<UpdateThreadPartialResponse>> {
|
|
2286
2148
|
const pathParams = {
|
|
2287
2149
|
message_id: request?.message_id,
|
|
2288
2150
|
};
|
|
@@ -2293,7 +2155,7 @@ export class ChatApi extends BaseApi {
|
|
|
2293
2155
|
user: request?.user,
|
|
2294
2156
|
};
|
|
2295
2157
|
|
|
2296
|
-
const response = await this.sendRequest<
|
|
2158
|
+
const response = await this.apiClient.sendRequest<
|
|
2297
2159
|
StreamResponse<UpdateThreadPartialResponse>
|
|
2298
2160
|
>(
|
|
2299
2161
|
'PATCH',
|
|
@@ -2301,44 +2163,50 @@ export class ChatApi extends BaseApi {
|
|
|
2301
2163
|
pathParams,
|
|
2302
2164
|
undefined,
|
|
2303
2165
|
body,
|
|
2166
|
+
'application/json',
|
|
2304
2167
|
);
|
|
2305
2168
|
|
|
2306
2169
|
decoders.UpdateThreadPartialResponse?.(response.body);
|
|
2307
2170
|
|
|
2308
2171
|
return { ...response.body, metadata: response.metadata };
|
|
2309
|
-
}
|
|
2172
|
+
}
|
|
2310
2173
|
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
> => {
|
|
2314
|
-
const response = await this.sendRequest<
|
|
2174
|
+
async unreadCounts(): Promise<StreamResponse<WrappedUnreadCountsResponse>> {
|
|
2175
|
+
const response = await this.apiClient.sendRequest<
|
|
2315
2176
|
StreamResponse<WrappedUnreadCountsResponse>
|
|
2316
2177
|
>('GET', '/api/v2/chat/unread', undefined, undefined);
|
|
2317
2178
|
|
|
2318
2179
|
decoders.WrappedUnreadCountsResponse?.(response.body);
|
|
2319
2180
|
|
|
2320
2181
|
return { ...response.body, metadata: response.metadata };
|
|
2321
|
-
}
|
|
2182
|
+
}
|
|
2322
2183
|
|
|
2323
|
-
|
|
2184
|
+
async unreadCountsBatch(
|
|
2324
2185
|
request: UnreadCountsBatchRequest,
|
|
2325
|
-
): Promise<StreamResponse<UnreadCountsBatchResponse>>
|
|
2186
|
+
): Promise<StreamResponse<UnreadCountsBatchResponse>> {
|
|
2326
2187
|
const body = {
|
|
2327
2188
|
user_ids: request?.user_ids,
|
|
2328
2189
|
};
|
|
2329
2190
|
|
|
2330
|
-
const response = await this.sendRequest<
|
|
2191
|
+
const response = await this.apiClient.sendRequest<
|
|
2331
2192
|
StreamResponse<UnreadCountsBatchResponse>
|
|
2332
|
-
>(
|
|
2193
|
+
>(
|
|
2194
|
+
'POST',
|
|
2195
|
+
'/api/v2/chat/unread_batch',
|
|
2196
|
+
undefined,
|
|
2197
|
+
undefined,
|
|
2198
|
+
body,
|
|
2199
|
+
'application/json',
|
|
2200
|
+
);
|
|
2333
2201
|
|
|
2334
2202
|
decoders.UnreadCountsBatchResponse?.(response.body);
|
|
2335
2203
|
|
|
2336
2204
|
return { ...response.body, metadata: response.metadata };
|
|
2337
|
-
}
|
|
2205
|
+
}
|
|
2338
2206
|
|
|
2339
|
-
|
|
2207
|
+
async sendUserCustomEvent(
|
|
2340
2208
|
request: SendUserCustomEventRequest & { user_id: string },
|
|
2341
|
-
): Promise<StreamResponse<Response>>
|
|
2209
|
+
): Promise<StreamResponse<Response>> {
|
|
2342
2210
|
const pathParams = {
|
|
2343
2211
|
user_id: request?.user_id,
|
|
2344
2212
|
};
|
|
@@ -2346,16 +2214,17 @@ export class ChatApi extends BaseApi {
|
|
|
2346
2214
|
event: request?.event,
|
|
2347
2215
|
};
|
|
2348
2216
|
|
|
2349
|
-
const response = await this.sendRequest<StreamResponse<Response>>(
|
|
2217
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2350
2218
|
'POST',
|
|
2351
2219
|
'/api/v2/chat/users/{user_id}/event',
|
|
2352
2220
|
pathParams,
|
|
2353
2221
|
undefined,
|
|
2354
2222
|
body,
|
|
2223
|
+
'application/json',
|
|
2355
2224
|
);
|
|
2356
2225
|
|
|
2357
2226
|
decoders.Response?.(response.body);
|
|
2358
2227
|
|
|
2359
2228
|
return { ...response.body, metadata: response.metadata };
|
|
2360
|
-
}
|
|
2229
|
+
}
|
|
2361
2230
|
}
|