@fishjam-cloud/js-server-sdk 0.21.0 → 0.22.1

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.js CHANGED
@@ -9993,19 +9993,21 @@ var require_dist = __commonJS({
9993
9993
  var tty = require("tty");
9994
9994
  var hasFlag = require_has_flag();
9995
9995
  var { env } = process;
9996
- var forceColor;
9996
+ var flagForceColor;
9997
9997
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
9998
- forceColor = 0;
9998
+ flagForceColor = 0;
9999
9999
  } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
10000
- forceColor = 1;
10000
+ flagForceColor = 1;
10001
10001
  }
10002
- if ("FORCE_COLOR" in env) {
10003
- if (env.FORCE_COLOR === "true") {
10004
- forceColor = 1;
10005
- } else if (env.FORCE_COLOR === "false") {
10006
- forceColor = 0;
10007
- } else {
10008
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
10002
+ function envForceColor() {
10003
+ if ("FORCE_COLOR" in env) {
10004
+ if (env.FORCE_COLOR === "true") {
10005
+ return 1;
10006
+ }
10007
+ if (env.FORCE_COLOR === "false") {
10008
+ return 0;
10009
+ }
10010
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
10009
10011
  }
10010
10012
  }
10011
10013
  function translateLevel(level) {
@@ -10019,15 +10021,22 @@ var require_dist = __commonJS({
10019
10021
  has16m: level >= 3
10020
10022
  };
10021
10023
  }
10022
- function supportsColor(haveStream, streamIsTTY) {
10024
+ function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
10025
+ const noFlagForceColor = envForceColor();
10026
+ if (noFlagForceColor !== void 0) {
10027
+ flagForceColor = noFlagForceColor;
10028
+ }
10029
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
10023
10030
  if (forceColor === 0) {
10024
10031
  return 0;
10025
10032
  }
10026
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
10027
- return 3;
10028
- }
10029
- if (hasFlag("color=256")) {
10030
- return 2;
10033
+ if (sniffFlags) {
10034
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
10035
+ return 3;
10036
+ }
10037
+ if (hasFlag("color=256")) {
10038
+ return 2;
10039
+ }
10031
10040
  }
10032
10041
  if (haveStream && !streamIsTTY && forceColor === void 0) {
10033
10042
  return 0;
@@ -10044,7 +10053,7 @@ var require_dist = __commonJS({
10044
10053
  return 1;
10045
10054
  }
10046
10055
  if ("CI" in env) {
10047
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
10056
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
10048
10057
  return 1;
10049
10058
  }
10050
10059
  return min;
@@ -10056,7 +10065,7 @@ var require_dist = __commonJS({
10056
10065
  return 3;
10057
10066
  }
10058
10067
  if ("TERM_PROGRAM" in env) {
10059
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
10068
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
10060
10069
  switch (env.TERM_PROGRAM) {
10061
10070
  case "iTerm.app":
10062
10071
  return version >= 3 ? 3 : 2;
@@ -10075,14 +10084,17 @@ var require_dist = __commonJS({
10075
10084
  }
10076
10085
  return min;
10077
10086
  }
10078
- function getSupportLevel(stream4) {
10079
- const level = supportsColor(stream4, stream4 && stream4.isTTY);
10087
+ function getSupportLevel(stream4, options = {}) {
10088
+ const level = supportsColor(stream4, {
10089
+ streamIsTTY: stream4 && stream4.isTTY,
10090
+ ...options
10091
+ });
10080
10092
  return translateLevel(level);
10081
10093
  }
10082
10094
  module22.exports = {
10083
10095
  supportsColor: getSupportLevel,
10084
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
10085
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
10096
+ stdout: getSupportLevel({ isTTY: tty.isatty(1) }),
10097
+ stderr: getSupportLevel({ isTTY: tty.isatty(2) })
10086
10098
  };
10087
10099
  }
10088
10100
  });
@@ -10776,6 +10788,10 @@ var require_dist = __commonJS({
10776
10788
  var index_exports2 = {};
10777
10789
  __export2(index_exports2, {
10778
10790
  Configuration: () => Configuration,
10791
+ PeerOptionsAgentOutputAudioFormatEnum: () => PeerOptionsAgentOutputAudioFormatEnum,
10792
+ PeerOptionsAgentOutputAudioSampleRateEnum: () => PeerOptionsAgentOutputAudioSampleRateEnum,
10793
+ PeerOptionsAgentSubscribeModeEnum: () => PeerOptionsAgentSubscribeModeEnum,
10794
+ PeerOptionsWebRTCSubscribeModeEnum: () => PeerOptionsWebRTCSubscribeModeEnum,
10779
10795
  PeerStatus: () => PeerStatus2,
10780
10796
  PeerType: () => PeerType,
10781
10797
  RoomApi: () => RoomApi2,
@@ -10784,19 +10800,22 @@ var require_dist = __commonJS({
10784
10800
  RoomApiFp: () => RoomApiFp,
10785
10801
  RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum2,
10786
10802
  RoomConfigVideoCodecEnum: () => RoomConfigVideoCodecEnum2,
10803
+ StreamApi: () => StreamApi,
10804
+ StreamApiAxiosParamCreator: () => StreamApiAxiosParamCreator,
10805
+ StreamApiFactory: () => StreamApiFactory,
10806
+ StreamApiFp: () => StreamApiFp,
10787
10807
  StreamerApi: () => StreamerApi2,
10788
10808
  StreamerApiAxiosParamCreator: () => StreamerApiAxiosParamCreator,
10789
10809
  StreamerApiFactory: () => StreamerApiFactory,
10790
10810
  StreamerApiFp: () => StreamerApiFp,
10791
- SubscribeOptions1AudioFormatEnum: () => SubscribeOptions1AudioFormatEnum,
10792
- SubscribeOptions1AudioSampleRateEnum: () => SubscribeOptions1AudioSampleRateEnum,
10793
- SubscribeOptionsAudioFormatEnum: () => SubscribeOptionsAudioFormatEnum,
10794
- SubscribeOptionsAudioSampleRateEnum: () => SubscribeOptionsAudioSampleRateEnum,
10811
+ StreamerStatusEnum: () => StreamerStatusEnum,
10812
+ SubscribeMode: () => SubscribeMode,
10795
10813
  TrackTypeEnum: () => TrackTypeEnum,
10796
10814
  ViewerApi: () => ViewerApi2,
10797
10815
  ViewerApiAxiosParamCreator: () => ViewerApiAxiosParamCreator,
10798
10816
  ViewerApiFactory: () => ViewerApiFactory,
10799
- ViewerApiFp: () => ViewerApiFp
10817
+ ViewerApiFp: () => ViewerApiFp,
10818
+ ViewerStatusEnum: () => ViewerStatusEnum
10800
10819
  });
10801
10820
  module2.exports = __toCommonJS2(index_exports2);
10802
10821
  function bind(fn, thisArg) {
@@ -14036,6 +14055,21 @@ var require_dist = __commonJS({
14036
14055
  return axios22.request(axiosRequestArgs);
14037
14056
  };
14038
14057
  };
14058
+ var PeerOptionsAgentSubscribeModeEnum = {
14059
+ Auto: "auto",
14060
+ Manual: "manual"
14061
+ };
14062
+ var PeerOptionsAgentOutputAudioFormatEnum = {
14063
+ Pcm16: "pcm16"
14064
+ };
14065
+ var PeerOptionsAgentOutputAudioSampleRateEnum = {
14066
+ NUMBER_16000: 16e3,
14067
+ NUMBER_24000: 24e3
14068
+ };
14069
+ var PeerOptionsWebRTCSubscribeModeEnum = {
14070
+ Auto: "auto",
14071
+ Manual: "manual"
14072
+ };
14039
14073
  var PeerStatus2 = {
14040
14074
  Connected: "connected",
14041
14075
  Disconnected: "disconnected"
@@ -14049,30 +14083,29 @@ var require_dist = __commonJS({
14049
14083
  AudioOnly: "audio_only",
14050
14084
  Broadcaster: "broadcaster",
14051
14085
  Livestream: "livestream",
14052
- Conference: "conference"
14086
+ Conference: "conference",
14087
+ AudioOnlyLivestream: "audio_only_livestream"
14053
14088
  };
14054
14089
  var RoomConfigVideoCodecEnum2 = {
14055
14090
  H264: "h264",
14056
14091
  Vp8: "vp8"
14057
14092
  };
14058
- var SubscribeOptionsAudioFormatEnum = {
14059
- Pcm16: "pcm16"
14060
- };
14061
- var SubscribeOptionsAudioSampleRateEnum = {
14062
- NUMBER_16000: 16e3,
14063
- NUMBER_24000: 24e3
14064
- };
14065
- var SubscribeOptions1AudioFormatEnum = {
14066
- Pcm16: "pcm16"
14093
+ var StreamerStatusEnum = {
14094
+ Connected: "connected",
14095
+ Disconnected: "disconnected"
14067
14096
  };
14068
- var SubscribeOptions1AudioSampleRateEnum = {
14069
- NUMBER_16000: 16e3,
14070
- NUMBER_24000: 24e3
14097
+ var SubscribeMode = {
14098
+ Auto: "auto",
14099
+ Manual: "manual"
14071
14100
  };
14072
14101
  var TrackTypeEnum = {
14073
14102
  Audio: "audio",
14074
14103
  Video: "video"
14075
14104
  };
14105
+ var ViewerStatusEnum = {
14106
+ Connected: "connected",
14107
+ Disconnected: "disconnected"
14108
+ };
14076
14109
  var RoomApiAxiosParamCreator = function(configuration) {
14077
14110
  return {
14078
14111
  /**
@@ -14269,6 +14302,71 @@ var require_dist = __commonJS({
14269
14302
  url: toPathString(localVarUrlObj),
14270
14303
  options: localVarRequestOptions
14271
14304
  };
14305
+ },
14306
+ /**
14307
+ *
14308
+ * @summary Subscribe peer to another peer\'s tracks
14309
+ * @param {string} roomId Room id
14310
+ * @param {string} id Peer id
14311
+ * @param {string} [peerId] ID of the peer that produces the track
14312
+ * @param {*} [options] Override http request option.
14313
+ * @throws {RequiredError}
14314
+ */
14315
+ subscribePeer: async (roomId, id, peerId, options = {}) => {
14316
+ assertParamExists("subscribePeer", "roomId", roomId);
14317
+ assertParamExists("subscribePeer", "id", id);
14318
+ const localVarPath = `/room/{room_id}/peer/{id}/subscribe_peer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
14319
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14320
+ let baseOptions;
14321
+ if (configuration) {
14322
+ baseOptions = configuration.baseOptions;
14323
+ }
14324
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
14325
+ const localVarHeaderParameter = {};
14326
+ const localVarQueryParameter = {};
14327
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14328
+ if (peerId !== void 0) {
14329
+ localVarQueryParameter["peer_id"] = peerId;
14330
+ }
14331
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
14332
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14333
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14334
+ return {
14335
+ url: toPathString(localVarUrlObj),
14336
+ options: localVarRequestOptions
14337
+ };
14338
+ },
14339
+ /**
14340
+ *
14341
+ * @summary Subscribe peer to specific tracks
14342
+ * @param {string} roomId Room id
14343
+ * @param {string} id Peer id
14344
+ * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
14345
+ * @param {*} [options] Override http request option.
14346
+ * @throws {RequiredError}
14347
+ */
14348
+ subscribeTracks: async (roomId, id, subscribeTracksRequest, options = {}) => {
14349
+ assertParamExists("subscribeTracks", "roomId", roomId);
14350
+ assertParamExists("subscribeTracks", "id", id);
14351
+ const localVarPath = `/room/{room_id}/peer/{id}/subscribe_tracks`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
14352
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14353
+ let baseOptions;
14354
+ if (configuration) {
14355
+ baseOptions = configuration.baseOptions;
14356
+ }
14357
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
14358
+ const localVarHeaderParameter = {};
14359
+ const localVarQueryParameter = {};
14360
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14361
+ localVarHeaderParameter["Content-Type"] = "application/json";
14362
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
14363
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14364
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14365
+ localVarRequestOptions.data = serializeDataIfNeeded(subscribeTracksRequest, localVarRequestOptions, configuration);
14366
+ return {
14367
+ url: toPathString(localVarUrlObj),
14368
+ options: localVarRequestOptions
14369
+ };
14272
14370
  }
14273
14371
  };
14274
14372
  };
@@ -14367,6 +14465,36 @@ var require_dist = __commonJS({
14367
14465
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14368
14466
  const localVarOperationServerBasePath = operationServerMap["RoomApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
14369
14467
  return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14468
+ },
14469
+ /**
14470
+ *
14471
+ * @summary Subscribe peer to another peer\'s tracks
14472
+ * @param {string} roomId Room id
14473
+ * @param {string} id Peer id
14474
+ * @param {string} [peerId] ID of the peer that produces the track
14475
+ * @param {*} [options] Override http request option.
14476
+ * @throws {RequiredError}
14477
+ */
14478
+ async subscribePeer(roomId, id, peerId, options) {
14479
+ const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
14480
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14481
+ const localVarOperationServerBasePath = operationServerMap["RoomApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
14482
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14483
+ },
14484
+ /**
14485
+ *
14486
+ * @summary Subscribe peer to specific tracks
14487
+ * @param {string} roomId Room id
14488
+ * @param {string} id Peer id
14489
+ * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
14490
+ * @param {*} [options] Override http request option.
14491
+ * @throws {RequiredError}
14492
+ */
14493
+ async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
14494
+ const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(roomId, id, subscribeTracksRequest, options);
14495
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14496
+ const localVarOperationServerBasePath = operationServerMap["RoomApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
14497
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14370
14498
  }
14371
14499
  };
14372
14500
  };
@@ -14444,6 +14572,30 @@ var require_dist = __commonJS({
14444
14572
  */
14445
14573
  refreshToken(roomId, id, options) {
14446
14574
  return localVarFp.refreshToken(roomId, id, options).then((request) => request(axios22, basePath));
14575
+ },
14576
+ /**
14577
+ *
14578
+ * @summary Subscribe peer to another peer\'s tracks
14579
+ * @param {string} roomId Room id
14580
+ * @param {string} id Peer id
14581
+ * @param {string} [peerId] ID of the peer that produces the track
14582
+ * @param {*} [options] Override http request option.
14583
+ * @throws {RequiredError}
14584
+ */
14585
+ subscribePeer(roomId, id, peerId, options) {
14586
+ return localVarFp.subscribePeer(roomId, id, peerId, options).then((request) => request(axios22, basePath));
14587
+ },
14588
+ /**
14589
+ *
14590
+ * @summary Subscribe peer to specific tracks
14591
+ * @param {string} roomId Room id
14592
+ * @param {string} id Peer id
14593
+ * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
14594
+ * @param {*} [options] Override http request option.
14595
+ * @throws {RequiredError}
14596
+ */
14597
+ subscribeTracks(roomId, id, subscribeTracksRequest, options) {
14598
+ return localVarFp.subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(axios22, basePath));
14447
14599
  }
14448
14600
  };
14449
14601
  };
@@ -14527,19 +14679,44 @@ var require_dist = __commonJS({
14527
14679
  refreshToken(roomId, id, options) {
14528
14680
  return RoomApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
14529
14681
  }
14682
+ /**
14683
+ *
14684
+ * @summary Subscribe peer to another peer\'s tracks
14685
+ * @param {string} roomId Room id
14686
+ * @param {string} id Peer id
14687
+ * @param {string} [peerId] ID of the peer that produces the track
14688
+ * @param {*} [options] Override http request option.
14689
+ * @throws {RequiredError}
14690
+ * @memberof RoomApi
14691
+ */
14692
+ subscribePeer(roomId, id, peerId, options) {
14693
+ return RoomApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
14694
+ }
14695
+ /**
14696
+ *
14697
+ * @summary Subscribe peer to specific tracks
14698
+ * @param {string} roomId Room id
14699
+ * @param {string} id Peer id
14700
+ * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
14701
+ * @param {*} [options] Override http request option.
14702
+ * @throws {RequiredError}
14703
+ * @memberof RoomApi
14704
+ */
14705
+ subscribeTracks(roomId, id, subscribeTracksRequest, options) {
14706
+ return RoomApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
14707
+ }
14530
14708
  };
14531
- var StreamerApiAxiosParamCreator = function(configuration) {
14709
+ var StreamApiAxiosParamCreator = function(configuration) {
14532
14710
  return {
14533
14711
  /**
14534
14712
  *
14535
- * @summary Generate a token that can be used by a streamer to start streaming
14536
- * @param {string} roomId ID of the stream.
14713
+ * @summary Creates stream
14714
+ * @param {StreamConfig} [streamConfig] Stream configuration
14537
14715
  * @param {*} [options] Override http request option.
14538
14716
  * @throws {RequiredError}
14539
14717
  */
14540
- generateStreamerToken: async (roomId, options = {}) => {
14541
- assertParamExists("generateStreamerToken", "roomId", roomId);
14542
- const localVarPath = `/room/{room_id}/streamer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
14718
+ createStream: async (streamConfig, options = {}) => {
14719
+ const localVarPath = `/livestream`;
14543
14720
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14544
14721
  let baseOptions;
14545
14722
  if (configuration) {
@@ -14548,82 +14725,88 @@ var require_dist = __commonJS({
14548
14725
  const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
14549
14726
  const localVarHeaderParameter = {};
14550
14727
  const localVarQueryParameter = {};
14728
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14729
+ localVarHeaderParameter["Content-Type"] = "application/json";
14551
14730
  setSearchParams(localVarUrlObj, localVarQueryParameter);
14552
14731
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14553
14732
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14733
+ localVarRequestOptions.data = serializeDataIfNeeded(streamConfig, localVarRequestOptions, configuration);
14554
14734
  return {
14555
14735
  url: toPathString(localVarUrlObj),
14556
14736
  options: localVarRequestOptions
14557
14737
  };
14558
- }
14559
- };
14560
- };
14561
- var StreamerApiFp = function(configuration) {
14562
- const localVarAxiosParamCreator = StreamerApiAxiosParamCreator(configuration);
14563
- return {
14738
+ },
14564
14739
  /**
14565
14740
  *
14566
- * @summary Generate a token that can be used by a streamer to start streaming
14567
- * @param {string} roomId ID of the stream.
14741
+ * @summary Deletes stream
14742
+ * @param {string} streamId
14568
14743
  * @param {*} [options] Override http request option.
14569
14744
  * @throws {RequiredError}
14570
14745
  */
14571
- async generateStreamerToken(roomId, options) {
14572
- const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
14573
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14574
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
14575
- return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14576
- }
14577
- };
14578
- };
14579
- var StreamerApiFactory = function(configuration, basePath, axios22) {
14580
- const localVarFp = StreamerApiFp(configuration);
14581
- return {
14746
+ deleteStream: async (streamId, options = {}) => {
14747
+ assertParamExists("deleteStream", "streamId", streamId);
14748
+ const localVarPath = `/livestream/{stream_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
14749
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14750
+ let baseOptions;
14751
+ if (configuration) {
14752
+ baseOptions = configuration.baseOptions;
14753
+ }
14754
+ const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
14755
+ const localVarHeaderParameter = {};
14756
+ const localVarQueryParameter = {};
14757
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14758
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
14759
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14760
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14761
+ return {
14762
+ url: toPathString(localVarUrlObj),
14763
+ options: localVarRequestOptions
14764
+ };
14765
+ },
14582
14766
  /**
14583
14767
  *
14584
- * @summary Generate a token that can be used by a streamer to start streaming
14585
- * @param {string} roomId ID of the stream.
14768
+ * @summary Show information about all streams
14586
14769
  * @param {*} [options] Override http request option.
14587
14770
  * @throws {RequiredError}
14588
14771
  */
14589
- generateStreamerToken(roomId, options) {
14590
- return localVarFp.generateStreamerToken(roomId, options).then((request) => request(axios22, basePath));
14591
- }
14592
- };
14593
- };
14594
- var StreamerApi2 = class extends BaseAPI {
14595
- /**
14596
- *
14597
- * @summary Generate a token that can be used by a streamer to start streaming
14598
- * @param {string} roomId ID of the stream.
14599
- * @param {*} [options] Override http request option.
14600
- * @throws {RequiredError}
14601
- * @memberof StreamerApi
14602
- */
14603
- generateStreamerToken(roomId, options) {
14604
- return StreamerApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
14605
- }
14606
- };
14607
- var ViewerApiAxiosParamCreator = function(configuration) {
14608
- return {
14772
+ getAllStreams: async (options = {}) => {
14773
+ const localVarPath = `/livestream`;
14774
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14775
+ let baseOptions;
14776
+ if (configuration) {
14777
+ baseOptions = configuration.baseOptions;
14778
+ }
14779
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
14780
+ const localVarHeaderParameter = {};
14781
+ const localVarQueryParameter = {};
14782
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14783
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
14784
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14785
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14786
+ return {
14787
+ url: toPathString(localVarUrlObj),
14788
+ options: localVarRequestOptions
14789
+ };
14790
+ },
14609
14791
  /**
14610
14792
  *
14611
- * @summary Generates token that a viewer can use to watch a livestream
14612
- * @param {string} roomId ID of the stream.
14793
+ * @summary Shows information about the stream
14794
+ * @param {string} streamId
14613
14795
  * @param {*} [options] Override http request option.
14614
14796
  * @throws {RequiredError}
14615
14797
  */
14616
- generateViewerToken: async (roomId, options = {}) => {
14617
- assertParamExists("generateViewerToken", "roomId", roomId);
14618
- const localVarPath = `/room/{room_id}/viewer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
14798
+ getStream: async (streamId, options = {}) => {
14799
+ assertParamExists("getStream", "streamId", streamId);
14800
+ const localVarPath = `/livestream/{stream_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
14619
14801
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14620
14802
  let baseOptions;
14621
14803
  if (configuration) {
14622
14804
  baseOptions = configuration.baseOptions;
14623
14805
  }
14624
- const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
14806
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
14625
14807
  const localVarHeaderParameter = {};
14626
14808
  const localVarQueryParameter = {};
14809
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14627
14810
  setSearchParams(localVarUrlObj, localVarQueryParameter);
14628
14811
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14629
14812
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -14634,47 +14817,554 @@ var require_dist = __commonJS({
14634
14817
  }
14635
14818
  };
14636
14819
  };
14637
- var ViewerApiFp = function(configuration) {
14638
- const localVarAxiosParamCreator = ViewerApiAxiosParamCreator(configuration);
14820
+ var StreamApiFp = function(configuration) {
14821
+ const localVarAxiosParamCreator = StreamApiAxiosParamCreator(configuration);
14639
14822
  return {
14640
14823
  /**
14641
14824
  *
14642
- * @summary Generates token that a viewer can use to watch a livestream
14643
- * @param {string} roomId ID of the stream.
14825
+ * @summary Creates stream
14826
+ * @param {StreamConfig} [streamConfig] Stream configuration
14644
14827
  * @param {*} [options] Override http request option.
14645
14828
  * @throws {RequiredError}
14646
14829
  */
14647
- async generateViewerToken(roomId, options) {
14648
- const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
14830
+ async createStream(streamConfig, options) {
14831
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createStream(streamConfig, options);
14649
14832
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14650
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
14833
+ const localVarOperationServerBasePath = operationServerMap["StreamApi.createStream"]?.[localVarOperationServerIndex]?.url;
14651
14834
  return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14652
- }
14653
- };
14654
- };
14655
- var ViewerApiFactory = function(configuration, basePath, axios22) {
14656
- const localVarFp = ViewerApiFp(configuration);
14657
- return {
14835
+ },
14658
14836
  /**
14659
14837
  *
14660
- * @summary Generates token that a viewer can use to watch a livestream
14661
- * @param {string} roomId ID of the stream.
14838
+ * @summary Deletes stream
14839
+ * @param {string} streamId
14662
14840
  * @param {*} [options] Override http request option.
14663
14841
  * @throws {RequiredError}
14664
14842
  */
14665
- generateViewerToken(roomId, options) {
14666
- return localVarFp.generateViewerToken(roomId, options).then((request) => request(axios22, basePath));
14667
- }
14668
- };
14669
- };
14670
- var ViewerApi2 = class extends BaseAPI {
14671
- /**
14672
- *
14673
- * @summary Generates token that a viewer can use to watch a livestream
14674
- * @param {string} roomId ID of the stream.
14675
- * @param {*} [options] Override http request option.
14676
- * @throws {RequiredError}
14677
- * @memberof ViewerApi
14843
+ async deleteStream(streamId, options) {
14844
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStream(streamId, options);
14845
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14846
+ const localVarOperationServerBasePath = operationServerMap["StreamApi.deleteStream"]?.[localVarOperationServerIndex]?.url;
14847
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14848
+ },
14849
+ /**
14850
+ *
14851
+ * @summary Show information about all streams
14852
+ * @param {*} [options] Override http request option.
14853
+ * @throws {RequiredError}
14854
+ */
14855
+ async getAllStreams(options) {
14856
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getAllStreams(options);
14857
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14858
+ const localVarOperationServerBasePath = operationServerMap["StreamApi.getAllStreams"]?.[localVarOperationServerIndex]?.url;
14859
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14860
+ },
14861
+ /**
14862
+ *
14863
+ * @summary Shows information about the stream
14864
+ * @param {string} streamId
14865
+ * @param {*} [options] Override http request option.
14866
+ * @throws {RequiredError}
14867
+ */
14868
+ async getStream(streamId, options) {
14869
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getStream(streamId, options);
14870
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14871
+ const localVarOperationServerBasePath = operationServerMap["StreamApi.getStream"]?.[localVarOperationServerIndex]?.url;
14872
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14873
+ }
14874
+ };
14875
+ };
14876
+ var StreamApiFactory = function(configuration, basePath, axios22) {
14877
+ const localVarFp = StreamApiFp(configuration);
14878
+ return {
14879
+ /**
14880
+ *
14881
+ * @summary Creates stream
14882
+ * @param {StreamConfig} [streamConfig] Stream configuration
14883
+ * @param {*} [options] Override http request option.
14884
+ * @throws {RequiredError}
14885
+ */
14886
+ createStream(streamConfig, options) {
14887
+ return localVarFp.createStream(streamConfig, options).then((request) => request(axios22, basePath));
14888
+ },
14889
+ /**
14890
+ *
14891
+ * @summary Deletes stream
14892
+ * @param {string} streamId
14893
+ * @param {*} [options] Override http request option.
14894
+ * @throws {RequiredError}
14895
+ */
14896
+ deleteStream(streamId, options) {
14897
+ return localVarFp.deleteStream(streamId, options).then((request) => request(axios22, basePath));
14898
+ },
14899
+ /**
14900
+ *
14901
+ * @summary Show information about all streams
14902
+ * @param {*} [options] Override http request option.
14903
+ * @throws {RequiredError}
14904
+ */
14905
+ getAllStreams(options) {
14906
+ return localVarFp.getAllStreams(options).then((request) => request(axios22, basePath));
14907
+ },
14908
+ /**
14909
+ *
14910
+ * @summary Shows information about the stream
14911
+ * @param {string} streamId
14912
+ * @param {*} [options] Override http request option.
14913
+ * @throws {RequiredError}
14914
+ */
14915
+ getStream(streamId, options) {
14916
+ return localVarFp.getStream(streamId, options).then((request) => request(axios22, basePath));
14917
+ }
14918
+ };
14919
+ };
14920
+ var StreamApi = class extends BaseAPI {
14921
+ /**
14922
+ *
14923
+ * @summary Creates stream
14924
+ * @param {StreamConfig} [streamConfig] Stream configuration
14925
+ * @param {*} [options] Override http request option.
14926
+ * @throws {RequiredError}
14927
+ * @memberof StreamApi
14928
+ */
14929
+ createStream(streamConfig, options) {
14930
+ return StreamApiFp(this.configuration).createStream(streamConfig, options).then((request) => request(this.axios, this.basePath));
14931
+ }
14932
+ /**
14933
+ *
14934
+ * @summary Deletes stream
14935
+ * @param {string} streamId
14936
+ * @param {*} [options] Override http request option.
14937
+ * @throws {RequiredError}
14938
+ * @memberof StreamApi
14939
+ */
14940
+ deleteStream(streamId, options) {
14941
+ return StreamApiFp(this.configuration).deleteStream(streamId, options).then((request) => request(this.axios, this.basePath));
14942
+ }
14943
+ /**
14944
+ *
14945
+ * @summary Show information about all streams
14946
+ * @param {*} [options] Override http request option.
14947
+ * @throws {RequiredError}
14948
+ * @memberof StreamApi
14949
+ */
14950
+ getAllStreams(options) {
14951
+ return StreamApiFp(this.configuration).getAllStreams(options).then((request) => request(this.axios, this.basePath));
14952
+ }
14953
+ /**
14954
+ *
14955
+ * @summary Shows information about the stream
14956
+ * @param {string} streamId
14957
+ * @param {*} [options] Override http request option.
14958
+ * @throws {RequiredError}
14959
+ * @memberof StreamApi
14960
+ */
14961
+ getStream(streamId, options) {
14962
+ return StreamApiFp(this.configuration).getStream(streamId, options).then((request) => request(this.axios, this.basePath));
14963
+ }
14964
+ };
14965
+ var StreamerApiAxiosParamCreator = function(configuration) {
14966
+ return {
14967
+ /**
14968
+ *
14969
+ * @summary Creates streamer
14970
+ * @param {string} streamId Stream id
14971
+ * @param {*} [options] Override http request option.
14972
+ * @throws {RequiredError}
14973
+ */
14974
+ createStreamer: async (streamId, options = {}) => {
14975
+ assertParamExists("createStreamer", "streamId", streamId);
14976
+ const localVarPath = `/livestream/{stream_id}/streamer`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
14977
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14978
+ let baseOptions;
14979
+ if (configuration) {
14980
+ baseOptions = configuration.baseOptions;
14981
+ }
14982
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
14983
+ const localVarHeaderParameter = {};
14984
+ const localVarQueryParameter = {};
14985
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
14986
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
14987
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14988
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14989
+ return {
14990
+ url: toPathString(localVarUrlObj),
14991
+ options: localVarRequestOptions
14992
+ };
14993
+ },
14994
+ /**
14995
+ *
14996
+ * @summary Deletes streamer
14997
+ * @param {string} streamId Stream id
14998
+ * @param {string} streamerId Streamer id
14999
+ * @param {*} [options] Override http request option.
15000
+ * @throws {RequiredError}
15001
+ */
15002
+ deleteStreamer: async (streamId, streamerId, options = {}) => {
15003
+ assertParamExists("deleteStreamer", "streamId", streamId);
15004
+ assertParamExists("deleteStreamer", "streamerId", streamerId);
15005
+ const localVarPath = `/livestream/{stream_id}/streamer/{streamer_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))).replace(`{${"streamer_id"}}`, encodeURIComponent(String(streamerId)));
15006
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15007
+ let baseOptions;
15008
+ if (configuration) {
15009
+ baseOptions = configuration.baseOptions;
15010
+ }
15011
+ const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
15012
+ const localVarHeaderParameter = {};
15013
+ const localVarQueryParameter = {};
15014
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
15015
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
15016
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15017
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
15018
+ return {
15019
+ url: toPathString(localVarUrlObj),
15020
+ options: localVarRequestOptions
15021
+ };
15022
+ },
15023
+ /**
15024
+ *
15025
+ * @summary Generate a token that can be used by a streamer to start streaming
15026
+ * @param {string} roomId ID of the stream.
15027
+ * @param {*} [options] Override http request option.
15028
+ * @throws {RequiredError}
15029
+ */
15030
+ generateStreamerToken: async (roomId, options = {}) => {
15031
+ assertParamExists("generateStreamerToken", "roomId", roomId);
15032
+ const localVarPath = `/room/{room_id}/streamer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
15033
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15034
+ let baseOptions;
15035
+ if (configuration) {
15036
+ baseOptions = configuration.baseOptions;
15037
+ }
15038
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
15039
+ const localVarHeaderParameter = {};
15040
+ const localVarQueryParameter = {};
15041
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
15042
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
15043
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15044
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
15045
+ return {
15046
+ url: toPathString(localVarUrlObj),
15047
+ options: localVarRequestOptions
15048
+ };
15049
+ }
15050
+ };
15051
+ };
15052
+ var StreamerApiFp = function(configuration) {
15053
+ const localVarAxiosParamCreator = StreamerApiAxiosParamCreator(configuration);
15054
+ return {
15055
+ /**
15056
+ *
15057
+ * @summary Creates streamer
15058
+ * @param {string} streamId Stream id
15059
+ * @param {*} [options] Override http request option.
15060
+ * @throws {RequiredError}
15061
+ */
15062
+ async createStreamer(streamId, options) {
15063
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
15064
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15065
+ const localVarOperationServerBasePath = operationServerMap["StreamerApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
15066
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15067
+ },
15068
+ /**
15069
+ *
15070
+ * @summary Deletes streamer
15071
+ * @param {string} streamId Stream id
15072
+ * @param {string} streamerId Streamer id
15073
+ * @param {*} [options] Override http request option.
15074
+ * @throws {RequiredError}
15075
+ */
15076
+ async deleteStreamer(streamId, streamerId, options) {
15077
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
15078
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15079
+ const localVarOperationServerBasePath = operationServerMap["StreamerApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
15080
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15081
+ },
15082
+ /**
15083
+ *
15084
+ * @summary Generate a token that can be used by a streamer to start streaming
15085
+ * @param {string} roomId ID of the stream.
15086
+ * @param {*} [options] Override http request option.
15087
+ * @throws {RequiredError}
15088
+ */
15089
+ async generateStreamerToken(roomId, options) {
15090
+ const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
15091
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15092
+ const localVarOperationServerBasePath = operationServerMap["StreamerApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
15093
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15094
+ }
15095
+ };
15096
+ };
15097
+ var StreamerApiFactory = function(configuration, basePath, axios22) {
15098
+ const localVarFp = StreamerApiFp(configuration);
15099
+ return {
15100
+ /**
15101
+ *
15102
+ * @summary Creates streamer
15103
+ * @param {string} streamId Stream id
15104
+ * @param {*} [options] Override http request option.
15105
+ * @throws {RequiredError}
15106
+ */
15107
+ createStreamer(streamId, options) {
15108
+ return localVarFp.createStreamer(streamId, options).then((request) => request(axios22, basePath));
15109
+ },
15110
+ /**
15111
+ *
15112
+ * @summary Deletes streamer
15113
+ * @param {string} streamId Stream id
15114
+ * @param {string} streamerId Streamer id
15115
+ * @param {*} [options] Override http request option.
15116
+ * @throws {RequiredError}
15117
+ */
15118
+ deleteStreamer(streamId, streamerId, options) {
15119
+ return localVarFp.deleteStreamer(streamId, streamerId, options).then((request) => request(axios22, basePath));
15120
+ },
15121
+ /**
15122
+ *
15123
+ * @summary Generate a token that can be used by a streamer to start streaming
15124
+ * @param {string} roomId ID of the stream.
15125
+ * @param {*} [options] Override http request option.
15126
+ * @throws {RequiredError}
15127
+ */
15128
+ generateStreamerToken(roomId, options) {
15129
+ return localVarFp.generateStreamerToken(roomId, options).then((request) => request(axios22, basePath));
15130
+ }
15131
+ };
15132
+ };
15133
+ var StreamerApi2 = class extends BaseAPI {
15134
+ /**
15135
+ *
15136
+ * @summary Creates streamer
15137
+ * @param {string} streamId Stream id
15138
+ * @param {*} [options] Override http request option.
15139
+ * @throws {RequiredError}
15140
+ * @memberof StreamerApi
15141
+ */
15142
+ createStreamer(streamId, options) {
15143
+ return StreamerApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
15144
+ }
15145
+ /**
15146
+ *
15147
+ * @summary Deletes streamer
15148
+ * @param {string} streamId Stream id
15149
+ * @param {string} streamerId Streamer id
15150
+ * @param {*} [options] Override http request option.
15151
+ * @throws {RequiredError}
15152
+ * @memberof StreamerApi
15153
+ */
15154
+ deleteStreamer(streamId, streamerId, options) {
15155
+ return StreamerApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
15156
+ }
15157
+ /**
15158
+ *
15159
+ * @summary Generate a token that can be used by a streamer to start streaming
15160
+ * @param {string} roomId ID of the stream.
15161
+ * @param {*} [options] Override http request option.
15162
+ * @throws {RequiredError}
15163
+ * @memberof StreamerApi
15164
+ */
15165
+ generateStreamerToken(roomId, options) {
15166
+ return StreamerApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
15167
+ }
15168
+ };
15169
+ var ViewerApiAxiosParamCreator = function(configuration) {
15170
+ return {
15171
+ /**
15172
+ *
15173
+ * @summary Creates viewer
15174
+ * @param {string} streamId Stream id
15175
+ * @param {*} [options] Override http request option.
15176
+ * @throws {RequiredError}
15177
+ */
15178
+ createViewer: async (streamId, options = {}) => {
15179
+ assertParamExists("createViewer", "streamId", streamId);
15180
+ const localVarPath = `/livestream/{stream_id}/viewer`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
15181
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15182
+ let baseOptions;
15183
+ if (configuration) {
15184
+ baseOptions = configuration.baseOptions;
15185
+ }
15186
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
15187
+ const localVarHeaderParameter = {};
15188
+ const localVarQueryParameter = {};
15189
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
15190
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
15191
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15192
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
15193
+ return {
15194
+ url: toPathString(localVarUrlObj),
15195
+ options: localVarRequestOptions
15196
+ };
15197
+ },
15198
+ /**
15199
+ *
15200
+ * @summary Deletes viewer
15201
+ * @param {string} streamId Stream id
15202
+ * @param {string} viewerId Viewer id
15203
+ * @param {*} [options] Override http request option.
15204
+ * @throws {RequiredError}
15205
+ */
15206
+ deleteViewer: async (streamId, viewerId, options = {}) => {
15207
+ assertParamExists("deleteViewer", "streamId", streamId);
15208
+ assertParamExists("deleteViewer", "viewerId", viewerId);
15209
+ const localVarPath = `/livestream/{stream_id}/viewer/{viewer_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))).replace(`{${"viewer_id"}}`, encodeURIComponent(String(viewerId)));
15210
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15211
+ let baseOptions;
15212
+ if (configuration) {
15213
+ baseOptions = configuration.baseOptions;
15214
+ }
15215
+ const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
15216
+ const localVarHeaderParameter = {};
15217
+ const localVarQueryParameter = {};
15218
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
15219
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
15220
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15221
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
15222
+ return {
15223
+ url: toPathString(localVarUrlObj),
15224
+ options: localVarRequestOptions
15225
+ };
15226
+ },
15227
+ /**
15228
+ *
15229
+ * @summary Generates token that a viewer can use to watch a livestream
15230
+ * @param {string} roomId ID of the stream.
15231
+ * @param {*} [options] Override http request option.
15232
+ * @throws {RequiredError}
15233
+ */
15234
+ generateViewerToken: async (roomId, options = {}) => {
15235
+ assertParamExists("generateViewerToken", "roomId", roomId);
15236
+ const localVarPath = `/room/{room_id}/viewer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
15237
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15238
+ let baseOptions;
15239
+ if (configuration) {
15240
+ baseOptions = configuration.baseOptions;
15241
+ }
15242
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
15243
+ const localVarHeaderParameter = {};
15244
+ const localVarQueryParameter = {};
15245
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
15246
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
15247
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15248
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
15249
+ return {
15250
+ url: toPathString(localVarUrlObj),
15251
+ options: localVarRequestOptions
15252
+ };
15253
+ }
15254
+ };
15255
+ };
15256
+ var ViewerApiFp = function(configuration) {
15257
+ const localVarAxiosParamCreator = ViewerApiAxiosParamCreator(configuration);
15258
+ return {
15259
+ /**
15260
+ *
15261
+ * @summary Creates viewer
15262
+ * @param {string} streamId Stream id
15263
+ * @param {*} [options] Override http request option.
15264
+ * @throws {RequiredError}
15265
+ */
15266
+ async createViewer(streamId, options) {
15267
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
15268
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15269
+ const localVarOperationServerBasePath = operationServerMap["ViewerApi.createViewer"]?.[localVarOperationServerIndex]?.url;
15270
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15271
+ },
15272
+ /**
15273
+ *
15274
+ * @summary Deletes viewer
15275
+ * @param {string} streamId Stream id
15276
+ * @param {string} viewerId Viewer id
15277
+ * @param {*} [options] Override http request option.
15278
+ * @throws {RequiredError}
15279
+ */
15280
+ async deleteViewer(streamId, viewerId, options) {
15281
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
15282
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15283
+ const localVarOperationServerBasePath = operationServerMap["ViewerApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
15284
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15285
+ },
15286
+ /**
15287
+ *
15288
+ * @summary Generates token that a viewer can use to watch a livestream
15289
+ * @param {string} roomId ID of the stream.
15290
+ * @param {*} [options] Override http request option.
15291
+ * @throws {RequiredError}
15292
+ */
15293
+ async generateViewerToken(roomId, options) {
15294
+ const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
15295
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15296
+ const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
15297
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15298
+ }
15299
+ };
15300
+ };
15301
+ var ViewerApiFactory = function(configuration, basePath, axios22) {
15302
+ const localVarFp = ViewerApiFp(configuration);
15303
+ return {
15304
+ /**
15305
+ *
15306
+ * @summary Creates viewer
15307
+ * @param {string} streamId Stream id
15308
+ * @param {*} [options] Override http request option.
15309
+ * @throws {RequiredError}
15310
+ */
15311
+ createViewer(streamId, options) {
15312
+ return localVarFp.createViewer(streamId, options).then((request) => request(axios22, basePath));
15313
+ },
15314
+ /**
15315
+ *
15316
+ * @summary Deletes viewer
15317
+ * @param {string} streamId Stream id
15318
+ * @param {string} viewerId Viewer id
15319
+ * @param {*} [options] Override http request option.
15320
+ * @throws {RequiredError}
15321
+ */
15322
+ deleteViewer(streamId, viewerId, options) {
15323
+ return localVarFp.deleteViewer(streamId, viewerId, options).then((request) => request(axios22, basePath));
15324
+ },
15325
+ /**
15326
+ *
15327
+ * @summary Generates token that a viewer can use to watch a livestream
15328
+ * @param {string} roomId ID of the stream.
15329
+ * @param {*} [options] Override http request option.
15330
+ * @throws {RequiredError}
15331
+ */
15332
+ generateViewerToken(roomId, options) {
15333
+ return localVarFp.generateViewerToken(roomId, options).then((request) => request(axios22, basePath));
15334
+ }
15335
+ };
15336
+ };
15337
+ var ViewerApi2 = class extends BaseAPI {
15338
+ /**
15339
+ *
15340
+ * @summary Creates viewer
15341
+ * @param {string} streamId Stream id
15342
+ * @param {*} [options] Override http request option.
15343
+ * @throws {RequiredError}
15344
+ * @memberof ViewerApi
15345
+ */
15346
+ createViewer(streamId, options) {
15347
+ return ViewerApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
15348
+ }
15349
+ /**
15350
+ *
15351
+ * @summary Deletes viewer
15352
+ * @param {string} streamId Stream id
15353
+ * @param {string} viewerId Viewer id
15354
+ * @param {*} [options] Override http request option.
15355
+ * @throws {RequiredError}
15356
+ * @memberof ViewerApi
15357
+ */
15358
+ deleteViewer(streamId, viewerId, options) {
15359
+ return ViewerApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
15360
+ }
15361
+ /**
15362
+ *
15363
+ * @summary Generates token that a viewer can use to watch a livestream
15364
+ * @param {string} roomId ID of the stream.
15365
+ * @param {*} [options] Override http request option.
15366
+ * @throws {RequiredError}
15367
+ * @memberof ViewerApi
14678
15368
  */
14679
15369
  generateViewerToken(roomId, options) {
14680
15370
  return ViewerApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
@@ -14792,6 +15482,7 @@ var require_dist2 = __commonJS({
14792
15482
  AgentRequest_AddTrack: () => AgentRequest_AddTrack,
14793
15483
  AgentRequest_AddTrack_CodecParameters: () => AgentRequest_AddTrack_CodecParameters,
14794
15484
  AgentRequest_AuthRequest: () => AgentRequest_AuthRequest,
15485
+ AgentRequest_InterruptTrack: () => AgentRequest_InterruptTrack,
14795
15486
  AgentRequest_RemoveTrack: () => AgentRequest_RemoveTrack,
14796
15487
  AgentRequest_TrackData: () => AgentRequest_TrackData2,
14797
15488
  AgentResponse: () => AgentResponse2,
@@ -14817,6 +15508,8 @@ var require_dist2 = __commonJS({
14817
15508
  ServerMessage_RoomDeleted: () => ServerMessage_RoomDeleted,
14818
15509
  ServerMessage_StreamConnected: () => ServerMessage_StreamConnected,
14819
15510
  ServerMessage_StreamDisconnected: () => ServerMessage_StreamDisconnected,
15511
+ ServerMessage_StreamerConnected: () => ServerMessage_StreamerConnected,
15512
+ ServerMessage_StreamerDisconnected: () => ServerMessage_StreamerDisconnected,
14820
15513
  ServerMessage_SubscribeRequest: () => ServerMessage_SubscribeRequest,
14821
15514
  ServerMessage_SubscribeResponse: () => ServerMessage_SubscribeResponse,
14822
15515
  ServerMessage_TrackAdded: () => ServerMessage_TrackAdded,
@@ -15799,7 +16492,9 @@ var require_dist2 = __commonJS({
15799
16492
  streamConnected: void 0,
15800
16493
  streamDisconnected: void 0,
15801
16494
  viewerConnected: void 0,
15802
- viewerDisconnected: void 0
16495
+ viewerDisconnected: void 0,
16496
+ streamerConnected: void 0,
16497
+ streamerDisconnected: void 0
15803
16498
  };
15804
16499
  }
15805
16500
  var ServerMessage3 = {
@@ -15876,6 +16571,12 @@ var require_dist2 = __commonJS({
15876
16571
  if (message.viewerDisconnected !== void 0) {
15877
16572
  ServerMessage_ViewerDisconnected.encode(message.viewerDisconnected, writer.uint32(202).fork()).join();
15878
16573
  }
16574
+ if (message.streamerConnected !== void 0) {
16575
+ ServerMessage_StreamerConnected.encode(message.streamerConnected, writer.uint32(210).fork()).join();
16576
+ }
16577
+ if (message.streamerDisconnected !== void 0) {
16578
+ ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
16579
+ }
15879
16580
  return writer;
15880
16581
  },
15881
16582
  decode(input, length) {
@@ -16053,6 +16754,20 @@ var require_dist2 = __commonJS({
16053
16754
  message.viewerDisconnected = ServerMessage_ViewerDisconnected.decode(reader, reader.uint32());
16054
16755
  continue;
16055
16756
  }
16757
+ case 26: {
16758
+ if (tag !== 210) {
16759
+ break;
16760
+ }
16761
+ message.streamerConnected = ServerMessage_StreamerConnected.decode(reader, reader.uint32());
16762
+ continue;
16763
+ }
16764
+ case 27: {
16765
+ if (tag !== 218) {
16766
+ break;
16767
+ }
16768
+ message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
16769
+ continue;
16770
+ }
16056
16771
  }
16057
16772
  if ((tag & 7) === 4 || tag === 0) {
16058
16773
  break;
@@ -16086,7 +16801,9 @@ var require_dist2 = __commonJS({
16086
16801
  streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
16087
16802
  streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
16088
16803
  viewerConnected: isSet2(object.viewerConnected) ? ServerMessage_ViewerConnected.fromJSON(object.viewerConnected) : void 0,
16089
- viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0
16804
+ viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
16805
+ streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
16806
+ streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0
16090
16807
  };
16091
16808
  },
16092
16809
  toJSON(message) {
@@ -16163,6 +16880,12 @@ var require_dist2 = __commonJS({
16163
16880
  if (message.viewerDisconnected !== void 0) {
16164
16881
  obj.viewerDisconnected = ServerMessage_ViewerDisconnected.toJSON(message.viewerDisconnected);
16165
16882
  }
16883
+ if (message.streamerConnected !== void 0) {
16884
+ obj.streamerConnected = ServerMessage_StreamerConnected.toJSON(message.streamerConnected);
16885
+ }
16886
+ if (message.streamerDisconnected !== void 0) {
16887
+ obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
16888
+ }
16166
16889
  return obj;
16167
16890
  },
16168
16891
  create(base) {
@@ -16194,6 +16917,8 @@ var require_dist2 = __commonJS({
16194
16917
  message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
16195
16918
  message.viewerConnected = object.viewerConnected !== void 0 && object.viewerConnected !== null ? ServerMessage_ViewerConnected.fromPartial(object.viewerConnected) : void 0;
16196
16919
  message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
16920
+ message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
16921
+ message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
16197
16922
  return message;
16198
16923
  }
16199
16924
  };
@@ -17838,12 +18563,154 @@ var require_dist2 = __commonJS({
17838
18563
  return message;
17839
18564
  }
17840
18565
  };
18566
+ function createBaseServerMessage_StreamerConnected() {
18567
+ return { streamId: "", streamerId: "" };
18568
+ }
18569
+ var ServerMessage_StreamerConnected = {
18570
+ encode(message, writer = new BinaryWriter()) {
18571
+ if (message.streamId !== "") {
18572
+ writer.uint32(10).string(message.streamId);
18573
+ }
18574
+ if (message.streamerId !== "") {
18575
+ writer.uint32(18).string(message.streamerId);
18576
+ }
18577
+ return writer;
18578
+ },
18579
+ decode(input, length) {
18580
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18581
+ let end = length === void 0 ? reader.len : reader.pos + length;
18582
+ const message = createBaseServerMessage_StreamerConnected();
18583
+ while (reader.pos < end) {
18584
+ const tag = reader.uint32();
18585
+ switch (tag >>> 3) {
18586
+ case 1: {
18587
+ if (tag !== 10) {
18588
+ break;
18589
+ }
18590
+ message.streamId = reader.string();
18591
+ continue;
18592
+ }
18593
+ case 2: {
18594
+ if (tag !== 18) {
18595
+ break;
18596
+ }
18597
+ message.streamerId = reader.string();
18598
+ continue;
18599
+ }
18600
+ }
18601
+ if ((tag & 7) === 4 || tag === 0) {
18602
+ break;
18603
+ }
18604
+ reader.skip(tag & 7);
18605
+ }
18606
+ return message;
18607
+ },
18608
+ fromJSON(object) {
18609
+ return {
18610
+ streamId: isSet2(object.streamId) ? globalThis.String(object.streamId) : "",
18611
+ streamerId: isSet2(object.streamerId) ? globalThis.String(object.streamerId) : ""
18612
+ };
18613
+ },
18614
+ toJSON(message) {
18615
+ const obj = {};
18616
+ if (message.streamId !== "") {
18617
+ obj.streamId = message.streamId;
18618
+ }
18619
+ if (message.streamerId !== "") {
18620
+ obj.streamerId = message.streamerId;
18621
+ }
18622
+ return obj;
18623
+ },
18624
+ create(base) {
18625
+ return ServerMessage_StreamerConnected.fromPartial(base ?? {});
18626
+ },
18627
+ fromPartial(object) {
18628
+ const message = createBaseServerMessage_StreamerConnected();
18629
+ message.streamId = object.streamId ?? "";
18630
+ message.streamerId = object.streamerId ?? "";
18631
+ return message;
18632
+ }
18633
+ };
18634
+ function createBaseServerMessage_StreamerDisconnected() {
18635
+ return { streamId: "", streamerId: "" };
18636
+ }
18637
+ var ServerMessage_StreamerDisconnected = {
18638
+ encode(message, writer = new BinaryWriter()) {
18639
+ if (message.streamId !== "") {
18640
+ writer.uint32(10).string(message.streamId);
18641
+ }
18642
+ if (message.streamerId !== "") {
18643
+ writer.uint32(18).string(message.streamerId);
18644
+ }
18645
+ return writer;
18646
+ },
18647
+ decode(input, length) {
18648
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18649
+ let end = length === void 0 ? reader.len : reader.pos + length;
18650
+ const message = createBaseServerMessage_StreamerDisconnected();
18651
+ while (reader.pos < end) {
18652
+ const tag = reader.uint32();
18653
+ switch (tag >>> 3) {
18654
+ case 1: {
18655
+ if (tag !== 10) {
18656
+ break;
18657
+ }
18658
+ message.streamId = reader.string();
18659
+ continue;
18660
+ }
18661
+ case 2: {
18662
+ if (tag !== 18) {
18663
+ break;
18664
+ }
18665
+ message.streamerId = reader.string();
18666
+ continue;
18667
+ }
18668
+ }
18669
+ if ((tag & 7) === 4 || tag === 0) {
18670
+ break;
18671
+ }
18672
+ reader.skip(tag & 7);
18673
+ }
18674
+ return message;
18675
+ },
18676
+ fromJSON(object) {
18677
+ return {
18678
+ streamId: isSet2(object.streamId) ? globalThis.String(object.streamId) : "",
18679
+ streamerId: isSet2(object.streamerId) ? globalThis.String(object.streamerId) : ""
18680
+ };
18681
+ },
18682
+ toJSON(message) {
18683
+ const obj = {};
18684
+ if (message.streamId !== "") {
18685
+ obj.streamId = message.streamId;
18686
+ }
18687
+ if (message.streamerId !== "") {
18688
+ obj.streamerId = message.streamerId;
18689
+ }
18690
+ return obj;
18691
+ },
18692
+ create(base) {
18693
+ return ServerMessage_StreamerDisconnected.fromPartial(base ?? {});
18694
+ },
18695
+ fromPartial(object) {
18696
+ const message = createBaseServerMessage_StreamerDisconnected();
18697
+ message.streamId = object.streamId ?? "";
18698
+ message.streamerId = object.streamerId ?? "";
18699
+ return message;
18700
+ }
18701
+ };
17841
18702
  function isSet2(value) {
17842
18703
  return value !== null && value !== void 0;
17843
18704
  }
17844
18705
  var protobufPackage = "fishjam";
17845
18706
  function createBaseAgentRequest() {
17846
- return { authRequest: void 0, addTrack: void 0, removeTrack: void 0, trackData: void 0 };
18707
+ return {
18708
+ authRequest: void 0,
18709
+ addTrack: void 0,
18710
+ removeTrack: void 0,
18711
+ trackData: void 0,
18712
+ interruptTrack: void 0
18713
+ };
17847
18714
  }
17848
18715
  var AgentRequest2 = {
17849
18716
  encode(message, writer = new BinaryWriter()) {
@@ -17859,6 +18726,9 @@ var require_dist2 = __commonJS({
17859
18726
  if (message.trackData !== void 0) {
17860
18727
  AgentRequest_TrackData2.encode(message.trackData, writer.uint32(34).fork()).join();
17861
18728
  }
18729
+ if (message.interruptTrack !== void 0) {
18730
+ AgentRequest_InterruptTrack.encode(message.interruptTrack, writer.uint32(42).fork()).join();
18731
+ }
17862
18732
  return writer;
17863
18733
  },
17864
18734
  decode(input, length) {
@@ -17896,6 +18766,13 @@ var require_dist2 = __commonJS({
17896
18766
  message.trackData = AgentRequest_TrackData2.decode(reader, reader.uint32());
17897
18767
  continue;
17898
18768
  }
18769
+ case 5: {
18770
+ if (tag !== 42) {
18771
+ break;
18772
+ }
18773
+ message.interruptTrack = AgentRequest_InterruptTrack.decode(reader, reader.uint32());
18774
+ continue;
18775
+ }
17899
18776
  }
17900
18777
  if ((tag & 7) === 4 || tag === 0) {
17901
18778
  break;
@@ -17909,7 +18786,8 @@ var require_dist2 = __commonJS({
17909
18786
  authRequest: isSet3(object.authRequest) ? AgentRequest_AuthRequest.fromJSON(object.authRequest) : void 0,
17910
18787
  addTrack: isSet3(object.addTrack) ? AgentRequest_AddTrack.fromJSON(object.addTrack) : void 0,
17911
18788
  removeTrack: isSet3(object.removeTrack) ? AgentRequest_RemoveTrack.fromJSON(object.removeTrack) : void 0,
17912
- trackData: isSet3(object.trackData) ? AgentRequest_TrackData2.fromJSON(object.trackData) : void 0
18789
+ trackData: isSet3(object.trackData) ? AgentRequest_TrackData2.fromJSON(object.trackData) : void 0,
18790
+ interruptTrack: isSet3(object.interruptTrack) ? AgentRequest_InterruptTrack.fromJSON(object.interruptTrack) : void 0
17913
18791
  };
17914
18792
  },
17915
18793
  toJSON(message) {
@@ -17926,6 +18804,9 @@ var require_dist2 = __commonJS({
17926
18804
  if (message.trackData !== void 0) {
17927
18805
  obj.trackData = AgentRequest_TrackData2.toJSON(message.trackData);
17928
18806
  }
18807
+ if (message.interruptTrack !== void 0) {
18808
+ obj.interruptTrack = AgentRequest_InterruptTrack.toJSON(message.interruptTrack);
18809
+ }
17929
18810
  return obj;
17930
18811
  },
17931
18812
  create(base) {
@@ -17937,6 +18818,7 @@ var require_dist2 = __commonJS({
17937
18818
  message.addTrack = object.addTrack !== void 0 && object.addTrack !== null ? AgentRequest_AddTrack.fromPartial(object.addTrack) : void 0;
17938
18819
  message.removeTrack = object.removeTrack !== void 0 && object.removeTrack !== null ? AgentRequest_RemoveTrack.fromPartial(object.removeTrack) : void 0;
17939
18820
  message.trackData = object.trackData !== void 0 && object.trackData !== null ? AgentRequest_TrackData2.fromPartial(object.trackData) : void 0;
18821
+ message.interruptTrack = object.interruptTrack !== void 0 && object.interruptTrack !== null ? AgentRequest_InterruptTrack.fromPartial(object.interruptTrack) : void 0;
17940
18822
  return message;
17941
18823
  }
17942
18824
  };
@@ -18261,6 +19143,57 @@ var require_dist2 = __commonJS({
18261
19143
  return message;
18262
19144
  }
18263
19145
  };
19146
+ function createBaseAgentRequest_InterruptTrack() {
19147
+ return { trackId: "" };
19148
+ }
19149
+ var AgentRequest_InterruptTrack = {
19150
+ encode(message, writer = new BinaryWriter()) {
19151
+ if (message.trackId !== "") {
19152
+ writer.uint32(10).string(message.trackId);
19153
+ }
19154
+ return writer;
19155
+ },
19156
+ decode(input, length) {
19157
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
19158
+ let end = length === void 0 ? reader.len : reader.pos + length;
19159
+ const message = createBaseAgentRequest_InterruptTrack();
19160
+ while (reader.pos < end) {
19161
+ const tag = reader.uint32();
19162
+ switch (tag >>> 3) {
19163
+ case 1: {
19164
+ if (tag !== 10) {
19165
+ break;
19166
+ }
19167
+ message.trackId = reader.string();
19168
+ continue;
19169
+ }
19170
+ }
19171
+ if ((tag & 7) === 4 || tag === 0) {
19172
+ break;
19173
+ }
19174
+ reader.skip(tag & 7);
19175
+ }
19176
+ return message;
19177
+ },
19178
+ fromJSON(object) {
19179
+ return { trackId: isSet3(object.trackId) ? globalThis.String(object.trackId) : "" };
19180
+ },
19181
+ toJSON(message) {
19182
+ const obj = {};
19183
+ if (message.trackId !== "") {
19184
+ obj.trackId = message.trackId;
19185
+ }
19186
+ return obj;
19187
+ },
19188
+ create(base) {
19189
+ return AgentRequest_InterruptTrack.fromPartial(base ?? {});
19190
+ },
19191
+ fromPartial(object) {
19192
+ const message = createBaseAgentRequest_InterruptTrack();
19193
+ message.trackId = object.trackId ?? "";
19194
+ return message;
19195
+ }
19196
+ };
18264
19197
  function createBaseAgentResponse() {
18265
19198
  return { authenticated: void 0, trackData: void 0 };
18266
19199
  }
@@ -18551,8 +19484,12 @@ var httpToWebsocket = (httpUrl) => {
18551
19484
  return url.href;
18552
19485
  };
18553
19486
  var getFishjamUrl = (config) => {
18554
- if (!config.fishjamId && !config.fishjamUrl) throw new MissingFishjamIdException();
18555
- return config.fishjamUrl ?? `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
19487
+ if (!config.fishjamId) throw new MissingFishjamIdException();
19488
+ try {
19489
+ return new URL(config.fishjamId).href;
19490
+ } catch {
19491
+ return `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
19492
+ }
18556
19493
  };
18557
19494
 
18558
19495
  // src/ws_notifier.ts
@@ -18582,6 +19519,7 @@ var FishjamWSNotifier = class extends import_events.EventEmitter {
18582
19519
  const fishjamUrl = getFishjamUrl(config);
18583
19520
  const websocketUrl = `${httpToWebsocket(fishjamUrl)}/socket/server/websocket`;
18584
19521
  this.client = new WebSocket(websocketUrl);
19522
+ this.client.binaryType = "arraybuffer";
18585
19523
  this.client.onerror = (message) => onError(message);
18586
19524
  this.client.onclose = (message) => onClose(message.code, message.reason);
18587
19525
  this.client.onmessage = (message) => this.dispatchNotification(message);
@@ -18589,7 +19527,8 @@ var FishjamWSNotifier = class extends import_events.EventEmitter {
18589
19527
  }
18590
19528
  dispatchNotification(message) {
18591
19529
  try {
18592
- const decodedMessage = import_fishjam_proto.ServerMessage.decode(message.data);
19530
+ const data = new Uint8Array(message.data);
19531
+ const decodedMessage = import_fishjam_proto.ServerMessage.decode(data);
18593
19532
  const [notification, msg] = Object.entries(decodedMessage).find(([_k, v]) => v);
18594
19533
  if (!this.isExpectedEvent(notification)) return;
18595
19534
  this.emit(notification, msg);
@@ -18617,13 +19556,14 @@ var import_fishjam_proto2 = __toESM(require_dist2());
18617
19556
  var expectedEventsList2 = ["trackData"];
18618
19557
  var FishjamAgent = class extends import_events2.EventEmitter {
18619
19558
  client;
18620
- constructor(config, agentToken, onError, onClose) {
19559
+ constructor(config, agentToken, callbacks) {
18621
19560
  super();
18622
19561
  const fishjamUrl = getFishjamUrl(config);
18623
19562
  const websocketUrl = `${httpToWebsocket(fishjamUrl)}/socket/agent/websocket`;
18624
19563
  this.client = new WebSocket(websocketUrl);
18625
- this.client.onerror = (message) => onError(message);
18626
- this.client.onclose = (message) => onClose(message.code, message.reason);
19564
+ this.client.binaryType = "arraybuffer";
19565
+ this.client.onclose = (message) => callbacks?.onClose?.(message.code, message.reason);
19566
+ this.client.onerror = (message) => callbacks?.onError?.(message);
18627
19567
  this.client.onmessage = (message) => this.dispatchNotification(message);
18628
19568
  this.client.onopen = () => this.setupConnection(agentToken);
18629
19569
  }
@@ -18642,6 +19582,18 @@ var FishjamAgent = class extends import_events2.EventEmitter {
18642
19582
  this.client.send(addTrack);
18643
19583
  return track;
18644
19584
  }
19585
+ /**
19586
+ * Interrupt track indentified by `trackId`.
19587
+ *
19588
+ * Any audio that has been sent by the agent, but not played
19589
+ * by Fishjam will be cleared and be prevented from playing.
19590
+ *
19591
+ * Audio sent after the interrupt will be played normally.
19592
+ */
19593
+ interruptTrack(trackId) {
19594
+ const msg = import_fishjam_proto2.AgentRequest.encode({ interruptTrack: { trackId } }).finish();
19595
+ this.client.send(msg);
19596
+ }
18645
19597
  /**
18646
19598
  * Deletes an outgoing audio track for the agent
18647
19599
  */
@@ -18656,9 +19608,13 @@ var FishjamAgent = class extends import_events2.EventEmitter {
18656
19608
  const trackData = import_fishjam_proto2.AgentRequest.encode({ trackData: { trackId, data } }).finish();
18657
19609
  this.client.send(trackData);
18658
19610
  }
19611
+ disconnect() {
19612
+ this.client.close();
19613
+ }
18659
19614
  dispatchNotification(message) {
18660
19615
  try {
18661
- const decodedMessage = import_fishjam_proto2.AgentResponse.decode(message.data);
19616
+ const data = new Uint8Array(message.data);
19617
+ const decodedMessage = import_fishjam_proto2.AgentResponse.decode(data);
18662
19618
  const [notification, msg] = Object.entries(decodedMessage).find(([_k, v]) => v);
18663
19619
  if (!this.isExpectedEvent(notification)) return;
18664
19620
  this.emit(notification, msg);
@@ -18725,7 +19681,7 @@ var FishjamClient = class {
18725
19681
  * Example usage:
18726
19682
  * ```
18727
19683
  * const fishjamClient = new FishjamClient({
18728
- * fishjamUrl: fastify.config.FISHJAM_URL,
19684
+ * fishjamId: fastify.config.FISHJAM_ID,
18729
19685
  * managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
18730
19686
  * });
18731
19687
  * ```
@@ -18799,7 +19755,7 @@ var FishjamClient = class {
18799
19755
  /**
18800
19756
  * Create a new agent assigned to a room.
18801
19757
  */
18802
- async createAgent(roomId, options = {}, onError, onClose) {
19758
+ async createAgent(roomId, options = {}, callbacks) {
18803
19759
  try {
18804
19760
  const response = await this.roomApi.addPeer(roomId, {
18805
19761
  type: "agent",
@@ -18808,7 +19764,7 @@ var FishjamClient = class {
18808
19764
  const {
18809
19765
  data: { data }
18810
19766
  } = response;
18811
- const agent = new FishjamAgent(this.fishjamConfig, data.token, onError, onClose);
19767
+ const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
18812
19768
  return { agent, peer: data.peer };
18813
19769
  } catch (error) {
18814
19770
  throw mapException(error);
@@ -18835,6 +19791,28 @@ var FishjamClient = class {
18835
19791
  throw mapException(error, "peer");
18836
19792
  }
18837
19793
  }
19794
+ /**
19795
+ * Subscribe a peer to another peer - this will make all tracks from the publisher available to the subscriber.
19796
+ * Using this function only makes sense if subscribeMode is set to manual
19797
+ */
19798
+ async subscribePeer(roomId, subscriberPeerId, publisherPeerId) {
19799
+ try {
19800
+ await this.roomApi.subscribePeer(roomId, subscriberPeerId, publisherPeerId);
19801
+ } catch (error) {
19802
+ throw mapException(error, "peer");
19803
+ }
19804
+ }
19805
+ /**
19806
+ * Subscribe a peer to specific tracks from another peer - this will make only the specified tracks from the publisher available to the subscriber.
19807
+ * Using this function only makes sense if subscribeMode is set to manual
19808
+ */
19809
+ async subscribeTracks(roomId, subscriberPeerId, tracks) {
19810
+ try {
19811
+ await this.roomApi.subscribeTracks(roomId, subscriberPeerId, { track_ids: tracks });
19812
+ } catch (error) {
19813
+ throw mapException(error, "peer");
19814
+ }
19815
+ }
18838
19816
  /**
18839
19817
  * Refresh the peer token for an already existing peer.
18840
19818
  * If an already created peer has not been connected to the room for more than 24 hours, the token will become invalid. This method can be used to generate a new peer token for the existing peer.