@stream-io/node-sdk 0.6.1 → 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,
@@ -142,6 +149,7 @@ export class ModerationApi {
142
149
  block_list_config: request?.block_list_config,
143
150
  bodyguard_config: request?.bodyguard_config,
144
151
  google_vision_config: request?.google_vision_config,
152
+ llm_config: request?.llm_config,
145
153
  rule_builder_config: request?.rule_builder_config,
146
154
  user: request?.user,
147
155
  velocity_filter_config: request?.velocity_filter_config,
@@ -404,6 +412,97 @@ export class ModerationApi {
404
412
  return { ...response.body, metadata: response.metadata };
405
413
  }
406
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
+
407
506
  async mute(request: MuteRequest): Promise<StreamResponse<MuteResponse>> {
408
507
  const body = {
409
508
  target_ids: request?.target_ids,
@@ -15,6 +15,8 @@ import {
15
15
  GetOrCreateCallResponse,
16
16
  GoLiveRequest,
17
17
  GoLiveResponse,
18
+ KickUserRequest,
19
+ KickUserResponse,
18
20
  ListRecordingsResponse,
19
21
  ListTranscriptionsResponse,
20
22
  MuteUsersRequest,
@@ -25,6 +27,8 @@ import {
25
27
  QueryCallParticipantsResponse,
26
28
  SendCallEventRequest,
27
29
  SendCallEventResponse,
30
+ SendClosedCaptionRequest,
31
+ SendClosedCaptionResponse,
28
32
  StartClosedCaptionsRequest,
29
33
  StartClosedCaptionsResponse,
30
34
  StartFrameRecordingRequest,
@@ -106,6 +110,16 @@ export class CallApi {
106
110
  });
107
111
  }
108
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
+
109
123
  delete(
110
124
  request?: DeleteCallRequest,
111
125
  ): Promise<StreamResponse<DeleteCallResponse>> {
@@ -140,6 +154,12 @@ export class CallApi {
140
154
  return this.videoApi.goLive({ id: this.id, type: this.type, ...request });
141
155
  }
142
156
 
157
+ kickUser(
158
+ request: KickUserRequest,
159
+ ): Promise<StreamResponse<KickUserResponse>> {
160
+ return this.videoApi.kickUser({ id: this.id, type: this.type, ...request });
161
+ }
162
+
143
163
  end(): Promise<StreamResponse<EndCallResponse>> {
144
164
  return this.videoApi.endCall({ id: this.id, type: this.type });
145
165
  }
@@ -20,6 +20,8 @@ import {
20
20
  GetOrCreateCallResponse,
21
21
  GoLiveRequest,
22
22
  GoLiveResponse,
23
+ KickUserRequest,
24
+ KickUserResponse,
23
25
  ListCallTypeResponse,
24
26
  ListRecordingsResponse,
25
27
  ListTranscriptionsResponse,
@@ -42,6 +44,8 @@ import {
42
44
  Response,
43
45
  SendCallEventRequest,
44
46
  SendCallEventResponse,
47
+ SendClosedCaptionRequest,
48
+ SendClosedCaptionResponse,
45
49
  StartClosedCaptionsRequest,
46
50
  StartClosedCaptionsResponse,
47
51
  StartFrameRecordingRequest,
@@ -296,6 +300,41 @@ export class VideoApi {
296
300
  return { ...response.body, metadata: response.metadata };
297
301
  }
298
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
+
299
338
  async deleteCall(
300
339
  request: DeleteCallRequest & { type: string; id: string },
301
340
  ): Promise<StreamResponse<DeleteCallResponse>> {
@@ -416,6 +455,36 @@ export class VideoApi {
416
455
  return { ...response.body, metadata: response.metadata };
417
456
  }
418
457
 
458
+ async kickUser(
459
+ request: KickUserRequest & { type: string; id: string },
460
+ ): Promise<StreamResponse<KickUserResponse>> {
461
+ const pathParams = {
462
+ type: request?.type,
463
+ id: request?.id,
464
+ };
465
+ const body = {
466
+ user_id: request?.user_id,
467
+ block: request?.block,
468
+ kicked_by_id: request?.kicked_by_id,
469
+ kicked_by: request?.kicked_by,
470
+ };
471
+
472
+ const response = await this.apiClient.sendRequest<
473
+ StreamResponse<KickUserResponse>
474
+ >(
475
+ 'POST',
476
+ '/api/v2/video/call/{type}/{id}/kick',
477
+ pathParams,
478
+ undefined,
479
+ body,
480
+ 'application/json',
481
+ );
482
+
483
+ decoders.KickUserResponse?.(response.body);
484
+
485
+ return { ...response.body, metadata: response.metadata };
486
+ }
487
+
419
488
  async endCall(request: {
420
489
  type: string;
421
490
  id: string;