@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.js CHANGED
@@ -138,45 +138,17 @@ var VideoCodec = {
138
138
  H264: "h264",
139
139
  Vp8: "vp8"
140
140
  };
141
- var MoqApiAxiosParamCreator = function(configuration) {
141
+ var MoQApiAxiosParamCreator = function(configuration) {
142
142
  return {
143
143
  /**
144
- *
145
- * @summary Creates a MoQ publisher token for the given stream
146
- * @param {string} streamId Stream id
144
+ * Issue a short-lived JWT for a Media over QUIC client.
145
+ * @summary Create a MoQ token
146
+ * @param {MoqTokenConfig} [moqTokenConfig]
147
147
  * @param {*} [options] Override http request option.
148
148
  * @throws {RequiredError}
149
149
  */
150
- createMoqPublisherToken: async (streamId, options = {}) => {
151
- assertParamExists("createMoqPublisherToken", "streamId", streamId);
152
- const localVarPath = `/moq/{stream_id}/publisher`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
153
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
154
- let baseOptions;
155
- if (configuration) {
156
- baseOptions = configuration.baseOptions;
157
- }
158
- const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
159
- const localVarHeaderParameter = {};
160
- const localVarQueryParameter = {};
161
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
162
- setSearchParams(localVarUrlObj, localVarQueryParameter);
163
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
164
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
165
- return {
166
- url: toPathString(localVarUrlObj),
167
- options: localVarRequestOptions
168
- };
169
- },
170
- /**
171
- *
172
- * @summary Creates a MoQ subscriber token for the given stream
173
- * @param {string} streamId Stream id
174
- * @param {*} [options] Override http request option.
175
- * @throws {RequiredError}
176
- */
177
- createMoqSubscriberToken: async (streamId, options = {}) => {
178
- assertParamExists("createMoqSubscriberToken", "streamId", streamId);
179
- const localVarPath = `/moq/{stream_id}/subscriber`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
150
+ createMoqToken: async (moqTokenConfig, options = {}) => {
151
+ const localVarPath = `/moq/token`;
180
152
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
181
153
  let baseOptions;
182
154
  if (configuration) {
@@ -186,9 +158,11 @@ var MoqApiAxiosParamCreator = function(configuration) {
186
158
  const localVarHeaderParameter = {};
187
159
  const localVarQueryParameter = {};
188
160
  await setBearerAuthToObject(localVarHeaderParameter, configuration);
161
+ localVarHeaderParameter["Content-Type"] = "application/json";
189
162
  setSearchParams(localVarUrlObj, localVarQueryParameter);
190
163
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
191
164
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
165
+ localVarRequestOptions.data = serializeDataIfNeeded(moqTokenConfig, localVarRequestOptions, configuration);
192
166
  return {
193
167
  url: toPathString(localVarUrlObj),
194
168
  options: localVarRequestOptions
@@ -196,68 +170,44 @@ var MoqApiAxiosParamCreator = function(configuration) {
196
170
  }
197
171
  };
198
172
  };
199
- var MoqApiFp = function(configuration) {
200
- const localVarAxiosParamCreator = MoqApiAxiosParamCreator(configuration);
173
+ var MoQApiFp = function(configuration) {
174
+ const localVarAxiosParamCreator = MoQApiAxiosParamCreator(configuration);
201
175
  return {
202
176
  /**
203
- *
204
- * @summary Creates a MoQ publisher token for the given stream
205
- * @param {string} streamId Stream id
177
+ * Issue a short-lived JWT for a Media over QUIC client.
178
+ * @summary Create a MoQ token
179
+ * @param {MoqTokenConfig} [moqTokenConfig]
206
180
  * @param {*} [options] Override http request option.
207
181
  * @throws {RequiredError}
208
182
  */
209
- async createMoqPublisherToken(streamId, options) {
210
- const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqPublisherToken(streamId, options);
183
+ async createMoqToken(moqTokenConfig, options) {
184
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqToken(moqTokenConfig, options);
211
185
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
212
- const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqPublisherToken"]?.[localVarOperationServerIndex]?.url;
213
- return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
214
- },
215
- /**
216
- *
217
- * @summary Creates a MoQ subscriber token for the given stream
218
- * @param {string} streamId Stream id
219
- * @param {*} [options] Override http request option.
220
- * @throws {RequiredError}
221
- */
222
- async createMoqSubscriberToken(streamId, options) {
223
- const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqSubscriberToken(streamId, options);
224
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
225
- const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqSubscriberToken"]?.[localVarOperationServerIndex]?.url;
186
+ const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqToken"]?.[localVarOperationServerIndex]?.url;
226
187
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
227
188
  }
228
189
  };
229
190
  };
230
- var MoqApi = class extends BaseAPI {
191
+ var MoQApi = class extends BaseAPI {
231
192
  /**
232
- *
233
- * @summary Creates a MoQ publisher token for the given stream
234
- * @param {string} streamId Stream id
235
- * @param {*} [options] Override http request option.
236
- * @throws {RequiredError}
237
- * @memberof MoqApi
238
- */
239
- createMoqPublisherToken(streamId, options) {
240
- return MoqApiFp(this.configuration).createMoqPublisherToken(streamId, options).then((request) => request(this.axios, this.basePath));
241
- }
242
- /**
243
- *
244
- * @summary Creates a MoQ subscriber token for the given stream
245
- * @param {string} streamId Stream id
193
+ * Issue a short-lived JWT for a Media over QUIC client.
194
+ * @summary Create a MoQ token
195
+ * @param {MoqTokenConfig} [moqTokenConfig]
246
196
  * @param {*} [options] Override http request option.
247
197
  * @throws {RequiredError}
248
- * @memberof MoqApi
198
+ * @memberof MoQApi
249
199
  */
250
- createMoqSubscriberToken(streamId, options) {
251
- return MoqApiFp(this.configuration).createMoqSubscriberToken(streamId, options).then((request) => request(this.axios, this.basePath));
200
+ createMoqToken(moqTokenConfig, options) {
201
+ return MoQApiFp(this.configuration).createMoqToken(moqTokenConfig, options).then((request) => request(this.axios, this.basePath));
252
202
  }
253
203
  };
254
- var RoomApiAxiosParamCreator = function(configuration) {
204
+ var RoomsApiAxiosParamCreator = function(configuration) {
255
205
  return {
256
206
  /**
257
- *
258
- * @summary Create peer
207
+ * Add a peer to a room and return its connection token.
208
+ * @summary Create a peer
259
209
  * @param {string} roomId Room id
260
- * @param {PeerConfig} [peerConfig] Peer specification
210
+ * @param {PeerConfig} [peerConfig]
261
211
  * @param {*} [options] Override http request option.
262
212
  * @throws {RequiredError}
263
213
  */
@@ -284,9 +234,9 @@ var RoomApiAxiosParamCreator = function(configuration) {
284
234
  };
285
235
  },
286
236
  /**
287
- *
288
- * @summary Creates a room
289
- * @param {RoomConfig} [roomConfig] Room configuration
237
+ * Create a new room with the given configuration.
238
+ * @summary Create a room
239
+ * @param {RoomConfig} [roomConfig]
290
240
  * @param {*} [options] Override http request option.
291
241
  * @throws {RequiredError}
292
242
  */
@@ -312,8 +262,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
312
262
  };
313
263
  },
314
264
  /**
315
- *
316
- * @summary Delete peer
265
+ * Remove a peer from a room and disconnect it.
266
+ * @summary Delete a peer
317
267
  * @param {string} roomId Room id
318
268
  * @param {string} id Peer id
319
269
  * @param {*} [options] Override http request option.
@@ -341,8 +291,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
341
291
  };
342
292
  },
343
293
  /**
344
- *
345
- * @summary Delete the room
294
+ * Delete a room by id and disconnect all of its peers.
295
+ * @summary Delete a room
346
296
  * @param {string} roomId Room id
347
297
  * @param {*} [options] Override http request option.
348
298
  * @throws {RequiredError}
@@ -368,8 +318,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
368
318
  };
369
319
  },
370
320
  /**
371
- *
372
- * @summary Show information about all rooms
321
+ * List all rooms and livestreams.
322
+ * @summary List all rooms
373
323
  * @param {*} [options] Override http request option.
374
324
  * @throws {RequiredError}
375
325
  */
@@ -393,8 +343,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
393
343
  };
394
344
  },
395
345
  /**
396
- *
397
- * @summary Shows information about the room
346
+ * Get a room by id.
347
+ * @summary Get a room
398
348
  * @param {string} roomId Room ID
399
349
  * @param {*} [options] Override http request option.
400
350
  * @throws {RequiredError}
@@ -420,8 +370,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
420
370
  };
421
371
  },
422
372
  /**
423
- *
424
- * @summary Refresh peer token
373
+ * Issue a fresh connection token for an existing peer.
374
+ * @summary Refresh a peer token
425
375
  * @param {string} roomId Room id
426
376
  * @param {string} id Peer id
427
377
  * @param {*} [options] Override http request option.
@@ -449,8 +399,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
449
399
  };
450
400
  },
451
401
  /**
452
- *
453
- * @summary Subscribe peer to another peer\'s tracks
402
+ * Subscribe a peer to all current and future tracks published by another peer in the same room.
403
+ * @summary Subscribe a peer to another peer\'s tracks
454
404
  * @param {string} roomId Room id
455
405
  * @param {string} id Peer id
456
406
  * @param {string} [peerId] ID of the peer that produces the track
@@ -482,8 +432,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
482
432
  };
483
433
  },
484
434
  /**
485
- *
486
- * @summary Subscribe peer to specific tracks
435
+ * Subscribe a peer to a specific list of track IDs in the same room.
436
+ * @summary Subscribe a peer to specific tracks
487
437
  * @param {string} roomId Room id
488
438
  * @param {string} id Peer id
489
439
  * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
@@ -515,39 +465,39 @@ var RoomApiAxiosParamCreator = function(configuration) {
515
465
  }
516
466
  };
517
467
  };
518
- var RoomApiFp = function(configuration) {
519
- const localVarAxiosParamCreator = RoomApiAxiosParamCreator(configuration);
468
+ var RoomsApiFp = function(configuration) {
469
+ const localVarAxiosParamCreator = RoomsApiAxiosParamCreator(configuration);
520
470
  return {
521
471
  /**
522
- *
523
- * @summary Create peer
472
+ * Add a peer to a room and return its connection token.
473
+ * @summary Create a peer
524
474
  * @param {string} roomId Room id
525
- * @param {PeerConfig} [peerConfig] Peer specification
475
+ * @param {PeerConfig} [peerConfig]
526
476
  * @param {*} [options] Override http request option.
527
477
  * @throws {RequiredError}
528
478
  */
529
479
  async addPeer(roomId, peerConfig, options) {
530
480
  const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
531
481
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
532
- const localVarOperationServerBasePath = operationServerMap["RoomApi.addPeer"]?.[localVarOperationServerIndex]?.url;
482
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
533
483
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
534
484
  },
535
485
  /**
536
- *
537
- * @summary Creates a room
538
- * @param {RoomConfig} [roomConfig] Room configuration
486
+ * Create a new room with the given configuration.
487
+ * @summary Create a room
488
+ * @param {RoomConfig} [roomConfig]
539
489
  * @param {*} [options] Override http request option.
540
490
  * @throws {RequiredError}
541
491
  */
542
492
  async createRoom(roomConfig, options) {
543
493
  const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
544
494
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
545
- const localVarOperationServerBasePath = operationServerMap["RoomApi.createRoom"]?.[localVarOperationServerIndex]?.url;
495
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
546
496
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
547
497
  },
548
498
  /**
549
- *
550
- * @summary Delete peer
499
+ * Remove a peer from a room and disconnect it.
500
+ * @summary Delete a peer
551
501
  * @param {string} roomId Room id
552
502
  * @param {string} id Peer id
553
503
  * @param {*} [options] Override http request option.
@@ -556,12 +506,12 @@ var RoomApiFp = function(configuration) {
556
506
  async deletePeer(roomId, id, options) {
557
507
  const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
558
508
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
559
- const localVarOperationServerBasePath = operationServerMap["RoomApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
509
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
560
510
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
561
511
  },
562
512
  /**
563
- *
564
- * @summary Delete the room
513
+ * Delete a room by id and disconnect all of its peers.
514
+ * @summary Delete a room
565
515
  * @param {string} roomId Room id
566
516
  * @param {*} [options] Override http request option.
567
517
  * @throws {RequiredError}
@@ -569,24 +519,24 @@ var RoomApiFp = function(configuration) {
569
519
  async deleteRoom(roomId, options) {
570
520
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
571
521
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
572
- const localVarOperationServerBasePath = operationServerMap["RoomApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
522
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
573
523
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
574
524
  },
575
525
  /**
576
- *
577
- * @summary Show information about all rooms
526
+ * List all rooms and livestreams.
527
+ * @summary List all rooms
578
528
  * @param {*} [options] Override http request option.
579
529
  * @throws {RequiredError}
580
530
  */
581
531
  async getAllRooms(options) {
582
532
  const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
583
533
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
584
- const localVarOperationServerBasePath = operationServerMap["RoomApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
534
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
585
535
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
586
536
  },
587
537
  /**
588
- *
589
- * @summary Shows information about the room
538
+ * Get a room by id.
539
+ * @summary Get a room
590
540
  * @param {string} roomId Room ID
591
541
  * @param {*} [options] Override http request option.
592
542
  * @throws {RequiredError}
@@ -594,12 +544,12 @@ var RoomApiFp = function(configuration) {
594
544
  async getRoom(roomId, options) {
595
545
  const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
596
546
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
597
- const localVarOperationServerBasePath = operationServerMap["RoomApi.getRoom"]?.[localVarOperationServerIndex]?.url;
547
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
598
548
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
599
549
  },
600
550
  /**
601
- *
602
- * @summary Refresh peer token
551
+ * Issue a fresh connection token for an existing peer.
552
+ * @summary Refresh a peer token
603
553
  * @param {string} roomId Room id
604
554
  * @param {string} id Peer id
605
555
  * @param {*} [options] Override http request option.
@@ -608,12 +558,12 @@ var RoomApiFp = function(configuration) {
608
558
  async refreshToken(roomId, id, options) {
609
559
  const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
610
560
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
611
- const localVarOperationServerBasePath = operationServerMap["RoomApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
561
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
612
562
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
613
563
  },
614
564
  /**
615
- *
616
- * @summary Subscribe peer to another peer\'s tracks
565
+ * Subscribe a peer to all current and future tracks published by another peer in the same room.
566
+ * @summary Subscribe a peer to another peer\'s tracks
617
567
  * @param {string} roomId Room id
618
568
  * @param {string} id Peer id
619
569
  * @param {string} [peerId] ID of the peer that produces the track
@@ -623,12 +573,12 @@ var RoomApiFp = function(configuration) {
623
573
  async subscribePeer(roomId, id, peerId, options) {
624
574
  const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
625
575
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
626
- const localVarOperationServerBasePath = operationServerMap["RoomApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
576
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
627
577
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
628
578
  },
629
579
  /**
630
- *
631
- * @summary Subscribe peer to specific tracks
580
+ * Subscribe a peer to a specific list of track IDs in the same room.
581
+ * @summary Subscribe a peer to specific tracks
632
582
  * @param {string} roomId Room id
633
583
  * @param {string} id Peer id
634
584
  * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
@@ -638,123 +588,123 @@ var RoomApiFp = function(configuration) {
638
588
  async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
639
589
  const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(roomId, id, subscribeTracksRequest, options);
640
590
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
641
- const localVarOperationServerBasePath = operationServerMap["RoomApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
591
+ const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
642
592
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
643
593
  }
644
594
  };
645
595
  };
646
- var RoomApi = class extends BaseAPI {
596
+ var RoomsApi = class extends BaseAPI {
647
597
  /**
648
- *
649
- * @summary Create peer
598
+ * Add a peer to a room and return its connection token.
599
+ * @summary Create a peer
650
600
  * @param {string} roomId Room id
651
- * @param {PeerConfig} [peerConfig] Peer specification
601
+ * @param {PeerConfig} [peerConfig]
652
602
  * @param {*} [options] Override http request option.
653
603
  * @throws {RequiredError}
654
- * @memberof RoomApi
604
+ * @memberof RoomsApi
655
605
  */
656
606
  addPeer(roomId, peerConfig, options) {
657
- return RoomApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath));
607
+ return RoomsApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath));
658
608
  }
659
609
  /**
660
- *
661
- * @summary Creates a room
662
- * @param {RoomConfig} [roomConfig] Room configuration
610
+ * Create a new room with the given configuration.
611
+ * @summary Create a room
612
+ * @param {RoomConfig} [roomConfig]
663
613
  * @param {*} [options] Override http request option.
664
614
  * @throws {RequiredError}
665
- * @memberof RoomApi
615
+ * @memberof RoomsApi
666
616
  */
667
617
  createRoom(roomConfig, options) {
668
- return RoomApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath));
618
+ return RoomsApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath));
669
619
  }
670
620
  /**
671
- *
672
- * @summary Delete peer
621
+ * Remove a peer from a room and disconnect it.
622
+ * @summary Delete a peer
673
623
  * @param {string} roomId Room id
674
624
  * @param {string} id Peer id
675
625
  * @param {*} [options] Override http request option.
676
626
  * @throws {RequiredError}
677
- * @memberof RoomApi
627
+ * @memberof RoomsApi
678
628
  */
679
629
  deletePeer(roomId, id, options) {
680
- return RoomApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath));
630
+ return RoomsApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath));
681
631
  }
682
632
  /**
683
- *
684
- * @summary Delete the room
633
+ * Delete a room by id and disconnect all of its peers.
634
+ * @summary Delete a room
685
635
  * @param {string} roomId Room id
686
636
  * @param {*} [options] Override http request option.
687
637
  * @throws {RequiredError}
688
- * @memberof RoomApi
638
+ * @memberof RoomsApi
689
639
  */
690
640
  deleteRoom(roomId, options) {
691
- return RoomApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath));
641
+ return RoomsApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath));
692
642
  }
693
643
  /**
694
- *
695
- * @summary Show information about all rooms
644
+ * List all rooms and livestreams.
645
+ * @summary List all rooms
696
646
  * @param {*} [options] Override http request option.
697
647
  * @throws {RequiredError}
698
- * @memberof RoomApi
648
+ * @memberof RoomsApi
699
649
  */
700
650
  getAllRooms(options) {
701
- return RoomApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath));
651
+ return RoomsApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath));
702
652
  }
703
653
  /**
704
- *
705
- * @summary Shows information about the room
654
+ * Get a room by id.
655
+ * @summary Get a room
706
656
  * @param {string} roomId Room ID
707
657
  * @param {*} [options] Override http request option.
708
658
  * @throws {RequiredError}
709
- * @memberof RoomApi
659
+ * @memberof RoomsApi
710
660
  */
711
661
  getRoom(roomId, options) {
712
- return RoomApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath));
662
+ return RoomsApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath));
713
663
  }
714
664
  /**
715
- *
716
- * @summary Refresh peer token
665
+ * Issue a fresh connection token for an existing peer.
666
+ * @summary Refresh a peer token
717
667
  * @param {string} roomId Room id
718
668
  * @param {string} id Peer id
719
669
  * @param {*} [options] Override http request option.
720
670
  * @throws {RequiredError}
721
- * @memberof RoomApi
671
+ * @memberof RoomsApi
722
672
  */
723
673
  refreshToken(roomId, id, options) {
724
- return RoomApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
674
+ return RoomsApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
725
675
  }
726
676
  /**
727
- *
728
- * @summary Subscribe peer to another peer\'s tracks
677
+ * Subscribe a peer to all current and future tracks published by another peer in the same room.
678
+ * @summary Subscribe a peer to another peer\'s tracks
729
679
  * @param {string} roomId Room id
730
680
  * @param {string} id Peer id
731
681
  * @param {string} [peerId] ID of the peer that produces the track
732
682
  * @param {*} [options] Override http request option.
733
683
  * @throws {RequiredError}
734
- * @memberof RoomApi
684
+ * @memberof RoomsApi
735
685
  */
736
686
  subscribePeer(roomId, id, peerId, options) {
737
- return RoomApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
687
+ return RoomsApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
738
688
  }
739
689
  /**
740
- *
741
- * @summary Subscribe peer to specific tracks
690
+ * Subscribe a peer to a specific list of track IDs in the same room.
691
+ * @summary Subscribe a peer to specific tracks
742
692
  * @param {string} roomId Room id
743
693
  * @param {string} id Peer id
744
694
  * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
745
695
  * @param {*} [options] Override http request option.
746
696
  * @throws {RequiredError}
747
- * @memberof RoomApi
697
+ * @memberof RoomsApi
748
698
  */
749
699
  subscribeTracks(roomId, id, subscribeTracksRequest, options) {
750
- return RoomApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
700
+ return RoomsApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
751
701
  }
752
702
  };
753
- var StreamerApiAxiosParamCreator = function(configuration) {
703
+ var StreamersApiAxiosParamCreator = function(configuration) {
754
704
  return {
755
705
  /**
756
- *
757
- * @summary Creates streamer
706
+ * Create a streamer for a stream and return its credentials.
707
+ * @summary Create a streamer
758
708
  * @param {string} streamId Stream id
759
709
  * @param {*} [options] Override http request option.
760
710
  * @throws {RequiredError}
@@ -780,8 +730,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
780
730
  };
781
731
  },
782
732
  /**
783
- *
784
- * @summary Deletes streamer
733
+ * Delete a streamer from a stream and revoke its token.
734
+ * @summary Delete a streamer
785
735
  * @param {string} streamId Stream id
786
736
  * @param {string} streamerId Streamer id
787
737
  * @param {*} [options] Override http request option.
@@ -809,8 +759,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
809
759
  };
810
760
  },
811
761
  /**
812
- *
813
- * @summary Generate a token that can be used by a streamer to start streaming
762
+ * Issue a fresh streamer token.
763
+ * @summary Create a streamer token
814
764
  * @param {string} roomId ID of the stream.
815
765
  * @param {*} [options] Override http request option.
816
766
  * @throws {RequiredError}
@@ -837,12 +787,12 @@ var StreamerApiAxiosParamCreator = function(configuration) {
837
787
  }
838
788
  };
839
789
  };
840
- var StreamerApiFp = function(configuration) {
841
- const localVarAxiosParamCreator = StreamerApiAxiosParamCreator(configuration);
790
+ var StreamersApiFp = function(configuration) {
791
+ const localVarAxiosParamCreator = StreamersApiAxiosParamCreator(configuration);
842
792
  return {
843
793
  /**
844
- *
845
- * @summary Creates streamer
794
+ * Create a streamer for a stream and return its credentials.
795
+ * @summary Create a streamer
846
796
  * @param {string} streamId Stream id
847
797
  * @param {*} [options] Override http request option.
848
798
  * @throws {RequiredError}
@@ -850,12 +800,12 @@ var StreamerApiFp = function(configuration) {
850
800
  async createStreamer(streamId, options) {
851
801
  const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
852
802
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
853
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
803
+ const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
854
804
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
855
805
  },
856
806
  /**
857
- *
858
- * @summary Deletes streamer
807
+ * Delete a streamer from a stream and revoke its token.
808
+ * @summary Delete a streamer
859
809
  * @param {string} streamId Stream id
860
810
  * @param {string} streamerId Streamer id
861
811
  * @param {*} [options] Override http request option.
@@ -864,12 +814,12 @@ var StreamerApiFp = function(configuration) {
864
814
  async deleteStreamer(streamId, streamerId, options) {
865
815
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
866
816
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
867
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
817
+ const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
868
818
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
869
819
  },
870
820
  /**
871
- *
872
- * @summary Generate a token that can be used by a streamer to start streaming
821
+ * Issue a fresh streamer token.
822
+ * @summary Create a streamer token
873
823
  * @param {string} roomId ID of the stream.
874
824
  * @param {*} [options] Override http request option.
875
825
  * @throws {RequiredError}
@@ -877,52 +827,52 @@ var StreamerApiFp = function(configuration) {
877
827
  async generateStreamerToken(roomId, options) {
878
828
  const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
879
829
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
880
- const localVarOperationServerBasePath = operationServerMap["StreamerApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
830
+ const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
881
831
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
882
832
  }
883
833
  };
884
834
  };
885
- var StreamerApi = class extends BaseAPI {
835
+ var StreamersApi = class extends BaseAPI {
886
836
  /**
887
- *
888
- * @summary Creates streamer
837
+ * Create a streamer for a stream and return its credentials.
838
+ * @summary Create a streamer
889
839
  * @param {string} streamId Stream id
890
840
  * @param {*} [options] Override http request option.
891
841
  * @throws {RequiredError}
892
- * @memberof StreamerApi
842
+ * @memberof StreamersApi
893
843
  */
894
844
  createStreamer(streamId, options) {
895
- return StreamerApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
845
+ return StreamersApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
896
846
  }
897
847
  /**
898
- *
899
- * @summary Deletes streamer
848
+ * Delete a streamer from a stream and revoke its token.
849
+ * @summary Delete a streamer
900
850
  * @param {string} streamId Stream id
901
851
  * @param {string} streamerId Streamer id
902
852
  * @param {*} [options] Override http request option.
903
853
  * @throws {RequiredError}
904
- * @memberof StreamerApi
854
+ * @memberof StreamersApi
905
855
  */
906
856
  deleteStreamer(streamId, streamerId, options) {
907
- return StreamerApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
857
+ return StreamersApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
908
858
  }
909
859
  /**
910
- *
911
- * @summary Generate a token that can be used by a streamer to start streaming
860
+ * Issue a fresh streamer token.
861
+ * @summary Create a streamer token
912
862
  * @param {string} roomId ID of the stream.
913
863
  * @param {*} [options] Override http request option.
914
864
  * @throws {RequiredError}
915
- * @memberof StreamerApi
865
+ * @memberof StreamersApi
916
866
  */
917
867
  generateStreamerToken(roomId, options) {
918
- return StreamerApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
868
+ return StreamersApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
919
869
  }
920
870
  };
921
- var ViewerApiAxiosParamCreator = function(configuration) {
871
+ var ViewersApiAxiosParamCreator = function(configuration) {
922
872
  return {
923
873
  /**
924
- *
925
- * @summary Creates viewer
874
+ * Create a viewer for a stream and return its credentials.
875
+ * @summary Create a viewer
926
876
  * @param {string} streamId Stream id
927
877
  * @param {*} [options] Override http request option.
928
878
  * @throws {RequiredError}
@@ -948,8 +898,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
948
898
  };
949
899
  },
950
900
  /**
951
- *
952
- * @summary Deletes viewer
901
+ * Delete a viewer from a stream and revoke its token.
902
+ * @summary Delete a viewer
953
903
  * @param {string} streamId Stream id
954
904
  * @param {string} viewerId Viewer id
955
905
  * @param {*} [options] Override http request option.
@@ -977,8 +927,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
977
927
  };
978
928
  },
979
929
  /**
980
- *
981
- * @summary Generates token that a viewer can use to watch a livestream
930
+ * Issue a fresh viewer token.
931
+ * @summary Create a viewer token
982
932
  * @param {string} roomId ID of the stream.
983
933
  * @param {*} [options] Override http request option.
984
934
  * @throws {RequiredError}
@@ -1005,12 +955,12 @@ var ViewerApiAxiosParamCreator = function(configuration) {
1005
955
  }
1006
956
  };
1007
957
  };
1008
- var ViewerApiFp = function(configuration) {
1009
- const localVarAxiosParamCreator = ViewerApiAxiosParamCreator(configuration);
958
+ var ViewersApiFp = function(configuration) {
959
+ const localVarAxiosParamCreator = ViewersApiAxiosParamCreator(configuration);
1010
960
  return {
1011
961
  /**
1012
- *
1013
- * @summary Creates viewer
962
+ * Create a viewer for a stream and return its credentials.
963
+ * @summary Create a viewer
1014
964
  * @param {string} streamId Stream id
1015
965
  * @param {*} [options] Override http request option.
1016
966
  * @throws {RequiredError}
@@ -1018,12 +968,12 @@ var ViewerApiFp = function(configuration) {
1018
968
  async createViewer(streamId, options) {
1019
969
  const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
1020
970
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1021
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.createViewer"]?.[localVarOperationServerIndex]?.url;
971
+ const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
1022
972
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
1023
973
  },
1024
974
  /**
1025
- *
1026
- * @summary Deletes viewer
975
+ * Delete a viewer from a stream and revoke its token.
976
+ * @summary Delete a viewer
1027
977
  * @param {string} streamId Stream id
1028
978
  * @param {string} viewerId Viewer id
1029
979
  * @param {*} [options] Override http request option.
@@ -1032,12 +982,12 @@ var ViewerApiFp = function(configuration) {
1032
982
  async deleteViewer(streamId, viewerId, options) {
1033
983
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
1034
984
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1035
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
985
+ const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
1036
986
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
1037
987
  },
1038
988
  /**
1039
- *
1040
- * @summary Generates token that a viewer can use to watch a livestream
989
+ * Issue a fresh viewer token.
990
+ * @summary Create a viewer token
1041
991
  * @param {string} roomId ID of the stream.
1042
992
  * @param {*} [options] Override http request option.
1043
993
  * @throws {RequiredError}
@@ -1045,45 +995,45 @@ var ViewerApiFp = function(configuration) {
1045
995
  async generateViewerToken(roomId, options) {
1046
996
  const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
1047
997
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1048
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
998
+ const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
1049
999
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
1050
1000
  }
1051
1001
  };
1052
1002
  };
1053
- var ViewerApi = class extends BaseAPI {
1003
+ var ViewersApi = class extends BaseAPI {
1054
1004
  /**
1055
- *
1056
- * @summary Creates viewer
1005
+ * Create a viewer for a stream and return its credentials.
1006
+ * @summary Create a viewer
1057
1007
  * @param {string} streamId Stream id
1058
1008
  * @param {*} [options] Override http request option.
1059
1009
  * @throws {RequiredError}
1060
- * @memberof ViewerApi
1010
+ * @memberof ViewersApi
1061
1011
  */
1062
1012
  createViewer(streamId, options) {
1063
- return ViewerApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
1013
+ return ViewersApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
1064
1014
  }
1065
1015
  /**
1066
- *
1067
- * @summary Deletes viewer
1016
+ * Delete a viewer from a stream and revoke its token.
1017
+ * @summary Delete a viewer
1068
1018
  * @param {string} streamId Stream id
1069
1019
  * @param {string} viewerId Viewer id
1070
1020
  * @param {*} [options] Override http request option.
1071
1021
  * @throws {RequiredError}
1072
- * @memberof ViewerApi
1022
+ * @memberof ViewersApi
1073
1023
  */
1074
1024
  deleteViewer(streamId, viewerId, options) {
1075
- return ViewerApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
1025
+ return ViewersApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
1076
1026
  }
1077
1027
  /**
1078
- *
1079
- * @summary Generates token that a viewer can use to watch a livestream
1028
+ * Issue a fresh viewer token.
1029
+ * @summary Create a viewer token
1080
1030
  * @param {string} roomId ID of the stream.
1081
1031
  * @param {*} [options] Override http request option.
1082
1032
  * @throws {RequiredError}
1083
- * @memberof ViewerApi
1033
+ * @memberof ViewersApi
1084
1034
  */
1085
1035
  generateViewerToken(roomId, options) {
1086
- return ViewerApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
1036
+ return ViewersApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
1087
1037
  }
1088
1038
  };
1089
1039
 
@@ -1956,6 +1906,14 @@ var Track = {
1956
1906
  function isSet(value) {
1957
1907
  return value !== null && value !== void 0;
1958
1908
  }
1909
+ var ServerMessage_PeerType = /* @__PURE__ */ ((ServerMessage_PeerType2) => {
1910
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_UNSPECIFIED"] = 0] = "PEER_TYPE_UNSPECIFIED";
1911
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_WEBRTC"] = 1] = "PEER_TYPE_WEBRTC";
1912
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_AGENT"] = 2] = "PEER_TYPE_AGENT";
1913
+ ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_VAPI"] = 3] = "PEER_TYPE_VAPI";
1914
+ ServerMessage_PeerType2[ServerMessage_PeerType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1915
+ return ServerMessage_PeerType2;
1916
+ })(ServerMessage_PeerType || {});
1959
1917
  function serverMessage_PeerTypeFromJSON(object) {
1960
1918
  switch (object) {
1961
1919
  case 0:
@@ -2079,6 +2037,7 @@ function createBaseServerMessage() {
2079
2037
  viewerDisconnected: void 0,
2080
2038
  streamerConnected: void 0,
2081
2039
  streamerDisconnected: void 0,
2040
+ notificationBatch: void 0,
2082
2041
  streamConnected: void 0,
2083
2042
  streamDisconnected: void 0,
2084
2043
  hlsPlayable: void 0,
@@ -2164,6 +2123,9 @@ var ServerMessage = {
2164
2123
  if (message.streamerDisconnected !== void 0) {
2165
2124
  ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
2166
2125
  }
2126
+ if (message.notificationBatch !== void 0) {
2127
+ ServerMessage_NotificationBatch.encode(message.notificationBatch, writer.uint32(266).fork()).join();
2128
+ }
2167
2129
  if (message.streamConnected !== void 0) {
2168
2130
  ServerMessage_StreamConnected.encode(message.streamConnected, writer.uint32(178).fork()).join();
2169
2131
  }
@@ -2366,6 +2328,13 @@ var ServerMessage = {
2366
2328
  message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
2367
2329
  continue;
2368
2330
  }
2331
+ case 33: {
2332
+ if (tag !== 266) {
2333
+ break;
2334
+ }
2335
+ message.notificationBatch = ServerMessage_NotificationBatch.decode(reader, reader.uint32());
2336
+ continue;
2337
+ }
2369
2338
  case 22: {
2370
2339
  if (tag !== 178) {
2371
2340
  break;
@@ -2443,6 +2412,7 @@ var ServerMessage = {
2443
2412
  viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
2444
2413
  streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
2445
2414
  streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0,
2415
+ notificationBatch: isSet2(object.notificationBatch) ? ServerMessage_NotificationBatch.fromJSON(object.notificationBatch) : void 0,
2446
2416
  streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
2447
2417
  streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
2448
2418
  hlsPlayable: isSet2(object.hlsPlayable) ? ServerMessage_HlsPlayable.fromJSON(object.hlsPlayable) : void 0,
@@ -2528,6 +2498,9 @@ var ServerMessage = {
2528
2498
  if (message.streamerDisconnected !== void 0) {
2529
2499
  obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
2530
2500
  }
2501
+ if (message.notificationBatch !== void 0) {
2502
+ obj.notificationBatch = ServerMessage_NotificationBatch.toJSON(message.notificationBatch);
2503
+ }
2531
2504
  if (message.streamConnected !== void 0) {
2532
2505
  obj.streamConnected = ServerMessage_StreamConnected.toJSON(message.streamConnected);
2533
2506
  }
@@ -2578,6 +2551,7 @@ var ServerMessage = {
2578
2551
  message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
2579
2552
  message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
2580
2553
  message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
2554
+ message.notificationBatch = object.notificationBatch !== void 0 && object.notificationBatch !== null ? ServerMessage_NotificationBatch.fromPartial(object.notificationBatch) : void 0;
2581
2555
  message.streamConnected = object.streamConnected !== void 0 && object.streamConnected !== null ? ServerMessage_StreamConnected.fromPartial(object.streamConnected) : void 0;
2582
2556
  message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
2583
2557
  message.hlsPlayable = object.hlsPlayable !== void 0 && object.hlsPlayable !== null ? ServerMessage_HlsPlayable.fromPartial(object.hlsPlayable) : void 0;
@@ -4884,6 +4858,59 @@ var ServerMessage_StreamerDisconnected = {
4884
4858
  return message;
4885
4859
  }
4886
4860
  };
4861
+ function createBaseServerMessage_NotificationBatch() {
4862
+ return { notifications: [] };
4863
+ }
4864
+ var ServerMessage_NotificationBatch = {
4865
+ encode(message, writer = new BinaryWriter()) {
4866
+ for (const v of message.notifications) {
4867
+ ServerMessage.encode(v, writer.uint32(10).fork()).join();
4868
+ }
4869
+ return writer;
4870
+ },
4871
+ decode(input, length) {
4872
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4873
+ let end = length === void 0 ? reader.len : reader.pos + length;
4874
+ const message = createBaseServerMessage_NotificationBatch();
4875
+ while (reader.pos < end) {
4876
+ const tag = reader.uint32();
4877
+ switch (tag >>> 3) {
4878
+ case 1: {
4879
+ if (tag !== 10) {
4880
+ break;
4881
+ }
4882
+ message.notifications.push(ServerMessage.decode(reader, reader.uint32()));
4883
+ continue;
4884
+ }
4885
+ }
4886
+ if ((tag & 7) === 4 || tag === 0) {
4887
+ break;
4888
+ }
4889
+ reader.skip(tag & 7);
4890
+ }
4891
+ return message;
4892
+ },
4893
+ fromJSON(object) {
4894
+ return {
4895
+ notifications: globalThis.Array.isArray(object?.notifications) ? object.notifications.map((e) => ServerMessage.fromJSON(e)) : []
4896
+ };
4897
+ },
4898
+ toJSON(message) {
4899
+ const obj = {};
4900
+ if (message.notifications?.length) {
4901
+ obj.notifications = message.notifications.map((e) => ServerMessage.toJSON(e));
4902
+ }
4903
+ return obj;
4904
+ },
4905
+ create(base) {
4906
+ return ServerMessage_NotificationBatch.fromPartial(base ?? {});
4907
+ },
4908
+ fromPartial(object) {
4909
+ const message = createBaseServerMessage_NotificationBatch();
4910
+ message.notifications = object.notifications?.map((e) => ServerMessage.fromPartial(e)) || [];
4911
+ return message;
4912
+ }
4913
+ };
4887
4914
  function isSet2(value) {
4888
4915
  return value !== null && value !== void 0;
4889
4916
  }
@@ -5810,7 +5837,20 @@ var getFishjamUrl = (config) => {
5810
5837
  }
5811
5838
  };
5812
5839
 
5813
- // src/ws_notifier.ts
5840
+ // src/notifications.ts
5841
+ var peerTypeMap = {
5842
+ [ServerMessage_PeerType.PEER_TYPE_UNSPECIFIED]: "unspecified",
5843
+ [ServerMessage_PeerType.PEER_TYPE_WEBRTC]: "webrtc",
5844
+ [ServerMessage_PeerType.PEER_TYPE_AGENT]: "agent",
5845
+ [ServerMessage_PeerType.PEER_TYPE_VAPI]: "vapi",
5846
+ [ServerMessage_PeerType.UNRECOGNIZED]: "unspecified"
5847
+ };
5848
+ var trackTypeMap = {
5849
+ [TrackType.TRACK_TYPE_UNSPECIFIED]: "unspecified",
5850
+ [TrackType.TRACK_TYPE_VIDEO]: "video",
5851
+ [TrackType.TRACK_TYPE_AUDIO]: "audio",
5852
+ [TrackType.UNRECOGNIZED]: "unspecified"
5853
+ };
5814
5854
  var expectedEventsList = [
5815
5855
  "roomCreated",
5816
5856
  "roomDeleted",
@@ -5821,14 +5861,39 @@ var expectedEventsList = [
5821
5861
  "peerDisconnected",
5822
5862
  "peerMetadataUpdated",
5823
5863
  "peerCrashed",
5824
- "streamConnected",
5825
- "streamDisconnected",
5864
+ "streamerConnected",
5865
+ "streamerDisconnected",
5826
5866
  "viewerConnected",
5827
5867
  "viewerDisconnected",
5828
5868
  "trackAdded",
5829
5869
  "trackRemoved",
5830
- "trackMetadataUpdated"
5870
+ "trackMetadataUpdated",
5871
+ "channelAdded",
5872
+ "channelRemoved"
5831
5873
  ];
5874
+ var peerEventsWithPeerType = /* @__PURE__ */ new Set([
5875
+ "peerAdded",
5876
+ "peerDeleted",
5877
+ "peerConnected",
5878
+ "peerDisconnected",
5879
+ "peerMetadataUpdated",
5880
+ "peerCrashed"
5881
+ ]);
5882
+ var trackEvents = /* @__PURE__ */ new Set(["trackAdded", "trackRemoved", "trackMetadataUpdated"]);
5883
+ var mapTrack = (track) => track && { id: track.id, type: trackTypeMap[track.type], metadata: track.metadata };
5884
+ var mapNotification = (event, msg) => {
5885
+ if (peerEventsWithPeerType.has(event)) {
5886
+ const peerMsg = msg;
5887
+ return { ...peerMsg, peerType: peerTypeMap[peerMsg.peerType] };
5888
+ }
5889
+ if (trackEvents.has(event)) {
5890
+ const trackMsg = msg;
5891
+ return { ...trackMsg, track: mapTrack(trackMsg.track) };
5892
+ }
5893
+ return msg;
5894
+ };
5895
+
5896
+ // src/ws_notifier.ts
5832
5897
  var FishjamWSNotifier = class extends import_events.EventEmitter {
5833
5898
  client;
5834
5899
  constructor(config, onError, onClose) {
@@ -5848,7 +5913,8 @@ var FishjamWSNotifier = class extends import_events.EventEmitter {
5848
5913
  const decodedMessage = ServerMessage.decode(data);
5849
5914
  const [notification, msg] = Object.entries(decodedMessage).find(([_k, v]) => v);
5850
5915
  if (!this.isExpectedEvent(notification)) return;
5851
- this.emit(notification, msg);
5916
+ const emit = this.emit;
5917
+ emit(notification, mapNotification(notification, msg));
5852
5918
  } catch (e) {
5853
5919
  console.error("Couldn't decode websocket server message", e, message);
5854
5920
  }
@@ -6050,7 +6116,7 @@ var mapException = (error, entity) => {
6050
6116
  // package.json
6051
6117
  var package_default = {
6052
6118
  name: "@fishjam-cloud/js-server-sdk",
6053
- version: "0.27.0-rc.0",
6119
+ version: "0.27.0",
6054
6120
  description: "Fishjam server SDK for JavaScript",
6055
6121
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
6056
6122
  author: "Fishjam Team",
@@ -6173,10 +6239,10 @@ var FishjamClient = class {
6173
6239
  return response;
6174
6240
  });
6175
6241
  const fishjamUrl = getFishjamUrl(config);
6176
- this.moqApi = new MoqApi(void 0, fishjamUrl, client);
6177
- this.roomApi = new RoomApi(void 0, fishjamUrl, client);
6178
- this.viewerApi = new ViewerApi(void 0, fishjamUrl, client);
6179
- this.streamerApi = new StreamerApi(void 0, fishjamUrl, client);
6242
+ this.moqApi = new MoQApi(void 0, fishjamUrl, client);
6243
+ this.roomApi = new RoomsApi(void 0, fishjamUrl, client);
6244
+ this.viewerApi = new ViewersApi(void 0, fishjamUrl, client);
6245
+ this.streamerApi = new StreamersApi(void 0, fishjamUrl, client);
6180
6246
  this.fishjamConfig = config;
6181
6247
  }
6182
6248
  handleDeprecationHeader(headers) {
@@ -6364,24 +6430,12 @@ var FishjamClient = class {
6364
6430
  }
6365
6431
  }
6366
6432
  /**
6367
- * Creates a MoQ publisher token for the given stream.
6368
- * @returns a MoQ publisher token
6369
- */
6370
- async createMoqPublisherToken(streamId) {
6371
- try {
6372
- const tokenResponse = await this.moqApi.createMoqPublisherToken(streamId);
6373
- return tokenResponse.data;
6374
- } catch (error) {
6375
- throw mapException(error);
6376
- }
6377
- }
6378
- /**
6379
- * Creates a MoQ subscriber token for the given stream.
6380
- * @returns a MoQ subscriber token
6433
+ * Creates a MoQ token.
6434
+ * @returns a MoQ token
6381
6435
  */
6382
- async createMoqSubscriberToken(streamId) {
6436
+ async createMoqToken(config) {
6383
6437
  try {
6384
- const tokenResponse = await this.moqApi.createMoqSubscriberToken(streamId);
6438
+ const tokenResponse = await this.moqApi.createMoqToken(config);
6385
6439
  return tokenResponse.data;
6386
6440
  } catch (error) {
6387
6441
  throw mapException(error);