diff --git a/.changeset/mean-stingrays-occur.md b/.changeset/mean-stingrays-occur.md new file mode 100644 index 00000000..3d5fb8ac --- /dev/null +++ b/.changeset/mean-stingrays-occur.md @@ -0,0 +1,5 @@ +--- +"livekit-server-sdk": patch +--- + +Fix ingress creation parameter inline documentation diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index 5dd15cfa..dd8933fd 100644 --- a/packages/livekit-server-sdk/src/IngressClient.ts +++ b/packages/livekit-server-sdk/src/IngressClient.ts @@ -22,13 +22,13 @@ export interface CreateIngressOptions { */ name?: string; /** - * name of the room to send media to. optional + * name of the room to send media to. required */ roomName?: string; /** - * unique identity of the participant. optional + * unique identity of the participant. required */ - participantIdentity?: string; + participantIdentity: string; /** * participant display name */ @@ -67,11 +67,11 @@ export interface UpdateIngressOptions { */ name: string; /** - * name of the room to send media to. optional + * name of the room to send media to. */ roomName?: string; /** - * unique identity of the participant. optional + * unique identity of the participant. */ participantIdentity?: string; /** @@ -134,29 +134,35 @@ export class IngressClient extends ServiceBase { * @param inputType - protocol for the ingress * @param opts - CreateIngressOptions */ - async createIngress(inputType: IngressInput, opts?: CreateIngressOptions): Promise { + async createIngress(inputType: IngressInput, opts: CreateIngressOptions): Promise { let name: string = ''; - let roomName: string = ''; let participantName: string = ''; let participantIdentity: string = ''; - let participantMetadata: string | undefined; let bypassTranscoding: boolean = false; - let enableTranscoding: boolean | undefined; let url: string = ''; - let audio: IngressAudioOptions | undefined; - let video: IngressVideoOptions | undefined; - if (opts !== undefined) { - name = opts.name || ''; - roomName = opts.roomName || ''; - participantName = opts.participantName || ''; - participantIdentity = opts.participantIdentity || ''; - bypassTranscoding = opts.bypassTranscoding || false; - enableTranscoding = opts.enableTranscoding; - url = opts.url || ''; - audio = opts.audio; - video = opts.video; - participantMetadata = opts.participantMetadata; + if (opts == null) { + throw new Error('options dictionary is required'); + } + + const roomName: string | undefined = opts.roomName; + const enableTranscoding: boolean | undefined = opts.enableTranscoding; + const audio: IngressAudioOptions | undefined = opts.audio; + const video: IngressVideoOptions | undefined = opts.video; + const participantMetadata: string | undefined = opts.participantMetadata; + + name = opts.name || ''; + participantName = opts.participantName || ''; + participantIdentity = opts.participantIdentity || ''; + bypassTranscoding = opts.bypassTranscoding || false; + url = opts.url || ''; + + if (typeof roomName == 'undefined') { + throw new Error('required roomName option not provided'); + } + + if (participantIdentity == '') { + throw new Error('required participantIdentity option not provided'); } const req = new CreateIngressRequest({