@stream-io/node-sdk 0.4.26 → 0.5.1

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