@stream-io/node-sdk 0.6.2 → 0.6.3

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.
@@ -9,10 +9,12 @@ import {
9
9
  CustomCheckRequest,
10
10
  CustomCheckResponse,
11
11
  DeleteModerationConfigResponse,
12
+ DeleteModerationRuleResponse,
12
13
  DeleteModerationTemplateResponse,
13
14
  FlagRequest,
14
15
  FlagResponse,
15
16
  GetConfigResponse,
17
+ GetModerationRuleResponse,
16
18
  GetReviewQueueItemResponse,
17
19
  MuteRequest,
18
20
  MuteResponse,
@@ -23,6 +25,8 @@ import {
23
25
  QueryModerationFlagsResponse,
24
26
  QueryModerationLogsRequest,
25
27
  QueryModerationLogsResponse,
28
+ QueryModerationRulesRequest,
29
+ QueryModerationRulesResponse,
26
30
  QueryReviewQueueRequest,
27
31
  QueryReviewQueueResponse,
28
32
  SubmitActionRequest,
@@ -33,6 +37,8 @@ import {
33
37
  UnmuteResponse,
34
38
  UpsertConfigRequest,
35
39
  UpsertConfigResponse,
40
+ UpsertModerationRuleRequest,
41
+ UpsertModerationRuleResponse,
36
42
  UpsertModerationTemplateRequest,
37
43
  UpsertModerationTemplateResponse,
38
44
  } from '../models';
@@ -95,13 +101,14 @@ export class ModerationApi {
95
101
 
96
102
  async check(request: CheckRequest): Promise<StreamResponse<CheckResponse>> {
97
103
  const body = {
98
- config_key: request?.config_key,
99
104
  entity_creator_id: request?.entity_creator_id,
100
105
  entity_id: request?.entity_id,
101
106
  entity_type: request?.entity_type,
107
+ config_key: request?.config_key,
102
108
  config_team: request?.config_team,
103
109
  test_mode: request?.test_mode,
104
110
  user_id: request?.user_id,
111
+ config: request?.config,
105
112
  moderation_payload: request?.moderation_payload,
106
113
  options: request?.options,
107
114
  user: request?.user,
@@ -405,6 +412,97 @@ export class ModerationApi {
405
412
  return { ...response.body, metadata: response.metadata };
406
413
  }
407
414
 
415
+ async upsertModerationRule(
416
+ request: UpsertModerationRuleRequest,
417
+ ): Promise<StreamResponse<UpsertModerationRuleResponse>> {
418
+ const body = {
419
+ name: request?.name,
420
+ rule_type: request?.rule_type,
421
+ action: request?.action,
422
+ cooldown_period: request?.cooldown_period,
423
+ description: request?.description,
424
+ enabled: request?.enabled,
425
+ logic: request?.logic,
426
+ team: request?.team,
427
+ conditions: request?.conditions,
428
+ config_keys: request?.config_keys,
429
+ groups: request?.groups,
430
+ };
431
+
432
+ const response = await this.apiClient.sendRequest<
433
+ StreamResponse<UpsertModerationRuleResponse>
434
+ >(
435
+ 'POST',
436
+ '/api/v2/moderation/moderation_rule',
437
+ undefined,
438
+ undefined,
439
+ body,
440
+ 'application/json',
441
+ );
442
+
443
+ decoders.UpsertModerationRuleResponse?.(response.body);
444
+
445
+ return { ...response.body, metadata: response.metadata };
446
+ }
447
+
448
+ async deleteModerationRule(): Promise<
449
+ StreamResponse<DeleteModerationRuleResponse>
450
+ > {
451
+ const response = await this.apiClient.sendRequest<
452
+ StreamResponse<DeleteModerationRuleResponse>
453
+ >(
454
+ 'DELETE',
455
+ '/api/v2/moderation/moderation_rule/{id}',
456
+ undefined,
457
+ undefined,
458
+ );
459
+
460
+ decoders.DeleteModerationRuleResponse?.(response.body);
461
+
462
+ return { ...response.body, metadata: response.metadata };
463
+ }
464
+
465
+ async getModerationRule(): Promise<
466
+ StreamResponse<GetModerationRuleResponse>
467
+ > {
468
+ const response = await this.apiClient.sendRequest<
469
+ StreamResponse<GetModerationRuleResponse>
470
+ >('GET', '/api/v2/moderation/moderation_rule/{id}', undefined, undefined);
471
+
472
+ decoders.GetModerationRuleResponse?.(response.body);
473
+
474
+ return { ...response.body, metadata: response.metadata };
475
+ }
476
+
477
+ async queryModerationRules(
478
+ request?: QueryModerationRulesRequest,
479
+ ): Promise<StreamResponse<QueryModerationRulesResponse>> {
480
+ const body = {
481
+ limit: request?.limit,
482
+ next: request?.next,
483
+ prev: request?.prev,
484
+ user_id: request?.user_id,
485
+ sort: request?.sort,
486
+ filter: request?.filter,
487
+ user: request?.user,
488
+ };
489
+
490
+ const response = await this.apiClient.sendRequest<
491
+ StreamResponse<QueryModerationRulesResponse>
492
+ >(
493
+ 'POST',
494
+ '/api/v2/moderation/moderation_rules',
495
+ undefined,
496
+ undefined,
497
+ body,
498
+ 'application/json',
499
+ );
500
+
501
+ decoders.QueryModerationRulesResponse?.(response.body);
502
+
503
+ return { ...response.body, metadata: response.metadata };
504
+ }
505
+
408
506
  async mute(request: MuteRequest): Promise<StreamResponse<MuteResponse>> {
409
507
  const body = {
410
508
  target_ids: request?.target_ids,
@@ -27,15 +27,17 @@ import {
27
27
  QueryCallParticipantsResponse,
28
28
  SendCallEventRequest,
29
29
  SendCallEventResponse,
30
+ SendClosedCaptionRequest,
31
+ SendClosedCaptionResponse,
30
32
  StartClosedCaptionsRequest,
31
33
  StartClosedCaptionsResponse,
32
34
  StartFrameRecordingRequest,
33
35
  StartFrameRecordingResponse,
34
36
  StartHLSBroadcastingResponse,
35
- StartRecordingRequest,
36
- StartRecordingResponse,
37
37
  StartRTMPBroadcastsRequest,
38
38
  StartRTMPBroadcastsResponse,
39
+ StartRecordingRequest,
40
+ StartRecordingResponse,
39
41
  StartTranscriptionRequest,
40
42
  StartTranscriptionResponse,
41
43
  StopAllRTMPBroadcastsResponse,
@@ -45,9 +47,9 @@ import {
45
47
  StopHLSBroadcastingResponse,
46
48
  StopLiveRequest,
47
49
  StopLiveResponse,
48
- StopRecordingResponse,
49
50
  StopRTMPBroadcastsRequest,
50
51
  StopRTMPBroadcastsResponse,
52
+ StopRecordingResponse,
51
53
  StopTranscriptionRequest,
52
54
  StopTranscriptionResponse,
53
55
  UnblockUserRequest,
@@ -108,6 +110,16 @@ export class CallApi {
108
110
  });
109
111
  }
110
112
 
113
+ sendClosedCaption(
114
+ request: SendClosedCaptionRequest,
115
+ ): Promise<StreamResponse<SendClosedCaptionResponse>> {
116
+ return this.videoApi.sendClosedCaption({
117
+ id: this.id,
118
+ type: this.type,
119
+ ...request,
120
+ });
121
+ }
122
+
111
123
  delete(
112
124
  request?: DeleteCallRequest,
113
125
  ): Promise<StreamResponse<DeleteCallResponse>> {
@@ -35,24 +35,26 @@ import {
35
35
  QueryCallMembersResponse,
36
36
  QueryCallParticipantsRequest,
37
37
  QueryCallParticipantsResponse,
38
- QueryCallsRequest,
39
- QueryCallsResponse,
40
38
  QueryCallStatsRequest,
41
39
  QueryCallStatsResponse,
40
+ QueryCallsRequest,
41
+ QueryCallsResponse,
42
42
  QueryUserFeedbackRequest,
43
43
  QueryUserFeedbackResponse,
44
44
  Response,
45
45
  SendCallEventRequest,
46
46
  SendCallEventResponse,
47
+ SendClosedCaptionRequest,
48
+ SendClosedCaptionResponse,
47
49
  StartClosedCaptionsRequest,
48
50
  StartClosedCaptionsResponse,
49
51
  StartFrameRecordingRequest,
50
52
  StartFrameRecordingResponse,
51
53
  StartHLSBroadcastingResponse,
52
- StartRecordingRequest,
53
- StartRecordingResponse,
54
54
  StartRTMPBroadcastsRequest,
55
55
  StartRTMPBroadcastsResponse,
56
+ StartRecordingRequest,
57
+ StartRecordingResponse,
56
58
  StartTranscriptionRequest,
57
59
  StartTranscriptionResponse,
58
60
  StopAllRTMPBroadcastsResponse,
@@ -62,9 +64,9 @@ import {
62
64
  StopHLSBroadcastingResponse,
63
65
  StopLiveRequest,
64
66
  StopLiveResponse,
65
- StopRecordingResponse,
66
67
  StopRTMPBroadcastsRequest,
67
68
  StopRTMPBroadcastsResponse,
69
+ StopRecordingResponse,
68
70
  StopTranscriptionRequest,
69
71
  StopTranscriptionResponse,
70
72
  UnblockUserRequest,
@@ -298,6 +300,41 @@ export class VideoApi {
298
300
  return { ...response.body, metadata: response.metadata };
299
301
  }
300
302
 
303
+ async sendClosedCaption(
304
+ request: SendClosedCaptionRequest & { type: string; id: string },
305
+ ): Promise<StreamResponse<SendClosedCaptionResponse>> {
306
+ const pathParams = {
307
+ type: request?.type,
308
+ id: request?.id,
309
+ };
310
+ const body = {
311
+ speaker_id: request?.speaker_id,
312
+ text: request?.text,
313
+ end_time: request?.end_time,
314
+ language: request?.language,
315
+ service: request?.service,
316
+ start_time: request?.start_time,
317
+ translated: request?.translated,
318
+ user_id: request?.user_id,
319
+ user: request?.user,
320
+ };
321
+
322
+ const response = await this.apiClient.sendRequest<
323
+ StreamResponse<SendClosedCaptionResponse>
324
+ >(
325
+ 'POST',
326
+ '/api/v2/video/call/{type}/{id}/closed_captions',
327
+ pathParams,
328
+ undefined,
329
+ body,
330
+ 'application/json',
331
+ );
332
+
333
+ decoders.SendClosedCaptionResponse?.(response.body);
334
+
335
+ return { ...response.body, metadata: response.metadata };
336
+ }
337
+
301
338
  async deleteCall(
302
339
  request: DeleteCallRequest & { type: string; id: string },
303
340
  ): Promise<StreamResponse<DeleteCallResponse>> {