@stream-io/node-sdk 0.8.8 → 0.8.9

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.
@@ -106,13 +106,16 @@ export class ModerationApi {
106
106
  user_id: request?.user_id,
107
107
  };
108
108
 
109
- const response = await this.apiClient.sendRequest<
110
- StreamResponse<GetActionConfigResponse>
111
- >('GET', '/api/v2/moderation/action_config', undefined, queryParams);
109
+ const response = await this.apiClient.sendRequest<GetActionConfigResponse>(
110
+ 'GET',
111
+ '/api/v2/moderation/action_config',
112
+ undefined,
113
+ queryParams,
114
+ );
112
115
 
113
- decoders['GetActionConfigResponse']?.(response.body);
116
+ decoders['GetActionConfigResponse']?.(response);
114
117
 
115
- return { ...response.body, metadata: response.metadata };
118
+ return response;
116
119
  }
117
120
 
118
121
  async upsertActionConfig(
@@ -131,20 +134,18 @@ export class ModerationApi {
131
134
  user: request?.user,
132
135
  };
133
136
 
134
- const response = await this.apiClient.sendRequest<
135
- StreamResponse<UpsertActionConfigResponse>
136
- >(
137
- 'POST',
138
- '/api/v2/moderation/action_config',
139
- undefined,
140
- undefined,
141
- body,
142
- 'application/json',
143
- );
137
+ const response =
138
+ await this.apiClient.sendRequest<UpsertActionConfigResponse>(
139
+ 'POST',
140
+ '/api/v2/moderation/action_config',
141
+ undefined,
142
+ undefined,
143
+ body,
144
+ );
144
145
 
145
- decoders['UpsertActionConfigResponse']?.(response.body);
146
+ decoders['UpsertActionConfigResponse']?.(response);
146
147
 
147
- return { ...response.body, metadata: response.metadata };
148
+ return response;
148
149
  }
149
150
 
150
151
  async bulkUpsertActionConfig(
@@ -156,20 +157,18 @@ export class ModerationApi {
156
157
  user: request?.user,
157
158
  };
158
159
 
159
- const response = await this.apiClient.sendRequest<
160
- StreamResponse<BulkUpsertActionConfigResponse>
161
- >(
162
- 'POST',
163
- '/api/v2/moderation/action_config/bulk',
164
- undefined,
165
- undefined,
166
- body,
167
- 'application/json',
168
- );
160
+ const response =
161
+ await this.apiClient.sendRequest<BulkUpsertActionConfigResponse>(
162
+ 'POST',
163
+ '/api/v2/moderation/action_config/bulk',
164
+ undefined,
165
+ undefined,
166
+ body,
167
+ );
169
168
 
170
- decoders['BulkUpsertActionConfigResponse']?.(response.body);
169
+ decoders['BulkUpsertActionConfigResponse']?.(response);
171
170
 
172
- return { ...response.body, metadata: response.metadata };
171
+ return response;
173
172
  }
174
173
 
175
174
  async bulkDeleteActionConfig(
@@ -181,20 +180,18 @@ export class ModerationApi {
181
180
  user: request?.user,
182
181
  };
183
182
 
184
- const response = await this.apiClient.sendRequest<
185
- StreamResponse<BulkDeleteActionConfigResponse>
186
- >(
187
- 'POST',
188
- '/api/v2/moderation/action_config/bulk_delete',
189
- undefined,
190
- undefined,
191
- body,
192
- 'application/json',
193
- );
183
+ const response =
184
+ await this.apiClient.sendRequest<BulkDeleteActionConfigResponse>(
185
+ 'POST',
186
+ '/api/v2/moderation/action_config/bulk_delete',
187
+ undefined,
188
+ undefined,
189
+ body,
190
+ );
194
191
 
195
- decoders['BulkDeleteActionConfigResponse']?.(response.body);
192
+ decoders['BulkDeleteActionConfigResponse']?.(response);
196
193
 
197
- return { ...response.body, metadata: response.metadata };
194
+ return response;
198
195
  }
199
196
 
200
197
  async deleteActionConfig(request: {
@@ -208,18 +205,17 @@ export class ModerationApi {
208
205
  id: request?.id,
209
206
  };
210
207
 
211
- const response = await this.apiClient.sendRequest<
212
- StreamResponse<DeleteActionConfigResponse>
213
- >(
214
- 'DELETE',
215
- '/api/v2/moderation/action_config/{id}',
216
- pathParams,
217
- queryParams,
218
- );
208
+ const response =
209
+ await this.apiClient.sendRequest<DeleteActionConfigResponse>(
210
+ 'DELETE',
211
+ '/api/v2/moderation/action_config/{id}',
212
+ pathParams,
213
+ queryParams,
214
+ );
219
215
 
220
- decoders['DeleteActionConfigResponse']?.(response.body);
216
+ decoders['DeleteActionConfigResponse']?.(response);
221
217
 
222
- return { ...response.body, metadata: response.metadata };
218
+ return response;
223
219
  }
224
220
 
225
221
  async insertActionLog(
@@ -236,20 +232,17 @@ export class ModerationApi {
236
232
  custom: request?.custom,
237
233
  };
238
234
 
239
- const response = await this.apiClient.sendRequest<
240
- StreamResponse<InsertActionLogResponse>
241
- >(
235
+ const response = await this.apiClient.sendRequest<InsertActionLogResponse>(
242
236
  'POST',
243
237
  '/api/v2/moderation/action_logs',
244
238
  undefined,
245
239
  undefined,
246
240
  body,
247
- 'application/json',
248
241
  );
249
242
 
250
- decoders['InsertActionLogResponse']?.(response.body);
243
+ decoders['InsertActionLogResponse']?.(response);
251
244
 
252
- return { ...response.body, metadata: response.metadata };
245
+ return response;
253
246
  }
254
247
 
255
248
  async analyze(
@@ -270,20 +263,17 @@ export class ModerationApi {
270
263
  user: request?.user,
271
264
  };
272
265
 
273
- const response = await this.apiClient.sendRequest<
274
- StreamResponse<AnalyzeResponse>
275
- >(
266
+ const response = await this.apiClient.sendRequest<AnalyzeResponse>(
276
267
  'POST',
277
268
  '/api/v2/moderation/analyze',
278
269
  undefined,
279
270
  undefined,
280
271
  body,
281
- 'application/json',
282
272
  );
283
273
 
284
- decoders['AnalyzeResponse']?.(response.body);
274
+ decoders['AnalyzeResponse']?.(response);
285
275
 
286
- return { ...response.body, metadata: response.metadata };
276
+ return response;
287
277
  }
288
278
 
289
279
  async appeal(
@@ -300,20 +290,17 @@ export class ModerationApi {
300
290
  user: request?.user,
301
291
  };
302
292
 
303
- const response = await this.apiClient.sendRequest<
304
- StreamResponse<AppealResponse>
305
- >(
293
+ const response = await this.apiClient.sendRequest<AppealResponse>(
306
294
  'POST',
307
295
  '/api/v2/moderation/appeal',
308
296
  undefined,
309
297
  undefined,
310
298
  body,
311
- 'application/json',
312
299
  );
313
300
 
314
- decoders['AppealResponse']?.(response.body);
301
+ decoders['AppealResponse']?.(response);
315
302
 
316
- return { ...response.body, metadata: response.metadata };
303
+ return response;
317
304
  }
318
305
 
319
306
  async getAppeal(request: {
@@ -323,13 +310,16 @@ export class ModerationApi {
323
310
  id: request?.id,
324
311
  };
325
312
 
326
- const response = await this.apiClient.sendRequest<
327
- StreamResponse<GetAppealResponse>
328
- >('GET', '/api/v2/moderation/appeal/{id}', pathParams, undefined);
313
+ const response = await this.apiClient.sendRequest<GetAppealResponse>(
314
+ 'GET',
315
+ '/api/v2/moderation/appeal/{id}',
316
+ pathParams,
317
+ undefined,
318
+ );
329
319
 
330
- decoders['GetAppealResponse']?.(response.body);
320
+ decoders['GetAppealResponse']?.(response);
331
321
 
332
- return { ...response.body, metadata: response.metadata };
322
+ return response;
333
323
  }
334
324
 
335
325
  async queryAppeals(
@@ -345,20 +335,17 @@ export class ModerationApi {
345
335
  user: request?.user,
346
336
  };
347
337
 
348
- const response = await this.apiClient.sendRequest<
349
- StreamResponse<QueryAppealsResponse>
350
- >(
338
+ const response = await this.apiClient.sendRequest<QueryAppealsResponse>(
351
339
  'POST',
352
340
  '/api/v2/moderation/appeals',
353
341
  undefined,
354
342
  undefined,
355
343
  body,
356
- 'application/json',
357
344
  );
358
345
 
359
- decoders['QueryAppealsResponse']?.(response.body);
346
+ decoders['QueryAppealsResponse']?.(response);
360
347
 
361
- return { ...response.body, metadata: response.metadata };
348
+ return response;
362
349
  }
363
350
 
364
351
  async bulkActionAppeals(
@@ -376,20 +363,18 @@ export class ModerationApi {
376
363
  user: request?.user,
377
364
  };
378
365
 
379
- const response = await this.apiClient.sendRequest<
380
- StreamResponse<BulkActionAppealsResponse>
381
- >(
382
- 'POST',
383
- '/api/v2/moderation/appeals/bulk_action',
384
- undefined,
385
- undefined,
386
- body,
387
- 'application/json',
388
- );
366
+ const response =
367
+ await this.apiClient.sendRequest<BulkActionAppealsResponse>(
368
+ 'POST',
369
+ '/api/v2/moderation/appeals/bulk_action',
370
+ undefined,
371
+ undefined,
372
+ body,
373
+ );
389
374
 
390
- decoders['BulkActionAppealsResponse']?.(response.body);
375
+ decoders['BulkActionAppealsResponse']?.(response);
391
376
 
392
- return { ...response.body, metadata: response.metadata };
377
+ return response;
393
378
  }
394
379
 
395
380
  async ban(
@@ -407,20 +392,17 @@ export class ModerationApi {
407
392
  banned_by: request?.banned_by,
408
393
  };
409
394
 
410
- const response = await this.apiClient.sendRequest<
411
- StreamResponse<ModerationBanResponse>
412
- >(
395
+ const response = await this.apiClient.sendRequest<ModerationBanResponse>(
413
396
  'POST',
414
397
  '/api/v2/moderation/ban',
415
398
  undefined,
416
399
  undefined,
417
400
  body,
418
- 'application/json',
419
401
  );
420
402
 
421
- decoders['ModerationBanResponse']?.(response.body);
403
+ decoders['ModerationBanResponse']?.(response);
422
404
 
423
- return { ...response.body, metadata: response.metadata };
405
+ return response;
424
406
  }
425
407
 
426
408
  async bulkImageModeration(
@@ -430,20 +412,18 @@ export class ModerationApi {
430
412
  csv_file: request?.csv_file,
431
413
  };
432
414
 
433
- const response = await this.apiClient.sendRequest<
434
- StreamResponse<BulkImageModerationResponse>
435
- >(
436
- 'POST',
437
- '/api/v2/moderation/bulk_image_moderation',
438
- undefined,
439
- undefined,
440
- body,
441
- 'application/json',
442
- );
415
+ const response =
416
+ await this.apiClient.sendRequest<BulkImageModerationResponse>(
417
+ 'POST',
418
+ '/api/v2/moderation/bulk_image_moderation',
419
+ undefined,
420
+ undefined,
421
+ body,
422
+ );
443
423
 
444
- decoders['BulkImageModerationResponse']?.(response.body);
424
+ decoders['BulkImageModerationResponse']?.(response);
445
425
 
446
- return { ...response.body, metadata: response.metadata };
426
+ return response;
447
427
  }
448
428
 
449
429
  async bypass(
@@ -454,20 +434,17 @@ export class ModerationApi {
454
434
  target_user_id: request?.target_user_id,
455
435
  };
456
436
 
457
- const response = await this.apiClient.sendRequest<
458
- StreamResponse<BypassResponse>
459
- >(
437
+ const response = await this.apiClient.sendRequest<BypassResponse>(
460
438
  'POST',
461
439
  '/api/v2/moderation/bypass',
462
440
  undefined,
463
441
  undefined,
464
442
  body,
465
- 'application/json',
466
443
  );
467
444
 
468
- decoders['BypassResponse']?.(response.body);
445
+ decoders['BypassResponse']?.(response);
469
446
 
470
- return { ...response.body, metadata: response.metadata };
447
+ return response;
471
448
  }
472
449
 
473
450
  async check(request: CheckRequest): Promise<StreamResponse<CheckResponse>> {
@@ -487,20 +464,17 @@ export class ModerationApi {
487
464
  user: request?.user,
488
465
  };
489
466
 
490
- const response = await this.apiClient.sendRequest<
491
- StreamResponse<CheckResponse>
492
- >(
467
+ const response = await this.apiClient.sendRequest<CheckResponse>(
493
468
  'POST',
494
469
  '/api/v2/moderation/check',
495
470
  undefined,
496
471
  undefined,
497
472
  body,
498
- 'application/json',
499
473
  );
500
474
 
501
- decoders['CheckResponse']?.(response.body);
475
+ decoders['CheckResponse']?.(response);
502
476
 
503
- return { ...response.body, metadata: response.metadata };
477
+ return response;
504
478
  }
505
479
 
506
480
  async checkS3Access(
@@ -510,20 +484,17 @@ export class ModerationApi {
510
484
  s3_url: request?.s3_url,
511
485
  };
512
486
 
513
- const response = await this.apiClient.sendRequest<
514
- StreamResponse<CheckS3AccessResponse>
515
- >(
487
+ const response = await this.apiClient.sendRequest<CheckS3AccessResponse>(
516
488
  'POST',
517
489
  '/api/v2/moderation/check_s3_access',
518
490
  undefined,
519
491
  undefined,
520
492
  body,
521
- 'application/json',
522
493
  );
523
494
 
524
- decoders['CheckS3AccessResponse']?.(response.body);
495
+ decoders['CheckS3AccessResponse']?.(response);
525
496
 
526
- return { ...response.body, metadata: response.metadata };
497
+ return response;
527
498
  }
528
499
 
529
500
  async upsertConfig(
@@ -547,6 +518,7 @@ export class ModerationApi {
547
518
  bodyguard_config: request?.bodyguard_config,
548
519
  flood_config: request?.flood_config,
549
520
  google_vision_config: request?.google_vision_config,
521
+ intent_config: request?.intent_config,
550
522
  llm_config: request?.llm_config,
551
523
  rule_builder_config: request?.rule_builder_config,
552
524
  user: request?.user,
@@ -554,20 +526,17 @@ export class ModerationApi {
554
526
  video_call_rule_config: request?.video_call_rule_config,
555
527
  };
556
528
 
557
- const response = await this.apiClient.sendRequest<
558
- StreamResponse<UpsertConfigResponse>
559
- >(
529
+ const response = await this.apiClient.sendRequest<UpsertConfigResponse>(
560
530
  'POST',
561
531
  '/api/v2/moderation/config',
562
532
  undefined,
563
533
  undefined,
564
534
  body,
565
- 'application/json',
566
535
  );
567
536
 
568
- decoders['UpsertConfigResponse']?.(response.body);
537
+ decoders['UpsertConfigResponse']?.(response);
569
538
 
570
- return { ...response.body, metadata: response.metadata };
539
+ return response;
571
540
  }
572
541
 
573
542
  async deleteConfig(request: {
@@ -583,13 +552,17 @@ export class ModerationApi {
583
552
  key: request?.key,
584
553
  };
585
554
 
586
- const response = await this.apiClient.sendRequest<
587
- StreamResponse<DeleteModerationConfigResponse>
588
- >('DELETE', '/api/v2/moderation/config/{key}', pathParams, queryParams);
555
+ const response =
556
+ await this.apiClient.sendRequest<DeleteModerationConfigResponse>(
557
+ 'DELETE',
558
+ '/api/v2/moderation/config/{key}',
559
+ pathParams,
560
+ queryParams,
561
+ );
589
562
 
590
- decoders['DeleteModerationConfigResponse']?.(response.body);
563
+ decoders['DeleteModerationConfigResponse']?.(response);
591
564
 
592
- return { ...response.body, metadata: response.metadata };
565
+ return response;
593
566
  }
594
567
 
595
568
  async getConfig(request: {
@@ -603,13 +576,16 @@ export class ModerationApi {
603
576
  key: request?.key,
604
577
  };
605
578
 
606
- const response = await this.apiClient.sendRequest<
607
- StreamResponse<GetConfigResponse>
608
- >('GET', '/api/v2/moderation/config/{key}', pathParams, queryParams);
579
+ const response = await this.apiClient.sendRequest<GetConfigResponse>(
580
+ 'GET',
581
+ '/api/v2/moderation/config/{key}',
582
+ pathParams,
583
+ queryParams,
584
+ );
609
585
 
610
- decoders['GetConfigResponse']?.(response.body);
586
+ decoders['GetConfigResponse']?.(response);
611
587
 
612
- return { ...response.body, metadata: response.metadata };
588
+ return response;
613
589
  }
614
590
 
615
591
  async queryModerationConfigs(
@@ -625,20 +601,18 @@ export class ModerationApi {
625
601
  user: request?.user,
626
602
  };
627
603
 
628
- const response = await this.apiClient.sendRequest<
629
- StreamResponse<QueryModerationConfigsResponse>
630
- >(
631
- 'POST',
632
- '/api/v2/moderation/configs',
633
- undefined,
634
- undefined,
635
- body,
636
- 'application/json',
637
- );
604
+ const response =
605
+ await this.apiClient.sendRequest<QueryModerationConfigsResponse>(
606
+ 'POST',
607
+ '/api/v2/moderation/configs',
608
+ undefined,
609
+ undefined,
610
+ body,
611
+ );
638
612
 
639
- decoders['QueryModerationConfigsResponse']?.(response.body);
613
+ decoders['QueryModerationConfigsResponse']?.(response);
640
614
 
641
- return { ...response.body, metadata: response.metadata };
615
+ return response;
642
616
  }
643
617
 
644
618
  async customCheck(
@@ -654,54 +628,49 @@ export class ModerationApi {
654
628
  user: request?.user,
655
629
  };
656
630
 
657
- const response = await this.apiClient.sendRequest<
658
- StreamResponse<CustomCheckResponse>
659
- >(
631
+ const response = await this.apiClient.sendRequest<CustomCheckResponse>(
660
632
  'POST',
661
633
  '/api/v2/moderation/custom_check',
662
634
  undefined,
663
635
  undefined,
664
636
  body,
665
- 'application/json',
666
637
  );
667
638
 
668
- decoders['CustomCheckResponse']?.(response.body);
639
+ decoders['CustomCheckResponse']?.(response);
669
640
 
670
- return { ...response.body, metadata: response.metadata };
641
+ return response;
671
642
  }
672
643
 
673
644
  async v2DeleteTemplate(): Promise<
674
645
  StreamResponse<DeleteModerationTemplateResponse>
675
646
  > {
676
- const response = await this.apiClient.sendRequest<
677
- StreamResponse<DeleteModerationTemplateResponse>
678
- >(
679
- 'DELETE',
680
- '/api/v2/moderation/feeds_moderation_template',
681
- undefined,
682
- undefined,
683
- );
647
+ const response =
648
+ await this.apiClient.sendRequest<DeleteModerationTemplateResponse>(
649
+ 'DELETE',
650
+ '/api/v2/moderation/feeds_moderation_template',
651
+ undefined,
652
+ undefined,
653
+ );
684
654
 
685
- decoders['DeleteModerationTemplateResponse']?.(response.body);
655
+ decoders['DeleteModerationTemplateResponse']?.(response);
686
656
 
687
- return { ...response.body, metadata: response.metadata };
657
+ return response;
688
658
  }
689
659
 
690
660
  async v2QueryTemplates(): Promise<
691
661
  StreamResponse<QueryFeedModerationTemplatesResponse>
692
662
  > {
693
- const response = await this.apiClient.sendRequest<
694
- StreamResponse<QueryFeedModerationTemplatesResponse>
695
- >(
696
- 'GET',
697
- '/api/v2/moderation/feeds_moderation_template',
698
- undefined,
699
- undefined,
700
- );
663
+ const response =
664
+ await this.apiClient.sendRequest<QueryFeedModerationTemplatesResponse>(
665
+ 'GET',
666
+ '/api/v2/moderation/feeds_moderation_template',
667
+ undefined,
668
+ undefined,
669
+ );
701
670
 
702
- decoders['QueryFeedModerationTemplatesResponse']?.(response.body);
671
+ decoders['QueryFeedModerationTemplatesResponse']?.(response);
703
672
 
704
- return { ...response.body, metadata: response.metadata };
673
+ return response;
705
674
  }
706
675
 
707
676
  async v2UpsertTemplate(
@@ -712,20 +681,18 @@ export class ModerationApi {
712
681
  config: request?.config,
713
682
  };
714
683
 
715
- const response = await this.apiClient.sendRequest<
716
- StreamResponse<UpsertModerationTemplateResponse>
717
- >(
718
- 'POST',
719
- '/api/v2/moderation/feeds_moderation_template',
720
- undefined,
721
- undefined,
722
- body,
723
- 'application/json',
724
- );
684
+ const response =
685
+ await this.apiClient.sendRequest<UpsertModerationTemplateResponse>(
686
+ 'POST',
687
+ '/api/v2/moderation/feeds_moderation_template',
688
+ undefined,
689
+ undefined,
690
+ body,
691
+ );
725
692
 
726
- decoders['UpsertModerationTemplateResponse']?.(response.body);
693
+ decoders['UpsertModerationTemplateResponse']?.(response);
727
694
 
728
- return { ...response.body, metadata: response.metadata };
695
+ return response;
729
696
  }
730
697
 
731
698
  async flag(request: FlagRequest): Promise<StreamResponse<FlagItemResponse>> {
@@ -740,20 +707,17 @@ export class ModerationApi {
740
707
  user: request?.user,
741
708
  };
742
709
 
743
- const response = await this.apiClient.sendRequest<
744
- StreamResponse<FlagItemResponse>
745
- >(
710
+ const response = await this.apiClient.sendRequest<FlagItemResponse>(
746
711
  'POST',
747
712
  '/api/v2/moderation/flag',
748
713
  undefined,
749
714
  undefined,
750
715
  body,
751
- 'application/json',
752
716
  );
753
717
 
754
- decoders['FlagItemResponse']?.(response.body);
718
+ decoders['FlagItemResponse']?.(response);
755
719
 
756
- return { ...response.body, metadata: response.metadata };
720
+ return response;
757
721
  }
758
722
 
759
723
  async getFlagCount(
@@ -764,20 +728,17 @@ export class ModerationApi {
764
728
  entity_type: request?.entity_type,
765
729
  };
766
730
 
767
- const response = await this.apiClient.sendRequest<
768
- StreamResponse<GetFlagCountResponse>
769
- >(
731
+ const response = await this.apiClient.sendRequest<GetFlagCountResponse>(
770
732
  'POST',
771
733
  '/api/v2/moderation/flag_count',
772
734
  undefined,
773
735
  undefined,
774
736
  body,
775
- 'application/json',
776
737
  );
777
738
 
778
- decoders['GetFlagCountResponse']?.(response.body);
739
+ decoders['GetFlagCountResponse']?.(response);
779
740
 
780
- return { ...response.body, metadata: response.metadata };
741
+ return response;
781
742
  }
782
743
 
783
744
  async queryModerationFlags(
@@ -791,20 +752,18 @@ export class ModerationApi {
791
752
  filter: request?.filter,
792
753
  };
793
754
 
794
- const response = await this.apiClient.sendRequest<
795
- StreamResponse<QueryModerationFlagsResponse>
796
- >(
797
- 'POST',
798
- '/api/v2/moderation/flags',
799
- undefined,
800
- undefined,
801
- body,
802
- 'application/json',
803
- );
755
+ const response =
756
+ await this.apiClient.sendRequest<QueryModerationFlagsResponse>(
757
+ 'POST',
758
+ '/api/v2/moderation/flags',
759
+ undefined,
760
+ undefined,
761
+ body,
762
+ );
804
763
 
805
- decoders['QueryModerationFlagsResponse']?.(response.body);
764
+ decoders['QueryModerationFlagsResponse']?.(response);
806
765
 
807
- return { ...response.body, metadata: response.metadata };
766
+ return response;
808
767
  }
809
768
 
810
769
  async labels(
@@ -820,20 +779,17 @@ export class ModerationApi {
820
779
  user_id: request?.user_id,
821
780
  };
822
781
 
823
- const response = await this.apiClient.sendRequest<
824
- StreamResponse<LabelsResponse>
825
- >(
782
+ const response = await this.apiClient.sendRequest<LabelsResponse>(
826
783
  'POST',
827
784
  '/api/v2/moderation/labels',
828
785
  undefined,
829
786
  undefined,
830
787
  body,
831
- 'application/json',
832
788
  );
833
789
 
834
- decoders['LabelsResponse']?.(response.body);
790
+ decoders['LabelsResponse']?.(response);
835
791
 
836
- return { ...response.body, metadata: response.metadata };
792
+ return response;
837
793
  }
838
794
 
839
795
  async queryLabelResults(
@@ -849,20 +805,18 @@ export class ModerationApi {
849
805
  user: request?.user,
850
806
  };
851
807
 
852
- const response = await this.apiClient.sendRequest<
853
- StreamResponse<QueryLabelResultsResponse>
854
- >(
855
- 'POST',
856
- '/api/v2/moderation/labels/results',
857
- undefined,
858
- undefined,
859
- body,
860
- 'application/json',
861
- );
808
+ const response =
809
+ await this.apiClient.sendRequest<QueryLabelResultsResponse>(
810
+ 'POST',
811
+ '/api/v2/moderation/labels/results',
812
+ undefined,
813
+ undefined,
814
+ body,
815
+ );
862
816
 
863
- decoders['QueryLabelResultsResponse']?.(response.body);
817
+ decoders['QueryLabelResultsResponse']?.(response);
864
818
 
865
- return { ...response.body, metadata: response.metadata };
819
+ return response;
866
820
  }
867
821
 
868
822
  async queryModerationLogs(
@@ -878,20 +832,18 @@ export class ModerationApi {
878
832
  user: request?.user,
879
833
  };
880
834
 
881
- const response = await this.apiClient.sendRequest<
882
- StreamResponse<QueryModerationLogsResponse>
883
- >(
884
- 'POST',
885
- '/api/v2/moderation/logs',
886
- undefined,
887
- undefined,
888
- body,
889
- 'application/json',
890
- );
835
+ const response =
836
+ await this.apiClient.sendRequest<QueryModerationLogsResponse>(
837
+ 'POST',
838
+ '/api/v2/moderation/logs',
839
+ undefined,
840
+ undefined,
841
+ body,
842
+ );
891
843
 
892
- decoders['QueryModerationLogsResponse']?.(response.body);
844
+ decoders['QueryModerationLogsResponse']?.(response);
893
845
 
894
- return { ...response.body, metadata: response.metadata };
846
+ return response;
895
847
  }
896
848
 
897
849
  async upsertModerationRule(
@@ -914,20 +866,18 @@ export class ModerationApi {
914
866
  user: request?.user,
915
867
  };
916
868
 
917
- const response = await this.apiClient.sendRequest<
918
- StreamResponse<UpsertModerationRuleResponse>
919
- >(
920
- 'POST',
921
- '/api/v2/moderation/moderation_rule',
922
- undefined,
923
- undefined,
924
- body,
925
- 'application/json',
926
- );
869
+ const response =
870
+ await this.apiClient.sendRequest<UpsertModerationRuleResponse>(
871
+ 'POST',
872
+ '/api/v2/moderation/moderation_rule',
873
+ undefined,
874
+ undefined,
875
+ body,
876
+ );
927
877
 
928
- decoders['UpsertModerationRuleResponse']?.(response.body);
878
+ decoders['UpsertModerationRuleResponse']?.(response);
929
879
 
930
- return { ...response.body, metadata: response.metadata };
880
+ return response;
931
881
  }
932
882
 
933
883
  async deleteModerationRule(request: {
@@ -941,18 +891,17 @@ export class ModerationApi {
941
891
  id: request?.id,
942
892
  };
943
893
 
944
- const response = await this.apiClient.sendRequest<
945
- StreamResponse<DeleteModerationRuleResponse>
946
- >(
947
- 'DELETE',
948
- '/api/v2/moderation/moderation_rule/{id}',
949
- pathParams,
950
- queryParams,
951
- );
894
+ const response =
895
+ await this.apiClient.sendRequest<DeleteModerationRuleResponse>(
896
+ 'DELETE',
897
+ '/api/v2/moderation/moderation_rule/{id}',
898
+ pathParams,
899
+ queryParams,
900
+ );
952
901
 
953
- decoders['DeleteModerationRuleResponse']?.(response.body);
902
+ decoders['DeleteModerationRuleResponse']?.(response);
954
903
 
955
- return { ...response.body, metadata: response.metadata };
904
+ return response;
956
905
  }
957
906
 
958
907
  async getModerationRule(request: {
@@ -962,13 +911,17 @@ export class ModerationApi {
962
911
  id: request?.id,
963
912
  };
964
913
 
965
- const response = await this.apiClient.sendRequest<
966
- StreamResponse<GetModerationRuleResponse>
967
- >('GET', '/api/v2/moderation/moderation_rule/{id}', pathParams, undefined);
914
+ const response =
915
+ await this.apiClient.sendRequest<GetModerationRuleResponse>(
916
+ 'GET',
917
+ '/api/v2/moderation/moderation_rule/{id}',
918
+ pathParams,
919
+ undefined,
920
+ );
968
921
 
969
- decoders['GetModerationRuleResponse']?.(response.body);
922
+ decoders['GetModerationRuleResponse']?.(response);
970
923
 
971
- return { ...response.body, metadata: response.metadata };
924
+ return response;
972
925
  }
973
926
 
974
927
  async queryModerationRules(
@@ -984,20 +937,18 @@ export class ModerationApi {
984
937
  user: request?.user,
985
938
  };
986
939
 
987
- const response = await this.apiClient.sendRequest<
988
- StreamResponse<QueryModerationRulesResponse>
989
- >(
990
- 'POST',
991
- '/api/v2/moderation/moderation_rules',
992
- undefined,
993
- undefined,
994
- body,
995
- 'application/json',
996
- );
940
+ const response =
941
+ await this.apiClient.sendRequest<QueryModerationRulesResponse>(
942
+ 'POST',
943
+ '/api/v2/moderation/moderation_rules',
944
+ undefined,
945
+ undefined,
946
+ body,
947
+ );
997
948
 
998
- decoders['QueryModerationRulesResponse']?.(response.body);
949
+ decoders['QueryModerationRulesResponse']?.(response);
999
950
 
1000
- return { ...response.body, metadata: response.metadata };
951
+ return response;
1001
952
  }
1002
953
 
1003
954
  async mute(request: MuteRequest): Promise<StreamResponse<MuteResponse>> {
@@ -1008,20 +959,17 @@ export class ModerationApi {
1008
959
  user: request?.user,
1009
960
  };
1010
961
 
1011
- const response = await this.apiClient.sendRequest<
1012
- StreamResponse<MuteResponse>
1013
- >(
962
+ const response = await this.apiClient.sendRequest<MuteResponse>(
1014
963
  'POST',
1015
964
  '/api/v2/moderation/mute',
1016
965
  undefined,
1017
966
  undefined,
1018
967
  body,
1019
- 'application/json',
1020
968
  );
1021
969
 
1022
- decoders['MuteResponse']?.(response.body);
970
+ decoders['MuteResponse']?.(response);
1023
971
 
1024
- return { ...response.body, metadata: response.metadata };
972
+ return response;
1025
973
  }
1026
974
 
1027
975
  async getPolicyTestRun(request: {
@@ -1031,30 +979,32 @@ export class ModerationApi {
1031
979
  id: request?.id,
1032
980
  };
1033
981
 
1034
- const response = await this.apiClient.sendRequest<
1035
- StreamResponse<PolicyTestRunResponse>
1036
- >(
982
+ const response = await this.apiClient.sendRequest<PolicyTestRunResponse>(
1037
983
  'GET',
1038
984
  '/api/v2/moderation/policy_tests/runs/{id}',
1039
985
  pathParams,
1040
986
  undefined,
1041
987
  );
1042
988
 
1043
- decoders['PolicyTestRunResponse']?.(response.body);
989
+ decoders['PolicyTestRunResponse']?.(response);
1044
990
 
1045
- return { ...response.body, metadata: response.metadata };
991
+ return response;
1046
992
  }
1047
993
 
1048
994
  async listPolicyTestSets(): Promise<
1049
995
  StreamResponse<PolicyTestSetListResponse>
1050
996
  > {
1051
- const response = await this.apiClient.sendRequest<
1052
- StreamResponse<PolicyTestSetListResponse>
1053
- >('GET', '/api/v2/moderation/policy_tests/sets', undefined, undefined);
997
+ const response =
998
+ await this.apiClient.sendRequest<PolicyTestSetListResponse>(
999
+ 'GET',
1000
+ '/api/v2/moderation/policy_tests/sets',
1001
+ undefined,
1002
+ undefined,
1003
+ );
1054
1004
 
1055
- decoders['PolicyTestSetListResponse']?.(response.body);
1005
+ decoders['PolicyTestSetListResponse']?.(response);
1056
1006
 
1057
- return { ...response.body, metadata: response.metadata };
1007
+ return response;
1058
1008
  }
1059
1009
 
1060
1010
  async createPolicyTestSet(
@@ -1069,20 +1019,17 @@ export class ModerationApi {
1069
1019
  seed: request?.seed,
1070
1020
  };
1071
1021
 
1072
- const response = await this.apiClient.sendRequest<
1073
- StreamResponse<PolicyTestSetResponse>
1074
- >(
1022
+ const response = await this.apiClient.sendRequest<PolicyTestSetResponse>(
1075
1023
  'POST',
1076
1024
  '/api/v2/moderation/policy_tests/sets',
1077
1025
  undefined,
1078
1026
  undefined,
1079
1027
  body,
1080
- 'application/json',
1081
1028
  );
1082
1029
 
1083
- decoders['PolicyTestSetResponse']?.(response.body);
1030
+ decoders['PolicyTestSetResponse']?.(response);
1084
1031
 
1085
- return { ...response.body, metadata: response.metadata };
1032
+ return response;
1086
1033
  }
1087
1034
 
1088
1035
  async deletePolicyTestSet(request: {
@@ -1092,16 +1039,16 @@ export class ModerationApi {
1092
1039
  id: request?.id,
1093
1040
  };
1094
1041
 
1095
- const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
1042
+ const response = await this.apiClient.sendRequest<Response>(
1096
1043
  'DELETE',
1097
1044
  '/api/v2/moderation/policy_tests/sets/{id}',
1098
1045
  pathParams,
1099
1046
  undefined,
1100
1047
  );
1101
1048
 
1102
- decoders['Response']?.(response.body);
1049
+ decoders['Response']?.(response);
1103
1050
 
1104
- return { ...response.body, metadata: response.metadata };
1051
+ return response;
1105
1052
  }
1106
1053
 
1107
1054
  async getPolicyTestSet(request: {
@@ -1111,18 +1058,16 @@ export class ModerationApi {
1111
1058
  id: request?.id,
1112
1059
  };
1113
1060
 
1114
- const response = await this.apiClient.sendRequest<
1115
- StreamResponse<PolicyTestSetResponse>
1116
- >(
1061
+ const response = await this.apiClient.sendRequest<PolicyTestSetResponse>(
1117
1062
  'GET',
1118
1063
  '/api/v2/moderation/policy_tests/sets/{id}',
1119
1064
  pathParams,
1120
1065
  undefined,
1121
1066
  );
1122
1067
 
1123
- decoders['PolicyTestSetResponse']?.(response.body);
1068
+ decoders['PolicyTestSetResponse']?.(response);
1124
1069
 
1125
- return { ...response.body, metadata: response.metadata };
1070
+ return response;
1126
1071
  }
1127
1072
 
1128
1073
  async startPolicyTestRun(request: {
@@ -1132,18 +1077,16 @@ export class ModerationApi {
1132
1077
  id: request?.id,
1133
1078
  };
1134
1079
 
1135
- const response = await this.apiClient.sendRequest<
1136
- StreamResponse<PolicyTestRunResponse>
1137
- >(
1080
+ const response = await this.apiClient.sendRequest<PolicyTestRunResponse>(
1138
1081
  'POST',
1139
1082
  '/api/v2/moderation/policy_tests/sets/{id}/runs',
1140
1083
  pathParams,
1141
1084
  undefined,
1142
1085
  );
1143
1086
 
1144
- decoders['PolicyTestRunResponse']?.(response.body);
1087
+ decoders['PolicyTestRunResponse']?.(response);
1145
1088
 
1146
- return { ...response.body, metadata: response.metadata };
1089
+ return response;
1147
1090
  }
1148
1091
 
1149
1092
  async listQueues(request?: {
@@ -1153,13 +1096,16 @@ export class ModerationApi {
1153
1096
  user_id: request?.user_id,
1154
1097
  };
1155
1098
 
1156
- const response = await this.apiClient.sendRequest<
1157
- StreamResponse<ListQueuesResponse>
1158
- >('GET', '/api/v2/moderation/queues', undefined, queryParams);
1099
+ const response = await this.apiClient.sendRequest<ListQueuesResponse>(
1100
+ 'GET',
1101
+ '/api/v2/moderation/queues',
1102
+ undefined,
1103
+ queryParams,
1104
+ );
1159
1105
 
1160
- decoders['ListQueuesResponse']?.(response.body);
1106
+ decoders['ListQueuesResponse']?.(response);
1161
1107
 
1162
- return { ...response.body, metadata: response.metadata };
1108
+ return response;
1163
1109
  }
1164
1110
 
1165
1111
  async createQueue(
@@ -1175,20 +1121,17 @@ export class ModerationApi {
1175
1121
  user: request?.user,
1176
1122
  };
1177
1123
 
1178
- const response = await this.apiClient.sendRequest<
1179
- StreamResponse<QueueResponse>
1180
- >(
1124
+ const response = await this.apiClient.sendRequest<QueueResponse>(
1181
1125
  'POST',
1182
1126
  '/api/v2/moderation/queues',
1183
1127
  undefined,
1184
1128
  undefined,
1185
1129
  body,
1186
- 'application/json',
1187
1130
  );
1188
1131
 
1189
- decoders['QueueResponse']?.(response.body);
1132
+ decoders['QueueResponse']?.(response);
1190
1133
 
1191
- return { ...response.body, metadata: response.metadata };
1134
+ return response;
1192
1135
  }
1193
1136
 
1194
1137
  async getQueue(request: {
@@ -1202,13 +1145,16 @@ export class ModerationApi {
1202
1145
  id: request?.id,
1203
1146
  };
1204
1147
 
1205
- const response = await this.apiClient.sendRequest<
1206
- StreamResponse<QueueResponse>
1207
- >('GET', '/api/v2/moderation/queues/{id}', pathParams, queryParams);
1148
+ const response = await this.apiClient.sendRequest<QueueResponse>(
1149
+ 'GET',
1150
+ '/api/v2/moderation/queues/{id}',
1151
+ pathParams,
1152
+ queryParams,
1153
+ );
1208
1154
 
1209
- decoders['QueueResponse']?.(response.body);
1155
+ decoders['QueueResponse']?.(response);
1210
1156
 
1211
- return { ...response.body, metadata: response.metadata };
1157
+ return response;
1212
1158
  }
1213
1159
 
1214
1160
  async updateQueue(
@@ -1226,20 +1172,17 @@ export class ModerationApi {
1226
1172
  user: request?.user,
1227
1173
  };
1228
1174
 
1229
- const response = await this.apiClient.sendRequest<
1230
- StreamResponse<QueueResponse>
1231
- >(
1175
+ const response = await this.apiClient.sendRequest<QueueResponse>(
1232
1176
  'PATCH',
1233
1177
  '/api/v2/moderation/queues/{id}',
1234
1178
  pathParams,
1235
1179
  undefined,
1236
1180
  body,
1237
- 'application/json',
1238
1181
  );
1239
1182
 
1240
- decoders['QueueResponse']?.(response.body);
1183
+ decoders['QueueResponse']?.(response);
1241
1184
 
1242
- return { ...response.body, metadata: response.metadata };
1185
+ return response;
1243
1186
  }
1244
1187
 
1245
1188
  async deleteQueue(
@@ -1253,20 +1196,17 @@ export class ModerationApi {
1253
1196
  user: request?.user,
1254
1197
  };
1255
1198
 
1256
- const response = await this.apiClient.sendRequest<
1257
- StreamResponse<QueueResponse>
1258
- >(
1199
+ const response = await this.apiClient.sendRequest<QueueResponse>(
1259
1200
  'POST',
1260
1201
  '/api/v2/moderation/queues/{id}/delete',
1261
1202
  pathParams,
1262
1203
  undefined,
1263
1204
  body,
1264
- 'application/json',
1265
1205
  );
1266
1206
 
1267
- decoders['QueueResponse']?.(response.body);
1207
+ decoders['QueueResponse']?.(response);
1268
1208
 
1269
- return { ...response.body, metadata: response.metadata };
1209
+ return response;
1270
1210
  }
1271
1211
 
1272
1212
  async queryReviewQueue(
@@ -1287,20 +1227,17 @@ export class ModerationApi {
1287
1227
  user: request?.user,
1288
1228
  };
1289
1229
 
1290
- const response = await this.apiClient.sendRequest<
1291
- StreamResponse<QueryReviewQueueResponse>
1292
- >(
1230
+ const response = await this.apiClient.sendRequest<QueryReviewQueueResponse>(
1293
1231
  'POST',
1294
1232
  '/api/v2/moderation/review_queue',
1295
1233
  undefined,
1296
1234
  undefined,
1297
1235
  body,
1298
- 'application/json',
1299
1236
  );
1300
1237
 
1301
- decoders['QueryReviewQueueResponse']?.(response.body);
1238
+ decoders['QueryReviewQueueResponse']?.(response);
1302
1239
 
1303
- return { ...response.body, metadata: response.metadata };
1240
+ return response;
1304
1241
  }
1305
1242
 
1306
1243
  async getReviewQueueItem(request: {
@@ -1310,23 +1247,30 @@ export class ModerationApi {
1310
1247
  id: request?.id,
1311
1248
  };
1312
1249
 
1313
- const response = await this.apiClient.sendRequest<
1314
- StreamResponse<GetReviewQueueItemResponse>
1315
- >('GET', '/api/v2/moderation/review_queue/{id}', pathParams, undefined);
1250
+ const response =
1251
+ await this.apiClient.sendRequest<GetReviewQueueItemResponse>(
1252
+ 'GET',
1253
+ '/api/v2/moderation/review_queue/{id}',
1254
+ pathParams,
1255
+ undefined,
1256
+ );
1316
1257
 
1317
- decoders['GetReviewQueueItemResponse']?.(response.body);
1258
+ decoders['GetReviewQueueItemResponse']?.(response);
1318
1259
 
1319
- return { ...response.body, metadata: response.metadata };
1260
+ return response;
1320
1261
  }
1321
1262
 
1322
1263
  async getSetupSession(): Promise<StreamResponse<GetSetupSessionResponse>> {
1323
- const response = await this.apiClient.sendRequest<
1324
- StreamResponse<GetSetupSessionResponse>
1325
- >('GET', '/api/v2/moderation/setup', undefined, undefined);
1264
+ const response = await this.apiClient.sendRequest<GetSetupSessionResponse>(
1265
+ 'GET',
1266
+ '/api/v2/moderation/setup',
1267
+ undefined,
1268
+ undefined,
1269
+ );
1326
1270
 
1327
- decoders['GetSetupSessionResponse']?.(response.body);
1271
+ decoders['GetSetupSessionResponse']?.(response);
1328
1272
 
1329
- return { ...response.body, metadata: response.metadata };
1273
+ return response;
1330
1274
  }
1331
1275
 
1332
1276
  async upsertSetupSession(
@@ -1338,20 +1282,18 @@ export class ModerationApi {
1338
1282
  setup_data: request?.setup_data,
1339
1283
  };
1340
1284
 
1341
- const response = await this.apiClient.sendRequest<
1342
- StreamResponse<UpsertSetupSessionResponse>
1343
- >(
1344
- 'POST',
1345
- '/api/v2/moderation/setup',
1346
- undefined,
1347
- undefined,
1348
- body,
1349
- 'application/json',
1350
- );
1285
+ const response =
1286
+ await this.apiClient.sendRequest<UpsertSetupSessionResponse>(
1287
+ 'POST',
1288
+ '/api/v2/moderation/setup',
1289
+ undefined,
1290
+ undefined,
1291
+ body,
1292
+ );
1351
1293
 
1352
- decoders['UpsertSetupSessionResponse']?.(response.body);
1294
+ decoders['UpsertSetupSessionResponse']?.(response);
1353
1295
 
1354
- return { ...response.body, metadata: response.metadata };
1296
+ return response;
1355
1297
  }
1356
1298
 
1357
1299
  async submitAction(
@@ -1383,20 +1325,17 @@ export class ModerationApi {
1383
1325
  user: request?.user,
1384
1326
  };
1385
1327
 
1386
- const response = await this.apiClient.sendRequest<
1387
- StreamResponse<SubmitActionResponse>
1388
- >(
1328
+ const response = await this.apiClient.sendRequest<SubmitActionResponse>(
1389
1329
  'POST',
1390
1330
  '/api/v2/moderation/submit_action',
1391
1331
  undefined,
1392
1332
  undefined,
1393
1333
  body,
1394
- 'application/json',
1395
1334
  );
1396
1335
 
1397
- decoders['SubmitActionResponse']?.(response.body);
1336
+ decoders['SubmitActionResponse']?.(response);
1398
1337
 
1399
- return { ...response.body, metadata: response.metadata };
1338
+ return response;
1400
1339
  }
1401
1340
 
1402
1341
  async submitModerationFeedback(
@@ -1414,20 +1353,18 @@ export class ModerationApi {
1414
1353
  expected_labels: request?.expected_labels,
1415
1354
  };
1416
1355
 
1417
- const response = await this.apiClient.sendRequest<
1418
- StreamResponse<SubmitModerationFeedbackResponse>
1419
- >(
1420
- 'POST',
1421
- '/api/v2/moderation/submit_moderation_feedback',
1422
- undefined,
1423
- undefined,
1424
- body,
1425
- 'application/json',
1426
- );
1356
+ const response =
1357
+ await this.apiClient.sendRequest<SubmitModerationFeedbackResponse>(
1358
+ 'POST',
1359
+ '/api/v2/moderation/submit_moderation_feedback',
1360
+ undefined,
1361
+ undefined,
1362
+ body,
1363
+ );
1427
1364
 
1428
- decoders['SubmitModerationFeedbackResponse']?.(response.body);
1365
+ decoders['SubmitModerationFeedbackResponse']?.(response);
1429
1366
 
1430
- return { ...response.body, metadata: response.metadata };
1367
+ return response;
1431
1368
  }
1432
1369
 
1433
1370
  async unban(
@@ -1447,20 +1384,17 @@ export class ModerationApi {
1447
1384
  unbanned_by: request?.unbanned_by,
1448
1385
  };
1449
1386
 
1450
- const response = await this.apiClient.sendRequest<
1451
- StreamResponse<UnbanResponse>
1452
- >(
1387
+ const response = await this.apiClient.sendRequest<UnbanResponse>(
1453
1388
  'POST',
1454
1389
  '/api/v2/moderation/unban',
1455
1390
  undefined,
1456
1391
  queryParams,
1457
1392
  body,
1458
- 'application/json',
1459
1393
  );
1460
1394
 
1461
- decoders['UnbanResponse']?.(response.body);
1395
+ decoders['UnbanResponse']?.(response);
1462
1396
 
1463
- return { ...response.body, metadata: response.metadata };
1397
+ return response;
1464
1398
  }
1465
1399
 
1466
1400
  async unmute(
@@ -1472,19 +1406,16 @@ export class ModerationApi {
1472
1406
  user: request?.user,
1473
1407
  };
1474
1408
 
1475
- const response = await this.apiClient.sendRequest<
1476
- StreamResponse<UnmuteResponse>
1477
- >(
1409
+ const response = await this.apiClient.sendRequest<UnmuteResponse>(
1478
1410
  'POST',
1479
1411
  '/api/v2/moderation/unmute',
1480
1412
  undefined,
1481
1413
  undefined,
1482
1414
  body,
1483
- 'application/json',
1484
1415
  );
1485
1416
 
1486
- decoders['UnmuteResponse']?.(response.body);
1417
+ decoders['UnmuteResponse']?.(response);
1487
1418
 
1488
- return { ...response.body, metadata: response.metadata };
1419
+ return response;
1489
1420
  }
1490
1421
  }