@fishjam-cloud/js-server-sdk 0.27.0-rc.0 → 0.27.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-Q5OZUPAC.mjs";
3
+ } from "./chunk-GFB6IWU4.mjs";
4
4
 
5
5
  // ../fishjam-openapi/dist/index.js
6
6
  import globalAxios2 from "axios";
@@ -90,45 +90,17 @@ var VideoCodec = {
90
90
  H264: "h264",
91
91
  Vp8: "vp8"
92
92
  };
93
- var MoqApiAxiosParamCreator = function(configuration) {
93
+ var MoQApiAxiosParamCreator = function(configuration) {
94
94
  return {
95
95
  /**
96
- *
97
- * @summary Creates a MoQ publisher token for the given stream
98
- * @param {string} streamId Stream id
96
+ * Issue a short-lived JWT for a Media over QUIC client.
97
+ * @summary Create a MoQ token
98
+ * @param {MoqTokenConfig} [moqTokenConfig]
99
99
  * @param {*} [options] Override http request option.
100
100
  * @throws {RequiredError}
101
101
  */
102
- createMoqPublisherToken: async (streamId, options = {}) => {
103
- assertParamExists("createMoqPublisherToken", "streamId", streamId);
104
- const localVarPath = `/moq/{stream_id}/publisher`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
105
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
106
- let baseOptions;
107
- if (configuration) {
108
- baseOptions = configuration.baseOptions;
109
- }
110
- const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
111
- const localVarHeaderParameter = {};
112
- const localVarQueryParameter = {};
113
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
114
- setSearchParams(localVarUrlObj, localVarQueryParameter);
115
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
116
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
117
- return {
118
- url: toPathString(localVarUrlObj),
119
- options: localVarRequestOptions
120
- };
121
- },
122
- /**
123
- *
124
- * @summary Creates a MoQ subscriber token for the given stream
125
- * @param {string} streamId Stream id
126
- * @param {*} [options] Override http request option.
127
- * @throws {RequiredError}
128
- */
129
- createMoqSubscriberToken: async (streamId, options = {}) => {
130
- assertParamExists("createMoqSubscriberToken", "streamId", streamId);
131
- const localVarPath = `/moq/{stream_id}/subscriber`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
102
+ createMoqToken: async (moqTokenConfig, options = {}) => {
103
+ const localVarPath = `/moq/token`;
132
104
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
133
105
  let baseOptions;
134
106
  if (configuration) {
@@ -138,9 +110,11 @@ var MoqApiAxiosParamCreator = function(configuration) {
138
110
  const localVarHeaderParameter = {};
139
111
  const localVarQueryParameter = {};
140
112
  await setBearerAuthToObject(localVarHeaderParameter, configuration);
113
+ localVarHeaderParameter["Content-Type"] = "application/json";
141
114
  setSearchParams(localVarUrlObj, localVarQueryParameter);
142
115
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
143
116
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
117
+ localVarRequestOptions.data = serializeDataIfNeeded(moqTokenConfig, localVarRequestOptions, configuration);
144
118
  return {
145
119
  url: toPathString(localVarUrlObj),
146
120
  options: localVarRequestOptions
@@ -148,68 +122,44 @@ var MoqApiAxiosParamCreator = function(configuration) {
148
122
  }
149
123
  };
150
124
  };
151
- var MoqApiFp = function(configuration) {
152
- const localVarAxiosParamCreator = MoqApiAxiosParamCreator(configuration);
125
+ var MoQApiFp = function(configuration) {
126
+ const localVarAxiosParamCreator = MoQApiAxiosParamCreator(configuration);
153
127
  return {
154
128
  /**
155
- *
156
- * @summary Creates a MoQ publisher token for the given stream
157
- * @param {string} streamId Stream id
129
+ * Issue a short-lived JWT for a Media over QUIC client.
130
+ * @summary Create a MoQ token
131
+ * @param {MoqTokenConfig} [moqTokenConfig]
158
132
  * @param {*} [options] Override http request option.
159
133
  * @throws {RequiredError}
160
134
  */
161
- async createMoqPublisherToken(streamId, options) {
162
- const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqPublisherToken(streamId, options);
135
+ async createMoqToken(moqTokenConfig, options) {
136
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqToken(moqTokenConfig, options);
163
137
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
164
- const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqPublisherToken"]?.[localVarOperationServerIndex]?.url;
165
- return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
166
- },
167
- /**
168
- *
169
- * @summary Creates a MoQ subscriber token for the given stream
170
- * @param {string} streamId Stream id
171
- * @param {*} [options] Override http request option.
172
- * @throws {RequiredError}
173
- */
174
- async createMoqSubscriberToken(streamId, options) {
175
- const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqSubscriberToken(streamId, options);
176
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
177
- const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqSubscriberToken"]?.[localVarOperationServerIndex]?.url;
138
+ const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqToken"]?.[localVarOperationServerIndex]?.url;
178
139
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
179
140
  }
180
141
  };
181
142
  };
182
- var MoqApi = class extends BaseAPI {
143
+ var MoQApi = class extends BaseAPI {
183
144
  /**
184
- *
185
- * @summary Creates a MoQ publisher token for the given stream
186
- * @param {string} streamId Stream id
187
- * @param {*} [options] Override http request option.
188
- * @throws {RequiredError}
189
- * @memberof MoqApi
190
- */
191
- createMoqPublisherToken(streamId, options) {
192
- return MoqApiFp(this.configuration).createMoqPublisherToken(streamId, options).then((request) => request(this.axios, this.basePath));
193
- }
194
- /**
195
- *
196
- * @summary Creates a MoQ subscriber token for the given stream
197
- * @param {string} streamId Stream id
145
+ * Issue a short-lived JWT for a Media over QUIC client.
146
+ * @summary Create a MoQ token
147
+ * @param {MoqTokenConfig} [moqTokenConfig]
198
148
  * @param {*} [options] Override http request option.
199
149
  * @throws {RequiredError}
200
- * @memberof MoqApi
150
+ * @memberof MoQApi
201
151
  */
202
- createMoqSubscriberToken(streamId, options) {
203
- return MoqApiFp(this.configuration).createMoqSubscriberToken(streamId, options).then((request) => request(this.axios, this.basePath));
152
+ createMoqToken(moqTokenConfig, options) {
153
+ return MoQApiFp(this.configuration).createMoqToken(moqTokenConfig, options).then((request) => request(this.axios, this.basePath));
204
154
  }
205
155
  };
206
- var RoomApiAxiosParamCreator = function(configuration) {
156
+ var RoomsApiAxiosParamCreator = function(configuration) {
207
157
  return {
208
158
  /**
209
- *
210
- * @summary Create peer
159
+ * Add a peer to a room and return its connection token.
160
+ * @summary Create a peer
211
161
  * @param {string} roomId Room id
212
- * @param {PeerConfig} [peerConfig] Peer specification
162
+ * @param {PeerConfig} [peerConfig]
213
163
  * @param {*} [options] Override http request option.
214
164
  * @throws {RequiredError}
215
165
  */
@@ -236,9 +186,9 @@ var RoomApiAxiosParamCreator = function(configuration) {
236
186
  };
237
187
  },
238
188
  /**
239
- *
240
- * @summary Creates a room
241
- * @param {RoomConfig} [roomConfig] Room configuration
189
+ * Create a new room with the given configuration.
190
+ * @summary Create a room
191
+ * @param {RoomConfig} [roomConfig]
242
192
  * @param {*} [options] Override http request option.
243
193
  * @throws {RequiredError}
244
194
  */
@@ -264,8 +214,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
264
214
  };
265
215
  },
266
216
  /**
267
- *
268
- * @summary Delete peer
217
+ * Remove a peer from a room and disconnect it.
218
+ * @summary Delete a peer
269
219
  * @param {string} roomId Room id
270
220
  * @param {string} id Peer id
271
221
  * @param {*} [options] Override http request option.
@@ -293,8 +243,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
293
243
  };
294
244
  },
295
245
  /**
296
- *
297
- * @summary Delete the room
246
+ * Delete a room by id and disconnect all of its peers.
247
+ * @summary Delete a room
298
248
  * @param {string} roomId Room id
299
249
  * @param {*} [options] Override http request option.
300
250
  * @throws {RequiredError}
@@ -320,8 +270,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
320
270
  };
321
271
  },
322
272
  /**
323
- *
324
- * @summary Show information about all rooms
273
+ * List all rooms and livestreams.
274
+ * @summary List all rooms
325
275
  * @param {*} [options] Override http request option.
326
276
  * @throws {RequiredError}
327
277
  */
@@ -345,8 +295,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
345
295
  };
346
296
  },
347
297
  /**
348
- *
349
- * @summary Shows information about the room
298
+ * Get a room by id.
299
+ * @summary Get a room
350
300
  * @param {string} roomId Room ID
351
301
  * @param {*} [options] Override http request option.
352
302
  * @throws {RequiredError}
@@ -372,8 +322,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
372
322
  };
373
323
  },
374
324
  /**
375
- *
376
- * @summary Refresh peer token
325
+ * Issue a fresh connection token for an existing peer.
326
+ * @summary Refresh a peer token
377
327
  * @param {string} roomId Room id
378
328
  * @param {string} id Peer id
379
329
  * @param {*} [options] Override http request option.
@@ -401,8 +351,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
401
351
  };
402
352
  },
403
353
  /**
404
- *
405
- * @summary Subscribe peer to another peer\'s tracks
354
+ * Subscribe a peer to all current and future tracks published by another peer in the same room.
355
+ * @summary Subscribe a peer to another peer\'s tracks
406
356
  * @param {string} roomId Room id
407
357
  * @param {string} id Peer id
408
358
  * @param {string} [peerId] ID of the peer that produces the track
@@ -434,8 +384,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
434
384
  };
435
385
  },
436
386
  /**
437
- *
438
- * @summary Subscribe peer to specific tracks
387
+ * Subscribe a peer to a specific list of track IDs in the same room.
388
+ * @summary Subscribe a peer to specific tracks
439
389
  * @param {string} roomId Room id
440
390
  * @param {string} id Peer id
441
391
  * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
@@ -467,39 +417,39 @@ var RoomApiAxiosParamCreator = function(configuration) {
467
417
  }
468
418
  };
469
419
  };
470
- var RoomApiFp = function(configuration) {
471
- const localVarAxiosParamCreator = RoomApiAxiosParamCreator(configuration);
420
+ var RoomsApiFp = function(configuration) {
421
+ const localVarAxiosParamCreator = RoomsApiAxiosParamCreator(configuration);
472
422
  return {
473
423
  /**
474
- *
475
- * @summary Create peer
424
+ * Add a peer to a room and return its connection token.
425
+ * @summary Create a peer
476
426
  * @param {string} roomId Room id
477
- * @param {PeerConfig} [peerConfig] Peer specification
427
+ * @param {PeerConfig} [peerConfig]
478
428
  * @param {*} [options] Override http request option.
479
429
  * @throws {RequiredError}
480
430
  */
481
431
  async addPeer(roomId, peerConfig, options) {
482
432
  const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
483
433
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
484
- const localVarOperationServerBasePath = operationServerMap["RoomApi.addPeer"]?.[localVarOperationServerIndex]?.url;
434
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
485
435
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
486
436
  },
487
437
  /**
488
- *
489
- * @summary Creates a room
490
- * @param {RoomConfig} [roomConfig] Room configuration
438
+ * Create a new room with the given configuration.
439
+ * @summary Create a room
440
+ * @param {RoomConfig} [roomConfig]
491
441
  * @param {*} [options] Override http request option.
492
442
  * @throws {RequiredError}
493
443
  */
494
444
  async createRoom(roomConfig, options) {
495
445
  const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
496
446
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
497
- const localVarOperationServerBasePath = operationServerMap["RoomApi.createRoom"]?.[localVarOperationServerIndex]?.url;
447
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
498
448
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
499
449
  },
500
450
  /**
501
- *
502
- * @summary Delete peer
451
+ * Remove a peer from a room and disconnect it.
452
+ * @summary Delete a peer
503
453
  * @param {string} roomId Room id
504
454
  * @param {string} id Peer id
505
455
  * @param {*} [options] Override http request option.
@@ -508,12 +458,12 @@ var RoomApiFp = function(configuration) {
508
458
  async deletePeer(roomId, id, options) {
509
459
  const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
510
460
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
511
- const localVarOperationServerBasePath = operationServerMap["RoomApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
461
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
512
462
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
513
463
  },
514
464
  /**
515
- *
516
- * @summary Delete the room
465
+ * Delete a room by id and disconnect all of its peers.
466
+ * @summary Delete a room
517
467
  * @param {string} roomId Room id
518
468
  * @param {*} [options] Override http request option.
519
469
  * @throws {RequiredError}
@@ -521,24 +471,24 @@ var RoomApiFp = function(configuration) {
521
471
  async deleteRoom(roomId, options) {
522
472
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
523
473
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
524
- const localVarOperationServerBasePath = operationServerMap["RoomApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
474
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
525
475
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
526
476
  },
527
477
  /**
528
- *
529
- * @summary Show information about all rooms
478
+ * List all rooms and livestreams.
479
+ * @summary List all rooms
530
480
  * @param {*} [options] Override http request option.
531
481
  * @throws {RequiredError}
532
482
  */
533
483
  async getAllRooms(options) {
534
484
  const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
535
485
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
536
- const localVarOperationServerBasePath = operationServerMap["RoomApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
486
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
537
487
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
538
488
  },
539
489
  /**
540
- *
541
- * @summary Shows information about the room
490
+ * Get a room by id.
491
+ * @summary Get a room
542
492
  * @param {string} roomId Room ID
543
493
  * @param {*} [options] Override http request option.
544
494
  * @throws {RequiredError}
@@ -546,12 +496,12 @@ var RoomApiFp = function(configuration) {
546
496
  async getRoom(roomId, options) {
547
497
  const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
548
498
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
549
- const localVarOperationServerBasePath = operationServerMap["RoomApi.getRoom"]?.[localVarOperationServerIndex]?.url;
499
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
550
500
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
551
501
  },
552
502
  /**
553
- *
554
- * @summary Refresh peer token
503
+ * Issue a fresh connection token for an existing peer.
504
+ * @summary Refresh a peer token
555
505
  * @param {string} roomId Room id
556
506
  * @param {string} id Peer id
557
507
  * @param {*} [options] Override http request option.
@@ -560,12 +510,12 @@ var RoomApiFp = function(configuration) {
560
510
  async refreshToken(roomId, id, options) {
561
511
  const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
562
512
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
563
- const localVarOperationServerBasePath = operationServerMap["RoomApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
513
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
564
514
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
565
515
  },
566
516
  /**
567
- *
568
- * @summary Subscribe peer to another peer\'s tracks
517
+ * Subscribe a peer to all current and future tracks published by another peer in the same room.
518
+ * @summary Subscribe a peer to another peer\'s tracks
569
519
  * @param {string} roomId Room id
570
520
  * @param {string} id Peer id
571
521
  * @param {string} [peerId] ID of the peer that produces the track
@@ -575,12 +525,12 @@ var RoomApiFp = function(configuration) {
575
525
  async subscribePeer(roomId, id, peerId, options) {
576
526
  const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
577
527
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
578
- const localVarOperationServerBasePath = operationServerMap["RoomApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
528
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
579
529
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
580
530
  },
581
531
  /**
582
- *
583
- * @summary Subscribe peer to specific tracks
532
+ * Subscribe a peer to a specific list of track IDs in the same room.
533
+ * @summary Subscribe a peer to specific tracks
584
534
  * @param {string} roomId Room id
585
535
  * @param {string} id Peer id
586
536
  * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
@@ -590,123 +540,123 @@ var RoomApiFp = function(configuration) {
590
540
  async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
591
541
  const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(roomId, id, subscribeTracksRequest, options);
592
542
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
593
- const localVarOperationServerBasePath = operationServerMap["RoomApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
543
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
594
544
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
595
545
  }
596
546
  };
597
547
  };
598
- var RoomApi = class extends BaseAPI {
548
+ var RoomsApi = class extends BaseAPI {
599
549
  /**
600
- *
601
- * @summary Create peer
550
+ * Add a peer to a room and return its connection token.
551
+ * @summary Create a peer
602
552
  * @param {string} roomId Room id
603
- * @param {PeerConfig} [peerConfig] Peer specification
553
+ * @param {PeerConfig} [peerConfig]
604
554
  * @param {*} [options] Override http request option.
605
555
  * @throws {RequiredError}
606
- * @memberof RoomApi
556
+ * @memberof RoomsApi
607
557
  */
608
558
  addPeer(roomId, peerConfig, options) {
609
- return RoomApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath));
559
+ return RoomsApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath));
610
560
  }
611
561
  /**
612
- *
613
- * @summary Creates a room
614
- * @param {RoomConfig} [roomConfig] Room configuration
562
+ * Create a new room with the given configuration.
563
+ * @summary Create a room
564
+ * @param {RoomConfig} [roomConfig]
615
565
  * @param {*} [options] Override http request option.
616
566
  * @throws {RequiredError}
617
- * @memberof RoomApi
567
+ * @memberof RoomsApi
618
568
  */
619
569
  createRoom(roomConfig, options) {
620
- return RoomApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath));
570
+ return RoomsApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath));
621
571
  }
622
572
  /**
623
- *
624
- * @summary Delete peer
573
+ * Remove a peer from a room and disconnect it.
574
+ * @summary Delete a peer
625
575
  * @param {string} roomId Room id
626
576
  * @param {string} id Peer id
627
577
  * @param {*} [options] Override http request option.
628
578
  * @throws {RequiredError}
629
- * @memberof RoomApi
579
+ * @memberof RoomsApi
630
580
  */
631
581
  deletePeer(roomId, id, options) {
632
- return RoomApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath));
582
+ return RoomsApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath));
633
583
  }
634
584
  /**
635
- *
636
- * @summary Delete the room
585
+ * Delete a room by id and disconnect all of its peers.
586
+ * @summary Delete a room
637
587
  * @param {string} roomId Room id
638
588
  * @param {*} [options] Override http request option.
639
589
  * @throws {RequiredError}
640
- * @memberof RoomApi
590
+ * @memberof RoomsApi
641
591
  */
642
592
  deleteRoom(roomId, options) {
643
- return RoomApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath));
593
+ return RoomsApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath));
644
594
  }
645
595
  /**
646
- *
647
- * @summary Show information about all rooms
596
+ * List all rooms and livestreams.
597
+ * @summary List all rooms
648
598
  * @param {*} [options] Override http request option.
649
599
  * @throws {RequiredError}
650
- * @memberof RoomApi
600
+ * @memberof RoomsApi
651
601
  */
652
602
  getAllRooms(options) {
653
- return RoomApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath));
603
+ return RoomsApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath));
654
604
  }
655
605
  /**
656
- *
657
- * @summary Shows information about the room
606
+ * Get a room by id.
607
+ * @summary Get a room
658
608
  * @param {string} roomId Room ID
659
609
  * @param {*} [options] Override http request option.
660
610
  * @throws {RequiredError}
661
- * @memberof RoomApi
611
+ * @memberof RoomsApi
662
612
  */
663
613
  getRoom(roomId, options) {
664
- return RoomApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath));
614
+ return RoomsApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath));
665
615
  }
666
616
  /**
667
- *
668
- * @summary Refresh peer token
617
+ * Issue a fresh connection token for an existing peer.
618
+ * @summary Refresh a peer token
669
619
  * @param {string} roomId Room id
670
620
  * @param {string} id Peer id
671
621
  * @param {*} [options] Override http request option.
672
622
  * @throws {RequiredError}
673
- * @memberof RoomApi
623
+ * @memberof RoomsApi
674
624
  */
675
625
  refreshToken(roomId, id, options) {
676
- return RoomApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
626
+ return RoomsApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
677
627
  }
678
628
  /**
679
- *
680
- * @summary Subscribe peer to another peer\'s tracks
629
+ * Subscribe a peer to all current and future tracks published by another peer in the same room.
630
+ * @summary Subscribe a peer to another peer\'s tracks
681
631
  * @param {string} roomId Room id
682
632
  * @param {string} id Peer id
683
633
  * @param {string} [peerId] ID of the peer that produces the track
684
634
  * @param {*} [options] Override http request option.
685
635
  * @throws {RequiredError}
686
- * @memberof RoomApi
636
+ * @memberof RoomsApi
687
637
  */
688
638
  subscribePeer(roomId, id, peerId, options) {
689
- return RoomApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
639
+ return RoomsApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
690
640
  }
691
641
  /**
692
- *
693
- * @summary Subscribe peer to specific tracks
642
+ * Subscribe a peer to a specific list of track IDs in the same room.
643
+ * @summary Subscribe a peer to specific tracks
694
644
  * @param {string} roomId Room id
695
645
  * @param {string} id Peer id
696
646
  * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
697
647
  * @param {*} [options] Override http request option.
698
648
  * @throws {RequiredError}
699
- * @memberof RoomApi
649
+ * @memberof RoomsApi
700
650
  */
701
651
  subscribeTracks(roomId, id, subscribeTracksRequest, options) {
702
- return RoomApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
652
+ return RoomsApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
703
653
  }
704
654
  };
705
- var StreamerApiAxiosParamCreator = function(configuration) {
655
+ var StreamersApiAxiosParamCreator = function(configuration) {
706
656
  return {
707
657
  /**
708
- *
709
- * @summary Creates streamer
658
+ * Create a streamer for a stream and return its credentials.
659
+ * @summary Create a streamer
710
660
  * @param {string} streamId Stream id
711
661
  * @param {*} [options] Override http request option.
712
662
  * @throws {RequiredError}
@@ -732,8 +682,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
732
682
  };
733
683
  },
734
684
  /**
735
- *
736
- * @summary Deletes streamer
685
+ * Delete a streamer from a stream and revoke its token.
686
+ * @summary Delete a streamer
737
687
  * @param {string} streamId Stream id
738
688
  * @param {string} streamerId Streamer id
739
689
  * @param {*} [options] Override http request option.
@@ -761,8 +711,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
761
711
  };
762
712
  },
763
713
  /**
764
- *
765
- * @summary Generate a token that can be used by a streamer to start streaming
714
+ * Issue a fresh streamer token.
715
+ * @summary Create a streamer token
766
716
  * @param {string} roomId ID of the stream.
767
717
  * @param {*} [options] Override http request option.
768
718
  * @throws {RequiredError}
@@ -789,12 +739,12 @@ var StreamerApiAxiosParamCreator = function(configuration) {
789
739
  }
790
740
  };
791
741
  };
792
- var StreamerApiFp = function(configuration) {
793
- const localVarAxiosParamCreator = StreamerApiAxiosParamCreator(configuration);
742
+ var StreamersApiFp = function(configuration) {
743
+ const localVarAxiosParamCreator = StreamersApiAxiosParamCreator(configuration);
794
744
  return {
795
745
  /**
796
- *
797
- * @summary Creates streamer
746
+ * Create a streamer for a stream and return its credentials.
747
+ * @summary Create a streamer
798
748
  * @param {string} streamId Stream id
799
749
  * @param {*} [options] Override http request option.
800
750
  * @throws {RequiredError}
@@ -802,12 +752,12 @@ var StreamerApiFp = function(configuration) {
802
752
  async createStreamer(streamId, options) {
803
753
  const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
804
754
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
805
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
755
+ const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
806
756
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
807
757
  },
808
758
  /**
809
- *
810
- * @summary Deletes streamer
759
+ * Delete a streamer from a stream and revoke its token.
760
+ * @summary Delete a streamer
811
761
  * @param {string} streamId Stream id
812
762
  * @param {string} streamerId Streamer id
813
763
  * @param {*} [options] Override http request option.
@@ -816,12 +766,12 @@ var StreamerApiFp = function(configuration) {
816
766
  async deleteStreamer(streamId, streamerId, options) {
817
767
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
818
768
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
819
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
769
+ const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
820
770
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
821
771
  },
822
772
  /**
823
- *
824
- * @summary Generate a token that can be used by a streamer to start streaming
773
+ * Issue a fresh streamer token.
774
+ * @summary Create a streamer token
825
775
  * @param {string} roomId ID of the stream.
826
776
  * @param {*} [options] Override http request option.
827
777
  * @throws {RequiredError}
@@ -829,52 +779,52 @@ var StreamerApiFp = function(configuration) {
829
779
  async generateStreamerToken(roomId, options) {
830
780
  const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
831
781
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
832
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
782
+ const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
833
783
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
834
784
  }
835
785
  };
836
786
  };
837
- var StreamerApi = class extends BaseAPI {
787
+ var StreamersApi = class extends BaseAPI {
838
788
  /**
839
- *
840
- * @summary Creates streamer
789
+ * Create a streamer for a stream and return its credentials.
790
+ * @summary Create a streamer
841
791
  * @param {string} streamId Stream id
842
792
  * @param {*} [options] Override http request option.
843
793
  * @throws {RequiredError}
844
- * @memberof StreamerApi
794
+ * @memberof StreamersApi
845
795
  */
846
796
  createStreamer(streamId, options) {
847
- return StreamerApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
797
+ return StreamersApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
848
798
  }
849
799
  /**
850
- *
851
- * @summary Deletes streamer
800
+ * Delete a streamer from a stream and revoke its token.
801
+ * @summary Delete a streamer
852
802
  * @param {string} streamId Stream id
853
803
  * @param {string} streamerId Streamer id
854
804
  * @param {*} [options] Override http request option.
855
805
  * @throws {RequiredError}
856
- * @memberof StreamerApi
806
+ * @memberof StreamersApi
857
807
  */
858
808
  deleteStreamer(streamId, streamerId, options) {
859
- return StreamerApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
809
+ return StreamersApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
860
810
  }
861
811
  /**
862
- *
863
- * @summary Generate a token that can be used by a streamer to start streaming
812
+ * Issue a fresh streamer token.
813
+ * @summary Create a streamer token
864
814
  * @param {string} roomId ID of the stream.
865
815
  * @param {*} [options] Override http request option.
866
816
  * @throws {RequiredError}
867
- * @memberof StreamerApi
817
+ * @memberof StreamersApi
868
818
  */
869
819
  generateStreamerToken(roomId, options) {
870
- return StreamerApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
820
+ return StreamersApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
871
821
  }
872
822
  };
873
- var ViewerApiAxiosParamCreator = function(configuration) {
823
+ var ViewersApiAxiosParamCreator = function(configuration) {
874
824
  return {
875
825
  /**
876
- *
877
- * @summary Creates viewer
826
+ * Create a viewer for a stream and return its credentials.
827
+ * @summary Create a viewer
878
828
  * @param {string} streamId Stream id
879
829
  * @param {*} [options] Override http request option.
880
830
  * @throws {RequiredError}
@@ -900,8 +850,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
900
850
  };
901
851
  },
902
852
  /**
903
- *
904
- * @summary Deletes viewer
853
+ * Delete a viewer from a stream and revoke its token.
854
+ * @summary Delete a viewer
905
855
  * @param {string} streamId Stream id
906
856
  * @param {string} viewerId Viewer id
907
857
  * @param {*} [options] Override http request option.
@@ -929,8 +879,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
929
879
  };
930
880
  },
931
881
  /**
932
- *
933
- * @summary Generates token that a viewer can use to watch a livestream
882
+ * Issue a fresh viewer token.
883
+ * @summary Create a viewer token
934
884
  * @param {string} roomId ID of the stream.
935
885
  * @param {*} [options] Override http request option.
936
886
  * @throws {RequiredError}
@@ -957,12 +907,12 @@ var ViewerApiAxiosParamCreator = function(configuration) {
957
907
  }
958
908
  };
959
909
  };
960
- var ViewerApiFp = function(configuration) {
961
- const localVarAxiosParamCreator = ViewerApiAxiosParamCreator(configuration);
910
+ var ViewersApiFp = function(configuration) {
911
+ const localVarAxiosParamCreator = ViewersApiAxiosParamCreator(configuration);
962
912
  return {
963
913
  /**
964
- *
965
- * @summary Creates viewer
914
+ * Create a viewer for a stream and return its credentials.
915
+ * @summary Create a viewer
966
916
  * @param {string} streamId Stream id
967
917
  * @param {*} [options] Override http request option.
968
918
  * @throws {RequiredError}
@@ -970,12 +920,12 @@ var ViewerApiFp = function(configuration) {
970
920
  async createViewer(streamId, options) {
971
921
  const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
972
922
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
973
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.createViewer"]?.[localVarOperationServerIndex]?.url;
923
+ const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
974
924
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
975
925
  },
976
926
  /**
977
- *
978
- * @summary Deletes viewer
927
+ * Delete a viewer from a stream and revoke its token.
928
+ * @summary Delete a viewer
979
929
  * @param {string} streamId Stream id
980
930
  * @param {string} viewerId Viewer id
981
931
  * @param {*} [options] Override http request option.
@@ -984,12 +934,12 @@ var ViewerApiFp = function(configuration) {
984
934
  async deleteViewer(streamId, viewerId, options) {
985
935
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
986
936
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
987
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
937
+ const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
988
938
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
989
939
  },
990
940
  /**
991
- *
992
- * @summary Generates token that a viewer can use to watch a livestream
941
+ * Issue a fresh viewer token.
942
+ * @summary Create a viewer token
993
943
  * @param {string} roomId ID of the stream.
994
944
  * @param {*} [options] Override http request option.
995
945
  * @throws {RequiredError}
@@ -997,45 +947,45 @@ var ViewerApiFp = function(configuration) {
997
947
  async generateViewerToken(roomId, options) {
998
948
  const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
999
949
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1000
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
950
+ const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
1001
951
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
1002
952
  }
1003
953
  };
1004
954
  };
1005
- var ViewerApi = class extends BaseAPI {
955
+ var ViewersApi = class extends BaseAPI {
1006
956
  /**
1007
- *
1008
- * @summary Creates viewer
957
+ * Create a viewer for a stream and return its credentials.
958
+ * @summary Create a viewer
1009
959
  * @param {string} streamId Stream id
1010
960
  * @param {*} [options] Override http request option.
1011
961
  * @throws {RequiredError}
1012
- * @memberof ViewerApi
962
+ * @memberof ViewersApi
1013
963
  */
1014
964
  createViewer(streamId, options) {
1015
- return ViewerApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
965
+ return ViewersApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
1016
966
  }
1017
967
  /**
1018
- *
1019
- * @summary Deletes viewer
968
+ * Delete a viewer from a stream and revoke its token.
969
+ * @summary Delete a viewer
1020
970
  * @param {string} streamId Stream id
1021
971
  * @param {string} viewerId Viewer id
1022
972
  * @param {*} [options] Override http request option.
1023
973
  * @throws {RequiredError}
1024
- * @memberof ViewerApi
974
+ * @memberof ViewersApi
1025
975
  */
1026
976
  deleteViewer(streamId, viewerId, options) {
1027
- return ViewerApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
977
+ return ViewersApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
1028
978
  }
1029
979
  /**
1030
- *
1031
- * @summary Generates token that a viewer can use to watch a livestream
980
+ * Issue a fresh viewer token.
981
+ * @summary Create a viewer token
1032
982
  * @param {string} roomId ID of the stream.
1033
983
  * @param {*} [options] Override http request option.
1034
984
  * @throws {RequiredError}
1035
- * @memberof ViewerApi
985
+ * @memberof ViewersApi
1036
986
  */
1037
987
  generateViewerToken(roomId, options) {
1038
- return ViewerApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
988
+ return ViewersApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
1039
989
  }
1040
990
  };
1041
991
 
@@ -1908,6 +1858,14 @@ var Track = {
1908
1858
  function isSet(value) {
1909
1859
  return value !== null && value !== void 0;
1910
1860
  }
1861
+ var ServerMessage_PeerType = /* @__PURE__ */ ((ServerMessage_PeerType2) => {
1862
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_UNSPECIFIED"] = 0] = "PEER_TYPE_UNSPECIFIED";
1863
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_WEBRTC"] = 1] = "PEER_TYPE_WEBRTC";
1864
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_AGENT"] = 2] = "PEER_TYPE_AGENT";
1865
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_VAPI"] = 3] = "PEER_TYPE_VAPI";
1866
+ ServerMessage_PeerType2[ServerMessage_PeerType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1867
+ return ServerMessage_PeerType2;
1868
+ })(ServerMessage_PeerType || {});
1911
1869
  function serverMessage_PeerTypeFromJSON(object) {
1912
1870
  switch (object) {
1913
1871
  case 0:
@@ -2031,6 +1989,7 @@ function createBaseServerMessage() {
2031
1989
  viewerDisconnected: void 0,
2032
1990
  streamerConnected: void 0,
2033
1991
  streamerDisconnected: void 0,
1992
+ notificationBatch: void 0,
2034
1993
  streamConnected: void 0,
2035
1994
  streamDisconnected: void 0,
2036
1995
  hlsPlayable: void 0,
@@ -2116,6 +2075,9 @@ var ServerMessage = {
2116
2075
  if (message.streamerDisconnected !== void 0) {
2117
2076
  ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
2118
2077
  }
2078
+ if (message.notificationBatch !== void 0) {
2079
+ ServerMessage_NotificationBatch.encode(message.notificationBatch, writer.uint32(266).fork()).join();
2080
+ }
2119
2081
  if (message.streamConnected !== void 0) {
2120
2082
  ServerMessage_StreamConnected.encode(message.streamConnected, writer.uint32(178).fork()).join();
2121
2083
  }
@@ -2318,6 +2280,13 @@ var ServerMessage = {
2318
2280
  message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
2319
2281
  continue;
2320
2282
  }
2283
+ case 33: {
2284
+ if (tag !== 266) {
2285
+ break;
2286
+ }
2287
+ message.notificationBatch = ServerMessage_NotificationBatch.decode(reader, reader.uint32());
2288
+ continue;
2289
+ }
2321
2290
  case 22: {
2322
2291
  if (tag !== 178) {
2323
2292
  break;
@@ -2395,6 +2364,7 @@ var ServerMessage = {
2395
2364
  viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
2396
2365
  streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
2397
2366
  streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0,
2367
+ notificationBatch: isSet2(object.notificationBatch) ? ServerMessage_NotificationBatch.fromJSON(object.notificationBatch) : void 0,
2398
2368
  streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
2399
2369
  streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
2400
2370
  hlsPlayable: isSet2(object.hlsPlayable) ? ServerMessage_HlsPlayable.fromJSON(object.hlsPlayable) : void 0,
@@ -2480,6 +2450,9 @@ var ServerMessage = {
2480
2450
  if (message.streamerDisconnected !== void 0) {
2481
2451
  obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
2482
2452
  }
2453
+ if (message.notificationBatch !== void 0) {
2454
+ obj.notificationBatch = ServerMessage_NotificationBatch.toJSON(message.notificationBatch);
2455
+ }
2483
2456
  if (message.streamConnected !== void 0) {
2484
2457
  obj.streamConnected = ServerMessage_StreamConnected.toJSON(message.streamConnected);
2485
2458
  }
@@ -2530,6 +2503,7 @@ var ServerMessage = {
2530
2503
  message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
2531
2504
  message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
2532
2505
  message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
2506
+ message.notificationBatch = object.notificationBatch !== void 0 && object.notificationBatch !== null ? ServerMessage_NotificationBatch.fromPartial(object.notificationBatch) : void 0;
2533
2507
  message.streamConnected = object.streamConnected !== void 0 && object.streamConnected !== null ? ServerMessage_StreamConnected.fromPartial(object.streamConnected) : void 0;
2534
2508
  message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
2535
2509
  message.hlsPlayable = object.hlsPlayable !== void 0 && object.hlsPlayable !== null ? ServerMessage_HlsPlayable.fromPartial(object.hlsPlayable) : void 0;
@@ -4836,6 +4810,59 @@ var ServerMessage_StreamerDisconnected = {
4836
4810
  return message;
4837
4811
  }
4838
4812
  };
4813
+ function createBaseServerMessage_NotificationBatch() {
4814
+ return { notifications: [] };
4815
+ }
4816
+ var ServerMessage_NotificationBatch = {
4817
+ encode(message, writer = new BinaryWriter()) {
4818
+ for (const v of message.notifications) {
4819
+ ServerMessage.encode(v, writer.uint32(10).fork()).join();
4820
+ }
4821
+ return writer;
4822
+ },
4823
+ decode(input, length) {
4824
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4825
+ let end = length === void 0 ? reader.len : reader.pos + length;
4826
+ const message = createBaseServerMessage_NotificationBatch();
4827
+ while (reader.pos < end) {
4828
+ const tag = reader.uint32();
4829
+ switch (tag >>> 3) {
4830
+ case 1: {
4831
+ if (tag !== 10) {
4832
+ break;
4833
+ }
4834
+ message.notifications.push(ServerMessage.decode(reader, reader.uint32()));
4835
+ continue;
4836
+ }
4837
+ }
4838
+ if ((tag & 7) === 4 || tag === 0) {
4839
+ break;
4840
+ }
4841
+ reader.skip(tag & 7);
4842
+ }
4843
+ return message;
4844
+ },
4845
+ fromJSON(object) {
4846
+ return {
4847
+ notifications: globalThis.Array.isArray(object?.notifications) ? object.notifications.map((e) => ServerMessage.fromJSON(e)) : []
4848
+ };
4849
+ },
4850
+ toJSON(message) {
4851
+ const obj = {};
4852
+ if (message.notifications?.length) {
4853
+ obj.notifications = message.notifications.map((e) => ServerMessage.toJSON(e));
4854
+ }
4855
+ return obj;
4856
+ },
4857
+ create(base) {
4858
+ return ServerMessage_NotificationBatch.fromPartial(base ?? {});
4859
+ },
4860
+ fromPartial(object) {
4861
+ const message = createBaseServerMessage_NotificationBatch();
4862
+ message.notifications = object.notifications?.map((e) => ServerMessage.fromPartial(e)) || [];
4863
+ return message;
4864
+ }
4865
+ };
4839
4866
  function isSet2(value) {
4840
4867
  return value !== null && value !== void 0;
4841
4868
  }
@@ -5762,7 +5789,20 @@ var getFishjamUrl = (config) => {
5762
5789
  }
5763
5790
  };
5764
5791
 
5765
- // src/ws_notifier.ts
5792
+ // src/notifications.ts
5793
+ var peerTypeMap = {
5794
+ [ServerMessage_PeerType.PEER_TYPE_UNSPECIFIED]: "unspecified",
5795
+ [ServerMessage_PeerType.PEER_TYPE_WEBRTC]: "webrtc",
5796
+ [ServerMessage_PeerType.PEER_TYPE_AGENT]: "agent",
5797
+ [ServerMessage_PeerType.PEER_TYPE_VAPI]: "vapi",
5798
+ [ServerMessage_PeerType.UNRECOGNIZED]: "unspecified"
5799
+ };
5800
+ var trackTypeMap = {
5801
+ [TrackType.TRACK_TYPE_UNSPECIFIED]: "unspecified",
5802
+ [TrackType.TRACK_TYPE_VIDEO]: "video",
5803
+ [TrackType.TRACK_TYPE_AUDIO]: "audio",
5804
+ [TrackType.UNRECOGNIZED]: "unspecified"
5805
+ };
5766
5806
  var expectedEventsList = [
5767
5807
  "roomCreated",
5768
5808
  "roomDeleted",
@@ -5773,14 +5813,39 @@ var expectedEventsList = [
5773
5813
  "peerDisconnected",
5774
5814
  "peerMetadataUpdated",
5775
5815
  "peerCrashed",
5776
- "streamConnected",
5777
- "streamDisconnected",
5816
+ "streamerConnected",
5817
+ "streamerDisconnected",
5778
5818
  "viewerConnected",
5779
5819
  "viewerDisconnected",
5780
5820
  "trackAdded",
5781
5821
  "trackRemoved",
5782
- "trackMetadataUpdated"
5822
+ "trackMetadataUpdated",
5823
+ "channelAdded",
5824
+ "channelRemoved"
5783
5825
  ];
5826
+ var peerEventsWithPeerType = /* @__PURE__ */ new Set([
5827
+ "peerAdded",
5828
+ "peerDeleted",
5829
+ "peerConnected",
5830
+ "peerDisconnected",
5831
+ "peerMetadataUpdated",
5832
+ "peerCrashed"
5833
+ ]);
5834
+ var trackEvents = /* @__PURE__ */ new Set(["trackAdded", "trackRemoved", "trackMetadataUpdated"]);
5835
+ var mapTrack = (track) => track && { id: track.id, type: trackTypeMap[track.type], metadata: track.metadata };
5836
+ var mapNotification = (event, msg) => {
5837
+ if (peerEventsWithPeerType.has(event)) {
5838
+ const peerMsg = msg;
5839
+ return { ...peerMsg, peerType: peerTypeMap[peerMsg.peerType] };
5840
+ }
5841
+ if (trackEvents.has(event)) {
5842
+ const trackMsg = msg;
5843
+ return { ...trackMsg, track: mapTrack(trackMsg.track) };
5844
+ }
5845
+ return msg;
5846
+ };
5847
+
5848
+ // src/ws_notifier.ts
5784
5849
  var FishjamWSNotifier = class extends EventEmitter {
5785
5850
  client;
5786
5851
  constructor(config, onError, onClose) {
@@ -5800,7 +5865,8 @@ var FishjamWSNotifier = class extends EventEmitter {
5800
5865
  const decodedMessage = ServerMessage.decode(data);
5801
5866
  const [notification, msg] = Object.entries(decodedMessage).find(([_k, v]) => v);
5802
5867
  if (!this.isExpectedEvent(notification)) return;
5803
- this.emit(notification, msg);
5868
+ const emit = this.emit;
5869
+ emit(notification, mapNotification(notification, msg));
5804
5870
  } catch (e) {
5805
5871
  console.error("Couldn't decode websocket server message", e, message);
5806
5872
  }
@@ -6030,10 +6096,10 @@ var FishjamClient = class {
6030
6096
  return response;
6031
6097
  });
6032
6098
  const fishjamUrl = getFishjamUrl(config);
6033
- this.moqApi = new MoqApi(void 0, fishjamUrl, client);
6034
- this.roomApi = new RoomApi(void 0, fishjamUrl, client);
6035
- this.viewerApi = new ViewerApi(void 0, fishjamUrl, client);
6036
- this.streamerApi = new StreamerApi(void 0, fishjamUrl, client);
6099
+ this.moqApi = new MoQApi(void 0, fishjamUrl, client);
6100
+ this.roomApi = new RoomsApi(void 0, fishjamUrl, client);
6101
+ this.viewerApi = new ViewersApi(void 0, fishjamUrl, client);
6102
+ this.streamerApi = new StreamersApi(void 0, fishjamUrl, client);
6037
6103
  this.fishjamConfig = config;
6038
6104
  }
6039
6105
  handleDeprecationHeader(headers) {
@@ -6221,24 +6287,12 @@ var FishjamClient = class {
6221
6287
  }
6222
6288
  }
6223
6289
  /**
6224
- * Creates a MoQ publisher token for the given stream.
6225
- * @returns a MoQ publisher token
6226
- */
6227
- async createMoqPublisherToken(streamId) {
6228
- try {
6229
- const tokenResponse = await this.moqApi.createMoqPublisherToken(streamId);
6230
- return tokenResponse.data;
6231
- } catch (error) {
6232
- throw mapException(error);
6233
- }
6234
- }
6235
- /**
6236
- * Creates a MoQ subscriber token for the given stream.
6237
- * @returns a MoQ subscriber token
6290
+ * Creates a MoQ token.
6291
+ * @returns a MoQ token
6238
6292
  */
6239
- async createMoqSubscriberToken(streamId) {
6293
+ async createMoqToken(config) {
6240
6294
  try {
6241
- const tokenResponse = await this.moqApi.createMoqSubscriberToken(streamId);
6295
+ const tokenResponse = await this.moqApi.createMoqToken(config);
6242
6296
  return tokenResponse.data;
6243
6297
  } catch (error) {
6244
6298
  throw mapException(error);