From cbeb37f44aedb83a15856fa4ef62f71862238470 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Fri, 4 Oct 2024 13:37:08 -0500 Subject: [PATCH] feat: update open api --- __tests__/call.test.ts | 29 ++++ __tests__/create-test-client.ts | 4 +- __tests__/external-storage.test.ts | 3 +- src/gen/model-decoders/index.ts | 77 +++++----- src/gen/models/index.ts | 228 ++++++++++++++++------------ src/gen/moderation/ModerationApi.ts | 42 +++++ src/gen/video/CallApi.ts | 14 ++ src/gen/video/VideoApi.ts | 48 ++++++ 8 files changed, 306 insertions(+), 139 deletions(-) diff --git a/__tests__/call.test.ts b/__tests__/call.test.ts index c2cdd9a..03104a4 100644 --- a/__tests__/call.test.ts +++ b/__tests__/call.test.ts @@ -253,6 +253,35 @@ describe('call API', () => { }); }); + it('closed caption settings', async () => { + const response = await call.update({ + settings_override: { + transcription: { + mode: 'available', + closed_caption_mode: 'disabled', + }, + }, + }); + + expect(response.call.settings.transcription.mode).toBe('available'); + expect(response.call.settings.transcription.closed_caption_mode).toBe( + 'disabled', + ); + expect(response.call.captioning).toBe(false); + }); + + it('should start-stop closed captions', async () => { + // somewhat dummy test, we should do a proper test in the future where we join a call and start recording + await expect(() => call.startClosedCaptions()).rejects.toThrowError( + 'Stream error code 4: StartClosedCaptions failed with error: "there is no active session"', + ); + + // somewhat dummy test, we should do a proper test in the future where we join a call and start recording + await expect(() => call.stopClosedCaptions()).rejects.toThrowError( + 'Stream error code 4: StopClosedCaptions failed with error: "call is not being transcribed"', + ); + }); + it('delete call', async () => { try { await call.delete({ hard: true }); diff --git a/__tests__/create-test-client.ts b/__tests__/create-test-client.ts index 62382df..237a88c 100644 --- a/__tests__/create-test-client.ts +++ b/__tests__/create-test-client.ts @@ -5,5 +5,7 @@ const apiKey = process.env.STREAM_API_KEY!; const secret = process.env.STREAM_SECRET!; export const createTestClient = () => { - return new StreamClient(apiKey, secret, { timeout: 10000 }); + return new StreamClient(apiKey, secret, { + timeout: 10000, + }); }; diff --git a/__tests__/external-storage.test.ts b/__tests__/external-storage.test.ts index d2c4750..e427f55 100644 --- a/__tests__/external-storage.test.ts +++ b/__tests__/external-storage.test.ts @@ -3,7 +3,8 @@ import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; -describe('external storage CRUD API', () => { +// Staging app has a bunch of test storage registered, so we can't register new ones +describe.skip('external storage CRUD API', () => { let client: StreamClient; const storageName = `streamnodetest${uuidv4()}`; diff --git a/src/gen/model-decoders/index.ts b/src/gen/model-decoders/index.ts index a944289..9f11f46 100644 --- a/src/gen/model-decoders/index.ts +++ b/src/gen/model-decoders/index.ts @@ -371,7 +371,7 @@ decoders.ChannelStateResponse = (input?: Record) => { pinned_messages: { type: 'MessageResponse', isSingle: false }, - threads: { type: 'ThreadState', isSingle: false }, + threads: { type: 'ThreadStateResponse', isSingle: false }, hide_messages_before: { type: 'DatetimeType', isSingle: true }, @@ -396,7 +396,7 @@ decoders.ChannelStateResponseFields = (input?: Record) => { pinned_messages: { type: 'MessageResponse', isSingle: false }, - threads: { type: 'ThreadState', isSingle: false }, + threads: { type: 'ThreadStateResponse', isSingle: false }, hide_messages_before: { type: 'DatetimeType', isSingle: true }, @@ -1013,7 +1013,7 @@ decoders.MessageResponse = (input?: Record) => { poll: { type: 'Poll', isSingle: true }, - quoted_message: { type: 'Message', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, }; @@ -1050,13 +1050,24 @@ decoders.MessageWithChannelResponse = (input?: Record) => { poll: { type: 'Poll', isSingle: true }, - quoted_message: { type: 'Message', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, }; return decode(typeMappings, input); }; +decoders.ModerationConfig = (input?: Record) => { + const typeMappings: TypeMapping = { + created_at: { type: 'DatetimeType', isSingle: true }, + + updated_at: { type: 'DatetimeType', isSingle: true }, + + velocity_filter_config: { type: 'VelocityFilterConfig', isSingle: true }, + }; + return decode(typeMappings, input); +}; + decoders.ModerationUsageStats = (input?: Record) => { const typeMappings: TypeMapping = { updated_at: { type: 'DatetimeType', isSingle: true }, @@ -1306,6 +1317,13 @@ decoders.QueryMessageHistoryResponse = (input?: Record) => { return decode(typeMappings, input); }; +decoders.QueryModerationConfigsResponse = (input?: Record) => { + const typeMappings: TypeMapping = { + configs: { type: 'ModerationConfig', isSingle: false }, + }; + return decode(typeMappings, input); +}; + decoders.QueryModerationLogsResponse = (input?: Record) => { const typeMappings: TypeMapping = { l_og_s: { type: 'ActionLogResponse', isSingle: false }, @@ -1469,13 +1487,13 @@ decoders.SearchResultMessage = (input?: Record) => { updated_at: { type: 'DatetimeType', isSingle: true }, - latest_reactions: { type: 'Reaction', isSingle: false }, + latest_reactions: { type: 'ReactionResponse', isSingle: false }, - mentioned_users: { type: 'UserObject', isSingle: false }, + mentioned_users: { type: 'UserResponse', isSingle: false }, - own_reactions: { type: 'Reaction', isSingle: false }, + own_reactions: { type: 'ReactionResponse', isSingle: false }, - reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, + user: { type: 'UserResponse', isSingle: true }, deleted_at: { type: 'DatetimeType', isSingle: true }, @@ -1485,17 +1503,17 @@ decoders.SearchResultMessage = (input?: Record) => { pinned_at: { type: 'DatetimeType', isSingle: true }, - thread_participants: { type: 'UserObject', isSingle: false }, + thread_participants: { type: 'UserResponse', isSingle: false }, channel: { type: 'ChannelResponse', isSingle: true }, - pinned_by: { type: 'UserObject', isSingle: true }, + pinned_by: { type: 'UserResponse', isSingle: true }, poll: { type: 'Poll', isSingle: true }, - quoted_message: { type: 'Message', isSingle: true }, + quoted_message: { type: 'MessageResponse', isSingle: true }, - user: { type: 'UserObject', isSingle: true }, + reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, }; return decode(typeMappings, input); }; @@ -1566,31 +1584,6 @@ decoders.ThreadResponse = (input?: Record) => { return decode(typeMappings, input); }; -decoders.ThreadState = (input?: Record) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_replies: { type: 'Message', isSingle: false }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_message_at: { type: 'DatetimeType', isSingle: true }, - - read: { type: 'Read', isSingle: false }, - - thread_participants: { type: 'ThreadParticipant', isSingle: false }, - - channel: { type: 'Channel', isSingle: true }, - - created_by: { type: 'UserObject', isSingle: true }, - - parent_message: { type: 'Message', isSingle: true }, - }; - return decode(typeMappings, input); -}; - decoders.ThreadStateResponse = (input?: Record) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, @@ -1611,7 +1604,7 @@ decoders.ThreadStateResponse = (input?: Record) => { created_by: { type: 'UserResponse', isSingle: true }, - parent_message: { type: 'Message', isSingle: true }, + parent_message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1695,7 +1688,7 @@ decoders.UpdateChannelResponse = (input?: Record) => { channel: { type: 'ChannelResponse', isSingle: true }, - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1725,14 +1718,14 @@ decoders.UpdateMemberPartialResponse = (input?: Record) => { decoders.UpdateMessagePartialResponse = (input?: Record) => { const typeMappings: TypeMapping = { - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; decoders.UpdateMessageResponse = (input?: Record) => { const typeMappings: TypeMapping = { - message: { type: 'Message', isSingle: true }, + message: { type: 'MessageResponse', isSingle: true }, }; return decode(typeMappings, input); }; @@ -1860,7 +1853,7 @@ decoders.UserResponse = (input?: Record) => { decoders.VelocityFilterConfig = (input?: Record) => { const typeMappings: TypeMapping = { - rule: { type: 'VelocityFilterConfigRule', isSingle: false }, + rules: { type: 'VelocityFilterConfigRule', isSingle: false }, }; return decode(typeMappings, input); }; diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 2f42e7a..c0d17a8 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -67,15 +67,17 @@ export interface APNS { } export interface AWSRekognitionConfig { - enabled?: boolean; + enabled: boolean; - rules?: AWSRekognitionRule[]; + rules: AWSRekognitionRule[]; } export interface AWSRekognitionRule { action: 'flag' | 'shadow' | 'remove'; label: string; + + min_confidence: number; } export interface Action { @@ -97,6 +99,8 @@ export interface ActionLog { reason: string; + reporter_type: string; + review_queue_item_id: string; target_user_id: string; @@ -345,9 +349,9 @@ export interface AutomodDetails { } export interface AutomodPlatformCircumventionConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodRule[]; + rules: AutomodRule[]; } export interface AutomodRule { @@ -359,9 +363,9 @@ export interface AutomodRule { } export interface AutomodSemanticFiltersConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodSemanticFiltersRule[]; + rules: AutomodSemanticFiltersRule[]; } export interface AutomodSemanticFiltersRule { @@ -373,9 +377,9 @@ export interface AutomodSemanticFiltersRule { } export interface AutomodToxicityConfig { - enabled?: boolean; + enabled: boolean; - rules?: AutomodRule[]; + rules: AutomodRule[]; } export interface AzureRequest { @@ -467,9 +471,9 @@ export interface BanResponse { } export interface BlockListConfig { - enabled?: boolean; + enabled: boolean; - rules?: BlockListRule[]; + rules: BlockListRule[]; } export interface BlockListOptions { @@ -535,19 +539,21 @@ export interface BlockedUserResponse { } export interface BodyguardConfig { - enabled?: boolean; + enabled: boolean; - profile?: string; + profile: string; - rules?: BodyguardRule[]; + rules: BodyguardRule[]; - severity_rules?: BodyguardSeverityRule[]; + severity_rules: BodyguardSeverityRule[]; } export interface BodyguardRule { action: 'flag' | 'shadow' | 'remove'; label: string; + + severity_rules: BodyguardSeverityRule[]; } export interface BodyguardSeverityRule { @@ -585,6 +591,8 @@ export interface CallEvent { end_timestamp: number; + internal: boolean; + severity: number; timestamp: number; @@ -641,6 +649,8 @@ export interface CallRequest { export interface CallResponse { backstage: boolean; + captioning: boolean; + cid: string; created_at: Date; @@ -1011,7 +1021,7 @@ export interface ChannelConfigWithInfo { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1221,7 +1231,7 @@ export interface ChannelStateResponse { pinned_messages: MessageResponse[]; - threads: ThreadState[]; + threads: ThreadStateResponse[]; hidden?: boolean; @@ -1247,7 +1257,7 @@ export interface ChannelStateResponseFields { pinned_messages: MessageResponse[]; - threads: ThreadState[]; + threads: ThreadStateResponse[]; hidden?: boolean; @@ -1321,7 +1331,7 @@ export interface ChannelTypeConfig { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1381,6 +1391,8 @@ export interface CheckRequest { entity_type: string; + test_mode?: boolean; + user_id?: string; moderation_payload?: ModerationPayload; @@ -1681,7 +1693,7 @@ export interface CreateChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -1972,6 +1984,10 @@ export interface DeleteMessageResponse { message: MessageResponse; } +export interface DeleteModerationConfigResponse { + duration: string; +} + export interface DeleteModerationTemplateResponse { duration: string; } @@ -2623,7 +2639,7 @@ export interface GetChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -2865,7 +2881,7 @@ export interface GoLiveResponse { } export interface GoogleVisionConfig { - enabled?: boolean; + enabled: boolean; } export interface HLSSettings { @@ -3158,16 +3174,6 @@ export interface Location { subdivision_iso_code: string; } -export interface MOSStats { - average_score: number; - - max_score: number; - - min_score: number; - - hist_og_ram_duration_seconds: number[]; -} - export interface MarkChannelsReadRequest { user_id?: string; @@ -3549,7 +3555,7 @@ export interface MessageResponse { poll?: Poll; - quoted_message?: Message; + quoted_message?: MessageResponse; reaction_groups?: Record; } @@ -3633,7 +3639,7 @@ export interface MessageWithChannelResponse { poll?: Poll; - quoted_message?: Message; + quoted_message?: MessageResponse; reaction_groups?: Record; } @@ -3652,6 +3658,32 @@ export interface ModerationActionConfig { custom: Record; } +export interface ModerationConfig { + async: boolean; + + created_at: Date; + + key: string; + + updated_at: Date; + + automod_platform_circumvention_config?: AutomodPlatformCircumventionConfig; + + automod_semantic_filters_config?: AutomodSemanticFiltersConfig; + + automod_toxicity_config?: AutomodToxicityConfig; + + aws_rek_og_nition_config?: AWSRekognitionConfig; + + block_list_config?: BlockListConfig; + + bodyguard_config?: BodyguardConfig; + + go_og_le_vision_config?: GoogleVisionConfig; + + velocity_filter_config?: VelocityFilterConfig; +} + export interface ModerationPayload { images?: string[]; @@ -3810,9 +3842,11 @@ export const OwnCapability = { SEND_AUDIO: 'send-audio', SEND_VIDEO: 'send-video', START_BROADCAST_CALL: 'start-broadcast-call', + START_CLOSED_CAPTIONS_CALL: 'start-closed-captions-call', START_RECORD_CALL: 'start-record-call', START_TRANSCRIPTION_CALL: 'start-transcription-call', STOP_BROADCAST_CALL: 'stop-broadcast-call', + STOP_CLOSED_CAPTIONS_CALL: 'stop-closed-captions-call', STOP_RECORD_CALL: 'stop-record-call', STOP_TRANSCRIPTION_CALL: 'stop-transcription-call', UPDATE_CALL: 'update-call', @@ -4514,6 +4548,32 @@ export interface QueryMessageHistoryResponse { prev?: string; } +export interface QueryModerationConfigsRequest { + limit?: number; + + next?: string; + + prev?: string; + + user_id?: string; + + sort?: SortParamRequest[]; + + filter?: Record; + + user?: UserRequest; +} + +export interface QueryModerationConfigsResponse { + duration: string; + + configs: ModerationConfig[]; + + next?: string; + + prev?: string; +} + export interface QueryModerationLogsRequest { limit?: number; @@ -5161,21 +5221,19 @@ export interface SearchResultMessage { attachments: Attachment[]; - latest_reactions: Reaction[]; + latest_reactions: ReactionResponse[]; - mentioned_users: UserObject[]; + mentioned_users: UserResponse[]; - own_reactions: Reaction[]; + own_reactions: ReactionResponse[]; custom: Record; reaction_counts: Record; - reaction_groups: Record; - reaction_scores: Record; - before_message_send_failed?: boolean; + user: UserResponse; command?: string; @@ -5197,7 +5255,7 @@ export interface SearchResultMessage { show_in_channel?: boolean; - thread_participants?: UserObject[]; + thread_participants?: UserResponse[]; channel?: ChannelResponse; @@ -5205,13 +5263,13 @@ export interface SearchResultMessage { image_labels?: Record; - pinned_by?: UserObject; + pinned_by?: UserResponse; poll?: Poll; - quoted_message?: Message; + quoted_message?: MessageResponse; - user?: UserObject; + reaction_groups?: Record; } export interface SearchWarning { @@ -5306,6 +5364,12 @@ export interface SortParamRequest { field?: string; } +export interface StartClosedCaptionsRequest {} + +export interface StartClosedCaptionsResponse { + duration: string; +} + export interface StartHLSBroadcastingRequest {} export interface StartHLSBroadcastingResponse { @@ -5344,6 +5408,12 @@ export interface StopAllRTMPBroadcastsResponse { duration: string; } +export interface StopClosedCaptionsRequest {} + +export interface StopClosedCaptionsResponse { + duration: string; +} + export interface StopHLSBroadcastingRequest {} export interface StopHLSBroadcastingResponse { @@ -5496,42 +5566,6 @@ export interface ThreadResponse { parent_message?: Message; } -export interface ThreadState { - channel_cid: string; - - created_at: Date; - - parent_message_id: string; - - title: string; - - updated_at: Date; - - latest_replies: Message[]; - - custom: Record; - - active_participant_count?: number; - - deleted_at?: Date; - - last_message_at?: Date; - - participant_count?: number; - - reply_count?: number; - - read?: Read[]; - - thread_participants?: ThreadParticipant[]; - - channel?: Channel; - - created_by?: UserObject; - - parent_message?: Message; -} - export interface ThreadStateResponse { channel_cid: string; @@ -5567,7 +5601,7 @@ export interface ThreadStateResponse { created_by?: UserResponse; - parent_message?: Message; + parent_message?: MessageResponse; } export interface Thresholds { @@ -5603,7 +5637,7 @@ export interface TimeStats { } export interface TranscriptionSettings { - closed_caption_mode: string; + closed_caption_mode: 'available' | 'disabled' | 'auto-on'; mode: 'available' | 'disabled' | 'auto-on'; @@ -5613,13 +5647,13 @@ export interface TranscriptionSettings { export interface TranscriptionSettingsRequest { mode: 'available' | 'disabled' | 'auto-on'; - closed_caption_mode?: string; + closed_caption_mode?: 'available' | 'disabled' | 'auto-on'; languages?: string[]; } export interface TranscriptionSettingsResponse { - closed_caption_mode: string; + closed_caption_mode: 'available' | 'disabled' | 'auto-on'; mode: 'available' | 'disabled' | 'auto-on'; @@ -6042,7 +6076,7 @@ export interface UpdateChannelResponse { channel?: ChannelResponse; - message?: Message; + message?: MessageResponse; } export interface UpdateChannelTypeRequest { @@ -6160,7 +6194,7 @@ export interface UpdateChannelTypeResponse { partition_size?: number; - partition_ttl?: number; + partition_ttl?: string; allowed_flag_reasons?: string[]; @@ -6236,7 +6270,7 @@ export interface UpdateMessagePartialRequest { export interface UpdateMessagePartialResponse { duration: string; - message?: Message; + message?: MessageResponse; pending_message_metadata?: Record; } @@ -6250,7 +6284,7 @@ export interface UpdateMessageRequest { export interface UpdateMessageResponse { duration: string; - message: Message; + message: MessageResponse; pending_message_metadata?: Record; } @@ -6568,6 +6602,8 @@ export interface UserResponse { export interface UserSessionStats { freeze_duration_seconds: number; + group: string; + max_freeze_fraction: number; max_freezes_duration_seconds: number; @@ -6654,16 +6690,12 @@ export interface UserSessionStats { pub_sub_hints?: MediaPubSubHint; - publisher_audio_mos?: MOSStats; - publisher_jitter?: TimeStats; publisher_latency?: TimeStats; publisher_video_quality_limitation_duration_seconds?: Record; - subscriber_audio_mos?: MOSStats; - subscriber_jitter?: TimeStats; subscriber_latency?: TimeStats; @@ -6682,17 +6714,23 @@ export interface UserStats { } export interface VelocityFilterConfig { - enabled?: boolean; + cascading_actions: boolean; - rule?: VelocityFilterConfigRule[]; + enabled: boolean; + + rules: VelocityFilterConfigRule[]; } export interface VelocityFilterConfigRule { action: 'flag' | 'shadow' | 'remove' | 'ban'; - ip_ban?: boolean; + cascading_action: 'flag' | 'shadow' | 'remove' | 'ban'; + + cascading_threshold: number; + + ip_ban: boolean; - shadow_ban?: boolean; + shadow_ban: boolean; timeout?: Date; } diff --git a/src/gen/moderation/ModerationApi.ts b/src/gen/moderation/ModerationApi.ts index b388b7a..b24c2e5 100644 --- a/src/gen/moderation/ModerationApi.ts +++ b/src/gen/moderation/ModerationApi.ts @@ -7,6 +7,7 @@ import { CheckResponse, CustomCheckRequest, CustomCheckResponse, + DeleteModerationConfigResponse, DeleteModerationTemplateResponse, FlagRequest, FlagResponse, @@ -17,6 +18,8 @@ import { MuteRequest, MuteResponse, QueryFeedModerationTemplatesResponse, + QueryModerationConfigsRequest, + QueryModerationConfigsResponse, QueryModerationLogsRequest, QueryModerationLogsResponse, QueryReviewQueueRequest, @@ -71,6 +74,7 @@ export class ModerationApi extends BaseApi { entity_creator_id: request?.entity_creator_id, entity_id: request?.entity_id, entity_type: request?.entity_type, + test_mode: request?.test_mode, user_id: request?.user_id, moderation_payload: request?.moderation_payload, options: request?.options, @@ -116,6 +120,22 @@ export class ModerationApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + deleteConfig = async (request: { + key: string; + }): Promise> => { + const pathParams = { + key: request?.key, + }; + + const response = await this.sendRequest< + StreamResponse + >('DELETE', '/api/v2/moderation/config/{key}', pathParams, undefined); + + decoders.DeleteModerationConfigResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + getConfig = async (request: { key: string; }): Promise> => { @@ -135,6 +155,28 @@ export class ModerationApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + queryModerationConfigs = async ( + request?: QueryModerationConfigsRequest, + ): Promise> => { + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + user_id: request?.user_id, + sort: request?.sort, + filter: request?.filter, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/moderation/configs', undefined, undefined, body); + + decoders.QueryModerationConfigsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + customCheck = async ( request: CustomCheckRequest, ): Promise> => { diff --git a/src/gen/video/CallApi.ts b/src/gen/video/CallApi.ts index a221d41..1dc6660 100644 --- a/src/gen/video/CallApi.ts +++ b/src/gen/video/CallApi.ts @@ -24,6 +24,7 @@ import { PinResponse, SendCallEventRequest, SendCallEventResponse, + StartClosedCaptionsResponse, StartHLSBroadcastingResponse, StartRTMPBroadcastsRequest, StartRTMPBroadcastsResponse, @@ -32,6 +33,7 @@ import { StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, + StopClosedCaptionsResponse, StopHLSBroadcastingResponse, StopLiveResponse, StopRTMPBroadcastsRequest, @@ -199,6 +201,12 @@ export class CallApi { return this.videoApi.startHLSBroadcasting({ id: this.id, type: this.type }); }; + startClosedCaptions = (): Promise< + StreamResponse + > => { + return this.videoApi.startClosedCaptions({ id: this.id, type: this.type }); + }; + startRecording = ( request?: StartRecordingRequest, ): Promise> => { @@ -235,6 +243,12 @@ export class CallApi { return this.videoApi.stopHLSBroadcasting({ id: this.id, type: this.type }); }; + stopClosedCaptions = (): Promise< + StreamResponse + > => { + return this.videoApi.stopClosedCaptions({ id: this.id, type: this.type }); + }; + stopLive = (): Promise> => { return this.videoApi.stopLive({ id: this.id, type: this.type }); }; diff --git a/src/gen/video/VideoApi.ts b/src/gen/video/VideoApi.ts index 8e8e5ba..73f754b 100644 --- a/src/gen/video/VideoApi.ts +++ b/src/gen/video/VideoApi.ts @@ -36,6 +36,7 @@ import { Response, SendCallEventRequest, SendCallEventResponse, + StartClosedCaptionsResponse, StartHLSBroadcastingResponse, StartRTMPBroadcastsRequest, StartRTMPBroadcastsResponse, @@ -44,6 +45,7 @@ import { StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, + StopClosedCaptionsResponse, StopHLSBroadcastingResponse, StopLiveResponse, StopRTMPBroadcastsRequest, @@ -558,6 +560,29 @@ export class VideoApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + startClosedCaptions = async (request: { + type: string; + id: string; + }): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/call/{type}/{id}/start_closed_captions', + pathParams, + undefined, + ); + + decoders.StartClosedCaptionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + startRecording = async ( request: StartRecordingRequest & { type: string; id: string }, ): Promise> => { @@ -658,6 +683,29 @@ export class VideoApi extends BaseApi { return { ...response.body, metadata: response.metadata }; }; + stopClosedCaptions = async (request: { + type: string; + id: string; + }): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/video/call/{type}/{id}/stop_closed_captions', + pathParams, + undefined, + ); + + decoders.StopClosedCaptionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + stopLive = async (request: { type: string; id: string;