@fishjam-cloud/js-server-sdk 0.29.0 → 0.30.0

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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-3EYSX4WM.mjs";
3
+ } from "./chunk-VFSCWQBY.mjs";
4
4
 
5
5
  // ../fishjam-openapi/dist/index.js
6
6
  var BASE_PATH = "https://fishjam.io/api/v1/connect".replace(/\/+$/, "");
@@ -368,9 +368,336 @@ var MoQApi = class extends BaseAPI {
368
368
  return await response.value();
369
369
  }
370
370
  };
371
+ function RecordingSourceFromJSON(json) {
372
+ return RecordingSourceFromJSONTyped(json, false);
373
+ }
374
+ function RecordingSourceFromJSONTyped(json, ignoreDiscriminator) {
375
+ if (json == null) {
376
+ return json;
377
+ }
378
+ return {
379
+ "compositionURL": json["compositionURL"],
380
+ "outputId": json["outputId"],
381
+ "scaleRatio": json["scaleRatio"] == null ? void 0 : json["scaleRatio"]
382
+ };
383
+ }
384
+ function RecordingSourceToJSON(json) {
385
+ return RecordingSourceToJSONTyped(json, false);
386
+ }
387
+ function RecordingSourceToJSONTyped(value, ignoreDiscriminator = false) {
388
+ if (value == null) {
389
+ return value;
390
+ }
391
+ return {
392
+ "compositionURL": value["compositionURL"],
393
+ "outputId": value["outputId"],
394
+ "scaleRatio": value["scaleRatio"]
395
+ };
396
+ }
397
+ function RecordingConfigToJSON(json) {
398
+ return RecordingConfigToJSONTyped(json, false);
399
+ }
400
+ function RecordingConfigToJSONTyped(value, ignoreDiscriminator = false) {
401
+ if (value == null) {
402
+ return value;
403
+ }
404
+ return {
405
+ "metadata": value["metadata"],
406
+ "source": RecordingSourceToJSON(value["source"])
407
+ };
408
+ }
409
+ function RecordingStatusFromJSON(json) {
410
+ return RecordingStatusFromJSONTyped(json, false);
411
+ }
412
+ function RecordingStatusFromJSONTyped(json, ignoreDiscriminator) {
413
+ return json;
414
+ }
415
+ function RecordingFileFromJSON(json) {
416
+ return RecordingFileFromJSONTyped(json, false);
417
+ }
418
+ function RecordingFileFromJSONTyped(json, ignoreDiscriminator) {
419
+ if (json == null) {
420
+ return json;
421
+ }
422
+ return {
423
+ "url": json["url"]
424
+ };
425
+ }
426
+ function RecordingFromJSON(json) {
427
+ return RecordingFromJSONTyped(json, false);
428
+ }
429
+ function RecordingFromJSONTyped(json, ignoreDiscriminator) {
430
+ if (json == null) {
431
+ return json;
432
+ }
433
+ return {
434
+ "files": json["files"].map(RecordingFileFromJSON),
435
+ "id": json["id"],
436
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"],
437
+ "source": RecordingSourceFromJSON(json["source"]),
438
+ "status": RecordingStatusFromJSON(json["status"])
439
+ };
440
+ }
441
+ function RecordingDetailsResponseFromJSON(json) {
442
+ return RecordingDetailsResponseFromJSONTyped(json, false);
443
+ }
444
+ function RecordingDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
445
+ if (json == null) {
446
+ return json;
447
+ }
448
+ return {
449
+ "data": RecordingFromJSON(json["data"])
450
+ };
451
+ }
452
+ function RecordingListResponseFromJSON(json) {
453
+ return RecordingListResponseFromJSONTyped(json, false);
454
+ }
455
+ function RecordingListResponseFromJSONTyped(json, ignoreDiscriminator) {
456
+ if (json == null) {
457
+ return json;
458
+ }
459
+ return {
460
+ "data": json["data"].map(RecordingFromJSON)
461
+ };
462
+ }
463
+ var RecordingsApi = class extends BaseAPI {
464
+ /**
465
+ * Creates request options for createRecording without sending the request
466
+ */
467
+ async createRecordingRequestOpts(requestParameters) {
468
+ if (requestParameters["recordingConfig"] == null) {
469
+ throw new RequiredError(
470
+ "recordingConfig",
471
+ 'Required parameter "recordingConfig" was null or undefined when calling createRecording().'
472
+ );
473
+ }
474
+ const queryParameters = {};
475
+ const headerParameters = {};
476
+ headerParameters["Content-Type"] = "application/json";
477
+ if (this.configuration && this.configuration.accessToken) {
478
+ const token = this.configuration.accessToken;
479
+ const tokenString = await token("management_token", []);
480
+ if (tokenString) {
481
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
482
+ }
483
+ }
484
+ let urlPath = `/recordings`;
485
+ return {
486
+ path: urlPath,
487
+ method: "POST",
488
+ headers: headerParameters,
489
+ query: queryParameters,
490
+ body: RecordingConfigToJSON(requestParameters["recordingConfig"])
491
+ };
492
+ }
493
+ /**
494
+ * Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
495
+ * Create a recording
496
+ */
497
+ async createRecordingRaw(requestParameters, initOverrides) {
498
+ const requestOptions = await this.createRecordingRequestOpts(requestParameters);
499
+ const response = await this.request(requestOptions, initOverrides);
500
+ return new JSONApiResponse(response, (jsonValue) => RecordingDetailsResponseFromJSON(jsonValue));
501
+ }
502
+ /**
503
+ * Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
504
+ * Create a recording
505
+ */
506
+ async createRecording(requestParameters, initOverrides) {
507
+ const response = await this.createRecordingRaw(requestParameters, initOverrides);
508
+ return await response.value();
509
+ }
510
+ /**
511
+ * Creates request options for deleteRecording without sending the request
512
+ */
513
+ async deleteRecordingRequestOpts(requestParameters) {
514
+ if (requestParameters["recordingId"] == null) {
515
+ throw new RequiredError(
516
+ "recordingId",
517
+ 'Required parameter "recordingId" was null or undefined when calling deleteRecording().'
518
+ );
519
+ }
520
+ const queryParameters = {};
521
+ const headerParameters = {};
522
+ if (this.configuration && this.configuration.accessToken) {
523
+ const token = this.configuration.accessToken;
524
+ const tokenString = await token("management_token", []);
525
+ if (tokenString) {
526
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
527
+ }
528
+ }
529
+ let urlPath = `/recordings/{recording_id}`;
530
+ urlPath = urlPath.replace("{recording_id}", encodeURIComponent(String(requestParameters["recordingId"])));
531
+ return {
532
+ path: urlPath,
533
+ method: "DELETE",
534
+ headers: headerParameters,
535
+ query: queryParameters
536
+ };
537
+ }
538
+ /**
539
+ * Delete a recording by id. The recording disappears from the API immediately; its stored media is removed asynchronously by a background job. A recording that is still `active` cannot be deleted — wait for it to finish or fail.
540
+ * Delete a recording
541
+ */
542
+ async deleteRecordingRaw(requestParameters, initOverrides) {
543
+ const requestOptions = await this.deleteRecordingRequestOpts(requestParameters);
544
+ const response = await this.request(requestOptions, initOverrides);
545
+ return new VoidApiResponse(response);
546
+ }
547
+ /**
548
+ * Delete a recording by id. The recording disappears from the API immediately; its stored media is removed asynchronously by a background job. A recording that is still `active` cannot be deleted — wait for it to finish or fail.
549
+ * Delete a recording
550
+ */
551
+ async deleteRecording(requestParameters, initOverrides) {
552
+ await this.deleteRecordingRaw(requestParameters, initOverrides);
553
+ }
554
+ /**
555
+ * Creates request options for getRecording without sending the request
556
+ */
557
+ async getRecordingRequestOpts(requestParameters) {
558
+ if (requestParameters["recordingId"] == null) {
559
+ throw new RequiredError(
560
+ "recordingId",
561
+ 'Required parameter "recordingId" was null or undefined when calling getRecording().'
562
+ );
563
+ }
564
+ const queryParameters = {};
565
+ const headerParameters = {};
566
+ if (this.configuration && this.configuration.accessToken) {
567
+ const token = this.configuration.accessToken;
568
+ const tokenString = await token("management_token", []);
569
+ if (tokenString) {
570
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
571
+ }
572
+ }
573
+ let urlPath = `/recordings/{recording_id}`;
574
+ urlPath = urlPath.replace("{recording_id}", encodeURIComponent(String(requestParameters["recordingId"])));
575
+ return {
576
+ path: urlPath,
577
+ method: "GET",
578
+ headers: headerParameters,
579
+ query: queryParameters
580
+ };
581
+ }
582
+ /**
583
+ * Get a recording by id.
584
+ * Get a recording
585
+ */
586
+ async getRecordingRaw(requestParameters, initOverrides) {
587
+ const requestOptions = await this.getRecordingRequestOpts(requestParameters);
588
+ const response = await this.request(requestOptions, initOverrides);
589
+ return new JSONApiResponse(response, (jsonValue) => RecordingDetailsResponseFromJSON(jsonValue));
590
+ }
591
+ /**
592
+ * Get a recording by id.
593
+ * Get a recording
594
+ */
595
+ async getRecording(requestParameters, initOverrides) {
596
+ const response = await this.getRecordingRaw(requestParameters, initOverrides);
597
+ return await response.value();
598
+ }
599
+ /**
600
+ * Creates request options for listRecordings without sending the request
601
+ */
602
+ async listRecordingsRequestOpts(requestParameters) {
603
+ const queryParameters = {};
604
+ if (requestParameters["metadata"] != null) {
605
+ for (let key of Object.keys(requestParameters["metadata"])) {
606
+ queryParameters[key] = requestParameters["metadata"][key];
607
+ }
608
+ }
609
+ if (requestParameters["status"] != null) {
610
+ queryParameters["status"] = requestParameters["status"];
611
+ }
612
+ const headerParameters = {};
613
+ if (this.configuration && this.configuration.accessToken) {
614
+ const token = this.configuration.accessToken;
615
+ const tokenString = await token("management_token", []);
616
+ if (tokenString) {
617
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
618
+ }
619
+ }
620
+ let urlPath = `/recordings`;
621
+ return {
622
+ path: urlPath,
623
+ method: "GET",
624
+ headers: headerParameters,
625
+ query: queryParameters
626
+ };
627
+ }
628
+ /**
629
+ * List recordings for the tenant, optionally filtered by metadata and status.
630
+ * List recordings
631
+ */
632
+ async listRecordingsRaw(requestParameters, initOverrides) {
633
+ const requestOptions = await this.listRecordingsRequestOpts(requestParameters);
634
+ const response = await this.request(requestOptions, initOverrides);
635
+ return new JSONApiResponse(response, (jsonValue) => RecordingListResponseFromJSON(jsonValue));
636
+ }
637
+ /**
638
+ * List recordings for the tenant, optionally filtered by metadata and status.
639
+ * List recordings
640
+ */
641
+ async listRecordings(requestParameters = {}, initOverrides) {
642
+ const response = await this.listRecordingsRaw(requestParameters, initOverrides);
643
+ return await response.value();
644
+ }
645
+ /**
646
+ * Creates request options for stopRecording without sending the request
647
+ */
648
+ async stopRecordingRequestOpts(requestParameters) {
649
+ if (requestParameters["recordingId"] == null) {
650
+ throw new RequiredError(
651
+ "recordingId",
652
+ 'Required parameter "recordingId" was null or undefined when calling stopRecording().'
653
+ );
654
+ }
655
+ const queryParameters = {};
656
+ const headerParameters = {};
657
+ if (this.configuration && this.configuration.accessToken) {
658
+ const token = this.configuration.accessToken;
659
+ const tokenString = await token("management_token", []);
660
+ if (tokenString) {
661
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
662
+ }
663
+ }
664
+ let urlPath = `/recordings/{recording_id}/stop`;
665
+ urlPath = urlPath.replace("{recording_id}", encodeURIComponent(String(requestParameters["recordingId"])));
666
+ return {
667
+ path: urlPath,
668
+ method: "POST",
669
+ headers: headerParameters,
670
+ query: queryParameters
671
+ };
672
+ }
673
+ /**
674
+ * Request the recorder to stop capturing. Finalization is asynchronous: the recording stays `active` until the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op.
675
+ * Stop a recording
676
+ */
677
+ async stopRecordingRaw(requestParameters, initOverrides) {
678
+ const requestOptions = await this.stopRecordingRequestOpts(requestParameters);
679
+ const response = await this.request(requestOptions, initOverrides);
680
+ return new JSONApiResponse(response, (jsonValue) => RecordingDetailsResponseFromJSON(jsonValue));
681
+ }
682
+ /**
683
+ * Request the recorder to stop capturing. Finalization is asynchronous: the recording stays `active` until the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op.
684
+ * Stop a recording
685
+ */
686
+ async stopRecording(requestParameters, initOverrides) {
687
+ const response = await this.stopRecordingRaw(requestParameters, initOverrides);
688
+ return await response.value();
689
+ }
690
+ };
691
+ var AudioSampleRate = {
692
+ NUMBER_16000: 16e3,
693
+ NUMBER_24000: 24e3
694
+ };
371
695
  function AudioSampleRateToJSON(value) {
372
696
  return value;
373
697
  }
698
+ var AudioFormat = {
699
+ Pcm16: "pcm16"
700
+ };
374
701
  function AudioFormatToJSON(value) {
375
702
  return value;
376
703
  }
@@ -386,6 +713,10 @@ function AgentOutputToJSONTyped(value, ignoreDiscriminator = false) {
386
713
  "audioSampleRate": AudioSampleRateToJSON(value["audioSampleRate"])
387
714
  };
388
715
  }
716
+ var SubscribeMode = {
717
+ Auto: "auto",
718
+ Manual: "manual"
719
+ };
389
720
  function SubscribeModeFromJSON(json) {
390
721
  return SubscribeModeFromJSONTyped(json, false);
391
722
  }
@@ -1369,6 +1700,72 @@ function ViewerFromJSONTyped(json, ignoreDiscriminator) {
1369
1700
  "token": json["token"]
1370
1701
  };
1371
1702
  }
1703
+ function TrackForwardingToJSON(json) {
1704
+ return TrackForwardingToJSONTyped(json, false);
1705
+ }
1706
+ function TrackForwardingToJSONTyped(value, ignoreDiscriminator = false) {
1707
+ if (value == null) {
1708
+ return value;
1709
+ }
1710
+ return {
1711
+ "compositionURL": value["compositionURL"],
1712
+ "selector": value["selector"]
1713
+ };
1714
+ }
1715
+ var TrackForwardingsApi = class extends BaseAPI {
1716
+ /**
1717
+ * Creates request options for createTrackForwarding without sending the request
1718
+ */
1719
+ async createTrackForwardingRequestOpts(requestParameters) {
1720
+ if (requestParameters["roomId"] == null) {
1721
+ throw new RequiredError(
1722
+ "roomId",
1723
+ 'Required parameter "roomId" was null or undefined when calling createTrackForwarding().'
1724
+ );
1725
+ }
1726
+ if (requestParameters["trackForwarding"] == null) {
1727
+ throw new RequiredError(
1728
+ "trackForwarding",
1729
+ 'Required parameter "trackForwarding" was null or undefined when calling createTrackForwarding().'
1730
+ );
1731
+ }
1732
+ const queryParameters = {};
1733
+ const headerParameters = {};
1734
+ headerParameters["Content-Type"] = "application/json";
1735
+ if (this.configuration && this.configuration.accessToken) {
1736
+ const token = this.configuration.accessToken;
1737
+ const tokenString = await token("management_token", []);
1738
+ if (tokenString) {
1739
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1740
+ }
1741
+ }
1742
+ let urlPath = `/room/{room_id}/track_forwardings`;
1743
+ urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
1744
+ return {
1745
+ path: urlPath,
1746
+ method: "POST",
1747
+ headers: headerParameters,
1748
+ query: queryParameters,
1749
+ body: TrackForwardingToJSON(requestParameters["trackForwarding"])
1750
+ };
1751
+ }
1752
+ /**
1753
+ * Forward a room\'s tracks into an external composition.
1754
+ * Create a track forwarding
1755
+ */
1756
+ async createTrackForwardingRaw(requestParameters, initOverrides) {
1757
+ const requestOptions = await this.createTrackForwardingRequestOpts(requestParameters);
1758
+ const response = await this.request(requestOptions, initOverrides);
1759
+ return new VoidApiResponse(response);
1760
+ }
1761
+ /**
1762
+ * Forward a room\'s tracks into an external composition.
1763
+ * Create a track forwarding
1764
+ */
1765
+ async createTrackForwarding(requestParameters, initOverrides) {
1766
+ await this.createTrackForwardingRaw(requestParameters, initOverrides);
1767
+ }
1768
+ };
1372
1769
  function ViewerDetailsResponseFromJSON(json) {
1373
1770
  return ViewerDetailsResponseFromJSONTyped(json, false);
1374
1771
  }
@@ -2515,13 +2912,62 @@ function serverMessage_VadNotification_StatusToJSON(object) {
2515
2912
  return "UNRECOGNIZED";
2516
2913
  }
2517
2914
  }
2518
- function createBaseServerMessage() {
2519
- return {
2520
- authenticated: void 0,
2521
- authRequest: void 0,
2522
- subscribeRequest: void 0,
2523
- subscribeResponse: void 0,
2524
- roomCreated: void 0,
2915
+ var ServerMessage_RecordingStatusChanged_Status = /* @__PURE__ */ ((ServerMessage_RecordingStatusChanged_Status2) => {
2916
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
2917
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_ACTIVE"] = 1] = "STATUS_ACTIVE";
2918
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_FINISHED"] = 2] = "STATUS_FINISHED";
2919
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_AVAILABLE"] = 3] = "STATUS_AVAILABLE";
2920
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_FAILED"] = 4] = "STATUS_FAILED";
2921
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
2922
+ return ServerMessage_RecordingStatusChanged_Status2;
2923
+ })(ServerMessage_RecordingStatusChanged_Status || {});
2924
+ function serverMessage_RecordingStatusChanged_StatusFromJSON(object) {
2925
+ switch (object) {
2926
+ case 0:
2927
+ case "STATUS_UNSPECIFIED":
2928
+ return 0;
2929
+ case 1:
2930
+ case "STATUS_ACTIVE":
2931
+ return 1;
2932
+ case 2:
2933
+ case "STATUS_FINISHED":
2934
+ return 2;
2935
+ case 3:
2936
+ case "STATUS_AVAILABLE":
2937
+ return 3;
2938
+ case 4:
2939
+ case "STATUS_FAILED":
2940
+ return 4;
2941
+ case -1:
2942
+ case "UNRECOGNIZED":
2943
+ default:
2944
+ return -1;
2945
+ }
2946
+ }
2947
+ function serverMessage_RecordingStatusChanged_StatusToJSON(object) {
2948
+ switch (object) {
2949
+ case 0:
2950
+ return "STATUS_UNSPECIFIED";
2951
+ case 1:
2952
+ return "STATUS_ACTIVE";
2953
+ case 2:
2954
+ return "STATUS_FINISHED";
2955
+ case 3:
2956
+ return "STATUS_AVAILABLE";
2957
+ case 4:
2958
+ return "STATUS_FAILED";
2959
+ case -1:
2960
+ default:
2961
+ return "UNRECOGNIZED";
2962
+ }
2963
+ }
2964
+ function createBaseServerMessage() {
2965
+ return {
2966
+ authenticated: void 0,
2967
+ authRequest: void 0,
2968
+ subscribeRequest: void 0,
2969
+ subscribeResponse: void 0,
2970
+ roomCreated: void 0,
2525
2971
  roomDeleted: void 0,
2526
2972
  roomCrashed: void 0,
2527
2973
  peerConnected: void 0,
@@ -2542,6 +2988,7 @@ function createBaseServerMessage() {
2542
2988
  viewerDisconnected: void 0,
2543
2989
  streamerConnected: void 0,
2544
2990
  streamerDisconnected: void 0,
2991
+ recordingStatusChanged: void 0,
2545
2992
  notificationBatch: void 0,
2546
2993
  streamConnected: void 0,
2547
2994
  streamDisconnected: void 0,
@@ -2628,6 +3075,9 @@ var ServerMessage = {
2628
3075
  if (message.streamerDisconnected !== void 0) {
2629
3076
  ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
2630
3077
  }
3078
+ if (message.recordingStatusChanged !== void 0) {
3079
+ ServerMessage_RecordingStatusChanged.encode(message.recordingStatusChanged, writer.uint32(274).fork()).join();
3080
+ }
2631
3081
  if (message.notificationBatch !== void 0) {
2632
3082
  ServerMessage_NotificationBatch.encode(message.notificationBatch, writer.uint32(266).fork()).join();
2633
3083
  }
@@ -2833,6 +3283,13 @@ var ServerMessage = {
2833
3283
  message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
2834
3284
  continue;
2835
3285
  }
3286
+ case 34: {
3287
+ if (tag !== 274) {
3288
+ break;
3289
+ }
3290
+ message.recordingStatusChanged = ServerMessage_RecordingStatusChanged.decode(reader, reader.uint32());
3291
+ continue;
3292
+ }
2836
3293
  case 33: {
2837
3294
  if (tag !== 266) {
2838
3295
  break;
@@ -2917,6 +3374,7 @@ var ServerMessage = {
2917
3374
  viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
2918
3375
  streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
2919
3376
  streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0,
3377
+ recordingStatusChanged: isSet2(object.recordingStatusChanged) ? ServerMessage_RecordingStatusChanged.fromJSON(object.recordingStatusChanged) : void 0,
2920
3378
  notificationBatch: isSet2(object.notificationBatch) ? ServerMessage_NotificationBatch.fromJSON(object.notificationBatch) : void 0,
2921
3379
  streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
2922
3380
  streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
@@ -3003,6 +3461,9 @@ var ServerMessage = {
3003
3461
  if (message.streamerDisconnected !== void 0) {
3004
3462
  obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
3005
3463
  }
3464
+ if (message.recordingStatusChanged !== void 0) {
3465
+ obj.recordingStatusChanged = ServerMessage_RecordingStatusChanged.toJSON(message.recordingStatusChanged);
3466
+ }
3006
3467
  if (message.notificationBatch !== void 0) {
3007
3468
  obj.notificationBatch = ServerMessage_NotificationBatch.toJSON(message.notificationBatch);
3008
3469
  }
@@ -3056,6 +3517,7 @@ var ServerMessage = {
3056
3517
  message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
3057
3518
  message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
3058
3519
  message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
3520
+ message.recordingStatusChanged = object.recordingStatusChanged !== void 0 && object.recordingStatusChanged !== null ? ServerMessage_RecordingStatusChanged.fromPartial(object.recordingStatusChanged) : void 0;
3059
3521
  message.notificationBatch = object.notificationBatch !== void 0 && object.notificationBatch !== null ? ServerMessage_NotificationBatch.fromPartial(object.notificationBatch) : void 0;
3060
3522
  message.streamConnected = object.streamConnected !== void 0 && object.streamConnected !== null ? ServerMessage_StreamConnected.fromPartial(object.streamConnected) : void 0;
3061
3523
  message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
@@ -5363,6 +5825,89 @@ var ServerMessage_StreamerDisconnected = {
5363
5825
  return message;
5364
5826
  }
5365
5827
  };
5828
+ function createBaseServerMessage_RecordingStatusChanged() {
5829
+ return { recordingId: "", status: 0, metadata: "" };
5830
+ }
5831
+ var ServerMessage_RecordingStatusChanged = {
5832
+ encode(message, writer = new BinaryWriter()) {
5833
+ if (message.recordingId !== "") {
5834
+ writer.uint32(10).string(message.recordingId);
5835
+ }
5836
+ if (message.status !== 0) {
5837
+ writer.uint32(16).int32(message.status);
5838
+ }
5839
+ if (message.metadata !== "") {
5840
+ writer.uint32(26).string(message.metadata);
5841
+ }
5842
+ return writer;
5843
+ },
5844
+ decode(input, length) {
5845
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5846
+ let end = length === void 0 ? reader.len : reader.pos + length;
5847
+ const message = createBaseServerMessage_RecordingStatusChanged();
5848
+ while (reader.pos < end) {
5849
+ const tag = reader.uint32();
5850
+ switch (tag >>> 3) {
5851
+ case 1: {
5852
+ if (tag !== 10) {
5853
+ break;
5854
+ }
5855
+ message.recordingId = reader.string();
5856
+ continue;
5857
+ }
5858
+ case 2: {
5859
+ if (tag !== 16) {
5860
+ break;
5861
+ }
5862
+ message.status = reader.int32();
5863
+ continue;
5864
+ }
5865
+ case 3: {
5866
+ if (tag !== 26) {
5867
+ break;
5868
+ }
5869
+ message.metadata = reader.string();
5870
+ continue;
5871
+ }
5872
+ }
5873
+ if ((tag & 7) === 4 || tag === 0) {
5874
+ break;
5875
+ }
5876
+ reader.skip(tag & 7);
5877
+ }
5878
+ return message;
5879
+ },
5880
+ fromJSON(object) {
5881
+ return {
5882
+ recordingId: isSet2(object.recordingId) ? globalThis.String(object.recordingId) : "",
5883
+ status: isSet2(object.status) ? serverMessage_RecordingStatusChanged_StatusFromJSON(object.status) : 0,
5884
+ metadata: isSet2(object.metadata) ? globalThis.String(object.metadata) : ""
5885
+ };
5886
+ },
5887
+ toJSON(message) {
5888
+ const obj = {};
5889
+ if (message.recordingId !== "") {
5890
+ obj.recordingId = message.recordingId;
5891
+ }
5892
+ if (message.status !== 0) {
5893
+ obj.status = serverMessage_RecordingStatusChanged_StatusToJSON(message.status);
5894
+ }
5895
+ if (message.metadata !== "") {
5896
+ obj.metadata = message.metadata;
5897
+ }
5898
+ return obj;
5899
+ },
5900
+ create(base) {
5901
+ return ServerMessage_RecordingStatusChanged.fromPartial(base ?? {});
5902
+ },
5903
+ fromPartial(object) {
5904
+ const message = createBaseServerMessage_RecordingStatusChanged();
5905
+ message.recordingId = object.recordingId ?? "";
5906
+ message.status = object.status ?? 0;
5907
+ message.metadata = object.metadata ?? "";
5908
+ return message;
5909
+ }
5910
+ };
5366
5911
  function createBaseServerMessage_NotificationBatch() {
5367
5912
  return { notifications: [] };
5368
5913
  }
@@ -6293,12 +6838,25 @@ function isSet3(value) {
6293
6838
  // src/ws_notifier.ts
6294
6839
  import { EventEmitter } from "events";
6295
6840
 
6841
+ // src/utils.ts
6842
+ import { readFile } from "node:fs/promises";
6843
+
6296
6844
  // src/exceptions/index.ts
6297
6845
  var MissingFishjamIdException = class extends Error {
6298
6846
  constructor() {
6299
6847
  super("Fishjam ID is required");
6300
6848
  }
6301
6849
  };
6850
+ var StaleSdkException = class extends Error {
6851
+ /** Raw wire value received from the server. */
6852
+ status;
6853
+ constructor(status) {
6854
+ super(
6855
+ `Received a recording status this SDK cannot parse (${status}). You are probably using an outdated version of @fishjam-cloud/js-server-sdk \u2014 please update it.`
6856
+ );
6857
+ this.status = status;
6858
+ }
6859
+ };
6302
6860
  var FishjamBaseException = class extends Error {
6303
6861
  statusCode;
6304
6862
  details;
@@ -6322,6 +6880,16 @@ var InvalidFishjamCredentialsException = class extends FishjamBaseException {
6322
6880
  };
6323
6881
  var PeerNotFoundException = class extends FishjamBaseException {
6324
6882
  };
6883
+ var RecordingNotFoundException = class extends FishjamBaseException {
6884
+ };
6885
+ var CompositionNotFoundException = class extends FishjamBaseException {
6886
+ };
6887
+ var InputNotFoundException = class extends FishjamBaseException {
6888
+ };
6889
+ var OutputNotFoundException = class extends FishjamBaseException {
6890
+ };
6891
+ var RendererNotFoundException = class extends FishjamBaseException {
6892
+ };
6325
6893
  var ServiceUnavailableException = class extends FishjamBaseException {
6326
6894
  };
6327
6895
  var QuotaExceededException = class extends FishjamBaseException {
@@ -6330,6 +6898,7 @@ var UnknownException = class extends FishjamBaseException {
6330
6898
  };
6331
6899
 
6332
6900
  // src/utils.ts
6901
+ var FISHJAM_URL = "https://fishjam.io";
6333
6902
  var httpToWebsocket = (httpUrl) => {
6334
6903
  const url = new URL(httpUrl);
6335
6904
  url.protocol = url.protocol.replace("http", "ws");
@@ -6340,7 +6909,7 @@ var getFishjamUrl = (config) => {
6340
6909
  try {
6341
6910
  return new URL(config.fishjamId).href;
6342
6911
  } catch {
6343
- return `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
6912
+ return `${FISHJAM_URL}/api/v1/connect/${config.fishjamId}`;
6344
6913
  }
6345
6914
  };
6346
6915
  var AGENT_SOCKET_PATH = "/socket/agent/websocket";
@@ -6353,6 +6922,10 @@ var getAgentWebsocketUrl = (config, peerWebsocketUrl) => {
6353
6922
  }
6354
6923
  return `${httpToWebsocket(getFishjamUrl(config))}${AGENT_SOCKET_PATH}`;
6355
6924
  };
6925
+ var COMPOSITION_URL = "https://rtc.fishjam.io";
6926
+ var getCompositionOrigin = (config) => new URL(config.compositionUrl ?? COMPOSITION_URL).origin;
6927
+ var toBlob = async (file) => typeof file === "string" ? new Blob([await readFile(file)]) : file;
6928
+ var getLivestreamWhipUrl = (config) => `${new URL(getFishjamUrl(config)).origin}/api/v1/live/api/whip`;
6356
6929
 
6357
6930
  // src/notifications.ts
6358
6931
  var peerTypeMap = {
@@ -6374,6 +6947,20 @@ var vadStatusMap = {
6374
6947
  [ServerMessage_VadNotification_Status.STATUS_SPEECH]: "speech",
6375
6948
  [ServerMessage_VadNotification_Status.UNRECOGNIZED]: "silence"
6376
6949
  };
6950
+ var mapRecordingStatus = (status) => {
6951
+ switch (status) {
6952
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_ACTIVE:
6953
+ return "active";
6954
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_FINISHED:
6955
+ return "finished";
6956
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_AVAILABLE:
6957
+ return "available";
6958
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_FAILED:
6959
+ return "failed";
6960
+ default:
6961
+ throw new StaleSdkException(status);
6962
+ }
6963
+ };
6377
6964
  var expectedEventsList = [
6378
6965
  "roomCreated",
6379
6966
  "roomDeleted",
@@ -6395,7 +6982,8 @@ var expectedEventsList = [
6395
6982
  "trackForwardingRemoved",
6396
6983
  "vadNotification",
6397
6984
  "channelAdded",
6398
- "channelRemoved"
6985
+ "channelRemoved",
6986
+ "recordingStatusChanged"
6399
6987
  ];
6400
6988
  var peerEventsWithPeerType = /* @__PURE__ */ new Set([
6401
6989
  "peerAdded",
@@ -6424,6 +7012,10 @@ var mapNotification = (event, msg) => {
6424
7012
  const vad = msg;
6425
7013
  return { ...vad, status: vadStatusMap[vad.status] };
6426
7014
  }
7015
+ if (event === "recordingStatusChanged") {
7016
+ const recording = msg;
7017
+ return { ...recording, status: mapRecordingStatus(recording.status) };
7018
+ }
6427
7019
  return msg;
6428
7020
  };
6429
7021
  var isExpectedEvent = (event) => expectedEventsList.includes(event);
@@ -6648,132 +7240,2283 @@ var toProtoEncoding = (encoding) => {
6648
7240
  return TrackEncoding.TRACK_ENCODING_OPUS;
6649
7241
  };
6650
7242
 
6651
- // src/exceptions/mapper.ts
6652
- var notFoundException = (info, entity) => {
6653
- switch (entity) {
6654
- case "credentials":
6655
- return new InvalidFishjamCredentialsException(info);
6656
- case "peer":
6657
- return new PeerNotFoundException(info);
6658
- case "room":
6659
- return new RoomNotFoundException(info);
6660
- default:
6661
- return new FishjamNotFoundException(info);
7243
+ // ../composition-openapi/dist/index.js
7244
+ var BASE_PATH2 = "https://rtc.fishjam.io".replace(/\/+$/, "");
7245
+ var Configuration2 = class {
7246
+ constructor(configuration = {}) {
7247
+ this.configuration = configuration;
6662
7248
  }
6663
- };
6664
- var mapException = async (error, entity) => {
6665
- if (error instanceof FetchError) {
6666
- return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message });
7249
+ set config(configuration) {
7250
+ this.configuration = configuration;
6667
7251
  }
6668
- if (!(error instanceof ResponseError)) {
6669
- return error;
7252
+ get basePath() {
7253
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
6670
7254
  }
6671
- const status = error.response.status;
6672
- const body = await error.response.json().catch(() => ({}));
6673
- const info = {
6674
- message: `Request failed with status code ${status}`,
6675
- statusCode: status,
6676
- details: body["detail"] ?? body["errors"] ?? "Unknown error"
6677
- };
6678
- switch (status) {
6679
- case 400:
6680
- return new BadRequestException(info);
6681
- case 402:
6682
- return new QuotaExceededException(info);
6683
- case 401:
6684
- return new UnauthorizedException(info);
6685
- case 404:
6686
- return notFoundException(info, entity);
6687
- case 503:
6688
- return new ServiceUnavailableException(info);
6689
- default:
6690
- return new UnknownException(info);
7255
+ get fetchApi() {
7256
+ return this.configuration.fetchApi;
6691
7257
  }
6692
- };
6693
-
6694
- // src/client.ts
6695
- var FishjamClient = class _FishjamClient {
6696
- moqApi;
6697
- roomApi;
6698
- viewerApi;
6699
- streamerApi;
6700
- credentialsApi;
6701
- fishjamConfig;
6702
- deprecationWarningShown = false;
6703
- /**
6704
- * Create new instance of Fishjam Client.
6705
- *
6706
- * Does not verify credentials against the backend — use
6707
- * {@link FishjamClient.create} or call
6708
- * {@link FishjamClient.checkCredentials} afterwards for that.
6709
- *
6710
- * Example usage:
6711
- * ```
6712
- * const fishjamClient = new FishjamClient({
6713
- * fishjamId: fastify.config.FISHJAM_ID,
6714
- * managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
6715
- * });
6716
- * ```
6717
- */
6718
- constructor(config) {
6719
- const deprecationMiddleware = {
6720
- post: async ({ response }) => {
6721
- this.handleDeprecationHeader(response.headers);
6722
- return response;
6723
- }
6724
- };
6725
- const apiConfig = new Configuration({
6726
- basePath: getFishjamUrl(config),
6727
- headers: {
6728
- Authorization: `Bearer ${config.managementToken}`,
6729
- "x-fishjam-api-client": `js-server/${package_default.version}`
6730
- },
6731
- middleware: [deprecationMiddleware]
6732
- });
6733
- this.moqApi = new MoQApi(apiConfig);
6734
- this.roomApi = new RoomsApi(apiConfig);
6735
- this.viewerApi = new ViewersApi(apiConfig);
6736
- this.streamerApi = new StreamersApi(apiConfig);
6737
- this.credentialsApi = new CredentialsApi(apiConfig);
6738
- this.fishjamConfig = config;
7258
+ get middleware() {
7259
+ return this.configuration.middleware || [];
6739
7260
  }
6740
- /**
6741
- * Async factory: constructs a client and verifies credentials against
6742
- * the backend.
6743
- *
6744
- * Throws {@link InvalidFishjamCredentialsException} when the
6745
- * `fishjamId` / `managementToken` pair is rejected by the backend.
6746
- *
6747
- * Example:
6748
- * ```
6749
- * const client = await FishjamClient.create({
6750
- * fishjamId: process.env.FISHJAM_ID!,
6751
- * managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
6752
- * });
6753
- * ```
6754
- */
6755
- static async create(config) {
6756
- const client = new _FishjamClient(config);
6757
- await client.checkCredentials();
6758
- return client;
7261
+ get queryParamsStringify() {
7262
+ return this.configuration.queryParamsStringify || querystring2;
6759
7263
  }
6760
- /**
6761
- * Verifies the configured credentials by making a single lightweight
6762
- * call to the Fishjam backend. Resolves on success, throws
6763
- * {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
6764
- * otherwise rethrows the standard mapped exception.
6765
- */
6766
- async checkCredentials() {
6767
- try {
6768
- await this.credentialsApi.validateCredentials();
6769
- } catch (error) {
6770
- throw await mapException(error, "credentials");
7264
+ get username() {
7265
+ return this.configuration.username;
7266
+ }
7267
+ get password() {
7268
+ return this.configuration.password;
7269
+ }
7270
+ get apiKey() {
7271
+ const apiKey = this.configuration.apiKey;
7272
+ if (apiKey) {
7273
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
6771
7274
  }
7275
+ return void 0;
6772
7276
  }
6773
- handleDeprecationHeader(headers) {
6774
- try {
6775
- const deprecationHeader = headers.get("x-fishjam-api-deprecated");
6776
- if (!deprecationHeader || this.deprecationWarningShown) return;
7277
+ get accessToken() {
7278
+ const accessToken = this.configuration.accessToken;
7279
+ if (accessToken) {
7280
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
7281
+ }
7282
+ return void 0;
7283
+ }
7284
+ get headers() {
7285
+ return this.configuration.headers;
7286
+ }
7287
+ get credentials() {
7288
+ return this.configuration.credentials;
7289
+ }
7290
+ };
7291
+ var DefaultConfig2 = new Configuration2();
7292
+ var BaseAPI2 = class _BaseAPI2 {
7293
+ constructor(configuration = DefaultConfig2) {
7294
+ this.configuration = configuration;
7295
+ this.middleware = configuration.middleware;
7296
+ }
7297
+ static jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
7298
+ middleware;
7299
+ withMiddleware(...middlewares) {
7300
+ const next = this.clone();
7301
+ next.middleware = next.middleware.concat(...middlewares);
7302
+ return next;
7303
+ }
7304
+ withPreMiddleware(...preMiddlewares) {
7305
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
7306
+ return this.withMiddleware(...middlewares);
7307
+ }
7308
+ withPostMiddleware(...postMiddlewares) {
7309
+ const middlewares = postMiddlewares.map((post) => ({ post }));
7310
+ return this.withMiddleware(...middlewares);
7311
+ }
7312
+ /**
7313
+ * Check if the given MIME is a JSON MIME.
7314
+ * JSON MIME examples:
7315
+ * application/json
7316
+ * application/json; charset=UTF8
7317
+ * APPLICATION/JSON
7318
+ * application/vnd.company+json
7319
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
7320
+ * @return True if the given MIME is JSON, false otherwise.
7321
+ */
7322
+ isJsonMime(mime) {
7323
+ if (!mime) {
7324
+ return false;
7325
+ }
7326
+ return _BaseAPI2.jsonRegex.test(mime);
7327
+ }
7328
+ async request(context, initOverrides) {
7329
+ const { url, init } = await this.createFetchParams(context, initOverrides);
7330
+ const response = await this.fetchApi(url, init);
7331
+ if (response && response.status >= 200 && response.status < 300) {
7332
+ return response;
7333
+ }
7334
+ throw new ResponseError2(response, "Response returned an error code");
7335
+ }
7336
+ async createFetchParams(context, initOverrides) {
7337
+ let url = this.configuration.basePath + context.path;
7338
+ if (context.query !== void 0 && Object.keys(context.query).length !== 0) {
7339
+ url += "?" + this.configuration.queryParamsStringify(context.query);
7340
+ }
7341
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
7342
+ Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {});
7343
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
7344
+ const initParams = {
7345
+ method: context.method,
7346
+ headers,
7347
+ body: context.body,
7348
+ credentials: this.configuration.credentials
7349
+ };
7350
+ const overriddenInit = {
7351
+ ...initParams,
7352
+ ...await initOverrideFn({
7353
+ init: initParams,
7354
+ context
7355
+ })
7356
+ };
7357
+ let body;
7358
+ if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
7359
+ body = overriddenInit.body;
7360
+ } else if (this.isJsonMime(headers["Content-Type"])) {
7361
+ body = JSON.stringify(overriddenInit.body);
7362
+ } else {
7363
+ body = overriddenInit.body;
7364
+ }
7365
+ const init = {
7366
+ ...overriddenInit,
7367
+ body
7368
+ };
7369
+ return { url, init };
7370
+ }
7371
+ fetchApi = async (url, init) => {
7372
+ let fetchParams = { url, init };
7373
+ for (const middleware of this.middleware) {
7374
+ if (middleware.pre) {
7375
+ fetchParams = await middleware.pre({
7376
+ fetch: this.fetchApi,
7377
+ ...fetchParams
7378
+ }) || fetchParams;
7379
+ }
7380
+ }
7381
+ let response = void 0;
7382
+ try {
7383
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
7384
+ } catch (e) {
7385
+ for (const middleware of this.middleware) {
7386
+ if (middleware.onError) {
7387
+ response = await middleware.onError({
7388
+ fetch: this.fetchApi,
7389
+ url: fetchParams.url,
7390
+ init: fetchParams.init,
7391
+ error: e,
7392
+ response: response ? response.clone() : void 0
7393
+ }) || response;
7394
+ }
7395
+ }
7396
+ if (response === void 0) {
7397
+ if (e instanceof Error) {
7398
+ throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
7399
+ } else {
7400
+ throw e;
7401
+ }
7402
+ }
7403
+ }
7404
+ for (const middleware of this.middleware) {
7405
+ if (middleware.post) {
7406
+ response = await middleware.post({
7407
+ fetch: this.fetchApi,
7408
+ url: fetchParams.url,
7409
+ init: fetchParams.init,
7410
+ response: response.clone()
7411
+ }) || response;
7412
+ }
7413
+ }
7414
+ return response;
7415
+ };
7416
+ /**
7417
+ * Create a shallow clone of `this` by constructing a new instance
7418
+ * and then shallow cloning data members.
7419
+ */
7420
+ clone() {
7421
+ const constructor = this.constructor;
7422
+ const next = new constructor(this.configuration);
7423
+ next.middleware = this.middleware.slice();
7424
+ return next;
7425
+ }
7426
+ };
7427
+ function isBlob2(value) {
7428
+ return typeof Blob !== "undefined" && value instanceof Blob;
7429
+ }
7430
+ function isFormData2(value) {
7431
+ return typeof FormData !== "undefined" && value instanceof FormData;
7432
+ }
7433
+ var ResponseError2 = class extends Error {
7434
+ constructor(response, msg) {
7435
+ super(msg);
7436
+ this.response = response;
7437
+ const actualProto = new.target.prototype;
7438
+ if (Object.setPrototypeOf) {
7439
+ Object.setPrototypeOf(this, actualProto);
7440
+ }
7441
+ }
7442
+ name = "ResponseError";
7443
+ };
7444
+ var FetchError2 = class extends Error {
7445
+ constructor(cause, msg) {
7446
+ super(msg);
7447
+ this.cause = cause;
7448
+ const actualProto = new.target.prototype;
7449
+ if (Object.setPrototypeOf) {
7450
+ Object.setPrototypeOf(this, actualProto);
7451
+ }
7452
+ }
7453
+ name = "FetchError";
7454
+ };
7455
+ var RequiredError2 = class extends Error {
7456
+ constructor(field, msg) {
7457
+ super(msg);
7458
+ this.field = field;
7459
+ const actualProto = new.target.prototype;
7460
+ if (Object.setPrototypeOf) {
7461
+ Object.setPrototypeOf(this, actualProto);
7462
+ }
7463
+ }
7464
+ name = "RequiredError";
7465
+ };
7466
+ function querystring2(params, prefix = "") {
7467
+ return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
7468
+ }
7469
+ function querystringSingleKey2(key, value, keyPrefix = "") {
7470
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
7471
+ if (value instanceof Array) {
7472
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
7473
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
7474
+ }
7475
+ if (value instanceof Set) {
7476
+ const valueAsArray = Array.from(value);
7477
+ return querystringSingleKey2(key, valueAsArray, keyPrefix);
7478
+ }
7479
+ if (value instanceof Date) {
7480
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
7481
+ }
7482
+ if (value instanceof Object) {
7483
+ return querystring2(value, fullKey);
7484
+ }
7485
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
7486
+ }
7487
+ function canConsumeForm(consumes) {
7488
+ for (const consume of consumes) {
7489
+ if (consume.contentType?.startsWith("multipart/form-data") == true) {
7490
+ return true;
7491
+ }
7492
+ }
7493
+ return false;
7494
+ }
7495
+ var JSONApiResponse2 = class {
7496
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
7497
+ this.raw = raw;
7498
+ this.transformer = transformer;
7499
+ }
7500
+ async value() {
7501
+ return this.transformer(await this.raw.json());
7502
+ }
7503
+ };
7504
+ var VoidApiResponse2 = class {
7505
+ constructor(raw) {
7506
+ this.raw = raw;
7507
+ }
7508
+ async value() {
7509
+ return void 0;
7510
+ }
7511
+ };
7512
+ var TextApiResponse = class {
7513
+ constructor(raw) {
7514
+ this.raw = raw;
7515
+ }
7516
+ async value() {
7517
+ return await this.raw.text();
7518
+ }
7519
+ };
7520
+ function CompositionCreatedResponseFromJSON(json) {
7521
+ return CompositionCreatedResponseFromJSONTyped(json, false);
7522
+ }
7523
+ function CompositionCreatedResponseFromJSONTyped(json, ignoreDiscriminator) {
7524
+ if (json == null) {
7525
+ return json;
7526
+ }
7527
+ return {
7528
+ compositionId: json["composition_id"],
7529
+ apiUrl: json["api_url"]
7530
+ };
7531
+ }
7532
+ function CreateCompositionRequestToJSON(json) {
7533
+ return CreateCompositionRequestToJSONTyped(json, false);
7534
+ }
7535
+ function CreateCompositionRequestToJSONTyped(value, ignoreDiscriminator = false) {
7536
+ if (value == null) {
7537
+ return value;
7538
+ }
7539
+ return {
7540
+ autostart: value["autostart"],
7541
+ cleanup_without_inputs: value["cleanupWithoutInputs"]
7542
+ };
7543
+ }
7544
+ var CompositionsApi = class extends BaseAPI2 {
7545
+ /**
7546
+ * Creates request options for createComposition without sending the request
7547
+ */
7548
+ async createCompositionRequestOpts(requestParameters) {
7549
+ if (requestParameters["createCompositionRequest"] == null) {
7550
+ throw new RequiredError2(
7551
+ "createCompositionRequest",
7552
+ 'Required parameter "createCompositionRequest" was null or undefined when calling createComposition().'
7553
+ );
7554
+ }
7555
+ const queryParameters = {};
7556
+ const headerParameters = {};
7557
+ headerParameters["Content-Type"] = "application/json";
7558
+ if (this.configuration && this.configuration.accessToken) {
7559
+ const token = this.configuration.accessToken;
7560
+ const tokenString = await token("BearerAuth", []);
7561
+ if (tokenString) {
7562
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7563
+ }
7564
+ }
7565
+ let urlPath = `/api/composition`;
7566
+ return {
7567
+ path: urlPath,
7568
+ method: "POST",
7569
+ headers: headerParameters,
7570
+ query: queryParameters,
7571
+ body: CreateCompositionRequestToJSON(requestParameters["createCompositionRequest"])
7572
+ };
7573
+ }
7574
+ /**
7575
+ * Create a composition
7576
+ */
7577
+ async createCompositionRaw(requestParameters, initOverrides) {
7578
+ const requestOptions = await this.createCompositionRequestOpts(requestParameters);
7579
+ const response = await this.request(requestOptions, initOverrides);
7580
+ return new JSONApiResponse2(response, (jsonValue) => CompositionCreatedResponseFromJSON(jsonValue));
7581
+ }
7582
+ /**
7583
+ * Create a composition
7584
+ */
7585
+ async createComposition(requestParameters, initOverrides) {
7586
+ const response = await this.createCompositionRaw(requestParameters, initOverrides);
7587
+ return await response.value();
7588
+ }
7589
+ /**
7590
+ * Creates request options for deleteComposition without sending the request
7591
+ */
7592
+ async deleteCompositionRequestOpts(requestParameters) {
7593
+ if (requestParameters["compositionId"] == null) {
7594
+ throw new RequiredError2(
7595
+ "compositionId",
7596
+ 'Required parameter "compositionId" was null or undefined when calling deleteComposition().'
7597
+ );
7598
+ }
7599
+ const queryParameters = {};
7600
+ const headerParameters = {};
7601
+ if (this.configuration && this.configuration.accessToken) {
7602
+ const token = this.configuration.accessToken;
7603
+ const tokenString = await token("BearerAuth", []);
7604
+ if (tokenString) {
7605
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7606
+ }
7607
+ }
7608
+ let urlPath = `/api/composition/{composition_id}`;
7609
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7610
+ return {
7611
+ path: urlPath,
7612
+ method: "DELETE",
7613
+ headers: headerParameters,
7614
+ query: queryParameters
7615
+ };
7616
+ }
7617
+ /**
7618
+ * Delete a composition
7619
+ */
7620
+ async deleteCompositionRaw(requestParameters, initOverrides) {
7621
+ const requestOptions = await this.deleteCompositionRequestOpts(requestParameters);
7622
+ const response = await this.request(requestOptions, initOverrides);
7623
+ return new VoidApiResponse2(response);
7624
+ }
7625
+ /**
7626
+ * Delete a composition
7627
+ */
7628
+ async deleteComposition(requestParameters, initOverrides) {
7629
+ await this.deleteCompositionRaw(requestParameters, initOverrides);
7630
+ }
7631
+ /**
7632
+ * Creates request options for reset without sending the request
7633
+ */
7634
+ async resetRequestOpts(requestParameters) {
7635
+ if (requestParameters["compositionId"] == null) {
7636
+ throw new RequiredError2(
7637
+ "compositionId",
7638
+ 'Required parameter "compositionId" was null or undefined when calling reset().'
7639
+ );
7640
+ }
7641
+ const queryParameters = {};
7642
+ const headerParameters = {};
7643
+ if (this.configuration && this.configuration.accessToken) {
7644
+ const token = this.configuration.accessToken;
7645
+ const tokenString = await token("BearerAuth", []);
7646
+ if (tokenString) {
7647
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7648
+ }
7649
+ }
7650
+ let urlPath = `/api/composition/{composition_id}/reset`;
7651
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7652
+ return {
7653
+ path: urlPath,
7654
+ method: "POST",
7655
+ headers: headerParameters,
7656
+ query: queryParameters
7657
+ };
7658
+ }
7659
+ /**
7660
+ * Reset a composition
7661
+ */
7662
+ async resetRaw(requestParameters, initOverrides) {
7663
+ const requestOptions = await this.resetRequestOpts(requestParameters);
7664
+ const response = await this.request(requestOptions, initOverrides);
7665
+ return new JSONApiResponse2(response);
7666
+ }
7667
+ /**
7668
+ * Reset a composition
7669
+ */
7670
+ async reset(requestParameters, initOverrides) {
7671
+ const response = await this.resetRaw(requestParameters, initOverrides);
7672
+ return await response.value();
7673
+ }
7674
+ /**
7675
+ * Creates request options for start without sending the request
7676
+ */
7677
+ async startRequestOpts(requestParameters) {
7678
+ if (requestParameters["compositionId"] == null) {
7679
+ throw new RequiredError2(
7680
+ "compositionId",
7681
+ 'Required parameter "compositionId" was null or undefined when calling start().'
7682
+ );
7683
+ }
7684
+ const queryParameters = {};
7685
+ const headerParameters = {};
7686
+ if (this.configuration && this.configuration.accessToken) {
7687
+ const token = this.configuration.accessToken;
7688
+ const tokenString = await token("BearerAuth", []);
7689
+ if (tokenString) {
7690
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7691
+ }
7692
+ }
7693
+ let urlPath = `/api/composition/{composition_id}/start`;
7694
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7695
+ return {
7696
+ path: urlPath,
7697
+ method: "POST",
7698
+ headers: headerParameters,
7699
+ query: queryParameters
7700
+ };
7701
+ }
7702
+ /**
7703
+ * Start a composition
7704
+ */
7705
+ async startRaw(requestParameters, initOverrides) {
7706
+ const requestOptions = await this.startRequestOpts(requestParameters);
7707
+ const response = await this.request(requestOptions, initOverrides);
7708
+ return new JSONApiResponse2(response);
7709
+ }
7710
+ /**
7711
+ * Start a composition
7712
+ */
7713
+ async start(requestParameters, initOverrides) {
7714
+ const response = await this.startRaw(requestParameters, initOverrides);
7715
+ return await response.value();
7716
+ }
7717
+ };
7718
+ function SendCompositionEventRequestToJSON(json) {
7719
+ return SendCompositionEventRequestToJSONTyped(json, false);
7720
+ }
7721
+ function SendCompositionEventRequestToJSONTyped(value, ignoreDiscriminator = false) {
7722
+ if (value == null) {
7723
+ return value;
7724
+ }
7725
+ return {
7726
+ event_name: value["eventName"],
7727
+ data: value["data"]
7728
+ };
7729
+ }
7730
+ var EventsApi = class extends BaseAPI2 {
7731
+ /**
7732
+ * Creates request options for sendCompositionEvent without sending the request
7733
+ */
7734
+ async sendCompositionEventRequestOpts(requestParameters) {
7735
+ if (requestParameters["compositionId"] == null) {
7736
+ throw new RequiredError2(
7737
+ "compositionId",
7738
+ 'Required parameter "compositionId" was null or undefined when calling sendCompositionEvent().'
7739
+ );
7740
+ }
7741
+ if (requestParameters["sendCompositionEventRequest"] == null) {
7742
+ throw new RequiredError2(
7743
+ "sendCompositionEventRequest",
7744
+ 'Required parameter "sendCompositionEventRequest" was null or undefined when calling sendCompositionEvent().'
7745
+ );
7746
+ }
7747
+ const queryParameters = {};
7748
+ const headerParameters = {};
7749
+ headerParameters["Content-Type"] = "application/json";
7750
+ if (this.configuration && this.configuration.accessToken) {
7751
+ const token = this.configuration.accessToken;
7752
+ const tokenString = await token("BearerAuth", []);
7753
+ if (tokenString) {
7754
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7755
+ }
7756
+ }
7757
+ let urlPath = `/api/composition/{composition_id}/event`;
7758
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7759
+ return {
7760
+ path: urlPath,
7761
+ method: "POST",
7762
+ headers: headerParameters,
7763
+ query: queryParameters,
7764
+ body: SendCompositionEventRequestToJSON(requestParameters["sendCompositionEventRequest"])
7765
+ };
7766
+ }
7767
+ /**
7768
+ * Send an event to templates
7769
+ */
7770
+ async sendCompositionEventRaw(requestParameters, initOverrides) {
7771
+ const requestOptions = await this.sendCompositionEventRequestOpts(requestParameters);
7772
+ const response = await this.request(requestOptions, initOverrides);
7773
+ return new JSONApiResponse2(response);
7774
+ }
7775
+ /**
7776
+ * Send an event to templates
7777
+ */
7778
+ async sendCompositionEvent(requestParameters, initOverrides) {
7779
+ const response = await this.sendCompositionEventRaw(requestParameters, initOverrides);
7780
+ return await response.value();
7781
+ }
7782
+ };
7783
+ function instanceOfMp4Input(value) {
7784
+ if (!("url" in value) || value["url"] === void 0) return false;
7785
+ if (!("type" in value) || value["type"] === void 0) return false;
7786
+ if (value["type"] !== "mp4") return false;
7787
+ return true;
7788
+ }
7789
+ function Mp4InputToJSON(json) {
7790
+ return Mp4InputToJSONTyped(json, false);
7791
+ }
7792
+ function Mp4InputToJSONTyped(value, ignoreDiscriminator = false) {
7793
+ if (value == null) {
7794
+ return value;
7795
+ }
7796
+ return {
7797
+ url: value["url"],
7798
+ loop: value["loop"],
7799
+ type: value["type"]
7800
+ };
7801
+ }
7802
+ function instanceOfRtmpInput(value) {
7803
+ if (!("streamKey" in value) && !("stream_key" in value) || value["streamKey"] === void 0 && value["stream_key"] === void 0)
7804
+ return false;
7805
+ if (!("type" in value) || value["type"] === void 0) return false;
7806
+ if (value["type"] !== "rtmp_server") return false;
7807
+ return true;
7808
+ }
7809
+ function RtmpInputToJSON(json) {
7810
+ return RtmpInputToJSONTyped(json, false);
7811
+ }
7812
+ function RtmpInputToJSONTyped(value, ignoreDiscriminator = false) {
7813
+ if (value == null) {
7814
+ return value;
7815
+ }
7816
+ return {
7817
+ stream_key: value["streamKey"],
7818
+ type: value["type"]
7819
+ };
7820
+ }
7821
+ function instanceOfWhepInput(value) {
7822
+ if (!("endpointUrl" in value) && !("endpoint_url" in value) || value["endpointUrl"] === void 0 && value["endpoint_url"] === void 0)
7823
+ return false;
7824
+ if (!("type" in value) || value["type"] === void 0) return false;
7825
+ if (value["type"] !== "whep_client") return false;
7826
+ return true;
7827
+ }
7828
+ function WhepInputToJSON(json) {
7829
+ return WhepInputToJSONTyped(json, false);
7830
+ }
7831
+ function WhepInputToJSONTyped(value, ignoreDiscriminator = false) {
7832
+ if (value == null) {
7833
+ return value;
7834
+ }
7835
+ return {
7836
+ endpoint_url: value["endpointUrl"],
7837
+ bearer_token: value["bearerToken"],
7838
+ video: value["video"],
7839
+ type: value["type"]
7840
+ };
7841
+ }
7842
+ function instanceOfWhipInput(value) {
7843
+ if (!("type" in value) || value["type"] === void 0) return false;
7844
+ if (value["type"] !== "whip_server") return false;
7845
+ return true;
7846
+ }
7847
+ function WhipInputToJSON(json) {
7848
+ return WhipInputToJSONTyped(json, false);
7849
+ }
7850
+ function WhipInputToJSONTyped(value, ignoreDiscriminator = false) {
7851
+ if (value == null) {
7852
+ return value;
7853
+ }
7854
+ return {
7855
+ bearer_token: value["bearerToken"],
7856
+ video: value["video"],
7857
+ type: value["type"]
7858
+ };
7859
+ }
7860
+ function RegisterInputToJSON(json) {
7861
+ return RegisterInputToJSONTyped(json, false);
7862
+ }
7863
+ function RegisterInputToJSONTyped(value, ignoreDiscriminator = false) {
7864
+ if (value == null) {
7865
+ return value;
7866
+ }
7867
+ if (typeof value !== "object") {
7868
+ return value;
7869
+ }
7870
+ if (instanceOfMp4Input(value)) {
7871
+ return Mp4InputToJSON(value);
7872
+ }
7873
+ if (instanceOfRtmpInput(value)) {
7874
+ return RtmpInputToJSON(value);
7875
+ }
7876
+ if (instanceOfWhepInput(value)) {
7877
+ return WhepInputToJSON(value);
7878
+ }
7879
+ if (instanceOfWhipInput(value)) {
7880
+ return WhipInputToJSON(value);
7881
+ }
7882
+ return {};
7883
+ }
7884
+ function RegisterInputResponseFromJSON(json) {
7885
+ return RegisterInputResponseFromJSONTyped(json, false);
7886
+ }
7887
+ function RegisterInputResponseFromJSONTyped(json, ignoreDiscriminator) {
7888
+ if (json == null) {
7889
+ return json;
7890
+ }
7891
+ return {
7892
+ bearerToken: json["bearer_token"] === void 0 ? void 0 : json["bearer_token"] === null ? null : json["bearer_token"],
7893
+ endpointRoute: json["endpoint_route"] === void 0 ? void 0 : json["endpoint_route"] === null ? null : json["endpoint_route"],
7894
+ videoDurationMs: json["video_duration_ms"] === void 0 ? void 0 : json["video_duration_ms"] === null ? null : json["video_duration_ms"],
7895
+ audioDurationMs: json["audio_duration_ms"] === void 0 ? void 0 : json["audio_duration_ms"] === null ? null : json["audio_duration_ms"],
7896
+ port: json["port"] === void 0 ? void 0 : json["port"] === null ? null : json["port"]
7897
+ };
7898
+ }
7899
+ function UnregisterInputToJSON(json) {
7900
+ return UnregisterInputToJSONTyped(json, false);
7901
+ }
7902
+ function UnregisterInputToJSONTyped(value, ignoreDiscriminator = false) {
7903
+ if (value == null) {
7904
+ return value;
7905
+ }
7906
+ return {
7907
+ schedule_time_ms: value["scheduleTimeMs"]
7908
+ };
7909
+ }
7910
+ var InputsApi = class extends BaseAPI2 {
7911
+ /**
7912
+ * Creates request options for registerInput without sending the request
7913
+ */
7914
+ async registerInputRequestOpts(requestParameters) {
7915
+ if (requestParameters["compositionId"] == null) {
7916
+ throw new RequiredError2(
7917
+ "compositionId",
7918
+ 'Required parameter "compositionId" was null or undefined when calling registerInput().'
7919
+ );
7920
+ }
7921
+ if (requestParameters["inputId"] == null) {
7922
+ throw new RequiredError2(
7923
+ "inputId",
7924
+ 'Required parameter "inputId" was null or undefined when calling registerInput().'
7925
+ );
7926
+ }
7927
+ if (requestParameters["registerInput"] == null) {
7928
+ throw new RequiredError2(
7929
+ "registerInput",
7930
+ 'Required parameter "registerInput" was null or undefined when calling registerInput().'
7931
+ );
7932
+ }
7933
+ const queryParameters = {};
7934
+ const headerParameters = {};
7935
+ headerParameters["Content-Type"] = "application/json";
7936
+ if (this.configuration && this.configuration.accessToken) {
7937
+ const token = this.configuration.accessToken;
7938
+ const tokenString = await token("BearerAuth", []);
7939
+ if (tokenString) {
7940
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7941
+ }
7942
+ }
7943
+ let urlPath = `/api/composition/{composition_id}/input/{input_id}/register`;
7944
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7945
+ urlPath = urlPath.replace("{input_id}", encodeURIComponent(String(requestParameters["inputId"])));
7946
+ return {
7947
+ path: urlPath,
7948
+ method: "POST",
7949
+ headers: headerParameters,
7950
+ query: queryParameters,
7951
+ body: RegisterInputToJSON(requestParameters["registerInput"])
7952
+ };
7953
+ }
7954
+ /**
7955
+ * Register an input
7956
+ */
7957
+ async registerInputRaw(requestParameters, initOverrides) {
7958
+ const requestOptions = await this.registerInputRequestOpts(requestParameters);
7959
+ const response = await this.request(requestOptions, initOverrides);
7960
+ return new JSONApiResponse2(response, (jsonValue) => RegisterInputResponseFromJSON(jsonValue));
7961
+ }
7962
+ /**
7963
+ * Register an input
7964
+ */
7965
+ async registerInput(requestParameters, initOverrides) {
7966
+ const response = await this.registerInputRaw(requestParameters, initOverrides);
7967
+ return await response.value();
7968
+ }
7969
+ /**
7970
+ * Creates request options for unregisterInput without sending the request
7971
+ */
7972
+ async unregisterInputRequestOpts(requestParameters) {
7973
+ if (requestParameters["compositionId"] == null) {
7974
+ throw new RequiredError2(
7975
+ "compositionId",
7976
+ 'Required parameter "compositionId" was null or undefined when calling unregisterInput().'
7977
+ );
7978
+ }
7979
+ if (requestParameters["inputId"] == null) {
7980
+ throw new RequiredError2(
7981
+ "inputId",
7982
+ 'Required parameter "inputId" was null or undefined when calling unregisterInput().'
7983
+ );
7984
+ }
7985
+ if (requestParameters["unregisterInput"] == null) {
7986
+ throw new RequiredError2(
7987
+ "unregisterInput",
7988
+ 'Required parameter "unregisterInput" was null or undefined when calling unregisterInput().'
7989
+ );
7990
+ }
7991
+ const queryParameters = {};
7992
+ const headerParameters = {};
7993
+ headerParameters["Content-Type"] = "application/json";
7994
+ if (this.configuration && this.configuration.accessToken) {
7995
+ const token = this.configuration.accessToken;
7996
+ const tokenString = await token("BearerAuth", []);
7997
+ if (tokenString) {
7998
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7999
+ }
8000
+ }
8001
+ let urlPath = `/api/composition/{composition_id}/input/{input_id}/unregister`;
8002
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8003
+ urlPath = urlPath.replace("{input_id}", encodeURIComponent(String(requestParameters["inputId"])));
8004
+ return {
8005
+ path: urlPath,
8006
+ method: "POST",
8007
+ headers: headerParameters,
8008
+ query: queryParameters,
8009
+ body: UnregisterInputToJSON(requestParameters["unregisterInput"])
8010
+ };
8011
+ }
8012
+ /**
8013
+ * Unregister an input
8014
+ */
8015
+ async unregisterInputRaw(requestParameters, initOverrides) {
8016
+ const requestOptions = await this.unregisterInputRequestOpts(requestParameters);
8017
+ const response = await this.request(requestOptions, initOverrides);
8018
+ return new JSONApiResponse2(response);
8019
+ }
8020
+ /**
8021
+ * Unregister an input
8022
+ */
8023
+ async unregisterInput(requestParameters, initOverrides) {
8024
+ const response = await this.unregisterInputRaw(requestParameters, initOverrides);
8025
+ return await response.value();
8026
+ }
8027
+ };
8028
+ var MediaTransportApi = class extends BaseAPI2 {
8029
+ /**
8030
+ * Creates request options for whepOffer without sending the request
8031
+ */
8032
+ async whepOfferRequestOpts(requestParameters) {
8033
+ if (requestParameters["compositionId"] == null) {
8034
+ throw new RequiredError2(
8035
+ "compositionId",
8036
+ 'Required parameter "compositionId" was null or undefined when calling whepOffer().'
8037
+ );
8038
+ }
8039
+ if (requestParameters["outputId"] == null) {
8040
+ throw new RequiredError2(
8041
+ "outputId",
8042
+ 'Required parameter "outputId" was null or undefined when calling whepOffer().'
8043
+ );
8044
+ }
8045
+ if (requestParameters["body"] == null) {
8046
+ throw new RequiredError2(
8047
+ "body",
8048
+ 'Required parameter "body" was null or undefined when calling whepOffer().'
8049
+ );
8050
+ }
8051
+ const queryParameters = {};
8052
+ const headerParameters = {};
8053
+ headerParameters["Content-Type"] = "application/sdp";
8054
+ if (this.configuration && this.configuration.accessToken) {
8055
+ const token = this.configuration.accessToken;
8056
+ const tokenString = await token("BearerAuth", []);
8057
+ if (tokenString) {
8058
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8059
+ }
8060
+ }
8061
+ let urlPath = `/api/composition/{composition_id}/whep/{output_id}`;
8062
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8063
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8064
+ return {
8065
+ path: urlPath,
8066
+ method: "POST",
8067
+ headers: headerParameters,
8068
+ query: queryParameters,
8069
+ body: requestParameters["body"]
8070
+ };
8071
+ }
8072
+ /**
8073
+ * Play an output over WHEP
8074
+ */
8075
+ async whepOfferRaw(requestParameters, initOverrides) {
8076
+ const requestOptions = await this.whepOfferRequestOpts(requestParameters);
8077
+ const response = await this.request(requestOptions, initOverrides);
8078
+ if (this.isJsonMime(response.headers.get("content-type"))) {
8079
+ return new JSONApiResponse2(response);
8080
+ } else {
8081
+ return new TextApiResponse(response);
8082
+ }
8083
+ }
8084
+ /**
8085
+ * Play an output over WHEP
8086
+ */
8087
+ async whepOffer(requestParameters, initOverrides) {
8088
+ const response = await this.whepOfferRaw(requestParameters, initOverrides);
8089
+ return await response.value();
8090
+ }
8091
+ /**
8092
+ * Creates request options for whipOffer without sending the request
8093
+ */
8094
+ async whipOfferRequestOpts(requestParameters) {
8095
+ if (requestParameters["compositionId"] == null) {
8096
+ throw new RequiredError2(
8097
+ "compositionId",
8098
+ 'Required parameter "compositionId" was null or undefined when calling whipOffer().'
8099
+ );
8100
+ }
8101
+ if (requestParameters["inputId"] == null) {
8102
+ throw new RequiredError2(
8103
+ "inputId",
8104
+ 'Required parameter "inputId" was null or undefined when calling whipOffer().'
8105
+ );
8106
+ }
8107
+ if (requestParameters["body"] == null) {
8108
+ throw new RequiredError2(
8109
+ "body",
8110
+ 'Required parameter "body" was null or undefined when calling whipOffer().'
8111
+ );
8112
+ }
8113
+ const queryParameters = {};
8114
+ const headerParameters = {};
8115
+ headerParameters["Content-Type"] = "application/sdp";
8116
+ if (this.configuration && this.configuration.accessToken) {
8117
+ const token = this.configuration.accessToken;
8118
+ const tokenString = await token("BearerAuth", []);
8119
+ if (tokenString) {
8120
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8121
+ }
8122
+ }
8123
+ let urlPath = `/api/composition/{composition_id}/whip/{input_id}`;
8124
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8125
+ urlPath = urlPath.replace("{input_id}", encodeURIComponent(String(requestParameters["inputId"])));
8126
+ return {
8127
+ path: urlPath,
8128
+ method: "POST",
8129
+ headers: headerParameters,
8130
+ query: queryParameters,
8131
+ body: requestParameters["body"]
8132
+ };
8133
+ }
8134
+ /**
8135
+ * Publish to an input over WHIP
8136
+ */
8137
+ async whipOfferRaw(requestParameters, initOverrides) {
8138
+ const requestOptions = await this.whipOfferRequestOpts(requestParameters);
8139
+ const response = await this.request(requestOptions, initOverrides);
8140
+ if (this.isJsonMime(response.headers.get("content-type"))) {
8141
+ return new JSONApiResponse2(response);
8142
+ } else {
8143
+ return new TextApiResponse(response);
8144
+ }
8145
+ }
8146
+ /**
8147
+ * Publish to an input over WHIP
8148
+ */
8149
+ async whipOffer(requestParameters, initOverrides) {
8150
+ const response = await this.whipOfferRaw(requestParameters, initOverrides);
8151
+ return await response.value();
8152
+ }
8153
+ };
8154
+ function instanceOfImage(value) {
8155
+ if (!("imageId" in value) && !("image_id" in value) || value["imageId"] === void 0 && value["image_id"] === void 0)
8156
+ return false;
8157
+ if (!("type" in value) || value["type"] === void 0) return false;
8158
+ if (value["type"] !== "image") return false;
8159
+ return true;
8160
+ }
8161
+ function ImageToJSON(json) {
8162
+ return ImageToJSONTyped(json, false);
8163
+ }
8164
+ function ImageToJSONTyped(value, ignoreDiscriminator = false) {
8165
+ if (value == null) {
8166
+ return value;
8167
+ }
8168
+ return {
8169
+ id: value["id"],
8170
+ image_id: value["imageId"],
8171
+ width: value["width"],
8172
+ height: value["height"],
8173
+ type: value["type"]
8174
+ };
8175
+ }
8176
+ function instanceOfInputStream(value) {
8177
+ if (!("inputId" in value) && !("input_id" in value) || value["inputId"] === void 0 && value["input_id"] === void 0)
8178
+ return false;
8179
+ if (!("type" in value) || value["type"] === void 0) return false;
8180
+ if (value["type"] !== "input_stream") return false;
8181
+ return true;
8182
+ }
8183
+ function InputStreamToJSON(json) {
8184
+ return InputStreamToJSONTyped(json, false);
8185
+ }
8186
+ function InputStreamToJSONTyped(value, ignoreDiscriminator = false) {
8187
+ if (value == null) {
8188
+ return value;
8189
+ }
8190
+ return {
8191
+ id: value["id"],
8192
+ input_id: value["inputId"],
8193
+ type: value["type"]
8194
+ };
8195
+ }
8196
+ function RescaleModeToJSON(value) {
8197
+ return value;
8198
+ }
8199
+ function VerticalAlignToJSON(value) {
8200
+ return value;
8201
+ }
8202
+ function BoxShadowToJSON(json) {
8203
+ return BoxShadowToJSONTyped(json, false);
8204
+ }
8205
+ function BoxShadowToJSONTyped(value, ignoreDiscriminator = false) {
8206
+ if (value == null) {
8207
+ return value;
8208
+ }
8209
+ return {
8210
+ offset_x: value["offsetX"],
8211
+ offset_y: value["offsetY"],
8212
+ color: value["color"],
8213
+ blur_radius: value["blurRadius"]
8214
+ };
8215
+ }
8216
+ function HorizontalAlignToJSON(value) {
8217
+ return value;
8218
+ }
8219
+ function instanceOfEasingFunctionBounce(value) {
8220
+ if (!("functionName" in value) && !("function_name" in value) || value["functionName"] === void 0 && value["function_name"] === void 0)
8221
+ return false;
8222
+ if (value["functionName"] !== "bounce" && value["function_name"] !== "bounce")
8223
+ return false;
8224
+ return true;
8225
+ }
8226
+ function EasingFunctionBounceToJSON(json) {
8227
+ return EasingFunctionBounceToJSONTyped(json, false);
8228
+ }
8229
+ function EasingFunctionBounceToJSONTyped(value, ignoreDiscriminator = false) {
8230
+ if (value == null) {
8231
+ return value;
8232
+ }
8233
+ return {
8234
+ function_name: value["functionName"]
8235
+ };
8236
+ }
8237
+ function instanceOfEasingFunctionCubicBezier(value) {
8238
+ if (!("points" in value) || value["points"] === void 0) return false;
8239
+ if (!("functionName" in value) && !("function_name" in value) || value["functionName"] === void 0 && value["function_name"] === void 0)
8240
+ return false;
8241
+ if (value["functionName"] !== "cubic_bezier" && value["function_name"] !== "cubic_bezier")
8242
+ return false;
8243
+ return true;
8244
+ }
8245
+ function EasingFunctionCubicBezierToJSON(json) {
8246
+ return EasingFunctionCubicBezierToJSONTyped(json, false);
8247
+ }
8248
+ function EasingFunctionCubicBezierToJSONTyped(value, ignoreDiscriminator = false) {
8249
+ if (value == null) {
8250
+ return value;
8251
+ }
8252
+ return {
8253
+ points: value["points"],
8254
+ function_name: value["functionName"]
8255
+ };
8256
+ }
8257
+ function instanceOfEasingFunctionLinear(value) {
8258
+ if (!("functionName" in value) && !("function_name" in value) || value["functionName"] === void 0 && value["function_name"] === void 0)
8259
+ return false;
8260
+ if (value["functionName"] !== "linear" && value["function_name"] !== "linear")
8261
+ return false;
8262
+ return true;
8263
+ }
8264
+ function EasingFunctionLinearToJSON(json) {
8265
+ return EasingFunctionLinearToJSONTyped(json, false);
8266
+ }
8267
+ function EasingFunctionLinearToJSONTyped(value, ignoreDiscriminator = false) {
8268
+ if (value == null) {
8269
+ return value;
8270
+ }
8271
+ return {
8272
+ function_name: value["functionName"]
8273
+ };
8274
+ }
8275
+ function EasingFunctionToJSON(json) {
8276
+ return EasingFunctionToJSONTyped(json, false);
8277
+ }
8278
+ function EasingFunctionToJSONTyped(value, ignoreDiscriminator = false) {
8279
+ if (value == null) {
8280
+ return value;
8281
+ }
8282
+ if (typeof value !== "object") {
8283
+ return value;
8284
+ }
8285
+ if (instanceOfEasingFunctionBounce(value)) {
8286
+ return EasingFunctionBounceToJSON(value);
8287
+ }
8288
+ if (instanceOfEasingFunctionCubicBezier(value)) {
8289
+ return EasingFunctionCubicBezierToJSON(value);
8290
+ }
8291
+ if (instanceOfEasingFunctionLinear(value)) {
8292
+ return EasingFunctionLinearToJSON(value);
8293
+ }
8294
+ return {};
8295
+ }
8296
+ function TransitionToJSON(json) {
8297
+ return TransitionToJSONTyped(json, false);
8298
+ }
8299
+ function TransitionToJSONTyped(value, ignoreDiscriminator = false) {
8300
+ if (value == null) {
8301
+ return value;
8302
+ }
8303
+ return {
8304
+ duration_ms: value["durationMs"],
8305
+ easing_function: EasingFunctionToJSON(value["easingFunction"]),
8306
+ should_interrupt: value["shouldInterrupt"]
8307
+ };
8308
+ }
8309
+ function instanceOfRescaler(value) {
8310
+ if (!("child" in value) || value["child"] === void 0) return false;
8311
+ if (!("type" in value) || value["type"] === void 0) return false;
8312
+ if (value["type"] !== "rescaler") return false;
8313
+ return true;
8314
+ }
8315
+ function RescalerToJSON(json) {
8316
+ return RescalerToJSONTyped(json, false);
8317
+ }
8318
+ function RescalerToJSONTyped(value, ignoreDiscriminator = false) {
8319
+ if (value == null) {
8320
+ return value;
8321
+ }
8322
+ return {
8323
+ id: value["id"],
8324
+ child: ComponentToJSON(value["child"]),
8325
+ mode: RescaleModeToJSON(value["mode"]),
8326
+ horizontal_align: HorizontalAlignToJSON(value["horizontalAlign"]),
8327
+ vertical_align: VerticalAlignToJSON(value["verticalAlign"]),
8328
+ width: value["width"],
8329
+ height: value["height"],
8330
+ top: value["top"],
8331
+ left: value["left"],
8332
+ bottom: value["bottom"],
8333
+ right: value["right"],
8334
+ rotation: value["rotation"],
8335
+ transition: TransitionToJSON(value["transition"]),
8336
+ border_radius: value["borderRadius"],
8337
+ border_width: value["borderWidth"],
8338
+ border_color: value["borderColor"],
8339
+ box_shadow: value["boxShadow"] == null ? void 0 : value["boxShadow"].map(BoxShadowToJSON),
8340
+ type: value["type"]
8341
+ };
8342
+ }
8343
+ function TextStyleToJSON(value) {
8344
+ return value;
8345
+ }
8346
+ function TextWeightToJSON(value) {
8347
+ return value;
8348
+ }
8349
+ function TextWrapModeToJSON(value) {
8350
+ return value;
8351
+ }
8352
+ function instanceOfText(value) {
8353
+ if (!("text" in value) || value["text"] === void 0) return false;
8354
+ if (!("fontSize" in value) && !("font_size" in value) || value["fontSize"] === void 0 && value["font_size"] === void 0)
8355
+ return false;
8356
+ if (!("type" in value) || value["type"] === void 0) return false;
8357
+ if (value["type"] !== "text") return false;
8358
+ return true;
8359
+ }
8360
+ function TextToJSON(json) {
8361
+ return TextToJSONTyped(json, false);
8362
+ }
8363
+ function TextToJSONTyped(value, ignoreDiscriminator = false) {
8364
+ if (value == null) {
8365
+ return value;
8366
+ }
8367
+ return {
8368
+ id: value["id"],
8369
+ text: value["text"],
8370
+ width: value["width"],
8371
+ height: value["height"],
8372
+ max_width: value["maxWidth"],
8373
+ max_height: value["maxHeight"],
8374
+ font_size: value["fontSize"],
8375
+ line_height: value["lineHeight"],
8376
+ color: value["color"],
8377
+ background_color: value["backgroundColor"],
8378
+ font_family: value["fontFamily"],
8379
+ style: TextStyleToJSON(value["style"]),
8380
+ align: HorizontalAlignToJSON(value["align"]),
8381
+ wrap: TextWrapModeToJSON(value["wrap"]),
8382
+ weight: TextWeightToJSON(value["weight"]),
8383
+ type: value["type"]
8384
+ };
8385
+ }
8386
+ function instanceOfTiles(value) {
8387
+ if (!("type" in value) || value["type"] === void 0) return false;
8388
+ if (value["type"] !== "tiles") return false;
8389
+ return true;
8390
+ }
8391
+ function TilesToJSON(json) {
8392
+ return TilesToJSONTyped(json, false);
8393
+ }
8394
+ function TilesToJSONTyped(value, ignoreDiscriminator = false) {
8395
+ if (value == null) {
8396
+ return value;
8397
+ }
8398
+ return {
8399
+ id: value["id"],
8400
+ children: value["children"] == null ? void 0 : value["children"].map(ComponentToJSON),
8401
+ width: value["width"],
8402
+ height: value["height"],
8403
+ background_color: value["backgroundColor"],
8404
+ tile_aspect_ratio: value["tileAspectRatio"],
8405
+ margin: value["margin"],
8406
+ padding: value["padding"],
8407
+ horizontal_align: HorizontalAlignToJSON(value["horizontalAlign"]),
8408
+ vertical_align: VerticalAlignToJSON(value["verticalAlign"]),
8409
+ transition: TransitionToJSON(value["transition"]),
8410
+ type: value["type"]
8411
+ };
8412
+ }
8413
+ function ViewDirectionToJSON(value) {
8414
+ return value;
8415
+ }
8416
+ function OverflowToJSON(value) {
8417
+ return value;
8418
+ }
8419
+ function instanceOfView(value) {
8420
+ if (!("type" in value) || value["type"] === void 0) return false;
8421
+ if (value["type"] !== "view") return false;
8422
+ return true;
8423
+ }
8424
+ function ViewToJSON(json) {
8425
+ return ViewToJSONTyped(json, false);
8426
+ }
8427
+ function ViewToJSONTyped(value, ignoreDiscriminator = false) {
8428
+ if (value == null) {
8429
+ return value;
8430
+ }
8431
+ return {
8432
+ id: value["id"],
8433
+ children: value["children"] == null ? void 0 : value["children"].map(ComponentToJSON),
8434
+ width: value["width"],
8435
+ height: value["height"],
8436
+ direction: ViewDirectionToJSON(value["direction"]),
8437
+ top: value["top"],
8438
+ left: value["left"],
8439
+ bottom: value["bottom"],
8440
+ right: value["right"],
8441
+ rotation: value["rotation"],
8442
+ transition: TransitionToJSON(value["transition"]),
8443
+ overflow: OverflowToJSON(value["overflow"]),
8444
+ background_color: value["backgroundColor"],
8445
+ border_radius: value["borderRadius"],
8446
+ border_width: value["borderWidth"],
8447
+ border_color: value["borderColor"],
8448
+ box_shadow: value["boxShadow"] == null ? void 0 : value["boxShadow"].map(BoxShadowToJSON),
8449
+ padding: value["padding"],
8450
+ padding_vertical: value["paddingVertical"],
8451
+ padding_horizontal: value["paddingHorizontal"],
8452
+ padding_top: value["paddingTop"],
8453
+ padding_right: value["paddingRight"],
8454
+ padding_bottom: value["paddingBottom"],
8455
+ padding_left: value["paddingLeft"],
8456
+ type: value["type"]
8457
+ };
8458
+ }
8459
+ function ComponentToJSON(json) {
8460
+ return ComponentToJSONTyped4(json, false);
8461
+ }
8462
+ function ComponentToJSONTyped4(value, ignoreDiscriminator = false) {
8463
+ if (value == null) {
8464
+ return value;
8465
+ }
8466
+ if (typeof value !== "object") {
8467
+ return value;
8468
+ }
8469
+ if (instanceOfImage(value)) {
8470
+ return ImageToJSON(value);
8471
+ }
8472
+ if (instanceOfInputStream(value)) {
8473
+ return InputStreamToJSON(value);
8474
+ }
8475
+ if (instanceOfRescaler(value)) {
8476
+ return RescalerToJSON(value);
8477
+ }
8478
+ if (instanceOfText(value)) {
8479
+ return TextToJSON(value);
8480
+ }
8481
+ if (instanceOfTiles(value)) {
8482
+ return TilesToJSON(value);
8483
+ }
8484
+ if (instanceOfView(value)) {
8485
+ return ViewToJSON(value);
8486
+ }
8487
+ return {};
8488
+ }
8489
+ function VideoSceneToJSON(json) {
8490
+ return VideoSceneToJSONTyped(json, false);
8491
+ }
8492
+ function VideoSceneToJSONTyped(value, ignoreDiscriminator = false) {
8493
+ if (value == null) {
8494
+ return value;
8495
+ }
8496
+ return {
8497
+ root: ComponentToJSON(value["root"])
8498
+ };
8499
+ }
8500
+ function OutputEndConditionToJSON(json) {
8501
+ return OutputEndConditionToJSONTyped(json, false);
8502
+ }
8503
+ function OutputEndConditionToJSONTyped(value, ignoreDiscriminator = false) {
8504
+ if (value == null) {
8505
+ return value;
8506
+ }
8507
+ return {
8508
+ any_of: value["anyOf"],
8509
+ all_of: value["allOf"],
8510
+ any_input: value["anyInput"],
8511
+ all_inputs: value["allInputs"]
8512
+ };
8513
+ }
8514
+ function ResolutionToJSON(json) {
8515
+ return ResolutionToJSONTyped(json, false);
8516
+ }
8517
+ function ResolutionToJSONTyped(value, ignoreDiscriminator = false) {
8518
+ if (value == null) {
8519
+ return value;
8520
+ }
8521
+ return {
8522
+ width: value["width"],
8523
+ height: value["height"]
8524
+ };
8525
+ }
8526
+ function OutputRtmpClientVideoOptionsToJSON(json) {
8527
+ return OutputRtmpClientVideoOptionsToJSONTyped(json, false);
8528
+ }
8529
+ function OutputRtmpClientVideoOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8530
+ if (value == null) {
8531
+ return value;
8532
+ }
8533
+ return {
8534
+ resolution: ResolutionToJSON(value["resolution"]),
8535
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8536
+ initial: VideoSceneToJSON(value["initial"])
8537
+ };
8538
+ }
8539
+ function AudioChannelsToJSON(value) {
8540
+ return value;
8541
+ }
8542
+ function AudioMixingStrategyToJSON(value) {
8543
+ return value;
8544
+ }
8545
+ function AudioSceneInputToJSON(json) {
8546
+ return AudioSceneInputToJSONTyped(json, false);
8547
+ }
8548
+ function AudioSceneInputToJSONTyped(value, ignoreDiscriminator = false) {
8549
+ if (value == null) {
8550
+ return value;
8551
+ }
8552
+ return {
8553
+ input_id: value["inputId"],
8554
+ volume: value["volume"]
8555
+ };
8556
+ }
8557
+ function AudioSceneToJSON(json) {
8558
+ return AudioSceneToJSONTyped(json, false);
8559
+ }
8560
+ function AudioSceneToJSONTyped(value, ignoreDiscriminator = false) {
8561
+ if (value == null) {
8562
+ return value;
8563
+ }
8564
+ return {
8565
+ inputs: value["inputs"].map(AudioSceneInputToJSON)
8566
+ };
8567
+ }
8568
+ function OutputRtmpClientAudioOptionsToJSON(json) {
8569
+ return OutputRtmpClientAudioOptionsToJSONTyped(json, false);
8570
+ }
8571
+ function OutputRtmpClientAudioOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8572
+ if (value == null) {
8573
+ return value;
8574
+ }
8575
+ return {
8576
+ mixing_strategy: AudioMixingStrategyToJSON(value["mixingStrategy"]),
8577
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8578
+ channels: AudioChannelsToJSON(value["channels"]),
8579
+ initial: AudioSceneToJSON(value["initial"])
8580
+ };
8581
+ }
8582
+ function instanceOfRtmpOutput(value) {
8583
+ if (!("url" in value) || value["url"] === void 0) return false;
8584
+ if (!("type" in value) || value["type"] === void 0) return false;
8585
+ if (value["type"] !== "rtmp_client") return false;
8586
+ return true;
8587
+ }
8588
+ function RtmpOutputToJSON(json) {
8589
+ return RtmpOutputToJSONTyped(json, false);
8590
+ }
8591
+ function RtmpOutputToJSONTyped(value, ignoreDiscriminator = false) {
8592
+ if (value == null) {
8593
+ return value;
8594
+ }
8595
+ return {
8596
+ url: value["url"],
8597
+ video: OutputRtmpClientVideoOptionsToJSON(value["video"]),
8598
+ audio: OutputRtmpClientAudioOptionsToJSON(value["audio"]),
8599
+ type: value["type"]
8600
+ };
8601
+ }
8602
+ function OutputWhipVideoOptionsToJSON(json) {
8603
+ return OutputWhipVideoOptionsToJSONTyped(json, false);
8604
+ }
8605
+ function OutputWhipVideoOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8606
+ if (value == null) {
8607
+ return value;
8608
+ }
8609
+ return {
8610
+ resolution: ResolutionToJSON(value["resolution"]),
8611
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8612
+ initial: VideoSceneToJSON(value["initial"])
8613
+ };
8614
+ }
8615
+ function instanceOfWhipAudioEncoderOptionsAny(value) {
8616
+ if (!("type" in value) || value["type"] === void 0) return false;
8617
+ if (value["type"] !== "any") return false;
8618
+ return true;
8619
+ }
8620
+ function WhipAudioEncoderOptionsAnyToJSON(json) {
8621
+ return WhipAudioEncoderOptionsAnyToJSONTyped(json, false);
8622
+ }
8623
+ function WhipAudioEncoderOptionsAnyToJSONTyped(value, ignoreDiscriminator = false) {
8624
+ if (value == null) {
8625
+ return value;
8626
+ }
8627
+ return {
8628
+ type: value["type"]
8629
+ };
8630
+ }
8631
+ function OpusEncoderPresetToJSON(value) {
8632
+ return value;
8633
+ }
8634
+ function instanceOfWhipAudioEncoderOptionsOpus(value) {
8635
+ if (!("type" in value) || value["type"] === void 0) return false;
8636
+ if (value["type"] !== "opus") return false;
8637
+ return true;
8638
+ }
8639
+ function WhipAudioEncoderOptionsOpusToJSON(json) {
8640
+ return WhipAudioEncoderOptionsOpusToJSONTyped(json, false);
8641
+ }
8642
+ function WhipAudioEncoderOptionsOpusToJSONTyped(value, ignoreDiscriminator = false) {
8643
+ if (value == null) {
8644
+ return value;
8645
+ }
8646
+ return {
8647
+ preset: OpusEncoderPresetToJSON(value["preset"]),
8648
+ sample_rate: value["sampleRate"],
8649
+ forward_error_correction: value["forwardErrorCorrection"],
8650
+ type: value["type"]
8651
+ };
8652
+ }
8653
+ function WhipAudioEncoderOptionsToJSON(json) {
8654
+ return WhipAudioEncoderOptionsToJSONTyped(json, false);
8655
+ }
8656
+ function WhipAudioEncoderOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8657
+ if (value == null) {
8658
+ return value;
8659
+ }
8660
+ if (typeof value !== "object") {
8661
+ return value;
8662
+ }
8663
+ if (instanceOfWhipAudioEncoderOptionsAny(value)) {
8664
+ return WhipAudioEncoderOptionsAnyToJSON(value);
8665
+ }
8666
+ if (instanceOfWhipAudioEncoderOptionsOpus(value)) {
8667
+ return WhipAudioEncoderOptionsOpusToJSON(value);
8668
+ }
8669
+ return {};
8670
+ }
8671
+ function OutputWhipAudioOptionsToJSON(json) {
8672
+ return OutputWhipAudioOptionsToJSONTyped(json, false);
8673
+ }
8674
+ function OutputWhipAudioOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8675
+ if (value == null) {
8676
+ return value;
8677
+ }
8678
+ return {
8679
+ mixing_strategy: AudioMixingStrategyToJSON(value["mixingStrategy"]),
8680
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8681
+ channels: AudioChannelsToJSON(value["channels"]),
8682
+ encoder_preferences: value["encoderPreferences"] == null ? void 0 : value["encoderPreferences"].map(WhipAudioEncoderOptionsToJSON),
8683
+ initial: AudioSceneToJSON(value["initial"])
8684
+ };
8685
+ }
8686
+ function instanceOfWhipOutput(value) {
8687
+ if (!("endpointUrl" in value) && !("endpoint_url" in value) || value["endpointUrl"] === void 0 && value["endpoint_url"] === void 0)
8688
+ return false;
8689
+ if (!("type" in value) || value["type"] === void 0) return false;
8690
+ if (value["type"] !== "whip_client") return false;
8691
+ return true;
8692
+ }
8693
+ function WhipOutputToJSON(json) {
8694
+ return WhipOutputToJSONTyped(json, false);
8695
+ }
8696
+ function WhipOutputToJSONTyped(value, ignoreDiscriminator = false) {
8697
+ if (value == null) {
8698
+ return value;
8699
+ }
8700
+ return {
8701
+ endpoint_url: value["endpointUrl"],
8702
+ bearer_token: value["bearerToken"],
8703
+ video: OutputWhipVideoOptionsToJSON(value["video"]),
8704
+ audio: OutputWhipAudioOptionsToJSON(value["audio"]),
8705
+ type: value["type"]
8706
+ };
8707
+ }
8708
+ function RegisterOutputToJSON(json) {
8709
+ return RegisterOutputToJSONTyped(json, false);
8710
+ }
8711
+ function RegisterOutputToJSONTyped(value, ignoreDiscriminator = false) {
8712
+ if (value == null) {
8713
+ return value;
8714
+ }
8715
+ if (typeof value !== "object") {
8716
+ return value;
8717
+ }
8718
+ if (instanceOfRtmpOutput(value)) {
8719
+ return RtmpOutputToJSON(value);
8720
+ }
8721
+ if (instanceOfWhipOutput(value)) {
8722
+ return WhipOutputToJSON(value);
8723
+ }
8724
+ return {};
8725
+ }
8726
+ function UnregisterOutputToJSON(json) {
8727
+ return UnregisterOutputToJSONTyped(json, false);
8728
+ }
8729
+ function UnregisterOutputToJSONTyped(value, ignoreDiscriminator = false) {
8730
+ if (value == null) {
8731
+ return value;
8732
+ }
8733
+ return {
8734
+ schedule_time_ms: value["scheduleTimeMs"]
8735
+ };
8736
+ }
8737
+ function UpdateOutputRequestToJSON(json) {
8738
+ return UpdateOutputRequestToJSONTyped(json, false);
8739
+ }
8740
+ function UpdateOutputRequestToJSONTyped(value, ignoreDiscriminator = false) {
8741
+ if (value == null) {
8742
+ return value;
8743
+ }
8744
+ return {
8745
+ video: VideoSceneToJSON(value["video"]),
8746
+ audio: AudioSceneToJSON(value["audio"]),
8747
+ schedule_time_ms: value["scheduleTimeMs"]
8748
+ };
8749
+ }
8750
+ var OutputsApi = class extends BaseAPI2 {
8751
+ /**
8752
+ * Creates request options for registerOutput without sending the request
8753
+ */
8754
+ async registerOutputRequestOpts(requestParameters) {
8755
+ if (requestParameters["compositionId"] == null) {
8756
+ throw new RequiredError2(
8757
+ "compositionId",
8758
+ 'Required parameter "compositionId" was null or undefined when calling registerOutput().'
8759
+ );
8760
+ }
8761
+ if (requestParameters["outputId"] == null) {
8762
+ throw new RequiredError2(
8763
+ "outputId",
8764
+ 'Required parameter "outputId" was null or undefined when calling registerOutput().'
8765
+ );
8766
+ }
8767
+ if (requestParameters["registerOutput"] == null) {
8768
+ throw new RequiredError2(
8769
+ "registerOutput",
8770
+ 'Required parameter "registerOutput" was null or undefined when calling registerOutput().'
8771
+ );
8772
+ }
8773
+ const queryParameters = {};
8774
+ const headerParameters = {};
8775
+ headerParameters["Content-Type"] = "application/json";
8776
+ if (this.configuration && this.configuration.accessToken) {
8777
+ const token = this.configuration.accessToken;
8778
+ const tokenString = await token("BearerAuth", []);
8779
+ if (tokenString) {
8780
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8781
+ }
8782
+ }
8783
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/register`;
8784
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8785
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8786
+ return {
8787
+ path: urlPath,
8788
+ method: "POST",
8789
+ headers: headerParameters,
8790
+ query: queryParameters,
8791
+ body: RegisterOutputToJSON(requestParameters["registerOutput"])
8792
+ };
8793
+ }
8794
+ /**
8795
+ * Register an output
8796
+ */
8797
+ async registerOutputRaw(requestParameters, initOverrides) {
8798
+ const requestOptions = await this.registerOutputRequestOpts(requestParameters);
8799
+ const response = await this.request(requestOptions, initOverrides);
8800
+ return new JSONApiResponse2(response);
8801
+ }
8802
+ /**
8803
+ * Register an output
8804
+ */
8805
+ async registerOutput(requestParameters, initOverrides) {
8806
+ const response = await this.registerOutputRaw(requestParameters, initOverrides);
8807
+ return await response.value();
8808
+ }
8809
+ /**
8810
+ * Creates request options for registerTemplateOutput without sending the request
8811
+ */
8812
+ async registerTemplateOutputRequestOpts(requestParameters) {
8813
+ if (requestParameters["compositionId"] == null) {
8814
+ throw new RequiredError2(
8815
+ "compositionId",
8816
+ 'Required parameter "compositionId" was null or undefined when calling registerTemplateOutput().'
8817
+ );
8818
+ }
8819
+ if (requestParameters["outputId"] == null) {
8820
+ throw new RequiredError2(
8821
+ "outputId",
8822
+ 'Required parameter "outputId" was null or undefined when calling registerTemplateOutput().'
8823
+ );
8824
+ }
8825
+ if (requestParameters["config"] == null) {
8826
+ throw new RequiredError2(
8827
+ "config",
8828
+ 'Required parameter "config" was null or undefined when calling registerTemplateOutput().'
8829
+ );
8830
+ }
8831
+ if (requestParameters["template"] == null) {
8832
+ throw new RequiredError2(
8833
+ "template",
8834
+ 'Required parameter "template" was null or undefined when calling registerTemplateOutput().'
8835
+ );
8836
+ }
8837
+ const queryParameters = {};
8838
+ const headerParameters = {};
8839
+ if (this.configuration && this.configuration.accessToken) {
8840
+ const token = this.configuration.accessToken;
8841
+ const tokenString = await token("BearerAuth", []);
8842
+ if (tokenString) {
8843
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8844
+ }
8845
+ }
8846
+ const consumes = [{ contentType: "multipart/form-data" }];
8847
+ const canConsumeForm2 = canConsumeForm(consumes);
8848
+ let formParams;
8849
+ let useForm = false;
8850
+ useForm = canConsumeForm2;
8851
+ if (useForm) {
8852
+ formParams = new FormData();
8853
+ } else {
8854
+ formParams = new URLSearchParams();
8855
+ }
8856
+ if (requestParameters["config"] != null) {
8857
+ formParams.append(
8858
+ "config",
8859
+ new Blob([JSON.stringify(RegisterOutputToJSON(requestParameters["config"]))], { type: "application/json" })
8860
+ );
8861
+ }
8862
+ if (requestParameters["template"] != null) {
8863
+ formParams.append("template", requestParameters["template"]);
8864
+ }
8865
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/template`;
8866
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8867
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8868
+ return {
8869
+ path: urlPath,
8870
+ method: "POST",
8871
+ headers: headerParameters,
8872
+ query: queryParameters,
8873
+ body: formParams
8874
+ };
8875
+ }
8876
+ /**
8877
+ * Register a templated output
8878
+ */
8879
+ async registerTemplateOutputRaw(requestParameters, initOverrides) {
8880
+ const requestOptions = await this.registerTemplateOutputRequestOpts(requestParameters);
8881
+ const response = await this.request(requestOptions, initOverrides);
8882
+ return new JSONApiResponse2(response);
8883
+ }
8884
+ /**
8885
+ * Register a templated output
8886
+ */
8887
+ async registerTemplateOutput(requestParameters, initOverrides) {
8888
+ const response = await this.registerTemplateOutputRaw(requestParameters, initOverrides);
8889
+ return await response.value();
8890
+ }
8891
+ /**
8892
+ * Creates request options for requestKeyframe without sending the request
8893
+ */
8894
+ async requestKeyframeRequestOpts(requestParameters) {
8895
+ if (requestParameters["compositionId"] == null) {
8896
+ throw new RequiredError2(
8897
+ "compositionId",
8898
+ 'Required parameter "compositionId" was null or undefined when calling requestKeyframe().'
8899
+ );
8900
+ }
8901
+ if (requestParameters["outputId"] == null) {
8902
+ throw new RequiredError2(
8903
+ "outputId",
8904
+ 'Required parameter "outputId" was null or undefined when calling requestKeyframe().'
8905
+ );
8906
+ }
8907
+ const queryParameters = {};
8908
+ const headerParameters = {};
8909
+ if (this.configuration && this.configuration.accessToken) {
8910
+ const token = this.configuration.accessToken;
8911
+ const tokenString = await token("BearerAuth", []);
8912
+ if (tokenString) {
8913
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8914
+ }
8915
+ }
8916
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/request_keyframe`;
8917
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8918
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8919
+ return {
8920
+ path: urlPath,
8921
+ method: "POST",
8922
+ headers: headerParameters,
8923
+ query: queryParameters
8924
+ };
8925
+ }
8926
+ /**
8927
+ * Request a keyframe
8928
+ */
8929
+ async requestKeyframeRaw(requestParameters, initOverrides) {
8930
+ const requestOptions = await this.requestKeyframeRequestOpts(requestParameters);
8931
+ const response = await this.request(requestOptions, initOverrides);
8932
+ return new JSONApiResponse2(response);
8933
+ }
8934
+ /**
8935
+ * Request a keyframe
8936
+ */
8937
+ async requestKeyframe(requestParameters, initOverrides) {
8938
+ const response = await this.requestKeyframeRaw(requestParameters, initOverrides);
8939
+ return await response.value();
8940
+ }
8941
+ /**
8942
+ * Creates request options for unregisterOutput without sending the request
8943
+ */
8944
+ async unregisterOutputRequestOpts(requestParameters) {
8945
+ if (requestParameters["compositionId"] == null) {
8946
+ throw new RequiredError2(
8947
+ "compositionId",
8948
+ 'Required parameter "compositionId" was null or undefined when calling unregisterOutput().'
8949
+ );
8950
+ }
8951
+ if (requestParameters["outputId"] == null) {
8952
+ throw new RequiredError2(
8953
+ "outputId",
8954
+ 'Required parameter "outputId" was null or undefined when calling unregisterOutput().'
8955
+ );
8956
+ }
8957
+ if (requestParameters["unregisterOutput"] == null) {
8958
+ throw new RequiredError2(
8959
+ "unregisterOutput",
8960
+ 'Required parameter "unregisterOutput" was null or undefined when calling unregisterOutput().'
8961
+ );
8962
+ }
8963
+ const queryParameters = {};
8964
+ const headerParameters = {};
8965
+ headerParameters["Content-Type"] = "application/json";
8966
+ if (this.configuration && this.configuration.accessToken) {
8967
+ const token = this.configuration.accessToken;
8968
+ const tokenString = await token("BearerAuth", []);
8969
+ if (tokenString) {
8970
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8971
+ }
8972
+ }
8973
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/unregister`;
8974
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8975
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8976
+ return {
8977
+ path: urlPath,
8978
+ method: "POST",
8979
+ headers: headerParameters,
8980
+ query: queryParameters,
8981
+ body: UnregisterOutputToJSON(requestParameters["unregisterOutput"])
8982
+ };
8983
+ }
8984
+ /**
8985
+ * Unregister an output
8986
+ */
8987
+ async unregisterOutputRaw(requestParameters, initOverrides) {
8988
+ const requestOptions = await this.unregisterOutputRequestOpts(requestParameters);
8989
+ const response = await this.request(requestOptions, initOverrides);
8990
+ return new JSONApiResponse2(response);
8991
+ }
8992
+ /**
8993
+ * Unregister an output
8994
+ */
8995
+ async unregisterOutput(requestParameters, initOverrides) {
8996
+ const response = await this.unregisterOutputRaw(requestParameters, initOverrides);
8997
+ return await response.value();
8998
+ }
8999
+ /**
9000
+ * Creates request options for updateOutput without sending the request
9001
+ */
9002
+ async updateOutputRequestOpts(requestParameters) {
9003
+ if (requestParameters["compositionId"] == null) {
9004
+ throw new RequiredError2(
9005
+ "compositionId",
9006
+ 'Required parameter "compositionId" was null or undefined when calling updateOutput().'
9007
+ );
9008
+ }
9009
+ if (requestParameters["outputId"] == null) {
9010
+ throw new RequiredError2(
9011
+ "outputId",
9012
+ 'Required parameter "outputId" was null or undefined when calling updateOutput().'
9013
+ );
9014
+ }
9015
+ if (requestParameters["updateOutputRequest"] == null) {
9016
+ throw new RequiredError2(
9017
+ "updateOutputRequest",
9018
+ 'Required parameter "updateOutputRequest" was null or undefined when calling updateOutput().'
9019
+ );
9020
+ }
9021
+ const queryParameters = {};
9022
+ const headerParameters = {};
9023
+ headerParameters["Content-Type"] = "application/json";
9024
+ if (this.configuration && this.configuration.accessToken) {
9025
+ const token = this.configuration.accessToken;
9026
+ const tokenString = await token("BearerAuth", []);
9027
+ if (tokenString) {
9028
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9029
+ }
9030
+ }
9031
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/update`;
9032
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9033
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
9034
+ return {
9035
+ path: urlPath,
9036
+ method: "POST",
9037
+ headers: headerParameters,
9038
+ query: queryParameters,
9039
+ body: UpdateOutputRequestToJSON(requestParameters["updateOutputRequest"])
9040
+ };
9041
+ }
9042
+ /**
9043
+ * Update an output\'s scene
9044
+ */
9045
+ async updateOutputRaw(requestParameters, initOverrides) {
9046
+ const requestOptions = await this.updateOutputRequestOpts(requestParameters);
9047
+ const response = await this.request(requestOptions, initOverrides);
9048
+ return new JSONApiResponse2(response);
9049
+ }
9050
+ /**
9051
+ * Update an output\'s scene
9052
+ */
9053
+ async updateOutput(requestParameters, initOverrides) {
9054
+ const response = await this.updateOutputRaw(requestParameters, initOverrides);
9055
+ return await response.value();
9056
+ }
9057
+ };
9058
+ function instanceOfImageSpecAuto(value) {
9059
+ if (!("url" in value) || value["url"] === void 0) return false;
9060
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9061
+ return false;
9062
+ if (value["assetType"] !== "auto" && value["asset_type"] !== "auto")
9063
+ return false;
9064
+ return true;
9065
+ }
9066
+ function ImageSpecAutoToJSON(json) {
9067
+ return ImageSpecAutoToJSONTyped(json, false);
9068
+ }
9069
+ function ImageSpecAutoToJSONTyped(value, ignoreDiscriminator = false) {
9070
+ if (value == null) {
9071
+ return value;
9072
+ }
9073
+ return {
9074
+ url: value["url"],
9075
+ asset_type: value["assetType"]
9076
+ };
9077
+ }
9078
+ function instanceOfImageSpecGif(value) {
9079
+ if (!("url" in value) || value["url"] === void 0) return false;
9080
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9081
+ return false;
9082
+ if (value["assetType"] !== "gif" && value["asset_type"] !== "gif")
9083
+ return false;
9084
+ return true;
9085
+ }
9086
+ function ImageSpecGifToJSON(json) {
9087
+ return ImageSpecGifToJSONTyped(json, false);
9088
+ }
9089
+ function ImageSpecGifToJSONTyped(value, ignoreDiscriminator = false) {
9090
+ if (value == null) {
9091
+ return value;
9092
+ }
9093
+ return {
9094
+ url: value["url"],
9095
+ asset_type: value["assetType"]
9096
+ };
9097
+ }
9098
+ function instanceOfImageSpecJpeg(value) {
9099
+ if (!("url" in value) || value["url"] === void 0) return false;
9100
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9101
+ return false;
9102
+ if (value["assetType"] !== "jpeg" && value["asset_type"] !== "jpeg")
9103
+ return false;
9104
+ return true;
9105
+ }
9106
+ function ImageSpecJpegToJSON(json) {
9107
+ return ImageSpecJpegToJSONTyped(json, false);
9108
+ }
9109
+ function ImageSpecJpegToJSONTyped(value, ignoreDiscriminator = false) {
9110
+ if (value == null) {
9111
+ return value;
9112
+ }
9113
+ return {
9114
+ url: value["url"],
9115
+ asset_type: value["assetType"]
9116
+ };
9117
+ }
9118
+ function instanceOfImageSpecPng(value) {
9119
+ if (!("url" in value) || value["url"] === void 0) return false;
9120
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9121
+ return false;
9122
+ if (value["assetType"] !== "png" && value["asset_type"] !== "png")
9123
+ return false;
9124
+ return true;
9125
+ }
9126
+ function ImageSpecPngToJSON(json) {
9127
+ return ImageSpecPngToJSONTyped(json, false);
9128
+ }
9129
+ function ImageSpecPngToJSONTyped(value, ignoreDiscriminator = false) {
9130
+ if (value == null) {
9131
+ return value;
9132
+ }
9133
+ return {
9134
+ url: value["url"],
9135
+ asset_type: value["assetType"]
9136
+ };
9137
+ }
9138
+ function instanceOfImageSpecSvg(value) {
9139
+ if (!("url" in value) || value["url"] === void 0) return false;
9140
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9141
+ return false;
9142
+ if (value["assetType"] !== "svg" && value["asset_type"] !== "svg")
9143
+ return false;
9144
+ return true;
9145
+ }
9146
+ function ImageSpecSvgToJSON(json) {
9147
+ return ImageSpecSvgToJSONTyped(json, false);
9148
+ }
9149
+ function ImageSpecSvgToJSONTyped(value, ignoreDiscriminator = false) {
9150
+ if (value == null) {
9151
+ return value;
9152
+ }
9153
+ return {
9154
+ url: value["url"],
9155
+ resolution: ResolutionToJSON(value["resolution"]),
9156
+ asset_type: value["assetType"]
9157
+ };
9158
+ }
9159
+ function ImageSpecToJSON(json) {
9160
+ return ImageSpecToJSONTyped(json, false);
9161
+ }
9162
+ function ImageSpecToJSONTyped(value, ignoreDiscriminator = false) {
9163
+ if (value == null) {
9164
+ return value;
9165
+ }
9166
+ if (typeof value !== "object") {
9167
+ return value;
9168
+ }
9169
+ if (instanceOfImageSpecAuto(value)) {
9170
+ return ImageSpecAutoToJSON(value);
9171
+ }
9172
+ if (instanceOfImageSpecGif(value)) {
9173
+ return ImageSpecGifToJSON(value);
9174
+ }
9175
+ if (instanceOfImageSpecJpeg(value)) {
9176
+ return ImageSpecJpegToJSON(value);
9177
+ }
9178
+ if (instanceOfImageSpecPng(value)) {
9179
+ return ImageSpecPngToJSON(value);
9180
+ }
9181
+ if (instanceOfImageSpecSvg(value)) {
9182
+ return ImageSpecSvgToJSON(value);
9183
+ }
9184
+ return {};
9185
+ }
9186
+ function UnregisterRendererToJSON(json) {
9187
+ return UnregisterRendererToJSONTyped(json, false);
9188
+ }
9189
+ function UnregisterRendererToJSONTyped(value, ignoreDiscriminator = false) {
9190
+ if (value == null) {
9191
+ return value;
9192
+ }
9193
+ return {
9194
+ schedule_time_ms: value["scheduleTimeMs"]
9195
+ };
9196
+ }
9197
+ var RenderersApi = class extends BaseAPI2 {
9198
+ /**
9199
+ * Creates request options for registerFont without sending the request
9200
+ */
9201
+ async registerFontRequestOpts(requestParameters) {
9202
+ if (requestParameters["compositionId"] == null) {
9203
+ throw new RequiredError2(
9204
+ "compositionId",
9205
+ 'Required parameter "compositionId" was null or undefined when calling registerFont().'
9206
+ );
9207
+ }
9208
+ if (requestParameters["font"] == null) {
9209
+ throw new RequiredError2(
9210
+ "font",
9211
+ 'Required parameter "font" was null or undefined when calling registerFont().'
9212
+ );
9213
+ }
9214
+ const queryParameters = {};
9215
+ const headerParameters = {};
9216
+ if (this.configuration && this.configuration.accessToken) {
9217
+ const token = this.configuration.accessToken;
9218
+ const tokenString = await token("BearerAuth", []);
9219
+ if (tokenString) {
9220
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9221
+ }
9222
+ }
9223
+ const consumes = [{ contentType: "multipart/form-data" }];
9224
+ const canConsumeForm2 = canConsumeForm(consumes);
9225
+ let formParams;
9226
+ let useForm = false;
9227
+ useForm = canConsumeForm2;
9228
+ if (useForm) {
9229
+ formParams = new FormData();
9230
+ } else {
9231
+ formParams = new URLSearchParams();
9232
+ }
9233
+ if (requestParameters["font"] != null) {
9234
+ formParams.append("font", requestParameters["font"]);
9235
+ }
9236
+ let urlPath = `/api/composition/{composition_id}/font/register`;
9237
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9238
+ return {
9239
+ path: urlPath,
9240
+ method: "POST",
9241
+ headers: headerParameters,
9242
+ query: queryParameters,
9243
+ body: formParams
9244
+ };
9245
+ }
9246
+ /**
9247
+ * Register a font
9248
+ */
9249
+ async registerFontRaw(requestParameters, initOverrides) {
9250
+ const requestOptions = await this.registerFontRequestOpts(requestParameters);
9251
+ const response = await this.request(requestOptions, initOverrides);
9252
+ return new JSONApiResponse2(response);
9253
+ }
9254
+ /**
9255
+ * Register a font
9256
+ */
9257
+ async registerFont(requestParameters, initOverrides) {
9258
+ const response = await this.registerFontRaw(requestParameters, initOverrides);
9259
+ return await response.value();
9260
+ }
9261
+ /**
9262
+ * Creates request options for registerImage without sending the request
9263
+ */
9264
+ async registerImageRequestOpts(requestParameters) {
9265
+ if (requestParameters["compositionId"] == null) {
9266
+ throw new RequiredError2(
9267
+ "compositionId",
9268
+ 'Required parameter "compositionId" was null or undefined when calling registerImage().'
9269
+ );
9270
+ }
9271
+ if (requestParameters["imageId"] == null) {
9272
+ throw new RequiredError2(
9273
+ "imageId",
9274
+ 'Required parameter "imageId" was null or undefined when calling registerImage().'
9275
+ );
9276
+ }
9277
+ if (requestParameters["imageSpec"] == null) {
9278
+ throw new RequiredError2(
9279
+ "imageSpec",
9280
+ 'Required parameter "imageSpec" was null or undefined when calling registerImage().'
9281
+ );
9282
+ }
9283
+ const queryParameters = {};
9284
+ const headerParameters = {};
9285
+ headerParameters["Content-Type"] = "application/json";
9286
+ if (this.configuration && this.configuration.accessToken) {
9287
+ const token = this.configuration.accessToken;
9288
+ const tokenString = await token("BearerAuth", []);
9289
+ if (tokenString) {
9290
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9291
+ }
9292
+ }
9293
+ let urlPath = `/api/composition/{composition_id}/image/{image_id}/register`;
9294
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9295
+ urlPath = urlPath.replace("{image_id}", encodeURIComponent(String(requestParameters["imageId"])));
9296
+ return {
9297
+ path: urlPath,
9298
+ method: "POST",
9299
+ headers: headerParameters,
9300
+ query: queryParameters,
9301
+ body: ImageSpecToJSON(requestParameters["imageSpec"])
9302
+ };
9303
+ }
9304
+ /**
9305
+ * Register an image
9306
+ */
9307
+ async registerImageRaw(requestParameters, initOverrides) {
9308
+ const requestOptions = await this.registerImageRequestOpts(requestParameters);
9309
+ const response = await this.request(requestOptions, initOverrides);
9310
+ return new JSONApiResponse2(response);
9311
+ }
9312
+ /**
9313
+ * Register an image
9314
+ */
9315
+ async registerImage(requestParameters, initOverrides) {
9316
+ const response = await this.registerImageRaw(requestParameters, initOverrides);
9317
+ return await response.value();
9318
+ }
9319
+ /**
9320
+ * Creates request options for unregisterImage without sending the request
9321
+ */
9322
+ async unregisterImageRequestOpts(requestParameters) {
9323
+ if (requestParameters["compositionId"] == null) {
9324
+ throw new RequiredError2(
9325
+ "compositionId",
9326
+ 'Required parameter "compositionId" was null or undefined when calling unregisterImage().'
9327
+ );
9328
+ }
9329
+ if (requestParameters["imageId"] == null) {
9330
+ throw new RequiredError2(
9331
+ "imageId",
9332
+ 'Required parameter "imageId" was null or undefined when calling unregisterImage().'
9333
+ );
9334
+ }
9335
+ if (requestParameters["unregisterRenderer"] == null) {
9336
+ throw new RequiredError2(
9337
+ "unregisterRenderer",
9338
+ 'Required parameter "unregisterRenderer" was null or undefined when calling unregisterImage().'
9339
+ );
9340
+ }
9341
+ const queryParameters = {};
9342
+ const headerParameters = {};
9343
+ headerParameters["Content-Type"] = "application/json";
9344
+ if (this.configuration && this.configuration.accessToken) {
9345
+ const token = this.configuration.accessToken;
9346
+ const tokenString = await token("BearerAuth", []);
9347
+ if (tokenString) {
9348
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9349
+ }
9350
+ }
9351
+ let urlPath = `/api/composition/{composition_id}/image/{image_id}/unregister`;
9352
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9353
+ urlPath = urlPath.replace("{image_id}", encodeURIComponent(String(requestParameters["imageId"])));
9354
+ return {
9355
+ path: urlPath,
9356
+ method: "POST",
9357
+ headers: headerParameters,
9358
+ query: queryParameters,
9359
+ body: UnregisterRendererToJSON(requestParameters["unregisterRenderer"])
9360
+ };
9361
+ }
9362
+ /**
9363
+ * Unregister an image
9364
+ */
9365
+ async unregisterImageRaw(requestParameters, initOverrides) {
9366
+ const requestOptions = await this.unregisterImageRequestOpts(requestParameters);
9367
+ const response = await this.request(requestOptions, initOverrides);
9368
+ return new JSONApiResponse2(response);
9369
+ }
9370
+ /**
9371
+ * Unregister an image
9372
+ */
9373
+ async unregisterImage(requestParameters, initOverrides) {
9374
+ const response = await this.unregisterImageRaw(requestParameters, initOverrides);
9375
+ return await response.value();
9376
+ }
9377
+ };
9378
+
9379
+ // src/exceptions/mapper.ts
9380
+ var notFoundException = (info, entity) => {
9381
+ switch (entity) {
9382
+ case "composition":
9383
+ return new CompositionNotFoundException(info);
9384
+ case "credentials":
9385
+ return new InvalidFishjamCredentialsException(info);
9386
+ case "input":
9387
+ return new InputNotFoundException(info);
9388
+ case "output":
9389
+ return new OutputNotFoundException(info);
9390
+ case "peer":
9391
+ return new PeerNotFoundException(info);
9392
+ case "recording":
9393
+ return new RecordingNotFoundException(info);
9394
+ case "renderer":
9395
+ return new RendererNotFoundException(info);
9396
+ case "room":
9397
+ return new RoomNotFoundException(info);
9398
+ default:
9399
+ return new FishjamNotFoundException(info);
9400
+ }
9401
+ };
9402
+ var mapException = async (error, entity) => {
9403
+ if (error instanceof FetchError || error instanceof FetchError2) {
9404
+ return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message });
9405
+ }
9406
+ if (!(error instanceof ResponseError) && !(error instanceof ResponseError2)) {
9407
+ return error;
9408
+ }
9409
+ const status = error.response.status;
9410
+ const body = await error.response.json().catch(() => ({}));
9411
+ const info = {
9412
+ message: `Request failed with status code ${status}`,
9413
+ statusCode: status,
9414
+ details: body["detail"] ?? body["errors"] ?? body["message"] ?? "Unknown error"
9415
+ };
9416
+ switch (status) {
9417
+ case 400:
9418
+ case 422:
9419
+ return new BadRequestException(info);
9420
+ case 402:
9421
+ return new QuotaExceededException(info);
9422
+ case 401:
9423
+ return new UnauthorizedException(info);
9424
+ case 404:
9425
+ return notFoundException(info, entity);
9426
+ case 503:
9427
+ return new ServiceUnavailableException(info);
9428
+ default:
9429
+ return new UnknownException(info);
9430
+ }
9431
+ };
9432
+
9433
+ // src/client.ts
9434
+ var FishjamClient = class _FishjamClient {
9435
+ moqApi;
9436
+ roomApi;
9437
+ viewerApi;
9438
+ streamerApi;
9439
+ credentialsApi;
9440
+ recordingsApi;
9441
+ trackForwardingsApi;
9442
+ fishjamConfig;
9443
+ deprecationWarningShown = false;
9444
+ /**
9445
+ * Create new instance of Fishjam Client.
9446
+ *
9447
+ * Does not verify credentials against the backend — use
9448
+ * {@link FishjamClient.create} or call
9449
+ * {@link FishjamClient.checkCredentials} afterwards for that.
9450
+ *
9451
+ * Example usage:
9452
+ * ```
9453
+ * const fishjamClient = new FishjamClient({
9454
+ * fishjamId: fastify.config.FISHJAM_ID,
9455
+ * managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
9456
+ * });
9457
+ * ```
9458
+ */
9459
+ constructor(config) {
9460
+ const deprecationMiddleware = {
9461
+ post: async ({ response }) => {
9462
+ this.handleDeprecationHeader(response.headers);
9463
+ return response;
9464
+ }
9465
+ };
9466
+ const apiConfig = new Configuration({
9467
+ basePath: getFishjamUrl(config),
9468
+ headers: {
9469
+ Authorization: `Bearer ${config.managementToken}`,
9470
+ "x-fishjam-api-client": `js-server/${package_default.version}`
9471
+ },
9472
+ middleware: [deprecationMiddleware]
9473
+ });
9474
+ this.moqApi = new MoQApi(apiConfig);
9475
+ this.roomApi = new RoomsApi(apiConfig);
9476
+ this.viewerApi = new ViewersApi(apiConfig);
9477
+ this.streamerApi = new StreamersApi(apiConfig);
9478
+ this.credentialsApi = new CredentialsApi(apiConfig);
9479
+ this.recordingsApi = new RecordingsApi(apiConfig);
9480
+ this.trackForwardingsApi = new TrackForwardingsApi(apiConfig);
9481
+ this.fishjamConfig = config;
9482
+ }
9483
+ /**
9484
+ * Async factory: constructs a client and verifies credentials against
9485
+ * the backend.
9486
+ *
9487
+ * Throws {@link InvalidFishjamCredentialsException} when the
9488
+ * `fishjamId` / `managementToken` pair is rejected by the backend.
9489
+ *
9490
+ * Example:
9491
+ * ```
9492
+ * const client = await FishjamClient.create({
9493
+ * fishjamId: process.env.FISHJAM_ID!,
9494
+ * managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
9495
+ * });
9496
+ * ```
9497
+ */
9498
+ static async create(config) {
9499
+ const client = new _FishjamClient(config);
9500
+ await client.checkCredentials();
9501
+ return client;
9502
+ }
9503
+ /**
9504
+ * Verifies the configured credentials by making a single lightweight
9505
+ * call to the Fishjam backend. Resolves on success, throws
9506
+ * {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
9507
+ * otherwise rethrows the standard mapped exception.
9508
+ */
9509
+ async checkCredentials() {
9510
+ try {
9511
+ await this.credentialsApi.validateCredentials();
9512
+ } catch (error) {
9513
+ throw await mapException(error, "credentials");
9514
+ }
9515
+ }
9516
+ handleDeprecationHeader(headers) {
9517
+ try {
9518
+ const deprecationHeader = headers.get("x-fishjam-api-deprecated");
9519
+ if (!deprecationHeader || this.deprecationWarningShown) return;
6777
9520
  const deprecationStatus = JSON.parse(deprecationHeader);
6778
9521
  if (deprecationStatus.status === "unsupported") {
6779
9522
  console.error(deprecationStatus.message);
@@ -6920,6 +9663,29 @@ var FishjamClient = class _FishjamClient {
6920
9663
  throw await mapException(error, "peer");
6921
9664
  }
6922
9665
  }
9666
+ /**
9667
+ * Forwards every track published in the room into a composition, which composes them into
9668
+ * its outputs. Pass the composition's address, as returned by
9669
+ * {@link CompositionClient.compositionUrl}.
9670
+ */
9671
+ async forwardRoomTracks(roomId, compositionUrl) {
9672
+ try {
9673
+ await this.trackForwardingsApi.createTrackForwarding({
9674
+ roomId,
9675
+ trackForwarding: { compositionURL: compositionUrl }
9676
+ });
9677
+ } catch (error) {
9678
+ throw await mapException(error, "room");
9679
+ }
9680
+ }
9681
+ /**
9682
+ * Where to publish a livestream, paired with a token from
9683
+ * {@link FishjamClient.createLivestreamStreamerToken}. A composition reaches viewers by
9684
+ * sending a WHIP output here.
9685
+ */
9686
+ livestreamWhipUrl() {
9687
+ return getLivestreamWhipUrl(this.fishjamConfig);
9688
+ }
6923
9689
  /**
6924
9690
  * Creates a livestream viewer token for the given room.
6925
9691
  * @returns a livestream viewer token
@@ -6953,24 +9719,342 @@ var FishjamClient = class _FishjamClient {
6953
9719
  throw await mapException(error);
6954
9720
  }
6955
9721
  }
9722
+ /**
9723
+ * Create a new recording. Capturing starts synchronously, so the returned recording is `active`.
9724
+ */
9725
+ async createRecording(config) {
9726
+ try {
9727
+ const { data } = await this.recordingsApi.createRecording({ recordingConfig: config });
9728
+ return data;
9729
+ } catch (error) {
9730
+ throw await mapException(error);
9731
+ }
9732
+ }
9733
+ /**
9734
+ * Get details about a given recording.
9735
+ */
9736
+ async getRecording(recordingId) {
9737
+ try {
9738
+ const { data } = await this.recordingsApi.getRecording({ recordingId });
9739
+ return data;
9740
+ } catch (error) {
9741
+ throw await mapException(error, "recording");
9742
+ }
9743
+ }
9744
+ /**
9745
+ * Get a list of all recordings, optionally filtered by metadata.
9746
+ * Returns recordings whose metadata contains all the given key-value pairs.
9747
+ */
9748
+ async getAllRecordings(metadata) {
9749
+ const metadataQuery = metadata ? Object.fromEntries(Object.entries(metadata).map(([key, value]) => [`metadata[${key}]`, value])) : void 0;
9750
+ try {
9751
+ const { data } = await this.recordingsApi.listRecordings({ metadata: metadataQuery });
9752
+ return data ?? [];
9753
+ } catch (error) {
9754
+ throw await mapException(error);
9755
+ }
9756
+ }
9757
+ /**
9758
+ * Stop an active recording. Finalization is asynchronous: the recording stays `active` until
9759
+ * the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op.
9760
+ */
9761
+ async stopRecording(recordingId) {
9762
+ try {
9763
+ const { data } = await this.recordingsApi.stopRecording({ recordingId });
9764
+ return data;
9765
+ } catch (error) {
9766
+ throw await mapException(error, "recording");
9767
+ }
9768
+ }
9769
+ /**
9770
+ * Delete a recording. Its stored media is removed asynchronously.
9771
+ * A recording that is still `active` cannot be deleted — stop it first or wait for it to finish.
9772
+ */
9773
+ async deleteRecording(recordingId) {
9774
+ try {
9775
+ await this.recordingsApi.deleteRecording({ recordingId });
9776
+ } catch (error) {
9777
+ throw await mapException(error, "recording");
9778
+ }
9779
+ }
9780
+ };
9781
+
9782
+ // src/composition.ts
9783
+ var CompositionClient = class {
9784
+ compositionsApi;
9785
+ eventsApi;
9786
+ inputsApi;
9787
+ mediaTransportApi;
9788
+ outputsApi;
9789
+ renderersApi;
9790
+ baseUrl;
9791
+ constructor(config) {
9792
+ this.baseUrl = getCompositionOrigin(config);
9793
+ const apiConfig = new Configuration2({
9794
+ basePath: this.baseUrl,
9795
+ headers: { Authorization: `Bearer ${config.managementToken}` }
9796
+ });
9797
+ this.compositionsApi = new CompositionsApi(apiConfig);
9798
+ this.eventsApi = new EventsApi(apiConfig);
9799
+ this.inputsApi = new InputsApi(apiConfig);
9800
+ this.mediaTransportApi = new MediaTransportApi(apiConfig);
9801
+ this.outputsApi = new OutputsApi(apiConfig);
9802
+ this.renderersApi = new RenderersApi(apiConfig);
9803
+ }
9804
+ /**
9805
+ * Create a new composition. Inputs registered on it are composed into the scenes its outputs render.
9806
+ */
9807
+ async createComposition(config = {}) {
9808
+ try {
9809
+ return await this.compositionsApi.createComposition({ createCompositionRequest: config });
9810
+ } catch (error) {
9811
+ throw await mapException(error);
9812
+ }
9813
+ }
9814
+ /**
9815
+ * The address of a composition, as other services refer to it. Fishjam needs it to forward a
9816
+ * room's tracks with {@link FishjamClient.forwardRoomTracks}.
9817
+ */
9818
+ compositionUrl(compositionId) {
9819
+ return new URL(`/api/composition/${compositionId}`, this.baseUrl).href;
9820
+ }
9821
+ /**
9822
+ * Start a composition created with `autostart` disabled. Its outputs begin producing audio and video.
9823
+ */
9824
+ async startComposition(compositionId) {
9825
+ try {
9826
+ await this.compositionsApi.start({ compositionId });
9827
+ } catch (error) {
9828
+ throw await mapException(error, "composition");
9829
+ }
9830
+ }
9831
+ /**
9832
+ * Reset a composition, tearing down its scene while keeping the composition itself alive.
9833
+ */
9834
+ async resetComposition(compositionId) {
9835
+ try {
9836
+ await this.compositionsApi.reset({ compositionId });
9837
+ } catch (error) {
9838
+ throw await mapException(error, "composition");
9839
+ }
9840
+ }
9841
+ /**
9842
+ * Delete an existing composition. Its inputs and outputs are torn down with it.
9843
+ */
9844
+ async deleteComposition(compositionId) {
9845
+ try {
9846
+ await this.compositionsApi.deleteComposition({ compositionId });
9847
+ } catch (error) {
9848
+ throw await mapException(error, "composition");
9849
+ }
9850
+ }
9851
+ /**
9852
+ * Register a media source on a composition. Prefer the variant methods, such as
9853
+ * {@link CompositionClient.registerWhipInput}, which return what that input type produces.
9854
+ */
9855
+ async registerInput(compositionId, inputId, input) {
9856
+ try {
9857
+ return await this.inputsApi.registerInput({ compositionId, inputId, registerInput: input });
9858
+ } catch (error) {
9859
+ throw await mapException(error, "composition");
9860
+ }
9861
+ }
9862
+ /**
9863
+ * Register an input that a WHIP publisher pushes media into.
9864
+ * @returns the address and token to publish with, see {@link WhipInputTarget}
9865
+ */
9866
+ async registerWhipInput(compositionId, inputId, options = {}) {
9867
+ const { bearerToken, endpointRoute } = await this.registerInput(compositionId, inputId, {
9868
+ ...options,
9869
+ type: "whip_server"
9870
+ });
9871
+ if (!bearerToken) {
9872
+ throw new UnknownException({
9873
+ message: `Could not obtain a publishing token for input "${inputId}", retry or report it`
9874
+ });
9875
+ }
9876
+ const url = endpointRoute ? `${this.compositionUrl(compositionId)}/${endpointRoute.replace(/^\//, "")}` : await this.whipPath(compositionId, inputId);
9877
+ return { url, bearerToken };
9878
+ }
9879
+ /**
9880
+ * Where WHIP publishing is served, for servers that do not report the route themselves.
9881
+ */
9882
+ async whipPath(compositionId, inputId) {
9883
+ const { path } = await this.mediaTransportApi.whipOfferRequestOpts({ compositionId, inputId, body: "" });
9884
+ return new URL(path, this.baseUrl).href;
9885
+ }
9886
+ /**
9887
+ * Register an input that pulls media from a WHEP endpoint.
9888
+ */
9889
+ async registerWhepInput(compositionId, inputId, options) {
9890
+ await this.registerInput(compositionId, inputId, { ...options, type: "whep_client" });
9891
+ }
9892
+ /**
9893
+ * Register an input that plays an MP4 file.
9894
+ * @returns how much media the file holds, see {@link Mp4InputDurations}
9895
+ */
9896
+ async registerMp4Input(compositionId, inputId, options) {
9897
+ const { videoDurationMs, audioDurationMs } = await this.registerInput(compositionId, inputId, {
9898
+ ...options,
9899
+ type: "mp4"
9900
+ });
9901
+ return { videoDurationMs: videoDurationMs ?? void 0, audioDurationMs: audioDurationMs ?? void 0 };
9902
+ }
9903
+ /**
9904
+ * Register an input that an RTMP publisher pushes media into. The stream key identifies the
9905
+ * input; the address to publish to belongs to the composition, not to this call.
9906
+ */
9907
+ async registerRtmpInput(compositionId, inputId, options) {
9908
+ await this.registerInput(compositionId, inputId, { ...options, type: "rtmp_server" });
9909
+ }
9910
+ /**
9911
+ * Unregister an input. Scenes referencing it stop receiving its media.
9912
+ */
9913
+ async unregisterInput(compositionId, inputId, options = {}) {
9914
+ try {
9915
+ await this.inputsApi.unregisterInput({ compositionId, inputId, unregisterInput: options });
9916
+ } catch (error) {
9917
+ throw await mapException(error, "input");
9918
+ }
9919
+ }
9920
+ /**
9921
+ * Register an output, the destination the composed result is sent to, carrying the scene to render.
9922
+ */
9923
+ async registerOutput(compositionId, outputId, output) {
9924
+ try {
9925
+ await this.outputsApi.registerOutput({ compositionId, outputId, registerOutput: output });
9926
+ } catch (error) {
9927
+ throw await mapException(error, "composition");
9928
+ }
9929
+ }
9930
+ /**
9931
+ * Register an output rendering a template bundle, as built by `@fishjam-cloud/composition-cli`.
9932
+ * The bundle is either a `Blob` or a path to read it from; never pass a path taken from
9933
+ * untrusted input, since its contents are uploaded.
9934
+ */
9935
+ async registerTemplateOutput(compositionId, outputId, config, template) {
9936
+ try {
9937
+ await this.outputsApi.registerTemplateOutput({
9938
+ compositionId,
9939
+ outputId,
9940
+ config,
9941
+ template: await toBlob(template)
9942
+ });
9943
+ } catch (error) {
9944
+ throw await mapException(error, "composition");
9945
+ }
9946
+ }
9947
+ /**
9948
+ * Register an output sending the composed result to a WHIP endpoint.
9949
+ */
9950
+ async registerWhipOutput(compositionId, outputId, options) {
9951
+ await this.registerOutput(compositionId, outputId, { ...options, type: "whip_client" });
9952
+ }
9953
+ /**
9954
+ * Register an output sending the composed result to an RTMP endpoint.
9955
+ */
9956
+ async registerRtmpOutput(compositionId, outputId, options) {
9957
+ await this.registerOutput(compositionId, outputId, { ...options, type: "rtmp_client" });
9958
+ }
9959
+ /**
9960
+ * Unregister an output. It stops producing audio and video.
9961
+ */
9962
+ async unregisterOutput(compositionId, outputId, options = {}) {
9963
+ try {
9964
+ await this.outputsApi.unregisterOutput({ compositionId, outputId, unregisterOutput: options });
9965
+ } catch (error) {
9966
+ throw await mapException(error, "output");
9967
+ }
9968
+ }
9969
+ /**
9970
+ * Replace the scene an output renders.
9971
+ */
9972
+ async updateOutput(compositionId, outputId, update) {
9973
+ try {
9974
+ await this.outputsApi.updateOutput({ compositionId, outputId, updateOutputRequest: update });
9975
+ } catch (error) {
9976
+ throw await mapException(error, "composition");
9977
+ }
9978
+ }
9979
+ /**
9980
+ * Ask an output to emit a keyframe, so a viewer joining mid-stream renders a full picture sooner.
9981
+ */
9982
+ async requestKeyframe(compositionId, outputId) {
9983
+ try {
9984
+ await this.outputsApi.requestKeyframe({ compositionId, outputId });
9985
+ } catch (error) {
9986
+ throw await mapException(error, "composition");
9987
+ }
9988
+ }
9989
+ /**
9990
+ * Register an image that scenes can reference by its renderer ID.
9991
+ */
9992
+ async registerImage(compositionId, imageId, image) {
9993
+ try {
9994
+ await this.renderersApi.registerImage({ compositionId, imageId, imageSpec: image });
9995
+ } catch (error) {
9996
+ throw await mapException(error, "composition");
9997
+ }
9998
+ }
9999
+ /**
10000
+ * Register a font that scenes can render text with. The font is either a `Blob` or a path
10001
+ * to read it from; never pass a path taken from untrusted input, since its contents are uploaded.
10002
+ */
10003
+ async registerFont(compositionId, font) {
10004
+ try {
10005
+ await this.renderersApi.registerFont({ compositionId, font: await toBlob(font) });
10006
+ } catch (error) {
10007
+ throw await mapException(error, "composition");
10008
+ }
10009
+ }
10010
+ /**
10011
+ * Unregister a previously registered image.
10012
+ */
10013
+ async unregisterImage(compositionId, imageId, options = {}) {
10014
+ try {
10015
+ await this.renderersApi.unregisterImage({ compositionId, imageId, unregisterRenderer: options });
10016
+ } catch (error) {
10017
+ throw await mapException(error, "renderer");
10018
+ }
10019
+ }
10020
+ /**
10021
+ * Deliver an event to the templates rendered by the composition's outputs.
10022
+ */
10023
+ async sendEvent(compositionId, event) {
10024
+ try {
10025
+ await this.eventsApi.sendCompositionEvent({ compositionId, sendCompositionEventRequest: event });
10026
+ } catch (error) {
10027
+ throw await mapException(error, "composition");
10028
+ }
10029
+ }
6956
10030
  };
6957
10031
  export {
10032
+ AudioFormat,
10033
+ AudioSampleRate,
6958
10034
  BadRequestException,
10035
+ CompositionClient,
10036
+ CompositionNotFoundException,
6959
10037
  FishjamAgent,
6960
10038
  FishjamBaseException,
6961
10039
  FishjamClient,
6962
10040
  FishjamNotFoundException,
6963
10041
  FishjamWSNotifier,
6964
10042
  ForbiddenException,
10043
+ InputNotFoundException,
6965
10044
  InvalidFishjamCredentialsException,
6966
10045
  MissingFishjamIdException,
10046
+ OutputNotFoundException,
6967
10047
  PeerNotFoundException,
6968
10048
  PeerStatus,
6969
10049
  QuotaExceededException,
10050
+ RecordingNotFoundException,
10051
+ RendererNotFoundException,
6970
10052
  RoomNotFoundException,
6971
10053
  RoomType,
6972
10054
  ServerMessage,
6973
10055
  ServiceUnavailableException,
10056
+ StaleSdkException,
10057
+ SubscribeMode,
6974
10058
  UnauthorizedException,
6975
10059
  UnknownException,
6976
10060
  VideoCodec,