From 6d72a9615e17b412797b28d8fd9ce9a13a960407 Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Thu, 10 Oct 2024 19:21:49 -0700 Subject: [PATCH 1/7] Fix ingress creation parameter inline documentation --- packages/livekit-server-sdk/src/IngressClient.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index 5dd15cfa..7ce6fcea 100644 --- a/packages/livekit-server-sdk/src/IngressClient.ts +++ b/packages/livekit-server-sdk/src/IngressClient.ts @@ -22,11 +22,11 @@ export interface CreateIngressOptions { */ 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; /** @@ -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; /** From 6e79d670bc7abd9fc1844e9dc47859216db241aa Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Thu, 10 Oct 2024 19:23:36 -0700 Subject: [PATCH 2/7] Create mean-stingrays-occur.md --- .changeset/mean-stingrays-occur.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/mean-stingrays-occur.md 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 From c910313502eec4fe5375244d2bef8dda108af087 Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Thu, 10 Oct 2024 19:28:06 -0700 Subject: [PATCH 3/7] fmt --- packages/livekit-server-sdk/src/IngressClient.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index 7ce6fcea..b93c4fa4 100644 --- a/packages/livekit-server-sdk/src/IngressClient.ts +++ b/packages/livekit-server-sdk/src/IngressClient.ts @@ -22,11 +22,11 @@ export interface CreateIngressOptions { */ name?: string; /** - * name of the room to send media to. + * name of the room to send media to. */ roomName?: string; /** - * unique identity of the participant. + * unique identity of the participant. */ participantIdentity?: string; /** @@ -67,11 +67,11 @@ export interface UpdateIngressOptions { */ name: string; /** - * name of the room to send media to. + * name of the room to send media to. */ roomName?: string; /** - * unique identity of the participant. + * unique identity of the participant. */ participantIdentity?: string; /** From 8622d73b5d403bb676eb48dae500da81869b285c Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Fri, 11 Oct 2024 10:31:10 -0700 Subject: [PATCH 4/7] WiP --- packages/livekit-server-sdk/src/IngressClient.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index b93c4fa4..b4c6c98e 100644 --- a/packages/livekit-server-sdk/src/IngressClient.ts +++ b/packages/livekit-server-sdk/src/IngressClient.ts @@ -24,11 +24,11 @@ export interface CreateIngressOptions { /** * name of the room to send media to. */ - roomName?: string; + roomName: string; /** * unique identity of the participant. */ - participantIdentity?: string; + participantIdentity: string; /** * participant display name */ @@ -148,9 +148,9 @@ export class IngressClient extends ServiceBase { if (opts !== undefined) { name = opts.name || ''; - roomName = opts.roomName || ''; + roomName = opts.roomName; participantName = opts.participantName || ''; - participantIdentity = opts.participantIdentity || ''; + participantIdentity = opts.participantIdentity; bypassTranscoding = opts.bypassTranscoding || false; enableTranscoding = opts.enableTranscoding; url = opts.url || ''; From 2fb35a612060449184556f0bed449a93f27a7787 Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Fri, 11 Oct 2024 12:23:40 -0700 Subject: [PATCH 5/7] Better enforcement of parameters --- .../livekit-server-sdk/src/IngressClient.ts | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index b4c6c98e..b34515ee 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. + * name of the room to send media to. required */ - roomName: string; + roomName?: string; /** - * unique identity of the participant. + * unique identity of the participant. required */ - participantIdentity: string; + participantIdentity?: string; /** * participant display name */ @@ -134,9 +134,9 @@ 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 roomName: string | undefined; let participantName: string = ''; let participantIdentity: string = ''; let participantMetadata: string | undefined; @@ -146,17 +146,27 @@ export class IngressClient extends ServiceBase { 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'); + } + + 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 (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({ From b42ce93edb12a326164a11318f594d536a4ea833 Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Fri, 11 Oct 2024 12:33:50 -0700 Subject: [PATCH 6/7] WiP --- packages/livekit-server-sdk/src/IngressClient.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index b34515ee..d8dd7d2c 100644 --- a/packages/livekit-server-sdk/src/IngressClient.ts +++ b/packages/livekit-server-sdk/src/IngressClient.ts @@ -136,30 +136,26 @@ export class IngressClient extends ServiceBase { */ async createIngress(inputType: IngressInput, opts: CreateIngressOptions): Promise { let name: string = ''; - let roomName: string | undefined; 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 == 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 || ''; - 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 (typeof roomName == 'undefined') { throw new Error('required roomName option not provided'); From 681011edea7b4081ddef1b8930ce44b9655f24bf Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Fri, 11 Oct 2024 12:39:41 -0700 Subject: [PATCH 7/7] Update packages/livekit-server-sdk/src/IngressClient.ts Co-authored-by: David Zhao --- packages/livekit-server-sdk/src/IngressClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/livekit-server-sdk/src/IngressClient.ts b/packages/livekit-server-sdk/src/IngressClient.ts index d8dd7d2c..dd8933fd 100644 --- a/packages/livekit-server-sdk/src/IngressClient.ts +++ b/packages/livekit-server-sdk/src/IngressClient.ts @@ -28,7 +28,7 @@ export interface CreateIngressOptions { /** * unique identity of the participant. required */ - participantIdentity?: string; + participantIdentity: string; /** * participant display name */