@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.
Files changed (42) hide show
  1. package/dist/index.cjs.js +6265 -3834
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.es.mjs +6263 -3835
  5. package/dist/index.es.mjs.map +1 -1
  6. package/dist/src/ApiClient.d.ts +15 -0
  7. package/dist/src/StreamCall.d.ts +2 -2
  8. package/dist/src/StreamClient.d.ts +10 -1
  9. package/dist/src/StreamFeed.d.ts +4 -0
  10. package/dist/src/StreamFeedsClient.d.ts +5 -0
  11. package/dist/src/StreamVideoClient.d.ts +3 -2
  12. package/dist/src/gen/chat/ChannelApi.d.ts +29 -30
  13. package/dist/src/gen/chat/ChatApi.d.ts +145 -180
  14. package/dist/src/gen/common/CommonApi.d.ts +122 -79
  15. package/dist/src/gen/feeds/FeedApi.d.ts +25 -0
  16. package/dist/src/gen/feeds/FeedsApi.d.ts +195 -0
  17. package/dist/src/gen/models/index.d.ts +1750 -47
  18. package/dist/src/gen/moderation/ModerationApi.d.ts +28 -27
  19. package/dist/src/gen/video/CallApi.d.ts +42 -43
  20. package/dist/src/gen/video/VideoApi.d.ts +91 -89
  21. package/dist/src/gen-imports.d.ts +5 -0
  22. package/index.ts +3 -1
  23. package/package.json +1 -1
  24. package/src/{BaseApi.ts → ApiClient.ts} +25 -6
  25. package/src/StreamCall.ts +2 -2
  26. package/src/StreamClient.ts +51 -14
  27. package/src/StreamFeed.ts +7 -0
  28. package/src/StreamFeedsClient.ts +8 -0
  29. package/src/StreamVideoClient.ts +9 -6
  30. package/src/gen/chat/ChannelApi.ts +74 -64
  31. package/src/gen/chat/ChatApi.ts +550 -681
  32. package/src/gen/common/CommonApi.ts +712 -262
  33. package/src/gen/feeds/FeedApi.ts +130 -0
  34. package/src/gen/feeds/FeedsApi.ts +1801 -0
  35. package/src/gen/model-decoders/{index.ts → decoders.ts} +2248 -336
  36. package/src/gen/models/index.ts +4668 -2088
  37. package/src/gen/moderation/ModerationApi.ts +159 -98
  38. package/src/gen/video/CallApi.ts +97 -108
  39. package/src/gen/video/VideoApi.ts +303 -203
  40. package/src/gen-imports.ts +5 -0
  41. package/dist/src/BaseApi.d.ts +0 -11
  42. /package/dist/src/gen/model-decoders/{index.d.ts → decoders.d.ts} +0 -0
@@ -1,5 +1,4 @@
1
- import { BaseApi } from '../../BaseApi';
2
- import { StreamResponse } from '../../types';
1
+ import { ApiClient, StreamResponse } from '../../gen-imports';
3
2
  import {
4
3
  BlockUsersRequest,
5
4
  BlockUsersResponse,
@@ -21,6 +20,8 @@ import {
21
20
  CreateImportResponse,
22
21
  CreateImportURLRequest,
23
22
  CreateImportURLResponse,
23
+ CreatePollOptionRequest,
24
+ CreatePollRequest,
24
25
  CreateRoleRequest,
25
26
  CreateRoleResponse,
26
27
  DeactivateUserRequest,
@@ -52,6 +53,12 @@ import {
52
53
  ListPermissionsResponse,
53
54
  ListPushProvidersResponse,
54
55
  ListRolesResponse,
56
+ PollOptionResponse,
57
+ PollResponse,
58
+ PollVotesResponse,
59
+ QueryPollVotesRequest,
60
+ QueryPollsRequest,
61
+ QueryPollsResponse,
55
62
  QueryUsersPayload,
56
63
  QueryUsersResponse,
57
64
  ReactivateUserRequest,
@@ -60,6 +67,8 @@ import {
60
67
  ReactivateUsersResponse,
61
68
  Response,
62
69
  RestoreUsersRequest,
70
+ SharedLocationResponse,
71
+ SharedLocationsResponse,
63
72
  UnblockUsersRequest,
64
73
  UnblockUsersResponse,
65
74
  UpdateAppRequest,
@@ -67,28 +76,34 @@ import {
67
76
  UpdateBlockListResponse,
68
77
  UpdateExternalStorageRequest,
69
78
  UpdateExternalStorageResponse,
79
+ UpdateLiveLocationRequest,
80
+ UpdatePollOptionRequest,
81
+ UpdatePollPartialRequest,
82
+ UpdatePollRequest,
70
83
  UpdateUsersPartialRequest,
71
84
  UpdateUsersRequest,
72
85
  UpdateUsersResponse,
73
86
  UpsertPushProviderRequest,
74
87
  UpsertPushProviderResponse,
75
88
  } from '../models';
76
- import { decoders } from '../model-decoders';
89
+ import { decoders } from '../model-decoders/decoders';
77
90
 
78
- export class CommonApi extends BaseApi {
79
- getApp = async (): Promise<StreamResponse<GetApplicationResponse>> => {
80
- const response = await this.sendRequest<
91
+ export class CommonApi {
92
+ constructor(public readonly apiClient: ApiClient) {}
93
+
94
+ async getApp(): Promise<StreamResponse<GetApplicationResponse>> {
95
+ const response = await this.apiClient.sendRequest<
81
96
  StreamResponse<GetApplicationResponse>
82
97
  >('GET', '/api/v2/app', undefined, undefined);
83
98
 
84
99
  decoders.GetApplicationResponse?.(response.body);
85
100
 
86
101
  return { ...response.body, metadata: response.metadata };
87
- };
102
+ }
88
103
 
89
- updateApp = async (
104
+ async updateApp(
90
105
  request?: UpdateAppRequest,
91
- ): Promise<StreamResponse<Response>> => {
106
+ ): Promise<StreamResponse<Response>> {
92
107
  const body = {
93
108
  async_url_enrich_enabled: request?.async_url_enrich_enabled,
94
109
  auto_translation_enabled: request?.auto_translation_enabled,
@@ -138,38 +153,39 @@ export class CommonApi extends BaseApi {
138
153
  xiaomi_config: request?.xiaomi_config,
139
154
  };
140
155
 
141
- const response = await this.sendRequest<StreamResponse<Response>>(
156
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
142
157
  'PATCH',
143
158
  '/api/v2/app',
144
159
  undefined,
145
160
  undefined,
146
161
  body,
162
+ 'application/json',
147
163
  );
148
164
 
149
165
  decoders.Response?.(response.body);
150
166
 
151
167
  return { ...response.body, metadata: response.metadata };
152
- };
168
+ }
153
169
 
154
- listBlockLists = async (request?: {
170
+ async listBlockLists(request?: {
155
171
  team?: string;
156
- }): Promise<StreamResponse<ListBlockListResponse>> => {
172
+ }): Promise<StreamResponse<ListBlockListResponse>> {
157
173
  const queryParams = {
158
174
  team: request?.team,
159
175
  };
160
176
 
161
- const response = await this.sendRequest<
177
+ const response = await this.apiClient.sendRequest<
162
178
  StreamResponse<ListBlockListResponse>
163
179
  >('GET', '/api/v2/blocklists', undefined, queryParams);
164
180
 
165
181
  decoders.ListBlockListResponse?.(response.body);
166
182
 
167
183
  return { ...response.body, metadata: response.metadata };
168
- };
184
+ }
169
185
 
170
- createBlockList = async (
186
+ async createBlockList(
171
187
  request: CreateBlockListRequest,
172
- ): Promise<StreamResponse<CreateBlockListResponse>> => {
188
+ ): Promise<StreamResponse<CreateBlockListResponse>> {
173
189
  const body = {
174
190
  name: request?.name,
175
191
  words: request?.words,
@@ -177,19 +193,26 @@ export class CommonApi extends BaseApi {
177
193
  type: request?.type,
178
194
  };
179
195
 
180
- const response = await this.sendRequest<
196
+ const response = await this.apiClient.sendRequest<
181
197
  StreamResponse<CreateBlockListResponse>
182
- >('POST', '/api/v2/blocklists', undefined, undefined, body);
198
+ >(
199
+ 'POST',
200
+ '/api/v2/blocklists',
201
+ undefined,
202
+ undefined,
203
+ body,
204
+ 'application/json',
205
+ );
183
206
 
184
207
  decoders.CreateBlockListResponse?.(response.body);
185
208
 
186
209
  return { ...response.body, metadata: response.metadata };
187
- };
210
+ }
188
211
 
189
- deleteBlockList = async (request: {
212
+ async deleteBlockList(request: {
190
213
  name: string;
191
214
  team?: string;
192
- }): Promise<StreamResponse<Response>> => {
215
+ }): Promise<StreamResponse<Response>> {
193
216
  const queryParams = {
194
217
  team: request?.team,
195
218
  };
@@ -197,7 +220,7 @@ export class CommonApi extends BaseApi {
197
220
  name: request?.name,
198
221
  };
199
222
 
200
- const response = await this.sendRequest<StreamResponse<Response>>(
223
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
201
224
  'DELETE',
202
225
  '/api/v2/blocklists/{name}',
203
226
  pathParams,
@@ -207,12 +230,12 @@ export class CommonApi extends BaseApi {
207
230
  decoders.Response?.(response.body);
208
231
 
209
232
  return { ...response.body, metadata: response.metadata };
210
- };
233
+ }
211
234
 
212
- getBlockList = async (request: {
235
+ async getBlockList(request: {
213
236
  name: string;
214
237
  team?: string;
215
- }): Promise<StreamResponse<GetBlockListResponse>> => {
238
+ }): Promise<StreamResponse<GetBlockListResponse>> {
216
239
  const queryParams = {
217
240
  team: request?.team,
218
241
  };
@@ -220,18 +243,18 @@ export class CommonApi extends BaseApi {
220
243
  name: request?.name,
221
244
  };
222
245
 
223
- const response = await this.sendRequest<
246
+ const response = await this.apiClient.sendRequest<
224
247
  StreamResponse<GetBlockListResponse>
225
248
  >('GET', '/api/v2/blocklists/{name}', pathParams, queryParams);
226
249
 
227
250
  decoders.GetBlockListResponse?.(response.body);
228
251
 
229
252
  return { ...response.body, metadata: response.metadata };
230
- };
253
+ }
231
254
 
232
- updateBlockList = async (
255
+ async updateBlockList(
233
256
  request: UpdateBlockListRequest & { name: string },
234
- ): Promise<StreamResponse<UpdateBlockListResponse>> => {
257
+ ): Promise<StreamResponse<UpdateBlockListResponse>> {
235
258
  const pathParams = {
236
259
  name: request?.name,
237
260
  };
@@ -240,18 +263,25 @@ export class CommonApi extends BaseApi {
240
263
  words: request?.words,
241
264
  };
242
265
 
243
- const response = await this.sendRequest<
266
+ const response = await this.apiClient.sendRequest<
244
267
  StreamResponse<UpdateBlockListResponse>
245
- >('PUT', '/api/v2/blocklists/{name}', pathParams, undefined, body);
268
+ >(
269
+ 'PUT',
270
+ '/api/v2/blocklists/{name}',
271
+ pathParams,
272
+ undefined,
273
+ body,
274
+ 'application/json',
275
+ );
246
276
 
247
277
  decoders.UpdateBlockListResponse?.(response.body);
248
278
 
249
279
  return { ...response.body, metadata: response.metadata };
250
- };
280
+ }
251
281
 
252
- checkPush = async (
282
+ async checkPush(
253
283
  request?: CheckPushRequest,
254
- ): Promise<StreamResponse<CheckPushResponse>> => {
284
+ ): Promise<StreamResponse<CheckPushResponse>> {
255
285
  const body = {
256
286
  apn_template: request?.apn_template,
257
287
  event_type: request?.event_type,
@@ -265,73 +295,82 @@ export class CommonApi extends BaseApi {
265
295
  user: request?.user,
266
296
  };
267
297
 
268
- const response = await this.sendRequest<StreamResponse<CheckPushResponse>>(
298
+ const response = await this.apiClient.sendRequest<
299
+ StreamResponse<CheckPushResponse>
300
+ >(
269
301
  'POST',
270
302
  '/api/v2/check_push',
271
303
  undefined,
272
304
  undefined,
273
305
  body,
306
+ 'application/json',
274
307
  );
275
308
 
276
309
  decoders.CheckPushResponse?.(response.body);
277
310
 
278
311
  return { ...response.body, metadata: response.metadata };
279
- };
312
+ }
280
313
 
281
- checkSNS = async (
314
+ async checkSNS(
282
315
  request?: CheckSNSRequest,
283
- ): Promise<StreamResponse<CheckSNSResponse>> => {
316
+ ): Promise<StreamResponse<CheckSNSResponse>> {
284
317
  const body = {
285
318
  sns_key: request?.sns_key,
286
319
  sns_secret: request?.sns_secret,
287
320
  sns_topic_arn: request?.sns_topic_arn,
288
321
  };
289
322
 
290
- const response = await this.sendRequest<StreamResponse<CheckSNSResponse>>(
323
+ const response = await this.apiClient.sendRequest<
324
+ StreamResponse<CheckSNSResponse>
325
+ >(
291
326
  'POST',
292
327
  '/api/v2/check_sns',
293
328
  undefined,
294
329
  undefined,
295
330
  body,
331
+ 'application/json',
296
332
  );
297
333
 
298
334
  decoders.CheckSNSResponse?.(response.body);
299
335
 
300
336
  return { ...response.body, metadata: response.metadata };
301
- };
337
+ }
302
338
 
303
- checkSQS = async (
339
+ async checkSQS(
304
340
  request?: CheckSQSRequest,
305
- ): Promise<StreamResponse<CheckSQSResponse>> => {
341
+ ): Promise<StreamResponse<CheckSQSResponse>> {
306
342
  const body = {
307
343
  sqs_key: request?.sqs_key,
308
344
  sqs_secret: request?.sqs_secret,
309
345
  sqs_url: request?.sqs_url,
310
346
  };
311
347
 
312
- const response = await this.sendRequest<StreamResponse<CheckSQSResponse>>(
348
+ const response = await this.apiClient.sendRequest<
349
+ StreamResponse<CheckSQSResponse>
350
+ >(
313
351
  'POST',
314
352
  '/api/v2/check_sqs',
315
353
  undefined,
316
354
  undefined,
317
355
  body,
356
+ 'application/json',
318
357
  );
319
358
 
320
359
  decoders.CheckSQSResponse?.(response.body);
321
360
 
322
361
  return { ...response.body, metadata: response.metadata };
323
- };
362
+ }
324
363
 
325
- deleteDevice = async (request: {
364
+ async deleteDevice(request: {
326
365
  id: string;
327
366
  user_id?: string;
328
- }): Promise<StreamResponse<Response>> => {
367
+ }): Promise<StreamResponse<Response>> {
329
368
  const queryParams = {
330
369
  id: request?.id,
331
370
  user_id: request?.user_id,
332
371
  };
333
372
 
334
- const response = await this.sendRequest<StreamResponse<Response>>(
373
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
335
374
  'DELETE',
336
375
  '/api/v2/devices',
337
376
  undefined,
@@ -341,27 +380,27 @@ export class CommonApi extends BaseApi {
341
380
  decoders.Response?.(response.body);
342
381
 
343
382
  return { ...response.body, metadata: response.metadata };
344
- };
383
+ }
345
384
 
346
- listDevices = async (request?: {
385
+ async listDevices(request?: {
347
386
  user_id?: string;
348
- }): Promise<StreamResponse<ListDevicesResponse>> => {
387
+ }): Promise<StreamResponse<ListDevicesResponse>> {
349
388
  const queryParams = {
350
389
  user_id: request?.user_id,
351
390
  };
352
391
 
353
- const response = await this.sendRequest<
392
+ const response = await this.apiClient.sendRequest<
354
393
  StreamResponse<ListDevicesResponse>
355
394
  >('GET', '/api/v2/devices', undefined, queryParams);
356
395
 
357
396
  decoders.ListDevicesResponse?.(response.body);
358
397
 
359
398
  return { ...response.body, metadata: response.metadata };
360
- };
399
+ }
361
400
 
362
- createDevice = async (
401
+ async createDevice(
363
402
  request: CreateDeviceRequest,
364
- ): Promise<StreamResponse<Response>> => {
403
+ ): Promise<StreamResponse<Response>> {
365
404
  const body = {
366
405
  id: request?.id,
367
406
  push_provider: request?.push_provider,
@@ -371,50 +410,58 @@ export class CommonApi extends BaseApi {
371
410
  user: request?.user,
372
411
  };
373
412
 
374
- const response = await this.sendRequest<StreamResponse<Response>>(
413
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
375
414
  'POST',
376
415
  '/api/v2/devices',
377
416
  undefined,
378
417
  undefined,
379
418
  body,
419
+ 'application/json',
380
420
  );
381
421
 
382
422
  decoders.Response?.(response.body);
383
423
 
384
424
  return { ...response.body, metadata: response.metadata };
385
- };
425
+ }
386
426
 
387
- exportUsers = async (
427
+ async exportUsers(
388
428
  request: ExportUsersRequest,
389
- ): Promise<StreamResponse<ExportUsersResponse>> => {
429
+ ): Promise<StreamResponse<ExportUsersResponse>> {
390
430
  const body = {
391
431
  user_ids: request?.user_ids,
392
432
  };
393
433
 
394
- const response = await this.sendRequest<
434
+ const response = await this.apiClient.sendRequest<
395
435
  StreamResponse<ExportUsersResponse>
396
- >('POST', '/api/v2/export/users', undefined, undefined, body);
436
+ >(
437
+ 'POST',
438
+ '/api/v2/export/users',
439
+ undefined,
440
+ undefined,
441
+ body,
442
+ 'application/json',
443
+ );
397
444
 
398
445
  decoders.ExportUsersResponse?.(response.body);
399
446
 
400
447
  return { ...response.body, metadata: response.metadata };
401
- };
448
+ }
402
449
 
403
- listExternalStorage = async (): Promise<
450
+ async listExternalStorage(): Promise<
404
451
  StreamResponse<ListExternalStorageResponse>
405
- > => {
406
- const response = await this.sendRequest<
452
+ > {
453
+ const response = await this.apiClient.sendRequest<
407
454
  StreamResponse<ListExternalStorageResponse>
408
455
  >('GET', '/api/v2/external_storage', undefined, undefined);
409
456
 
410
457
  decoders.ListExternalStorageResponse?.(response.body);
411
458
 
412
459
  return { ...response.body, metadata: response.metadata };
413
- };
460
+ }
414
461
 
415
- createExternalStorage = async (
462
+ async createExternalStorage(
416
463
  request: CreateExternalStorageRequest,
417
- ): Promise<StreamResponse<CreateExternalStorageResponse>> => {
464
+ ): Promise<StreamResponse<CreateExternalStorageResponse>> {
418
465
  const body = {
419
466
  bucket: request?.bucket,
420
467
  name: request?.name,
@@ -425,34 +472,41 @@ export class CommonApi extends BaseApi {
425
472
  azure_blob: request?.azure_blob,
426
473
  };
427
474
 
428
- const response = await this.sendRequest<
475
+ const response = await this.apiClient.sendRequest<
429
476
  StreamResponse<CreateExternalStorageResponse>
430
- >('POST', '/api/v2/external_storage', undefined, undefined, body);
477
+ >(
478
+ 'POST',
479
+ '/api/v2/external_storage',
480
+ undefined,
481
+ undefined,
482
+ body,
483
+ 'application/json',
484
+ );
431
485
 
432
486
  decoders.CreateExternalStorageResponse?.(response.body);
433
487
 
434
488
  return { ...response.body, metadata: response.metadata };
435
- };
489
+ }
436
490
 
437
- deleteExternalStorage = async (request: {
491
+ async deleteExternalStorage(request: {
438
492
  name: string;
439
- }): Promise<StreamResponse<DeleteExternalStorageResponse>> => {
493
+ }): Promise<StreamResponse<DeleteExternalStorageResponse>> {
440
494
  const pathParams = {
441
495
  name: request?.name,
442
496
  };
443
497
 
444
- const response = await this.sendRequest<
498
+ const response = await this.apiClient.sendRequest<
445
499
  StreamResponse<DeleteExternalStorageResponse>
446
500
  >('DELETE', '/api/v2/external_storage/{name}', pathParams, undefined);
447
501
 
448
502
  decoders.DeleteExternalStorageResponse?.(response.body);
449
503
 
450
504
  return { ...response.body, metadata: response.metadata };
451
- };
505
+ }
452
506
 
453
- updateExternalStorage = async (
507
+ async updateExternalStorage(
454
508
  request: UpdateExternalStorageRequest & { name: string },
455
- ): Promise<StreamResponse<UpdateExternalStorageResponse>> => {
509
+ ): Promise<StreamResponse<UpdateExternalStorageResponse>> {
456
510
  const pathParams = {
457
511
  name: request?.name,
458
512
  };
@@ -465,194 +519,516 @@ export class CommonApi extends BaseApi {
465
519
  azure_blob: request?.azure_blob,
466
520
  };
467
521
 
468
- const response = await this.sendRequest<
522
+ const response = await this.apiClient.sendRequest<
469
523
  StreamResponse<UpdateExternalStorageResponse>
470
- >('PUT', '/api/v2/external_storage/{name}', pathParams, undefined, body);
524
+ >(
525
+ 'PUT',
526
+ '/api/v2/external_storage/{name}',
527
+ pathParams,
528
+ undefined,
529
+ body,
530
+ 'application/json',
531
+ );
471
532
 
472
533
  decoders.UpdateExternalStorageResponse?.(response.body);
473
534
 
474
535
  return { ...response.body, metadata: response.metadata };
475
- };
536
+ }
476
537
 
477
- checkExternalStorage = async (request: {
538
+ async checkExternalStorage(request: {
478
539
  name: string;
479
- }): Promise<StreamResponse<CheckExternalStorageResponse>> => {
540
+ }): Promise<StreamResponse<CheckExternalStorageResponse>> {
480
541
  const pathParams = {
481
542
  name: request?.name,
482
543
  };
483
544
 
484
- const response = await this.sendRequest<
545
+ const response = await this.apiClient.sendRequest<
485
546
  StreamResponse<CheckExternalStorageResponse>
486
547
  >('GET', '/api/v2/external_storage/{name}/check', pathParams, undefined);
487
548
 
488
549
  decoders.CheckExternalStorageResponse?.(response.body);
489
550
 
490
551
  return { ...response.body, metadata: response.metadata };
491
- };
552
+ }
492
553
 
493
- createGuest = async (
554
+ async createGuest(
494
555
  request: CreateGuestRequest,
495
- ): Promise<StreamResponse<CreateGuestResponse>> => {
556
+ ): Promise<StreamResponse<CreateGuestResponse>> {
496
557
  const body = {
497
558
  user: request?.user,
498
559
  };
499
560
 
500
- const response = await this.sendRequest<
561
+ const response = await this.apiClient.sendRequest<
501
562
  StreamResponse<CreateGuestResponse>
502
- >('POST', '/api/v2/guest', undefined, undefined, body);
563
+ >('POST', '/api/v2/guest', undefined, undefined, body, 'application/json');
503
564
 
504
565
  decoders.CreateGuestResponse?.(response.body);
505
566
 
506
567
  return { ...response.body, metadata: response.metadata };
507
- };
568
+ }
508
569
 
509
- createImportURL = async (
570
+ async createImportURL(
510
571
  request?: CreateImportURLRequest,
511
- ): Promise<StreamResponse<CreateImportURLResponse>> => {
572
+ ): Promise<StreamResponse<CreateImportURLResponse>> {
512
573
  const body = {
513
574
  filename: request?.filename,
514
575
  };
515
576
 
516
- const response = await this.sendRequest<
577
+ const response = await this.apiClient.sendRequest<
517
578
  StreamResponse<CreateImportURLResponse>
518
- >('POST', '/api/v2/import_urls', undefined, undefined, body);
579
+ >(
580
+ 'POST',
581
+ '/api/v2/import_urls',
582
+ undefined,
583
+ undefined,
584
+ body,
585
+ 'application/json',
586
+ );
519
587
 
520
588
  decoders.CreateImportURLResponse?.(response.body);
521
589
 
522
590
  return { ...response.body, metadata: response.metadata };
523
- };
591
+ }
524
592
 
525
- listImports = async (): Promise<StreamResponse<ListImportsResponse>> => {
526
- const response = await this.sendRequest<
593
+ async listImports(): Promise<StreamResponse<ListImportsResponse>> {
594
+ const response = await this.apiClient.sendRequest<
527
595
  StreamResponse<ListImportsResponse>
528
596
  >('GET', '/api/v2/imports', undefined, undefined);
529
597
 
530
598
  decoders.ListImportsResponse?.(response.body);
531
599
 
532
600
  return { ...response.body, metadata: response.metadata };
533
- };
601
+ }
534
602
 
535
- createImport = async (
603
+ async createImport(
536
604
  request: CreateImportRequest,
537
- ): Promise<StreamResponse<CreateImportResponse>> => {
605
+ ): Promise<StreamResponse<CreateImportResponse>> {
538
606
  const body = {
539
607
  mode: request?.mode,
540
608
  path: request?.path,
541
609
  };
542
610
 
543
- const response = await this.sendRequest<
611
+ const response = await this.apiClient.sendRequest<
544
612
  StreamResponse<CreateImportResponse>
545
- >('POST', '/api/v2/imports', undefined, undefined, body);
613
+ >(
614
+ 'POST',
615
+ '/api/v2/imports',
616
+ undefined,
617
+ undefined,
618
+ body,
619
+ 'application/json',
620
+ );
546
621
 
547
622
  decoders.CreateImportResponse?.(response.body);
548
623
 
549
624
  return { ...response.body, metadata: response.metadata };
550
- };
625
+ }
551
626
 
552
- getImport = async (request: {
627
+ async getImport(request: {
553
628
  id: string;
554
- }): Promise<StreamResponse<GetImportResponse>> => {
629
+ }): Promise<StreamResponse<GetImportResponse>> {
555
630
  const pathParams = {
556
631
  id: request?.id,
557
632
  };
558
633
 
559
- const response = await this.sendRequest<StreamResponse<GetImportResponse>>(
560
- 'GET',
561
- '/api/v2/imports/{id}',
562
- pathParams,
563
- undefined,
564
- );
634
+ const response = await this.apiClient.sendRequest<
635
+ StreamResponse<GetImportResponse>
636
+ >('GET', '/api/v2/imports/{id}', pathParams, undefined);
565
637
 
566
638
  decoders.GetImportResponse?.(response.body);
567
639
 
568
640
  return { ...response.body, metadata: response.metadata };
569
- };
641
+ }
570
642
 
571
- getOG = async (request: {
643
+ async getOG(request: {
572
644
  url: string;
573
- }): Promise<StreamResponse<GetOGResponse>> => {
645
+ }): Promise<StreamResponse<GetOGResponse>> {
574
646
  const queryParams = {
575
647
  url: request?.url,
576
648
  };
577
649
 
578
- const response = await this.sendRequest<StreamResponse<GetOGResponse>>(
579
- 'GET',
580
- '/api/v2/og',
581
- undefined,
582
- queryParams,
583
- );
650
+ const response = await this.apiClient.sendRequest<
651
+ StreamResponse<GetOGResponse>
652
+ >('GET', '/api/v2/og', undefined, queryParams);
584
653
 
585
654
  decoders.GetOGResponse?.(response.body);
586
655
 
587
656
  return { ...response.body, metadata: response.metadata };
588
- };
657
+ }
589
658
 
590
- listPermissions = async (): Promise<
591
- StreamResponse<ListPermissionsResponse>
592
- > => {
593
- const response = await this.sendRequest<
659
+ async listPermissions(): Promise<StreamResponse<ListPermissionsResponse>> {
660
+ const response = await this.apiClient.sendRequest<
594
661
  StreamResponse<ListPermissionsResponse>
595
662
  >('GET', '/api/v2/permissions', undefined, undefined);
596
663
 
597
664
  decoders.ListPermissionsResponse?.(response.body);
598
665
 
599
666
  return { ...response.body, metadata: response.metadata };
600
- };
667
+ }
601
668
 
602
- getPermission = async (request: {
669
+ async getPermission(request: {
603
670
  id: string;
604
- }): Promise<StreamResponse<GetCustomPermissionResponse>> => {
671
+ }): Promise<StreamResponse<GetCustomPermissionResponse>> {
605
672
  const pathParams = {
606
673
  id: request?.id,
607
674
  };
608
675
 
609
- const response = await this.sendRequest<
676
+ const response = await this.apiClient.sendRequest<
610
677
  StreamResponse<GetCustomPermissionResponse>
611
678
  >('GET', '/api/v2/permissions/{id}', pathParams, undefined);
612
679
 
613
680
  decoders.GetCustomPermissionResponse?.(response.body);
614
681
 
615
682
  return { ...response.body, metadata: response.metadata };
616
- };
683
+ }
684
+
685
+ async createPoll(
686
+ request: CreatePollRequest,
687
+ ): Promise<StreamResponse<PollResponse>> {
688
+ const body = {
689
+ name: request?.name,
690
+ allow_answers: request?.allow_answers,
691
+ allow_user_suggested_options: request?.allow_user_suggested_options,
692
+ description: request?.description,
693
+ enforce_unique_vote: request?.enforce_unique_vote,
694
+ id: request?.id,
695
+ is_closed: request?.is_closed,
696
+ max_votes_allowed: request?.max_votes_allowed,
697
+ user_id: request?.user_id,
698
+ voting_visibility: request?.voting_visibility,
699
+ options: request?.options,
700
+ custom: request?.custom,
701
+ user: request?.user,
702
+ };
703
+
704
+ const response = await this.apiClient.sendRequest<
705
+ StreamResponse<PollResponse>
706
+ >('POST', '/api/v2/polls', undefined, undefined, body, 'application/json');
707
+
708
+ decoders.PollResponse?.(response.body);
709
+
710
+ return { ...response.body, metadata: response.metadata };
711
+ }
712
+
713
+ async updatePoll(
714
+ request: UpdatePollRequest,
715
+ ): Promise<StreamResponse<PollResponse>> {
716
+ const body = {
717
+ id: request?.id,
718
+ name: request?.name,
719
+ allow_answers: request?.allow_answers,
720
+ allow_user_suggested_options: request?.allow_user_suggested_options,
721
+ description: request?.description,
722
+ enforce_unique_vote: request?.enforce_unique_vote,
723
+ is_closed: request?.is_closed,
724
+ max_votes_allowed: request?.max_votes_allowed,
725
+ user_id: request?.user_id,
726
+ voting_visibility: request?.voting_visibility,
727
+ options: request?.options,
728
+ custom: request?.custom,
729
+ user: request?.user,
730
+ };
731
+
732
+ const response = await this.apiClient.sendRequest<
733
+ StreamResponse<PollResponse>
734
+ >('PUT', '/api/v2/polls', undefined, undefined, body, 'application/json');
735
+
736
+ decoders.PollResponse?.(response.body);
737
+
738
+ return { ...response.body, metadata: response.metadata };
739
+ }
740
+
741
+ async queryPolls(
742
+ request?: QueryPollsRequest & { user_id?: string },
743
+ ): Promise<StreamResponse<QueryPollsResponse>> {
744
+ const queryParams = {
745
+ user_id: request?.user_id,
746
+ };
747
+ const body = {
748
+ limit: request?.limit,
749
+ next: request?.next,
750
+ prev: request?.prev,
751
+ sort: request?.sort,
752
+ filter: request?.filter,
753
+ };
754
+
755
+ const response = await this.apiClient.sendRequest<
756
+ StreamResponse<QueryPollsResponse>
757
+ >(
758
+ 'POST',
759
+ '/api/v2/polls/query',
760
+ undefined,
761
+ queryParams,
762
+ body,
763
+ 'application/json',
764
+ );
765
+
766
+ decoders.QueryPollsResponse?.(response.body);
767
+
768
+ return { ...response.body, metadata: response.metadata };
769
+ }
770
+
771
+ async deletePoll(request: {
772
+ poll_id: string;
773
+ user_id?: string;
774
+ }): Promise<StreamResponse<Response>> {
775
+ const queryParams = {
776
+ user_id: request?.user_id,
777
+ };
778
+ const pathParams = {
779
+ poll_id: request?.poll_id,
780
+ };
781
+
782
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
783
+ 'DELETE',
784
+ '/api/v2/polls/{poll_id}',
785
+ pathParams,
786
+ queryParams,
787
+ );
788
+
789
+ decoders.Response?.(response.body);
790
+
791
+ return { ...response.body, metadata: response.metadata };
792
+ }
793
+
794
+ async getPoll(request: {
795
+ poll_id: string;
796
+ user_id?: string;
797
+ }): Promise<StreamResponse<PollResponse>> {
798
+ const queryParams = {
799
+ user_id: request?.user_id,
800
+ };
801
+ const pathParams = {
802
+ poll_id: request?.poll_id,
803
+ };
804
+
805
+ const response = await this.apiClient.sendRequest<
806
+ StreamResponse<PollResponse>
807
+ >('GET', '/api/v2/polls/{poll_id}', pathParams, queryParams);
808
+
809
+ decoders.PollResponse?.(response.body);
810
+
811
+ return { ...response.body, metadata: response.metadata };
812
+ }
813
+
814
+ async updatePollPartial(
815
+ request: UpdatePollPartialRequest & { poll_id: string },
816
+ ): Promise<StreamResponse<PollResponse>> {
817
+ const pathParams = {
818
+ poll_id: request?.poll_id,
819
+ };
820
+ const body = {
821
+ user_id: request?.user_id,
822
+ unset: request?.unset,
823
+ set: request?.set,
824
+ user: request?.user,
825
+ };
826
+
827
+ const response = await this.apiClient.sendRequest<
828
+ StreamResponse<PollResponse>
829
+ >(
830
+ 'PATCH',
831
+ '/api/v2/polls/{poll_id}',
832
+ pathParams,
833
+ undefined,
834
+ body,
835
+ 'application/json',
836
+ );
837
+
838
+ decoders.PollResponse?.(response.body);
839
+
840
+ return { ...response.body, metadata: response.metadata };
841
+ }
842
+
843
+ async createPollOption(
844
+ request: CreatePollOptionRequest & { poll_id: string },
845
+ ): Promise<StreamResponse<PollOptionResponse>> {
846
+ const pathParams = {
847
+ poll_id: request?.poll_id,
848
+ };
849
+ const body = {
850
+ text: request?.text,
851
+ user_id: request?.user_id,
852
+ custom: request?.custom,
853
+ user: request?.user,
854
+ };
855
+
856
+ const response = await this.apiClient.sendRequest<
857
+ StreamResponse<PollOptionResponse>
858
+ >(
859
+ 'POST',
860
+ '/api/v2/polls/{poll_id}/options',
861
+ pathParams,
862
+ undefined,
863
+ body,
864
+ 'application/json',
865
+ );
866
+
867
+ decoders.PollOptionResponse?.(response.body);
868
+
869
+ return { ...response.body, metadata: response.metadata };
870
+ }
617
871
 
618
- listPushProviders = async (): Promise<
872
+ async updatePollOption(
873
+ request: UpdatePollOptionRequest & { poll_id: string },
874
+ ): Promise<StreamResponse<PollOptionResponse>> {
875
+ const pathParams = {
876
+ poll_id: request?.poll_id,
877
+ };
878
+ const body = {
879
+ id: request?.id,
880
+ text: request?.text,
881
+ user_id: request?.user_id,
882
+ custom: request?.custom,
883
+ user: request?.user,
884
+ };
885
+
886
+ const response = await this.apiClient.sendRequest<
887
+ StreamResponse<PollOptionResponse>
888
+ >(
889
+ 'PUT',
890
+ '/api/v2/polls/{poll_id}/options',
891
+ pathParams,
892
+ undefined,
893
+ body,
894
+ 'application/json',
895
+ );
896
+
897
+ decoders.PollOptionResponse?.(response.body);
898
+
899
+ return { ...response.body, metadata: response.metadata };
900
+ }
901
+
902
+ async deletePollOption(request: {
903
+ poll_id: string;
904
+ option_id: string;
905
+ user_id?: string;
906
+ }): Promise<StreamResponse<Response>> {
907
+ const queryParams = {
908
+ user_id: request?.user_id,
909
+ };
910
+ const pathParams = {
911
+ poll_id: request?.poll_id,
912
+ option_id: request?.option_id,
913
+ };
914
+
915
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
916
+ 'DELETE',
917
+ '/api/v2/polls/{poll_id}/options/{option_id}',
918
+ pathParams,
919
+ queryParams,
920
+ );
921
+
922
+ decoders.Response?.(response.body);
923
+
924
+ return { ...response.body, metadata: response.metadata };
925
+ }
926
+
927
+ async getPollOption(request: {
928
+ poll_id: string;
929
+ option_id: string;
930
+ user_id?: string;
931
+ }): Promise<StreamResponse<PollOptionResponse>> {
932
+ const queryParams = {
933
+ user_id: request?.user_id,
934
+ };
935
+ const pathParams = {
936
+ poll_id: request?.poll_id,
937
+ option_id: request?.option_id,
938
+ };
939
+
940
+ const response = await this.apiClient.sendRequest<
941
+ StreamResponse<PollOptionResponse>
942
+ >(
943
+ 'GET',
944
+ '/api/v2/polls/{poll_id}/options/{option_id}',
945
+ pathParams,
946
+ queryParams,
947
+ );
948
+
949
+ decoders.PollOptionResponse?.(response.body);
950
+
951
+ return { ...response.body, metadata: response.metadata };
952
+ }
953
+
954
+ async queryPollVotes(
955
+ request: QueryPollVotesRequest & { poll_id: string; user_id?: string },
956
+ ): Promise<StreamResponse<PollVotesResponse>> {
957
+ const queryParams = {
958
+ user_id: request?.user_id,
959
+ };
960
+ const pathParams = {
961
+ poll_id: request?.poll_id,
962
+ };
963
+ const body = {
964
+ limit: request?.limit,
965
+ next: request?.next,
966
+ prev: request?.prev,
967
+ sort: request?.sort,
968
+ filter: request?.filter,
969
+ };
970
+
971
+ const response = await this.apiClient.sendRequest<
972
+ StreamResponse<PollVotesResponse>
973
+ >(
974
+ 'POST',
975
+ '/api/v2/polls/{poll_id}/votes',
976
+ pathParams,
977
+ queryParams,
978
+ body,
979
+ 'application/json',
980
+ );
981
+
982
+ decoders.PollVotesResponse?.(response.body);
983
+
984
+ return { ...response.body, metadata: response.metadata };
985
+ }
986
+
987
+ async listPushProviders(): Promise<
619
988
  StreamResponse<ListPushProvidersResponse>
620
- > => {
621
- const response = await this.sendRequest<
989
+ > {
990
+ const response = await this.apiClient.sendRequest<
622
991
  StreamResponse<ListPushProvidersResponse>
623
992
  >('GET', '/api/v2/push_providers', undefined, undefined);
624
993
 
625
994
  decoders.ListPushProvidersResponse?.(response.body);
626
995
 
627
996
  return { ...response.body, metadata: response.metadata };
628
- };
997
+ }
629
998
 
630
- upsertPushProvider = async (
999
+ async upsertPushProvider(
631
1000
  request?: UpsertPushProviderRequest,
632
- ): Promise<StreamResponse<UpsertPushProviderResponse>> => {
1001
+ ): Promise<StreamResponse<UpsertPushProviderResponse>> {
633
1002
  const body = {
634
1003
  push_provider: request?.push_provider,
635
1004
  };
636
1005
 
637
- const response = await this.sendRequest<
1006
+ const response = await this.apiClient.sendRequest<
638
1007
  StreamResponse<UpsertPushProviderResponse>
639
- >('POST', '/api/v2/push_providers', undefined, undefined, body);
1008
+ >(
1009
+ 'POST',
1010
+ '/api/v2/push_providers',
1011
+ undefined,
1012
+ undefined,
1013
+ body,
1014
+ 'application/json',
1015
+ );
640
1016
 
641
1017
  decoders.UpsertPushProviderResponse?.(response.body);
642
1018
 
643
1019
  return { ...response.body, metadata: response.metadata };
644
- };
1020
+ }
645
1021
 
646
- deletePushProvider = async (request: {
1022
+ async deletePushProvider(request: {
647
1023
  type: string;
648
1024
  name: string;
649
- }): Promise<StreamResponse<Response>> => {
1025
+ }): Promise<StreamResponse<Response>> {
650
1026
  const pathParams = {
651
1027
  type: request?.type,
652
1028
  name: request?.name,
653
1029
  };
654
1030
 
655
- const response = await this.sendRequest<StreamResponse<Response>>(
1031
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
656
1032
  'DELETE',
657
1033
  '/api/v2/push_providers/{type}/{name}',
658
1034
  pathParams,
@@ -662,15 +1038,15 @@ export class CommonApi extends BaseApi {
662
1038
  decoders.Response?.(response.body);
663
1039
 
664
1040
  return { ...response.body, metadata: response.metadata };
665
- };
1041
+ }
666
1042
 
667
- getRateLimits = async (request?: {
1043
+ async getRateLimits(request?: {
668
1044
  server_side?: boolean;
669
1045
  android?: boolean;
670
1046
  ios?: boolean;
671
1047
  web?: boolean;
672
1048
  endpoints?: string;
673
- }): Promise<StreamResponse<GetRateLimitsResponse>> => {
1049
+ }): Promise<StreamResponse<GetRateLimitsResponse>> {
674
1050
  const queryParams = {
675
1051
  server_side: request?.server_side,
676
1052
  android: request?.android,
@@ -679,56 +1055,49 @@ export class CommonApi extends BaseApi {
679
1055
  endpoints: request?.endpoints,
680
1056
  };
681
1057
 
682
- const response = await this.sendRequest<
1058
+ const response = await this.apiClient.sendRequest<
683
1059
  StreamResponse<GetRateLimitsResponse>
684
1060
  >('GET', '/api/v2/rate_limits', undefined, queryParams);
685
1061
 
686
1062
  decoders.GetRateLimitsResponse?.(response.body);
687
1063
 
688
1064
  return { ...response.body, metadata: response.metadata };
689
- };
1065
+ }
690
1066
 
691
- listRoles = async (): Promise<StreamResponse<ListRolesResponse>> => {
692
- const response = await this.sendRequest<StreamResponse<ListRolesResponse>>(
693
- 'GET',
694
- '/api/v2/roles',
695
- undefined,
696
- undefined,
697
- );
1067
+ async listRoles(): Promise<StreamResponse<ListRolesResponse>> {
1068
+ const response = await this.apiClient.sendRequest<
1069
+ StreamResponse<ListRolesResponse>
1070
+ >('GET', '/api/v2/roles', undefined, undefined);
698
1071
 
699
1072
  decoders.ListRolesResponse?.(response.body);
700
1073
 
701
1074
  return { ...response.body, metadata: response.metadata };
702
- };
1075
+ }
703
1076
 
704
- createRole = async (
1077
+ async createRole(
705
1078
  request: CreateRoleRequest,
706
- ): Promise<StreamResponse<CreateRoleResponse>> => {
1079
+ ): Promise<StreamResponse<CreateRoleResponse>> {
707
1080
  const body = {
708
1081
  name: request?.name,
709
1082
  };
710
1083
 
711
- const response = await this.sendRequest<StreamResponse<CreateRoleResponse>>(
712
- 'POST',
713
- '/api/v2/roles',
714
- undefined,
715
- undefined,
716
- body,
717
- );
1084
+ const response = await this.apiClient.sendRequest<
1085
+ StreamResponse<CreateRoleResponse>
1086
+ >('POST', '/api/v2/roles', undefined, undefined, body, 'application/json');
718
1087
 
719
1088
  decoders.CreateRoleResponse?.(response.body);
720
1089
 
721
1090
  return { ...response.body, metadata: response.metadata };
722
- };
1091
+ }
723
1092
 
724
- deleteRole = async (request: {
1093
+ async deleteRole(request: {
725
1094
  name: string;
726
- }): Promise<StreamResponse<Response>> => {
1095
+ }): Promise<StreamResponse<Response>> {
727
1096
  const pathParams = {
728
1097
  name: request?.name,
729
1098
  };
730
1099
 
731
- const response = await this.sendRequest<StreamResponse<Response>>(
1100
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
732
1101
  'DELETE',
733
1102
  '/api/v2/roles/{name}',
734
1103
  pathParams,
@@ -738,35 +1107,32 @@ export class CommonApi extends BaseApi {
738
1107
  decoders.Response?.(response.body);
739
1108
 
740
1109
  return { ...response.body, metadata: response.metadata };
741
- };
1110
+ }
742
1111
 
743
- getTask = async (request: {
1112
+ async getTask(request: {
744
1113
  id: string;
745
- }): Promise<StreamResponse<GetTaskResponse>> => {
1114
+ }): Promise<StreamResponse<GetTaskResponse>> {
746
1115
  const pathParams = {
747
1116
  id: request?.id,
748
1117
  };
749
1118
 
750
- const response = await this.sendRequest<StreamResponse<GetTaskResponse>>(
751
- 'GET',
752
- '/api/v2/tasks/{id}',
753
- pathParams,
754
- undefined,
755
- );
1119
+ const response = await this.apiClient.sendRequest<
1120
+ StreamResponse<GetTaskResponse>
1121
+ >('GET', '/api/v2/tasks/{id}', pathParams, undefined);
756
1122
 
757
1123
  decoders.GetTaskResponse?.(response.body);
758
1124
 
759
1125
  return { ...response.body, metadata: response.metadata };
760
- };
1126
+ }
761
1127
 
762
- deleteFile = async (request?: {
1128
+ async deleteFile(request?: {
763
1129
  url?: string;
764
- }): Promise<StreamResponse<Response>> => {
1130
+ }): Promise<StreamResponse<Response>> {
765
1131
  const queryParams = {
766
1132
  url: request?.url,
767
1133
  };
768
1134
 
769
- const response = await this.sendRequest<StreamResponse<Response>>(
1135
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
770
1136
  'DELETE',
771
1137
  '/api/v2/uploads/file',
772
1138
  undefined,
@@ -776,37 +1142,40 @@ export class CommonApi extends BaseApi {
776
1142
  decoders.Response?.(response.body);
777
1143
 
778
1144
  return { ...response.body, metadata: response.metadata };
779
- };
1145
+ }
780
1146
 
781
- uploadFile = async (
1147
+ async uploadFile(
782
1148
  request?: FileUploadRequest,
783
- ): Promise<StreamResponse<FileUploadResponse>> => {
1149
+ ): Promise<StreamResponse<FileUploadResponse>> {
784
1150
  const body = {
785
1151
  file: request?.file,
786
1152
  user: request?.user,
787
1153
  };
788
1154
 
789
- const response = await this.sendRequest<StreamResponse<FileUploadResponse>>(
1155
+ const response = await this.apiClient.sendRequest<
1156
+ StreamResponse<FileUploadResponse>
1157
+ >(
790
1158
  'POST',
791
1159
  '/api/v2/uploads/file',
792
1160
  undefined,
793
1161
  undefined,
794
1162
  body,
1163
+ 'multipart/form-data',
795
1164
  );
796
1165
 
797
1166
  decoders.FileUploadResponse?.(response.body);
798
1167
 
799
1168
  return { ...response.body, metadata: response.metadata };
800
- };
1169
+ }
801
1170
 
802
- deleteImage = async (request?: {
1171
+ async deleteImage(request?: {
803
1172
  url?: string;
804
- }): Promise<StreamResponse<Response>> => {
1173
+ }): Promise<StreamResponse<Response>> {
805
1174
  const queryParams = {
806
1175
  url: request?.url,
807
1176
  };
808
1177
 
809
- const response = await this.sendRequest<StreamResponse<Response>>(
1178
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
810
1179
  'DELETE',
811
1180
  '/api/v2/uploads/image',
812
1181
  undefined,
@@ -816,118 +1185,125 @@ export class CommonApi extends BaseApi {
816
1185
  decoders.Response?.(response.body);
817
1186
 
818
1187
  return { ...response.body, metadata: response.metadata };
819
- };
1188
+ }
820
1189
 
821
- uploadImage = async (
1190
+ async uploadImage(
822
1191
  request?: ImageUploadRequest,
823
- ): Promise<StreamResponse<ImageUploadResponse>> => {
1192
+ ): Promise<StreamResponse<ImageUploadResponse>> {
824
1193
  const body = {
825
1194
  file: request?.file,
826
1195
  upload_sizes: request?.upload_sizes,
827
1196
  user: request?.user,
828
1197
  };
829
1198
 
830
- const response = await this.sendRequest<
1199
+ const response = await this.apiClient.sendRequest<
831
1200
  StreamResponse<ImageUploadResponse>
832
- >('POST', '/api/v2/uploads/image', undefined, undefined, body);
1201
+ >(
1202
+ 'POST',
1203
+ '/api/v2/uploads/image',
1204
+ undefined,
1205
+ undefined,
1206
+ body,
1207
+ 'multipart/form-data',
1208
+ );
833
1209
 
834
1210
  decoders.ImageUploadResponse?.(response.body);
835
1211
 
836
1212
  return { ...response.body, metadata: response.metadata };
837
- };
1213
+ }
838
1214
 
839
- queryUsers = async (request?: {
1215
+ async queryUsers(request?: {
840
1216
  payload?: QueryUsersPayload;
841
- }): Promise<StreamResponse<QueryUsersResponse>> => {
1217
+ }): Promise<StreamResponse<QueryUsersResponse>> {
842
1218
  const queryParams = {
843
1219
  payload: request?.payload,
844
1220
  };
845
1221
 
846
- const response = await this.sendRequest<StreamResponse<QueryUsersResponse>>(
847
- 'GET',
848
- '/api/v2/users',
849
- undefined,
850
- queryParams,
851
- );
1222
+ const response = await this.apiClient.sendRequest<
1223
+ StreamResponse<QueryUsersResponse>
1224
+ >('GET', '/api/v2/users', undefined, queryParams);
852
1225
 
853
1226
  decoders.QueryUsersResponse?.(response.body);
854
1227
 
855
1228
  return { ...response.body, metadata: response.metadata };
856
- };
1229
+ }
857
1230
 
858
- updateUsersPartial = async (
1231
+ async updateUsersPartial(
859
1232
  request: UpdateUsersPartialRequest,
860
- ): Promise<StreamResponse<UpdateUsersResponse>> => {
1233
+ ): Promise<StreamResponse<UpdateUsersResponse>> {
861
1234
  const body = {
862
1235
  users: request?.users,
863
1236
  };
864
1237
 
865
- const response = await this.sendRequest<
1238
+ const response = await this.apiClient.sendRequest<
866
1239
  StreamResponse<UpdateUsersResponse>
867
- >('PATCH', '/api/v2/users', undefined, undefined, body);
1240
+ >('PATCH', '/api/v2/users', undefined, undefined, body, 'application/json');
868
1241
 
869
1242
  decoders.UpdateUsersResponse?.(response.body);
870
1243
 
871
1244
  return { ...response.body, metadata: response.metadata };
872
- };
1245
+ }
873
1246
 
874
- updateUsers = async (
1247
+ async updateUsers(
875
1248
  request: UpdateUsersRequest,
876
- ): Promise<StreamResponse<UpdateUsersResponse>> => {
1249
+ ): Promise<StreamResponse<UpdateUsersResponse>> {
877
1250
  const body = {
878
1251
  users: request?.users,
879
1252
  };
880
1253
 
881
- const response = await this.sendRequest<
1254
+ const response = await this.apiClient.sendRequest<
882
1255
  StreamResponse<UpdateUsersResponse>
883
- >('POST', '/api/v2/users', undefined, undefined, body);
1256
+ >('POST', '/api/v2/users', undefined, undefined, body, 'application/json');
884
1257
 
885
1258
  decoders.UpdateUsersResponse?.(response.body);
886
1259
 
887
1260
  return { ...response.body, metadata: response.metadata };
888
- };
1261
+ }
889
1262
 
890
- getBlockedUsers = async (request?: {
1263
+ async getBlockedUsers(request?: {
891
1264
  user_id?: string;
892
- }): Promise<StreamResponse<GetBlockedUsersResponse>> => {
1265
+ }): Promise<StreamResponse<GetBlockedUsersResponse>> {
893
1266
  const queryParams = {
894
1267
  user_id: request?.user_id,
895
1268
  };
896
1269
 
897
- const response = await this.sendRequest<
1270
+ const response = await this.apiClient.sendRequest<
898
1271
  StreamResponse<GetBlockedUsersResponse>
899
1272
  >('GET', '/api/v2/users/block', undefined, queryParams);
900
1273
 
901
1274
  decoders.GetBlockedUsersResponse?.(response.body);
902
1275
 
903
1276
  return { ...response.body, metadata: response.metadata };
904
- };
1277
+ }
905
1278
 
906
- blockUsers = async (
1279
+ async blockUsers(
907
1280
  request: BlockUsersRequest,
908
- ): Promise<StreamResponse<BlockUsersResponse>> => {
1281
+ ): Promise<StreamResponse<BlockUsersResponse>> {
909
1282
  const body = {
910
1283
  blocked_user_id: request?.blocked_user_id,
911
1284
  user_id: request?.user_id,
912
1285
  user: request?.user,
913
1286
  };
914
1287
 
915
- const response = await this.sendRequest<StreamResponse<BlockUsersResponse>>(
1288
+ const response = await this.apiClient.sendRequest<
1289
+ StreamResponse<BlockUsersResponse>
1290
+ >(
916
1291
  'POST',
917
1292
  '/api/v2/users/block',
918
1293
  undefined,
919
1294
  undefined,
920
1295
  body,
1296
+ 'application/json',
921
1297
  );
922
1298
 
923
1299
  decoders.BlockUsersResponse?.(response.body);
924
1300
 
925
1301
  return { ...response.body, metadata: response.metadata };
926
- };
1302
+ }
927
1303
 
928
- deactivateUsers = async (
1304
+ async deactivateUsers(
929
1305
  request: DeactivateUsersRequest,
930
- ): Promise<StreamResponse<DeactivateUsersResponse>> => {
1306
+ ): Promise<StreamResponse<DeactivateUsersResponse>> {
931
1307
  const body = {
932
1308
  user_ids: request?.user_ids,
933
1309
  created_by_id: request?.created_by_id,
@@ -935,18 +1311,25 @@ export class CommonApi extends BaseApi {
935
1311
  mark_messages_deleted: request?.mark_messages_deleted,
936
1312
  };
937
1313
 
938
- const response = await this.sendRequest<
1314
+ const response = await this.apiClient.sendRequest<
939
1315
  StreamResponse<DeactivateUsersResponse>
940
- >('POST', '/api/v2/users/deactivate', undefined, undefined, body);
1316
+ >(
1317
+ 'POST',
1318
+ '/api/v2/users/deactivate',
1319
+ undefined,
1320
+ undefined,
1321
+ body,
1322
+ 'application/json',
1323
+ );
941
1324
 
942
1325
  decoders.DeactivateUsersResponse?.(response.body);
943
1326
 
944
1327
  return { ...response.body, metadata: response.metadata };
945
- };
1328
+ }
946
1329
 
947
- deleteUsers = async (
1330
+ async deleteUsers(
948
1331
  request: DeleteUsersRequest,
949
- ): Promise<StreamResponse<DeleteUsersResponse>> => {
1332
+ ): Promise<StreamResponse<DeleteUsersResponse>> {
950
1333
  const body = {
951
1334
  user_ids: request?.user_ids,
952
1335
  calls: request?.calls,
@@ -957,18 +1340,71 @@ export class CommonApi extends BaseApi {
957
1340
  user: request?.user,
958
1341
  };
959
1342
 
960
- const response = await this.sendRequest<
1343
+ const response = await this.apiClient.sendRequest<
961
1344
  StreamResponse<DeleteUsersResponse>
962
- >('POST', '/api/v2/users/delete', undefined, undefined, body);
1345
+ >(
1346
+ 'POST',
1347
+ '/api/v2/users/delete',
1348
+ undefined,
1349
+ undefined,
1350
+ body,
1351
+ 'application/json',
1352
+ );
963
1353
 
964
1354
  decoders.DeleteUsersResponse?.(response.body);
965
1355
 
966
1356
  return { ...response.body, metadata: response.metadata };
967
- };
1357
+ }
1358
+
1359
+ async getUserLiveLocations(request?: {
1360
+ user_id?: string;
1361
+ }): Promise<StreamResponse<SharedLocationsResponse>> {
1362
+ const queryParams = {
1363
+ user_id: request?.user_id,
1364
+ };
1365
+
1366
+ const response = await this.apiClient.sendRequest<
1367
+ StreamResponse<SharedLocationsResponse>
1368
+ >('GET', '/api/v2/users/live_locations', undefined, queryParams);
1369
+
1370
+ decoders.SharedLocationsResponse?.(response.body);
1371
+
1372
+ return { ...response.body, metadata: response.metadata };
1373
+ }
1374
+
1375
+ async updateLiveLocation(
1376
+ request: UpdateLiveLocationRequest & { user_id?: string },
1377
+ ): Promise<StreamResponse<SharedLocationResponse>> {
1378
+ const queryParams = {
1379
+ user_id: request?.user_id,
1380
+ };
1381
+ const body = {
1382
+ created_by_device_id: request?.created_by_device_id,
1383
+ message_id: request?.message_id,
1384
+ end_at: request?.end_at,
1385
+ latitude: request?.latitude,
1386
+ longitude: request?.longitude,
1387
+ };
1388
+
1389
+ const response = await this.apiClient.sendRequest<
1390
+ StreamResponse<SharedLocationResponse>
1391
+ >(
1392
+ 'PUT',
1393
+ '/api/v2/users/live_locations',
1394
+ undefined,
1395
+ queryParams,
1396
+ body,
1397
+ 'application/json',
1398
+ );
1399
+
1400
+ decoders.SharedLocationResponse?.(response.body);
1401
+
1402
+ return { ...response.body, metadata: response.metadata };
1403
+ }
968
1404
 
969
- reactivateUsers = async (
1405
+ async reactivateUsers(
970
1406
  request: ReactivateUsersRequest,
971
- ): Promise<StreamResponse<ReactivateUsersResponse>> => {
1407
+ ): Promise<StreamResponse<ReactivateUsersResponse>> {
972
1408
  const body = {
973
1409
  user_ids: request?.user_ids,
974
1410
  created_by_id: request?.created_by_id,
@@ -976,56 +1412,71 @@ export class CommonApi extends BaseApi {
976
1412
  restore_messages: request?.restore_messages,
977
1413
  };
978
1414
 
979
- const response = await this.sendRequest<
1415
+ const response = await this.apiClient.sendRequest<
980
1416
  StreamResponse<ReactivateUsersResponse>
981
- >('POST', '/api/v2/users/reactivate', undefined, undefined, body);
1417
+ >(
1418
+ 'POST',
1419
+ '/api/v2/users/reactivate',
1420
+ undefined,
1421
+ undefined,
1422
+ body,
1423
+ 'application/json',
1424
+ );
982
1425
 
983
1426
  decoders.ReactivateUsersResponse?.(response.body);
984
1427
 
985
1428
  return { ...response.body, metadata: response.metadata };
986
- };
1429
+ }
987
1430
 
988
- restoreUsers = async (
1431
+ async restoreUsers(
989
1432
  request: RestoreUsersRequest,
990
- ): Promise<StreamResponse<Response>> => {
1433
+ ): Promise<StreamResponse<Response>> {
991
1434
  const body = {
992
1435
  user_ids: request?.user_ids,
993
1436
  };
994
1437
 
995
- const response = await this.sendRequest<StreamResponse<Response>>(
1438
+ const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
996
1439
  'POST',
997
1440
  '/api/v2/users/restore',
998
1441
  undefined,
999
1442
  undefined,
1000
1443
  body,
1444
+ 'application/json',
1001
1445
  );
1002
1446
 
1003
1447
  decoders.Response?.(response.body);
1004
1448
 
1005
1449
  return { ...response.body, metadata: response.metadata };
1006
- };
1450
+ }
1007
1451
 
1008
- unblockUsers = async (
1452
+ async unblockUsers(
1009
1453
  request: UnblockUsersRequest,
1010
- ): Promise<StreamResponse<UnblockUsersResponse>> => {
1454
+ ): Promise<StreamResponse<UnblockUsersResponse>> {
1011
1455
  const body = {
1012
1456
  blocked_user_id: request?.blocked_user_id,
1013
1457
  user_id: request?.user_id,
1014
1458
  user: request?.user,
1015
1459
  };
1016
1460
 
1017
- const response = await this.sendRequest<
1461
+ const response = await this.apiClient.sendRequest<
1018
1462
  StreamResponse<UnblockUsersResponse>
1019
- >('POST', '/api/v2/users/unblock', undefined, undefined, body);
1463
+ >(
1464
+ 'POST',
1465
+ '/api/v2/users/unblock',
1466
+ undefined,
1467
+ undefined,
1468
+ body,
1469
+ 'application/json',
1470
+ );
1020
1471
 
1021
1472
  decoders.UnblockUsersResponse?.(response.body);
1022
1473
 
1023
1474
  return { ...response.body, metadata: response.metadata };
1024
- };
1475
+ }
1025
1476
 
1026
- deactivateUser = async (
1477
+ async deactivateUser(
1027
1478
  request: DeactivateUserRequest & { user_id: string },
1028
- ): Promise<StreamResponse<DeactivateUserResponse>> => {
1479
+ ): Promise<StreamResponse<DeactivateUserResponse>> {
1029
1480
  const pathParams = {
1030
1481
  user_id: request?.user_id,
1031
1482
  };
@@ -1034,7 +1485,7 @@ export class CommonApi extends BaseApi {
1034
1485
  mark_messages_deleted: request?.mark_messages_deleted,
1035
1486
  };
1036
1487
 
1037
- const response = await this.sendRequest<
1488
+ const response = await this.apiClient.sendRequest<
1038
1489
  StreamResponse<DeactivateUserResponse>
1039
1490
  >(
1040
1491
  'POST',
@@ -1042,35 +1493,33 @@ export class CommonApi extends BaseApi {
1042
1493
  pathParams,
1043
1494
  undefined,
1044
1495
  body,
1496
+ 'application/json',
1045
1497
  );
1046
1498
 
1047
1499
  decoders.DeactivateUserResponse?.(response.body);
1048
1500
 
1049
1501
  return { ...response.body, metadata: response.metadata };
1050
- };
1502
+ }
1051
1503
 
1052
- exportUser = async (request: {
1504
+ async exportUser(request: {
1053
1505
  user_id: string;
1054
- }): Promise<StreamResponse<ExportUserResponse>> => {
1506
+ }): Promise<StreamResponse<ExportUserResponse>> {
1055
1507
  const pathParams = {
1056
1508
  user_id: request?.user_id,
1057
1509
  };
1058
1510
 
1059
- const response = await this.sendRequest<StreamResponse<ExportUserResponse>>(
1060
- 'GET',
1061
- '/api/v2/users/{user_id}/export',
1062
- pathParams,
1063
- undefined,
1064
- );
1511
+ const response = await this.apiClient.sendRequest<
1512
+ StreamResponse<ExportUserResponse>
1513
+ >('GET', '/api/v2/users/{user_id}/export', pathParams, undefined);
1065
1514
 
1066
1515
  decoders.ExportUserResponse?.(response.body);
1067
1516
 
1068
1517
  return { ...response.body, metadata: response.metadata };
1069
- };
1518
+ }
1070
1519
 
1071
- reactivateUser = async (
1520
+ async reactivateUser(
1072
1521
  request: ReactivateUserRequest & { user_id: string },
1073
- ): Promise<StreamResponse<ReactivateUserResponse>> => {
1522
+ ): Promise<StreamResponse<ReactivateUserResponse>> {
1074
1523
  const pathParams = {
1075
1524
  user_id: request?.user_id,
1076
1525
  };
@@ -1080,7 +1529,7 @@ export class CommonApi extends BaseApi {
1080
1529
  restore_messages: request?.restore_messages,
1081
1530
  };
1082
1531
 
1083
- const response = await this.sendRequest<
1532
+ const response = await this.apiClient.sendRequest<
1084
1533
  StreamResponse<ReactivateUserResponse>
1085
1534
  >(
1086
1535
  'POST',
@@ -1088,10 +1537,11 @@ export class CommonApi extends BaseApi {
1088
1537
  pathParams,
1089
1538
  undefined,
1090
1539
  body,
1540
+ 'application/json',
1091
1541
  );
1092
1542
 
1093
1543
  decoders.ReactivateUserResponse?.(response.body);
1094
1544
 
1095
1545
  return { ...response.body, metadata: response.metadata };
1096
- };
1546
+ }
1097
1547
  }