@fishjam-cloud/js-server-sdk 0.27.0-rc.1 → 0.28.0-rc.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/{chunk-B3H63SYI.mjs → chunk-GERVP75S.mjs} +3 -2
- package/dist/index.d.mts +203 -92
- package/dist/index.d.ts +203 -92
- package/dist/index.js +528 -201
- package/dist/index.mjs +524 -200
- package/dist/integrations/gemini.js +3 -2
- package/dist/integrations/gemini.mjs +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -37,9 +37,11 @@ __export(index_exports, {
|
|
|
37
37
|
FishjamNotFoundException: () => FishjamNotFoundException,
|
|
38
38
|
FishjamWSNotifier: () => FishjamWSNotifier,
|
|
39
39
|
ForbiddenException: () => ForbiddenException,
|
|
40
|
+
InvalidFishjamCredentialsException: () => InvalidFishjamCredentialsException,
|
|
40
41
|
MissingFishjamIdException: () => MissingFishjamIdException,
|
|
41
42
|
PeerNotFoundException: () => PeerNotFoundException,
|
|
42
43
|
PeerStatus: () => PeerStatus,
|
|
44
|
+
QuotaExceededException: () => QuotaExceededException,
|
|
43
45
|
RoomNotFoundException: () => RoomNotFoundException,
|
|
44
46
|
RoomType: () => RoomType,
|
|
45
47
|
ServerMessage: () => ServerMessage,
|
|
@@ -138,12 +140,75 @@ var VideoCodec = {
|
|
|
138
140
|
H264: "h264",
|
|
139
141
|
Vp8: "vp8"
|
|
140
142
|
};
|
|
141
|
-
var
|
|
143
|
+
var CredentialsApiAxiosParamCreator = function(configuration) {
|
|
142
144
|
return {
|
|
143
145
|
/**
|
|
144
|
-
*
|
|
145
|
-
* @summary
|
|
146
|
-
* @param {
|
|
146
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
147
|
+
* @summary Validate Fishjam Management Token
|
|
148
|
+
* @param {*} [options] Override http request option.
|
|
149
|
+
* @throws {RequiredError}
|
|
150
|
+
*/
|
|
151
|
+
validateCredentials: async (options = {}) => {
|
|
152
|
+
const localVarPath = `/validate`;
|
|
153
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
154
|
+
let baseOptions;
|
|
155
|
+
if (configuration) {
|
|
156
|
+
baseOptions = configuration.baseOptions;
|
|
157
|
+
}
|
|
158
|
+
const localVarRequestOptions = { method: "GET", ...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
|
+
var CredentialsApiFp = function(configuration) {
|
|
173
|
+
const localVarAxiosParamCreator = CredentialsApiAxiosParamCreator(configuration);
|
|
174
|
+
return {
|
|
175
|
+
/**
|
|
176
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
177
|
+
* @summary Validate Fishjam Management Token
|
|
178
|
+
* @param {*} [options] Override http request option.
|
|
179
|
+
* @throws {RequiredError}
|
|
180
|
+
*/
|
|
181
|
+
async validateCredentials(options) {
|
|
182
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options);
|
|
183
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
184
|
+
const localVarOperationServerBasePath = operationServerMap["CredentialsApi.validateCredentials"]?.[localVarOperationServerIndex]?.url;
|
|
185
|
+
return (axios2, basePath) => createRequestFunction(
|
|
186
|
+
localVarAxiosArgs,
|
|
187
|
+
import_axios.default,
|
|
188
|
+
BASE_PATH,
|
|
189
|
+
configuration
|
|
190
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
var CredentialsApi = class extends BaseAPI {
|
|
195
|
+
/**
|
|
196
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
197
|
+
* @summary Validate Fishjam Management Token
|
|
198
|
+
* @param {*} [options] Override http request option.
|
|
199
|
+
* @throws {RequiredError}
|
|
200
|
+
* @memberof CredentialsApi
|
|
201
|
+
*/
|
|
202
|
+
validateCredentials(options) {
|
|
203
|
+
return CredentialsApiFp(this.configuration).validateCredentials(options).then((request) => request(this.axios, this.basePath));
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
var MoQApiAxiosParamCreator = function(configuration) {
|
|
207
|
+
return {
|
|
208
|
+
/**
|
|
209
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
210
|
+
* @summary Create a MoQ token
|
|
211
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
147
212
|
* @param {*} [options] Override http request option.
|
|
148
213
|
* @throws {RequiredError}
|
|
149
214
|
*/
|
|
@@ -170,44 +235,49 @@ var MoqApiAxiosParamCreator = function(configuration) {
|
|
|
170
235
|
}
|
|
171
236
|
};
|
|
172
237
|
};
|
|
173
|
-
var
|
|
174
|
-
const localVarAxiosParamCreator =
|
|
238
|
+
var MoQApiFp = function(configuration) {
|
|
239
|
+
const localVarAxiosParamCreator = MoQApiAxiosParamCreator(configuration);
|
|
175
240
|
return {
|
|
176
241
|
/**
|
|
177
|
-
*
|
|
178
|
-
* @summary
|
|
179
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
242
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
243
|
+
* @summary Create a MoQ token
|
|
244
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
180
245
|
* @param {*} [options] Override http request option.
|
|
181
246
|
* @throws {RequiredError}
|
|
182
247
|
*/
|
|
183
248
|
async createMoqToken(moqTokenConfig, options) {
|
|
184
249
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqToken(moqTokenConfig, options);
|
|
185
250
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
186
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
187
|
-
return (axios2, basePath) => createRequestFunction(
|
|
251
|
+
const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqToken"]?.[localVarOperationServerIndex]?.url;
|
|
252
|
+
return (axios2, basePath) => createRequestFunction(
|
|
253
|
+
localVarAxiosArgs,
|
|
254
|
+
import_axios.default,
|
|
255
|
+
BASE_PATH,
|
|
256
|
+
configuration
|
|
257
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
188
258
|
}
|
|
189
259
|
};
|
|
190
260
|
};
|
|
191
|
-
var
|
|
261
|
+
var MoQApi = class extends BaseAPI {
|
|
192
262
|
/**
|
|
193
|
-
*
|
|
194
|
-
* @summary
|
|
195
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
263
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
264
|
+
* @summary Create a MoQ token
|
|
265
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
196
266
|
* @param {*} [options] Override http request option.
|
|
197
267
|
* @throws {RequiredError}
|
|
198
|
-
* @memberof
|
|
268
|
+
* @memberof MoQApi
|
|
199
269
|
*/
|
|
200
270
|
createMoqToken(moqTokenConfig, options) {
|
|
201
|
-
return
|
|
271
|
+
return MoQApiFp(this.configuration).createMoqToken(moqTokenConfig, options).then((request) => request(this.axios, this.basePath));
|
|
202
272
|
}
|
|
203
273
|
};
|
|
204
|
-
var
|
|
274
|
+
var RoomsApiAxiosParamCreator = function(configuration) {
|
|
205
275
|
return {
|
|
206
276
|
/**
|
|
207
|
-
*
|
|
208
|
-
* @summary Create peer
|
|
277
|
+
* Add a peer to a room and return its connection token.
|
|
278
|
+
* @summary Create a peer
|
|
209
279
|
* @param {string} roomId Room id
|
|
210
|
-
* @param {PeerConfig} [peerConfig]
|
|
280
|
+
* @param {PeerConfig} [peerConfig]
|
|
211
281
|
* @param {*} [options] Override http request option.
|
|
212
282
|
* @throws {RequiredError}
|
|
213
283
|
*/
|
|
@@ -234,9 +304,9 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
234
304
|
};
|
|
235
305
|
},
|
|
236
306
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @summary
|
|
239
|
-
* @param {RoomConfig} [roomConfig]
|
|
307
|
+
* Create a new room with the given configuration.
|
|
308
|
+
* @summary Create a room
|
|
309
|
+
* @param {RoomConfig} [roomConfig]
|
|
240
310
|
* @param {*} [options] Override http request option.
|
|
241
311
|
* @throws {RequiredError}
|
|
242
312
|
*/
|
|
@@ -262,8 +332,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
262
332
|
};
|
|
263
333
|
},
|
|
264
334
|
/**
|
|
265
|
-
*
|
|
266
|
-
* @summary Delete peer
|
|
335
|
+
* Remove a peer from a room and disconnect it.
|
|
336
|
+
* @summary Delete a peer
|
|
267
337
|
* @param {string} roomId Room id
|
|
268
338
|
* @param {string} id Peer id
|
|
269
339
|
* @param {*} [options] Override http request option.
|
|
@@ -291,8 +361,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
291
361
|
};
|
|
292
362
|
},
|
|
293
363
|
/**
|
|
294
|
-
*
|
|
295
|
-
* @summary Delete
|
|
364
|
+
* Delete a room by id and disconnect all of its peers.
|
|
365
|
+
* @summary Delete a room
|
|
296
366
|
* @param {string} roomId Room id
|
|
297
367
|
* @param {*} [options] Override http request option.
|
|
298
368
|
* @throws {RequiredError}
|
|
@@ -318,8 +388,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
318
388
|
};
|
|
319
389
|
},
|
|
320
390
|
/**
|
|
321
|
-
*
|
|
322
|
-
* @summary
|
|
391
|
+
* List all rooms and livestreams.
|
|
392
|
+
* @summary List all rooms
|
|
323
393
|
* @param {*} [options] Override http request option.
|
|
324
394
|
* @throws {RequiredError}
|
|
325
395
|
*/
|
|
@@ -343,8 +413,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
343
413
|
};
|
|
344
414
|
},
|
|
345
415
|
/**
|
|
346
|
-
*
|
|
347
|
-
* @summary
|
|
416
|
+
* Get a room by id.
|
|
417
|
+
* @summary Get a room
|
|
348
418
|
* @param {string} roomId Room ID
|
|
349
419
|
* @param {*} [options] Override http request option.
|
|
350
420
|
* @throws {RequiredError}
|
|
@@ -370,8 +440,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
370
440
|
};
|
|
371
441
|
},
|
|
372
442
|
/**
|
|
373
|
-
*
|
|
374
|
-
* @summary Refresh peer token
|
|
443
|
+
* Issue a fresh connection token for an existing peer.
|
|
444
|
+
* @summary Refresh a peer token
|
|
375
445
|
* @param {string} roomId Room id
|
|
376
446
|
* @param {string} id Peer id
|
|
377
447
|
* @param {*} [options] Override http request option.
|
|
@@ -399,8 +469,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
399
469
|
};
|
|
400
470
|
},
|
|
401
471
|
/**
|
|
402
|
-
*
|
|
403
|
-
* @summary Subscribe peer to another peer\'s tracks
|
|
472
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
473
|
+
* @summary Subscribe a peer to another peer\'s tracks
|
|
404
474
|
* @param {string} roomId Room id
|
|
405
475
|
* @param {string} id Peer id
|
|
406
476
|
* @param {string} [peerId] ID of the peer that produces the track
|
|
@@ -432,8 +502,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
432
502
|
};
|
|
433
503
|
},
|
|
434
504
|
/**
|
|
435
|
-
*
|
|
436
|
-
* @summary Subscribe peer to specific tracks
|
|
505
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
506
|
+
* @summary Subscribe a peer to specific tracks
|
|
437
507
|
* @param {string} roomId Room id
|
|
438
508
|
* @param {string} id Peer id
|
|
439
509
|
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
@@ -457,7 +527,11 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
457
527
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
458
528
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
459
529
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
460
|
-
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
530
|
+
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
531
|
+
subscribeTracksRequest,
|
|
532
|
+
localVarRequestOptions,
|
|
533
|
+
configuration
|
|
534
|
+
);
|
|
461
535
|
return {
|
|
462
536
|
url: toPathString(localVarUrlObj),
|
|
463
537
|
options: localVarRequestOptions
|
|
@@ -465,39 +539,49 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
465
539
|
}
|
|
466
540
|
};
|
|
467
541
|
};
|
|
468
|
-
var
|
|
469
|
-
const localVarAxiosParamCreator =
|
|
542
|
+
var RoomsApiFp = function(configuration) {
|
|
543
|
+
const localVarAxiosParamCreator = RoomsApiAxiosParamCreator(configuration);
|
|
470
544
|
return {
|
|
471
545
|
/**
|
|
472
|
-
*
|
|
473
|
-
* @summary Create peer
|
|
546
|
+
* Add a peer to a room and return its connection token.
|
|
547
|
+
* @summary Create a peer
|
|
474
548
|
* @param {string} roomId Room id
|
|
475
|
-
* @param {PeerConfig} [peerConfig]
|
|
549
|
+
* @param {PeerConfig} [peerConfig]
|
|
476
550
|
* @param {*} [options] Override http request option.
|
|
477
551
|
* @throws {RequiredError}
|
|
478
552
|
*/
|
|
479
553
|
async addPeer(roomId, peerConfig, options) {
|
|
480
554
|
const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
|
|
481
555
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
482
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
483
|
-
return (axios2, basePath) => createRequestFunction(
|
|
556
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
|
|
557
|
+
return (axios2, basePath) => createRequestFunction(
|
|
558
|
+
localVarAxiosArgs,
|
|
559
|
+
import_axios.default,
|
|
560
|
+
BASE_PATH,
|
|
561
|
+
configuration
|
|
562
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
484
563
|
},
|
|
485
564
|
/**
|
|
486
|
-
*
|
|
487
|
-
* @summary
|
|
488
|
-
* @param {RoomConfig} [roomConfig]
|
|
565
|
+
* Create a new room with the given configuration.
|
|
566
|
+
* @summary Create a room
|
|
567
|
+
* @param {RoomConfig} [roomConfig]
|
|
489
568
|
* @param {*} [options] Override http request option.
|
|
490
569
|
* @throws {RequiredError}
|
|
491
570
|
*/
|
|
492
571
|
async createRoom(roomConfig, options) {
|
|
493
572
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
|
|
494
573
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
495
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
496
|
-
return (axios2, basePath) => createRequestFunction(
|
|
574
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
|
|
575
|
+
return (axios2, basePath) => createRequestFunction(
|
|
576
|
+
localVarAxiosArgs,
|
|
577
|
+
import_axios.default,
|
|
578
|
+
BASE_PATH,
|
|
579
|
+
configuration
|
|
580
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
497
581
|
},
|
|
498
582
|
/**
|
|
499
|
-
*
|
|
500
|
-
* @summary Delete peer
|
|
583
|
+
* Remove a peer from a room and disconnect it.
|
|
584
|
+
* @summary Delete a peer
|
|
501
585
|
* @param {string} roomId Room id
|
|
502
586
|
* @param {string} id Peer id
|
|
503
587
|
* @param {*} [options] Override http request option.
|
|
@@ -506,12 +590,17 @@ var RoomApiFp = function(configuration) {
|
|
|
506
590
|
async deletePeer(roomId, id, options) {
|
|
507
591
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
|
|
508
592
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
509
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
510
|
-
return (axios2, basePath) => createRequestFunction(
|
|
593
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
|
|
594
|
+
return (axios2, basePath) => createRequestFunction(
|
|
595
|
+
localVarAxiosArgs,
|
|
596
|
+
import_axios.default,
|
|
597
|
+
BASE_PATH,
|
|
598
|
+
configuration
|
|
599
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
511
600
|
},
|
|
512
601
|
/**
|
|
513
|
-
*
|
|
514
|
-
* @summary Delete
|
|
602
|
+
* Delete a room by id and disconnect all of its peers.
|
|
603
|
+
* @summary Delete a room
|
|
515
604
|
* @param {string} roomId Room id
|
|
516
605
|
* @param {*} [options] Override http request option.
|
|
517
606
|
* @throws {RequiredError}
|
|
@@ -519,24 +608,34 @@ var RoomApiFp = function(configuration) {
|
|
|
519
608
|
async deleteRoom(roomId, options) {
|
|
520
609
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
|
|
521
610
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
522
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
523
|
-
return (axios2, basePath) => createRequestFunction(
|
|
611
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
|
|
612
|
+
return (axios2, basePath) => createRequestFunction(
|
|
613
|
+
localVarAxiosArgs,
|
|
614
|
+
import_axios.default,
|
|
615
|
+
BASE_PATH,
|
|
616
|
+
configuration
|
|
617
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
524
618
|
},
|
|
525
619
|
/**
|
|
526
|
-
*
|
|
527
|
-
* @summary
|
|
620
|
+
* List all rooms and livestreams.
|
|
621
|
+
* @summary List all rooms
|
|
528
622
|
* @param {*} [options] Override http request option.
|
|
529
623
|
* @throws {RequiredError}
|
|
530
624
|
*/
|
|
531
625
|
async getAllRooms(options) {
|
|
532
626
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
|
|
533
627
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
534
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
535
|
-
return (axios2, basePath) => createRequestFunction(
|
|
628
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
|
|
629
|
+
return (axios2, basePath) => createRequestFunction(
|
|
630
|
+
localVarAxiosArgs,
|
|
631
|
+
import_axios.default,
|
|
632
|
+
BASE_PATH,
|
|
633
|
+
configuration
|
|
634
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
536
635
|
},
|
|
537
636
|
/**
|
|
538
|
-
*
|
|
539
|
-
* @summary
|
|
637
|
+
* Get a room by id.
|
|
638
|
+
* @summary Get a room
|
|
540
639
|
* @param {string} roomId Room ID
|
|
541
640
|
* @param {*} [options] Override http request option.
|
|
542
641
|
* @throws {RequiredError}
|
|
@@ -544,12 +643,17 @@ var RoomApiFp = function(configuration) {
|
|
|
544
643
|
async getRoom(roomId, options) {
|
|
545
644
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
|
|
546
645
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
547
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
548
|
-
return (axios2, basePath) => createRequestFunction(
|
|
646
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
|
|
647
|
+
return (axios2, basePath) => createRequestFunction(
|
|
648
|
+
localVarAxiosArgs,
|
|
649
|
+
import_axios.default,
|
|
650
|
+
BASE_PATH,
|
|
651
|
+
configuration
|
|
652
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
549
653
|
},
|
|
550
654
|
/**
|
|
551
|
-
*
|
|
552
|
-
* @summary Refresh peer token
|
|
655
|
+
* Issue a fresh connection token for an existing peer.
|
|
656
|
+
* @summary Refresh a peer token
|
|
553
657
|
* @param {string} roomId Room id
|
|
554
658
|
* @param {string} id Peer id
|
|
555
659
|
* @param {*} [options] Override http request option.
|
|
@@ -558,12 +662,17 @@ var RoomApiFp = function(configuration) {
|
|
|
558
662
|
async refreshToken(roomId, id, options) {
|
|
559
663
|
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
|
|
560
664
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
561
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
562
|
-
return (axios2, basePath) => createRequestFunction(
|
|
665
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
|
|
666
|
+
return (axios2, basePath) => createRequestFunction(
|
|
667
|
+
localVarAxiosArgs,
|
|
668
|
+
import_axios.default,
|
|
669
|
+
BASE_PATH,
|
|
670
|
+
configuration
|
|
671
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
563
672
|
},
|
|
564
673
|
/**
|
|
565
|
-
*
|
|
566
|
-
* @summary Subscribe peer to another peer\'s tracks
|
|
674
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
675
|
+
* @summary Subscribe a peer to another peer\'s tracks
|
|
567
676
|
* @param {string} roomId Room id
|
|
568
677
|
* @param {string} id Peer id
|
|
569
678
|
* @param {string} [peerId] ID of the peer that produces the track
|
|
@@ -573,12 +682,17 @@ var RoomApiFp = function(configuration) {
|
|
|
573
682
|
async subscribePeer(roomId, id, peerId, options) {
|
|
574
683
|
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
|
|
575
684
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
576
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
577
|
-
return (axios2, basePath) => createRequestFunction(
|
|
685
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
|
|
686
|
+
return (axios2, basePath) => createRequestFunction(
|
|
687
|
+
localVarAxiosArgs,
|
|
688
|
+
import_axios.default,
|
|
689
|
+
BASE_PATH,
|
|
690
|
+
configuration
|
|
691
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
578
692
|
},
|
|
579
693
|
/**
|
|
580
|
-
*
|
|
581
|
-
* @summary Subscribe peer to specific tracks
|
|
694
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
695
|
+
* @summary Subscribe a peer to specific tracks
|
|
582
696
|
* @param {string} roomId Room id
|
|
583
697
|
* @param {string} id Peer id
|
|
584
698
|
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
@@ -586,132 +700,145 @@ var RoomApiFp = function(configuration) {
|
|
|
586
700
|
* @throws {RequiredError}
|
|
587
701
|
*/
|
|
588
702
|
async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
589
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
703
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
704
|
+
roomId,
|
|
705
|
+
id,
|
|
706
|
+
subscribeTracksRequest,
|
|
707
|
+
options
|
|
708
|
+
);
|
|
590
709
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
591
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
592
|
-
return (axios2, basePath) => createRequestFunction(
|
|
710
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
|
|
711
|
+
return (axios2, basePath) => createRequestFunction(
|
|
712
|
+
localVarAxiosArgs,
|
|
713
|
+
import_axios.default,
|
|
714
|
+
BASE_PATH,
|
|
715
|
+
configuration
|
|
716
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
593
717
|
}
|
|
594
718
|
};
|
|
595
719
|
};
|
|
596
|
-
var
|
|
720
|
+
var RoomsApi = class extends BaseAPI {
|
|
597
721
|
/**
|
|
598
|
-
*
|
|
599
|
-
* @summary Create peer
|
|
722
|
+
* Add a peer to a room and return its connection token.
|
|
723
|
+
* @summary Create a peer
|
|
600
724
|
* @param {string} roomId Room id
|
|
601
|
-
* @param {PeerConfig} [peerConfig]
|
|
725
|
+
* @param {PeerConfig} [peerConfig]
|
|
602
726
|
* @param {*} [options] Override http request option.
|
|
603
727
|
* @throws {RequiredError}
|
|
604
|
-
* @memberof
|
|
728
|
+
* @memberof RoomsApi
|
|
605
729
|
*/
|
|
606
730
|
addPeer(roomId, peerConfig, options) {
|
|
607
|
-
return
|
|
731
|
+
return RoomsApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath));
|
|
608
732
|
}
|
|
609
733
|
/**
|
|
610
|
-
*
|
|
611
|
-
* @summary
|
|
612
|
-
* @param {RoomConfig} [roomConfig]
|
|
734
|
+
* Create a new room with the given configuration.
|
|
735
|
+
* @summary Create a room
|
|
736
|
+
* @param {RoomConfig} [roomConfig]
|
|
613
737
|
* @param {*} [options] Override http request option.
|
|
614
738
|
* @throws {RequiredError}
|
|
615
|
-
* @memberof
|
|
739
|
+
* @memberof RoomsApi
|
|
616
740
|
*/
|
|
617
741
|
createRoom(roomConfig, options) {
|
|
618
|
-
return
|
|
742
|
+
return RoomsApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath));
|
|
619
743
|
}
|
|
620
744
|
/**
|
|
621
|
-
*
|
|
622
|
-
* @summary Delete peer
|
|
745
|
+
* Remove a peer from a room and disconnect it.
|
|
746
|
+
* @summary Delete a peer
|
|
623
747
|
* @param {string} roomId Room id
|
|
624
748
|
* @param {string} id Peer id
|
|
625
749
|
* @param {*} [options] Override http request option.
|
|
626
750
|
* @throws {RequiredError}
|
|
627
|
-
* @memberof
|
|
751
|
+
* @memberof RoomsApi
|
|
628
752
|
*/
|
|
629
753
|
deletePeer(roomId, id, options) {
|
|
630
|
-
return
|
|
754
|
+
return RoomsApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath));
|
|
631
755
|
}
|
|
632
756
|
/**
|
|
633
|
-
*
|
|
634
|
-
* @summary Delete
|
|
757
|
+
* Delete a room by id and disconnect all of its peers.
|
|
758
|
+
* @summary Delete a room
|
|
635
759
|
* @param {string} roomId Room id
|
|
636
760
|
* @param {*} [options] Override http request option.
|
|
637
761
|
* @throws {RequiredError}
|
|
638
|
-
* @memberof
|
|
762
|
+
* @memberof RoomsApi
|
|
639
763
|
*/
|
|
640
764
|
deleteRoom(roomId, options) {
|
|
641
|
-
return
|
|
765
|
+
return RoomsApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
642
766
|
}
|
|
643
767
|
/**
|
|
644
|
-
*
|
|
645
|
-
* @summary
|
|
768
|
+
* List all rooms and livestreams.
|
|
769
|
+
* @summary List all rooms
|
|
646
770
|
* @param {*} [options] Override http request option.
|
|
647
771
|
* @throws {RequiredError}
|
|
648
|
-
* @memberof
|
|
772
|
+
* @memberof RoomsApi
|
|
649
773
|
*/
|
|
650
774
|
getAllRooms(options) {
|
|
651
|
-
return
|
|
775
|
+
return RoomsApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath));
|
|
652
776
|
}
|
|
653
777
|
/**
|
|
654
|
-
*
|
|
655
|
-
* @summary
|
|
778
|
+
* Get a room by id.
|
|
779
|
+
* @summary Get a room
|
|
656
780
|
* @param {string} roomId Room ID
|
|
657
781
|
* @param {*} [options] Override http request option.
|
|
658
782
|
* @throws {RequiredError}
|
|
659
|
-
* @memberof
|
|
783
|
+
* @memberof RoomsApi
|
|
660
784
|
*/
|
|
661
785
|
getRoom(roomId, options) {
|
|
662
|
-
return
|
|
786
|
+
return RoomsApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
663
787
|
}
|
|
664
788
|
/**
|
|
665
|
-
*
|
|
666
|
-
* @summary Refresh peer token
|
|
789
|
+
* Issue a fresh connection token for an existing peer.
|
|
790
|
+
* @summary Refresh a peer token
|
|
667
791
|
* @param {string} roomId Room id
|
|
668
792
|
* @param {string} id Peer id
|
|
669
793
|
* @param {*} [options] Override http request option.
|
|
670
794
|
* @throws {RequiredError}
|
|
671
|
-
* @memberof
|
|
795
|
+
* @memberof RoomsApi
|
|
672
796
|
*/
|
|
673
797
|
refreshToken(roomId, id, options) {
|
|
674
|
-
return
|
|
798
|
+
return RoomsApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
|
|
675
799
|
}
|
|
676
800
|
/**
|
|
677
|
-
*
|
|
678
|
-
* @summary Subscribe peer to another peer\'s tracks
|
|
801
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
802
|
+
* @summary Subscribe a peer to another peer\'s tracks
|
|
679
803
|
* @param {string} roomId Room id
|
|
680
804
|
* @param {string} id Peer id
|
|
681
805
|
* @param {string} [peerId] ID of the peer that produces the track
|
|
682
806
|
* @param {*} [options] Override http request option.
|
|
683
807
|
* @throws {RequiredError}
|
|
684
|
-
* @memberof
|
|
808
|
+
* @memberof RoomsApi
|
|
685
809
|
*/
|
|
686
810
|
subscribePeer(roomId, id, peerId, options) {
|
|
687
|
-
return
|
|
811
|
+
return RoomsApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
|
|
688
812
|
}
|
|
689
813
|
/**
|
|
690
|
-
*
|
|
691
|
-
* @summary Subscribe peer to specific tracks
|
|
814
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
815
|
+
* @summary Subscribe a peer to specific tracks
|
|
692
816
|
* @param {string} roomId Room id
|
|
693
817
|
* @param {string} id Peer id
|
|
694
818
|
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
695
819
|
* @param {*} [options] Override http request option.
|
|
696
820
|
* @throws {RequiredError}
|
|
697
|
-
* @memberof
|
|
821
|
+
* @memberof RoomsApi
|
|
698
822
|
*/
|
|
699
823
|
subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
700
|
-
return
|
|
824
|
+
return RoomsApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
|
|
701
825
|
}
|
|
702
826
|
};
|
|
703
|
-
var
|
|
827
|
+
var StreamersApiAxiosParamCreator = function(configuration) {
|
|
704
828
|
return {
|
|
705
829
|
/**
|
|
706
|
-
*
|
|
707
|
-
* @summary
|
|
830
|
+
* Create a streamer for a stream and return its credentials.
|
|
831
|
+
* @summary Create a streamer
|
|
708
832
|
* @param {string} streamId Stream id
|
|
709
833
|
* @param {*} [options] Override http request option.
|
|
710
834
|
* @throws {RequiredError}
|
|
711
835
|
*/
|
|
712
836
|
createStreamer: async (streamId, options = {}) => {
|
|
713
837
|
assertParamExists("createStreamer", "streamId", streamId);
|
|
714
|
-
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
838
|
+
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
839
|
+
`{${"stream_id"}}`,
|
|
840
|
+
encodeURIComponent(String(streamId))
|
|
841
|
+
);
|
|
715
842
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
716
843
|
let baseOptions;
|
|
717
844
|
if (configuration) {
|
|
@@ -730,8 +857,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
|
|
|
730
857
|
};
|
|
731
858
|
},
|
|
732
859
|
/**
|
|
733
|
-
*
|
|
734
|
-
* @summary
|
|
860
|
+
* Delete a streamer from a stream and revoke its token.
|
|
861
|
+
* @summary Delete a streamer
|
|
735
862
|
* @param {string} streamId Stream id
|
|
736
863
|
* @param {string} streamerId Streamer id
|
|
737
864
|
* @param {*} [options] Override http request option.
|
|
@@ -759,8 +886,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
|
|
|
759
886
|
};
|
|
760
887
|
},
|
|
761
888
|
/**
|
|
762
|
-
*
|
|
763
|
-
* @summary
|
|
889
|
+
* Issue a fresh streamer token.
|
|
890
|
+
* @summary Create a streamer token
|
|
764
891
|
* @param {string} roomId ID of the stream.
|
|
765
892
|
* @param {*} [options] Override http request option.
|
|
766
893
|
* @throws {RequiredError}
|
|
@@ -787,12 +914,12 @@ var StreamerApiAxiosParamCreator = function(configuration) {
|
|
|
787
914
|
}
|
|
788
915
|
};
|
|
789
916
|
};
|
|
790
|
-
var
|
|
791
|
-
const localVarAxiosParamCreator =
|
|
917
|
+
var StreamersApiFp = function(configuration) {
|
|
918
|
+
const localVarAxiosParamCreator = StreamersApiAxiosParamCreator(configuration);
|
|
792
919
|
return {
|
|
793
920
|
/**
|
|
794
|
-
*
|
|
795
|
-
* @summary
|
|
921
|
+
* Create a streamer for a stream and return its credentials.
|
|
922
|
+
* @summary Create a streamer
|
|
796
923
|
* @param {string} streamId Stream id
|
|
797
924
|
* @param {*} [options] Override http request option.
|
|
798
925
|
* @throws {RequiredError}
|
|
@@ -800,12 +927,17 @@ var StreamerApiFp = function(configuration) {
|
|
|
800
927
|
async createStreamer(streamId, options) {
|
|
801
928
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
|
|
802
929
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
803
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
804
|
-
return (axios2, basePath) => createRequestFunction(
|
|
930
|
+
const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
931
|
+
return (axios2, basePath) => createRequestFunction(
|
|
932
|
+
localVarAxiosArgs,
|
|
933
|
+
import_axios.default,
|
|
934
|
+
BASE_PATH,
|
|
935
|
+
configuration
|
|
936
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
805
937
|
},
|
|
806
938
|
/**
|
|
807
|
-
*
|
|
808
|
-
* @summary
|
|
939
|
+
* Delete a streamer from a stream and revoke its token.
|
|
940
|
+
* @summary Delete a streamer
|
|
809
941
|
* @param {string} streamId Stream id
|
|
810
942
|
* @param {string} streamerId Streamer id
|
|
811
943
|
* @param {*} [options] Override http request option.
|
|
@@ -814,12 +946,17 @@ var StreamerApiFp = function(configuration) {
|
|
|
814
946
|
async deleteStreamer(streamId, streamerId, options) {
|
|
815
947
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
|
|
816
948
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
817
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
818
|
-
return (axios2, basePath) => createRequestFunction(
|
|
949
|
+
const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
950
|
+
return (axios2, basePath) => createRequestFunction(
|
|
951
|
+
localVarAxiosArgs,
|
|
952
|
+
import_axios.default,
|
|
953
|
+
BASE_PATH,
|
|
954
|
+
configuration
|
|
955
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
819
956
|
},
|
|
820
957
|
/**
|
|
821
|
-
*
|
|
822
|
-
* @summary
|
|
958
|
+
* Issue a fresh streamer token.
|
|
959
|
+
* @summary Create a streamer token
|
|
823
960
|
* @param {string} roomId ID of the stream.
|
|
824
961
|
* @param {*} [options] Override http request option.
|
|
825
962
|
* @throws {RequiredError}
|
|
@@ -827,59 +964,67 @@ var StreamerApiFp = function(configuration) {
|
|
|
827
964
|
async generateStreamerToken(roomId, options) {
|
|
828
965
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
|
|
829
966
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
830
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
831
|
-
return (axios2, basePath) => createRequestFunction(
|
|
967
|
+
const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
|
|
968
|
+
return (axios2, basePath) => createRequestFunction(
|
|
969
|
+
localVarAxiosArgs,
|
|
970
|
+
import_axios.default,
|
|
971
|
+
BASE_PATH,
|
|
972
|
+
configuration
|
|
973
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
832
974
|
}
|
|
833
975
|
};
|
|
834
976
|
};
|
|
835
|
-
var
|
|
977
|
+
var StreamersApi = class extends BaseAPI {
|
|
836
978
|
/**
|
|
837
|
-
*
|
|
838
|
-
* @summary
|
|
979
|
+
* Create a streamer for a stream and return its credentials.
|
|
980
|
+
* @summary Create a streamer
|
|
839
981
|
* @param {string} streamId Stream id
|
|
840
982
|
* @param {*} [options] Override http request option.
|
|
841
983
|
* @throws {RequiredError}
|
|
842
|
-
* @memberof
|
|
984
|
+
* @memberof StreamersApi
|
|
843
985
|
*/
|
|
844
986
|
createStreamer(streamId, options) {
|
|
845
|
-
return
|
|
987
|
+
return StreamersApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
|
|
846
988
|
}
|
|
847
989
|
/**
|
|
848
|
-
*
|
|
849
|
-
* @summary
|
|
990
|
+
* Delete a streamer from a stream and revoke its token.
|
|
991
|
+
* @summary Delete a streamer
|
|
850
992
|
* @param {string} streamId Stream id
|
|
851
993
|
* @param {string} streamerId Streamer id
|
|
852
994
|
* @param {*} [options] Override http request option.
|
|
853
995
|
* @throws {RequiredError}
|
|
854
|
-
* @memberof
|
|
996
|
+
* @memberof StreamersApi
|
|
855
997
|
*/
|
|
856
998
|
deleteStreamer(streamId, streamerId, options) {
|
|
857
|
-
return
|
|
999
|
+
return StreamersApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
|
|
858
1000
|
}
|
|
859
1001
|
/**
|
|
860
|
-
*
|
|
861
|
-
* @summary
|
|
1002
|
+
* Issue a fresh streamer token.
|
|
1003
|
+
* @summary Create a streamer token
|
|
862
1004
|
* @param {string} roomId ID of the stream.
|
|
863
1005
|
* @param {*} [options] Override http request option.
|
|
864
1006
|
* @throws {RequiredError}
|
|
865
|
-
* @memberof
|
|
1007
|
+
* @memberof StreamersApi
|
|
866
1008
|
*/
|
|
867
1009
|
generateStreamerToken(roomId, options) {
|
|
868
|
-
return
|
|
1010
|
+
return StreamersApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
869
1011
|
}
|
|
870
1012
|
};
|
|
871
|
-
var
|
|
1013
|
+
var ViewersApiAxiosParamCreator = function(configuration) {
|
|
872
1014
|
return {
|
|
873
1015
|
/**
|
|
874
|
-
*
|
|
875
|
-
* @summary
|
|
1016
|
+
* Create a viewer for a stream and return its credentials.
|
|
1017
|
+
* @summary Create a viewer
|
|
876
1018
|
* @param {string} streamId Stream id
|
|
877
1019
|
* @param {*} [options] Override http request option.
|
|
878
1020
|
* @throws {RequiredError}
|
|
879
1021
|
*/
|
|
880
1022
|
createViewer: async (streamId, options = {}) => {
|
|
881
1023
|
assertParamExists("createViewer", "streamId", streamId);
|
|
882
|
-
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
1024
|
+
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
1025
|
+
`{${"stream_id"}}`,
|
|
1026
|
+
encodeURIComponent(String(streamId))
|
|
1027
|
+
);
|
|
883
1028
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
884
1029
|
let baseOptions;
|
|
885
1030
|
if (configuration) {
|
|
@@ -898,8 +1043,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
|
|
|
898
1043
|
};
|
|
899
1044
|
},
|
|
900
1045
|
/**
|
|
901
|
-
*
|
|
902
|
-
* @summary
|
|
1046
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1047
|
+
* @summary Delete a viewer
|
|
903
1048
|
* @param {string} streamId Stream id
|
|
904
1049
|
* @param {string} viewerId Viewer id
|
|
905
1050
|
* @param {*} [options] Override http request option.
|
|
@@ -927,8 +1072,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
|
|
|
927
1072
|
};
|
|
928
1073
|
},
|
|
929
1074
|
/**
|
|
930
|
-
*
|
|
931
|
-
* @summary
|
|
1075
|
+
* Issue a fresh viewer token.
|
|
1076
|
+
* @summary Create a viewer token
|
|
932
1077
|
* @param {string} roomId ID of the stream.
|
|
933
1078
|
* @param {*} [options] Override http request option.
|
|
934
1079
|
* @throws {RequiredError}
|
|
@@ -955,12 +1100,12 @@ var ViewerApiAxiosParamCreator = function(configuration) {
|
|
|
955
1100
|
}
|
|
956
1101
|
};
|
|
957
1102
|
};
|
|
958
|
-
var
|
|
959
|
-
const localVarAxiosParamCreator =
|
|
1103
|
+
var ViewersApiFp = function(configuration) {
|
|
1104
|
+
const localVarAxiosParamCreator = ViewersApiAxiosParamCreator(configuration);
|
|
960
1105
|
return {
|
|
961
1106
|
/**
|
|
962
|
-
*
|
|
963
|
-
* @summary
|
|
1107
|
+
* Create a viewer for a stream and return its credentials.
|
|
1108
|
+
* @summary Create a viewer
|
|
964
1109
|
* @param {string} streamId Stream id
|
|
965
1110
|
* @param {*} [options] Override http request option.
|
|
966
1111
|
* @throws {RequiredError}
|
|
@@ -968,12 +1113,17 @@ var ViewerApiFp = function(configuration) {
|
|
|
968
1113
|
async createViewer(streamId, options) {
|
|
969
1114
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
|
|
970
1115
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
971
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
972
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1116
|
+
const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
|
|
1117
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1118
|
+
localVarAxiosArgs,
|
|
1119
|
+
import_axios.default,
|
|
1120
|
+
BASE_PATH,
|
|
1121
|
+
configuration
|
|
1122
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
973
1123
|
},
|
|
974
1124
|
/**
|
|
975
|
-
*
|
|
976
|
-
* @summary
|
|
1125
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1126
|
+
* @summary Delete a viewer
|
|
977
1127
|
* @param {string} streamId Stream id
|
|
978
1128
|
* @param {string} viewerId Viewer id
|
|
979
1129
|
* @param {*} [options] Override http request option.
|
|
@@ -982,12 +1132,17 @@ var ViewerApiFp = function(configuration) {
|
|
|
982
1132
|
async deleteViewer(streamId, viewerId, options) {
|
|
983
1133
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
|
|
984
1134
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
985
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
986
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1135
|
+
const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
|
|
1136
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1137
|
+
localVarAxiosArgs,
|
|
1138
|
+
import_axios.default,
|
|
1139
|
+
BASE_PATH,
|
|
1140
|
+
configuration
|
|
1141
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
987
1142
|
},
|
|
988
1143
|
/**
|
|
989
|
-
*
|
|
990
|
-
* @summary
|
|
1144
|
+
* Issue a fresh viewer token.
|
|
1145
|
+
* @summary Create a viewer token
|
|
991
1146
|
* @param {string} roomId ID of the stream.
|
|
992
1147
|
* @param {*} [options] Override http request option.
|
|
993
1148
|
* @throws {RequiredError}
|
|
@@ -995,45 +1150,50 @@ var ViewerApiFp = function(configuration) {
|
|
|
995
1150
|
async generateViewerToken(roomId, options) {
|
|
996
1151
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
|
|
997
1152
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
998
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
999
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1153
|
+
const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
|
|
1154
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1155
|
+
localVarAxiosArgs,
|
|
1156
|
+
import_axios.default,
|
|
1157
|
+
BASE_PATH,
|
|
1158
|
+
configuration
|
|
1159
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
1000
1160
|
}
|
|
1001
1161
|
};
|
|
1002
1162
|
};
|
|
1003
|
-
var
|
|
1163
|
+
var ViewersApi = class extends BaseAPI {
|
|
1004
1164
|
/**
|
|
1005
|
-
*
|
|
1006
|
-
* @summary
|
|
1165
|
+
* Create a viewer for a stream and return its credentials.
|
|
1166
|
+
* @summary Create a viewer
|
|
1007
1167
|
* @param {string} streamId Stream id
|
|
1008
1168
|
* @param {*} [options] Override http request option.
|
|
1009
1169
|
* @throws {RequiredError}
|
|
1010
|
-
* @memberof
|
|
1170
|
+
* @memberof ViewersApi
|
|
1011
1171
|
*/
|
|
1012
1172
|
createViewer(streamId, options) {
|
|
1013
|
-
return
|
|
1173
|
+
return ViewersApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
|
|
1014
1174
|
}
|
|
1015
1175
|
/**
|
|
1016
|
-
*
|
|
1017
|
-
* @summary
|
|
1176
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1177
|
+
* @summary Delete a viewer
|
|
1018
1178
|
* @param {string} streamId Stream id
|
|
1019
1179
|
* @param {string} viewerId Viewer id
|
|
1020
1180
|
* @param {*} [options] Override http request option.
|
|
1021
1181
|
* @throws {RequiredError}
|
|
1022
|
-
* @memberof
|
|
1182
|
+
* @memberof ViewersApi
|
|
1023
1183
|
*/
|
|
1024
1184
|
deleteViewer(streamId, viewerId, options) {
|
|
1025
|
-
return
|
|
1185
|
+
return ViewersApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
|
|
1026
1186
|
}
|
|
1027
1187
|
/**
|
|
1028
|
-
*
|
|
1029
|
-
* @summary
|
|
1188
|
+
* Issue a fresh viewer token.
|
|
1189
|
+
* @summary Create a viewer token
|
|
1030
1190
|
* @param {string} roomId ID of the stream.
|
|
1031
1191
|
* @param {*} [options] Override http request option.
|
|
1032
1192
|
* @throws {RequiredError}
|
|
1033
|
-
* @memberof
|
|
1193
|
+
* @memberof ViewersApi
|
|
1034
1194
|
*/
|
|
1035
1195
|
generateViewerToken(roomId, options) {
|
|
1036
|
-
return
|
|
1196
|
+
return ViewersApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
1037
1197
|
}
|
|
1038
1198
|
};
|
|
1039
1199
|
|
|
@@ -1906,6 +2066,14 @@ var Track = {
|
|
|
1906
2066
|
function isSet(value) {
|
|
1907
2067
|
return value !== null && value !== void 0;
|
|
1908
2068
|
}
|
|
2069
|
+
var ServerMessage_PeerType = /* @__PURE__ */ ((ServerMessage_PeerType2) => {
|
|
2070
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_UNSPECIFIED"] = 0] = "PEER_TYPE_UNSPECIFIED";
|
|
2071
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_WEBRTC"] = 1] = "PEER_TYPE_WEBRTC";
|
|
2072
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_AGENT"] = 2] = "PEER_TYPE_AGENT";
|
|
2073
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_VAPI"] = 3] = "PEER_TYPE_VAPI";
|
|
2074
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
2075
|
+
return ServerMessage_PeerType2;
|
|
2076
|
+
})(ServerMessage_PeerType || {});
|
|
1909
2077
|
function serverMessage_PeerTypeFromJSON(object) {
|
|
1910
2078
|
switch (object) {
|
|
1911
2079
|
case 0:
|
|
@@ -2029,6 +2197,7 @@ function createBaseServerMessage() {
|
|
|
2029
2197
|
viewerDisconnected: void 0,
|
|
2030
2198
|
streamerConnected: void 0,
|
|
2031
2199
|
streamerDisconnected: void 0,
|
|
2200
|
+
notificationBatch: void 0,
|
|
2032
2201
|
streamConnected: void 0,
|
|
2033
2202
|
streamDisconnected: void 0,
|
|
2034
2203
|
hlsPlayable: void 0,
|
|
@@ -2114,6 +2283,9 @@ var ServerMessage = {
|
|
|
2114
2283
|
if (message.streamerDisconnected !== void 0) {
|
|
2115
2284
|
ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
|
|
2116
2285
|
}
|
|
2286
|
+
if (message.notificationBatch !== void 0) {
|
|
2287
|
+
ServerMessage_NotificationBatch.encode(message.notificationBatch, writer.uint32(266).fork()).join();
|
|
2288
|
+
}
|
|
2117
2289
|
if (message.streamConnected !== void 0) {
|
|
2118
2290
|
ServerMessage_StreamConnected.encode(message.streamConnected, writer.uint32(178).fork()).join();
|
|
2119
2291
|
}
|
|
@@ -2316,6 +2488,13 @@ var ServerMessage = {
|
|
|
2316
2488
|
message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
|
|
2317
2489
|
continue;
|
|
2318
2490
|
}
|
|
2491
|
+
case 33: {
|
|
2492
|
+
if (tag !== 266) {
|
|
2493
|
+
break;
|
|
2494
|
+
}
|
|
2495
|
+
message.notificationBatch = ServerMessage_NotificationBatch.decode(reader, reader.uint32());
|
|
2496
|
+
continue;
|
|
2497
|
+
}
|
|
2319
2498
|
case 22: {
|
|
2320
2499
|
if (tag !== 178) {
|
|
2321
2500
|
break;
|
|
@@ -2393,6 +2572,7 @@ var ServerMessage = {
|
|
|
2393
2572
|
viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
|
|
2394
2573
|
streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
|
|
2395
2574
|
streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0,
|
|
2575
|
+
notificationBatch: isSet2(object.notificationBatch) ? ServerMessage_NotificationBatch.fromJSON(object.notificationBatch) : void 0,
|
|
2396
2576
|
streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
|
|
2397
2577
|
streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
|
|
2398
2578
|
hlsPlayable: isSet2(object.hlsPlayable) ? ServerMessage_HlsPlayable.fromJSON(object.hlsPlayable) : void 0,
|
|
@@ -2478,6 +2658,9 @@ var ServerMessage = {
|
|
|
2478
2658
|
if (message.streamerDisconnected !== void 0) {
|
|
2479
2659
|
obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
|
|
2480
2660
|
}
|
|
2661
|
+
if (message.notificationBatch !== void 0) {
|
|
2662
|
+
obj.notificationBatch = ServerMessage_NotificationBatch.toJSON(message.notificationBatch);
|
|
2663
|
+
}
|
|
2481
2664
|
if (message.streamConnected !== void 0) {
|
|
2482
2665
|
obj.streamConnected = ServerMessage_StreamConnected.toJSON(message.streamConnected);
|
|
2483
2666
|
}
|
|
@@ -2528,6 +2711,7 @@ var ServerMessage = {
|
|
|
2528
2711
|
message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
|
|
2529
2712
|
message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
|
|
2530
2713
|
message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
|
|
2714
|
+
message.notificationBatch = object.notificationBatch !== void 0 && object.notificationBatch !== null ? ServerMessage_NotificationBatch.fromPartial(object.notificationBatch) : void 0;
|
|
2531
2715
|
message.streamConnected = object.streamConnected !== void 0 && object.streamConnected !== null ? ServerMessage_StreamConnected.fromPartial(object.streamConnected) : void 0;
|
|
2532
2716
|
message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
|
|
2533
2717
|
message.hlsPlayable = object.hlsPlayable !== void 0 && object.hlsPlayable !== null ? ServerMessage_HlsPlayable.fromPartial(object.hlsPlayable) : void 0;
|
|
@@ -4834,6 +5018,59 @@ var ServerMessage_StreamerDisconnected = {
|
|
|
4834
5018
|
return message;
|
|
4835
5019
|
}
|
|
4836
5020
|
};
|
|
5021
|
+
function createBaseServerMessage_NotificationBatch() {
|
|
5022
|
+
return { notifications: [] };
|
|
5023
|
+
}
|
|
5024
|
+
var ServerMessage_NotificationBatch = {
|
|
5025
|
+
encode(message, writer = new BinaryWriter()) {
|
|
5026
|
+
for (const v of message.notifications) {
|
|
5027
|
+
ServerMessage.encode(v, writer.uint32(10).fork()).join();
|
|
5028
|
+
}
|
|
5029
|
+
return writer;
|
|
5030
|
+
},
|
|
5031
|
+
decode(input, length) {
|
|
5032
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5033
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
5034
|
+
const message = createBaseServerMessage_NotificationBatch();
|
|
5035
|
+
while (reader.pos < end) {
|
|
5036
|
+
const tag = reader.uint32();
|
|
5037
|
+
switch (tag >>> 3) {
|
|
5038
|
+
case 1: {
|
|
5039
|
+
if (tag !== 10) {
|
|
5040
|
+
break;
|
|
5041
|
+
}
|
|
5042
|
+
message.notifications.push(ServerMessage.decode(reader, reader.uint32()));
|
|
5043
|
+
continue;
|
|
5044
|
+
}
|
|
5045
|
+
}
|
|
5046
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5047
|
+
break;
|
|
5048
|
+
}
|
|
5049
|
+
reader.skip(tag & 7);
|
|
5050
|
+
}
|
|
5051
|
+
return message;
|
|
5052
|
+
},
|
|
5053
|
+
fromJSON(object) {
|
|
5054
|
+
return {
|
|
5055
|
+
notifications: globalThis.Array.isArray(object?.notifications) ? object.notifications.map((e) => ServerMessage.fromJSON(e)) : []
|
|
5056
|
+
};
|
|
5057
|
+
},
|
|
5058
|
+
toJSON(message) {
|
|
5059
|
+
const obj = {};
|
|
5060
|
+
if (message.notifications?.length) {
|
|
5061
|
+
obj.notifications = message.notifications.map((e) => ServerMessage.toJSON(e));
|
|
5062
|
+
}
|
|
5063
|
+
return obj;
|
|
5064
|
+
},
|
|
5065
|
+
create(base) {
|
|
5066
|
+
return ServerMessage_NotificationBatch.fromPartial(base ?? {});
|
|
5067
|
+
},
|
|
5068
|
+
fromPartial(object) {
|
|
5069
|
+
const message = createBaseServerMessage_NotificationBatch();
|
|
5070
|
+
message.notifications = object.notifications?.map((e) => ServerMessage.fromPartial(e)) || [];
|
|
5071
|
+
return message;
|
|
5072
|
+
}
|
|
5073
|
+
};
|
|
4837
5074
|
function isSet2(value) {
|
|
4838
5075
|
return value !== null && value !== void 0;
|
|
4839
5076
|
}
|
|
@@ -5738,10 +5975,14 @@ var RoomNotFoundException = class extends FishjamBaseException {
|
|
|
5738
5975
|
};
|
|
5739
5976
|
var FishjamNotFoundException = class extends FishjamBaseException {
|
|
5740
5977
|
};
|
|
5978
|
+
var InvalidFishjamCredentialsException = class extends FishjamBaseException {
|
|
5979
|
+
};
|
|
5741
5980
|
var PeerNotFoundException = class extends FishjamBaseException {
|
|
5742
5981
|
};
|
|
5743
5982
|
var ServiceUnavailableException = class extends FishjamBaseException {
|
|
5744
5983
|
};
|
|
5984
|
+
var QuotaExceededException = class extends FishjamBaseException {
|
|
5985
|
+
};
|
|
5745
5986
|
var UnknownException = class extends FishjamBaseException {
|
|
5746
5987
|
};
|
|
5747
5988
|
|
|
@@ -5760,7 +6001,20 @@ var getFishjamUrl = (config) => {
|
|
|
5760
6001
|
}
|
|
5761
6002
|
};
|
|
5762
6003
|
|
|
5763
|
-
// src/
|
|
6004
|
+
// src/notifications.ts
|
|
6005
|
+
var peerTypeMap = {
|
|
6006
|
+
[ServerMessage_PeerType.PEER_TYPE_UNSPECIFIED]: "unspecified",
|
|
6007
|
+
[ServerMessage_PeerType.PEER_TYPE_WEBRTC]: "webrtc",
|
|
6008
|
+
[ServerMessage_PeerType.PEER_TYPE_AGENT]: "agent",
|
|
6009
|
+
[ServerMessage_PeerType.PEER_TYPE_VAPI]: "vapi",
|
|
6010
|
+
[ServerMessage_PeerType.UNRECOGNIZED]: "unspecified"
|
|
6011
|
+
};
|
|
6012
|
+
var trackTypeMap = {
|
|
6013
|
+
[TrackType.TRACK_TYPE_UNSPECIFIED]: "unspecified",
|
|
6014
|
+
[TrackType.TRACK_TYPE_VIDEO]: "video",
|
|
6015
|
+
[TrackType.TRACK_TYPE_AUDIO]: "audio",
|
|
6016
|
+
[TrackType.UNRECOGNIZED]: "unspecified"
|
|
6017
|
+
};
|
|
5764
6018
|
var expectedEventsList = [
|
|
5765
6019
|
"roomCreated",
|
|
5766
6020
|
"roomDeleted",
|
|
@@ -5771,14 +6025,39 @@ var expectedEventsList = [
|
|
|
5771
6025
|
"peerDisconnected",
|
|
5772
6026
|
"peerMetadataUpdated",
|
|
5773
6027
|
"peerCrashed",
|
|
5774
|
-
"
|
|
5775
|
-
"
|
|
6028
|
+
"streamerConnected",
|
|
6029
|
+
"streamerDisconnected",
|
|
5776
6030
|
"viewerConnected",
|
|
5777
6031
|
"viewerDisconnected",
|
|
5778
6032
|
"trackAdded",
|
|
5779
6033
|
"trackRemoved",
|
|
5780
|
-
"trackMetadataUpdated"
|
|
6034
|
+
"trackMetadataUpdated",
|
|
6035
|
+
"channelAdded",
|
|
6036
|
+
"channelRemoved"
|
|
5781
6037
|
];
|
|
6038
|
+
var peerEventsWithPeerType = /* @__PURE__ */ new Set([
|
|
6039
|
+
"peerAdded",
|
|
6040
|
+
"peerDeleted",
|
|
6041
|
+
"peerConnected",
|
|
6042
|
+
"peerDisconnected",
|
|
6043
|
+
"peerMetadataUpdated",
|
|
6044
|
+
"peerCrashed"
|
|
6045
|
+
]);
|
|
6046
|
+
var trackEvents = /* @__PURE__ */ new Set(["trackAdded", "trackRemoved", "trackMetadataUpdated"]);
|
|
6047
|
+
var mapTrack = (track) => track && { id: track.id, type: trackTypeMap[track.type], metadata: track.metadata };
|
|
6048
|
+
var mapNotification = (event, msg) => {
|
|
6049
|
+
if (peerEventsWithPeerType.has(event)) {
|
|
6050
|
+
const peerMsg = msg;
|
|
6051
|
+
return { ...peerMsg, peerType: peerTypeMap[peerMsg.peerType] };
|
|
6052
|
+
}
|
|
6053
|
+
if (trackEvents.has(event)) {
|
|
6054
|
+
const trackMsg = msg;
|
|
6055
|
+
return { ...trackMsg, track: mapTrack(trackMsg.track) };
|
|
6056
|
+
}
|
|
6057
|
+
return msg;
|
|
6058
|
+
};
|
|
6059
|
+
|
|
6060
|
+
// src/ws_notifier.ts
|
|
5782
6061
|
var FishjamWSNotifier = class extends import_events.EventEmitter {
|
|
5783
6062
|
client;
|
|
5784
6063
|
constructor(config, onError, onClose) {
|
|
@@ -5798,7 +6077,8 @@ var FishjamWSNotifier = class extends import_events.EventEmitter {
|
|
|
5798
6077
|
const decodedMessage = ServerMessage.decode(data);
|
|
5799
6078
|
const [notification, msg] = Object.entries(decodedMessage).find(([_k, v]) => v);
|
|
5800
6079
|
if (!this.isExpectedEvent(notification)) return;
|
|
5801
|
-
this.emit
|
|
6080
|
+
const emit = this.emit;
|
|
6081
|
+
emit(notification, mapNotification(notification, msg));
|
|
5802
6082
|
} catch (e) {
|
|
5803
6083
|
console.error("Couldn't decode websocket server message", e, message);
|
|
5804
6084
|
}
|
|
@@ -5976,9 +6256,14 @@ var mapException = (error, entity) => {
|
|
|
5976
6256
|
switch (error.response?.status) {
|
|
5977
6257
|
case 400:
|
|
5978
6258
|
return new BadRequestException(error);
|
|
6259
|
+
case 402:
|
|
6260
|
+
return new QuotaExceededException(error);
|
|
5979
6261
|
case 401:
|
|
5980
6262
|
throw new UnauthorizedException(error);
|
|
5981
6263
|
case 404:
|
|
6264
|
+
if (error.request.path.includes("validate")) {
|
|
6265
|
+
return new InvalidFishjamCredentialsException(error);
|
|
6266
|
+
}
|
|
5982
6267
|
switch (entity) {
|
|
5983
6268
|
case "peer":
|
|
5984
6269
|
return new PeerNotFoundException(error);
|
|
@@ -6000,7 +6285,7 @@ var mapException = (error, entity) => {
|
|
|
6000
6285
|
// package.json
|
|
6001
6286
|
var package_default = {
|
|
6002
6287
|
name: "@fishjam-cloud/js-server-sdk",
|
|
6003
|
-
version: "0.
|
|
6288
|
+
version: "0.28.0-rc.0",
|
|
6004
6289
|
description: "Fishjam server SDK for JavaScript",
|
|
6005
6290
|
homepage: "https://github.com/fishjam-cloud/js-server-sdk",
|
|
6006
6291
|
author: "Fishjam Team",
|
|
@@ -6089,20 +6374,26 @@ var package_default = {
|
|
|
6089
6374
|
"*.{js,ts,tsx,mjs,cjs}": [
|
|
6090
6375
|
"eslint --fix --config eslint.config.mjs"
|
|
6091
6376
|
]
|
|
6092
|
-
}
|
|
6377
|
+
},
|
|
6378
|
+
stableVersion: "0.27.0"
|
|
6093
6379
|
};
|
|
6094
6380
|
|
|
6095
6381
|
// src/client.ts
|
|
6096
|
-
var FishjamClient = class {
|
|
6382
|
+
var FishjamClient = class _FishjamClient {
|
|
6097
6383
|
moqApi;
|
|
6098
6384
|
roomApi;
|
|
6099
6385
|
viewerApi;
|
|
6100
6386
|
streamerApi;
|
|
6387
|
+
credentialsApi;
|
|
6101
6388
|
fishjamConfig;
|
|
6102
6389
|
deprecationWarningShown = false;
|
|
6103
6390
|
/**
|
|
6104
6391
|
* Create new instance of Fishjam Client.
|
|
6105
6392
|
*
|
|
6393
|
+
* Does not verify credentials against the backend — use
|
|
6394
|
+
* {@link FishjamClient.create} or call
|
|
6395
|
+
* {@link FishjamClient.checkCredentials} afterwards for that.
|
|
6396
|
+
*
|
|
6106
6397
|
* Example usage:
|
|
6107
6398
|
* ```
|
|
6108
6399
|
* const fishjamClient = new FishjamClient({
|
|
@@ -6123,12 +6414,46 @@ var FishjamClient = class {
|
|
|
6123
6414
|
return response;
|
|
6124
6415
|
});
|
|
6125
6416
|
const fishjamUrl = getFishjamUrl(config);
|
|
6126
|
-
this.moqApi = new
|
|
6127
|
-
this.roomApi = new
|
|
6128
|
-
this.viewerApi = new
|
|
6129
|
-
this.streamerApi = new
|
|
6417
|
+
this.moqApi = new MoQApi(void 0, fishjamUrl, client);
|
|
6418
|
+
this.roomApi = new RoomsApi(void 0, fishjamUrl, client);
|
|
6419
|
+
this.viewerApi = new ViewersApi(void 0, fishjamUrl, client);
|
|
6420
|
+
this.streamerApi = new StreamersApi(void 0, fishjamUrl, client);
|
|
6421
|
+
this.credentialsApi = new CredentialsApi(void 0, fishjamUrl, client);
|
|
6130
6422
|
this.fishjamConfig = config;
|
|
6131
6423
|
}
|
|
6424
|
+
/**
|
|
6425
|
+
* Async factory: constructs a client and verifies credentials against
|
|
6426
|
+
* the backend.
|
|
6427
|
+
*
|
|
6428
|
+
* Throws {@link InvalidFishjamCredentialsException} when the
|
|
6429
|
+
* `fishjamId` / `managementToken` pair is rejected by the backend.
|
|
6430
|
+
*
|
|
6431
|
+
* Example:
|
|
6432
|
+
* ```
|
|
6433
|
+
* const client = await FishjamClient.create({
|
|
6434
|
+
* fishjamId: process.env.FISHJAM_ID!,
|
|
6435
|
+
* managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
|
|
6436
|
+
* });
|
|
6437
|
+
* ```
|
|
6438
|
+
*/
|
|
6439
|
+
static async create(config) {
|
|
6440
|
+
const client = new _FishjamClient(config);
|
|
6441
|
+
await client.checkCredentials();
|
|
6442
|
+
return client;
|
|
6443
|
+
}
|
|
6444
|
+
/**
|
|
6445
|
+
* Verifies the configured credentials by making a single lightweight
|
|
6446
|
+
* call to the Fishjam backend. Resolves on success, throws
|
|
6447
|
+
* {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
|
|
6448
|
+
* otherwise rethrows the standard mapped exception.
|
|
6449
|
+
*/
|
|
6450
|
+
async checkCredentials() {
|
|
6451
|
+
try {
|
|
6452
|
+
await this.credentialsApi.validateCredentials();
|
|
6453
|
+
} catch (error) {
|
|
6454
|
+
throw mapException(error);
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6132
6457
|
handleDeprecationHeader(headers) {
|
|
6133
6458
|
try {
|
|
6134
6459
|
const deprecationHeader = headers["x-fishjam-api-deprecated"];
|
|
@@ -6335,9 +6660,11 @@ var FishjamClient = class {
|
|
|
6335
6660
|
FishjamNotFoundException,
|
|
6336
6661
|
FishjamWSNotifier,
|
|
6337
6662
|
ForbiddenException,
|
|
6663
|
+
InvalidFishjamCredentialsException,
|
|
6338
6664
|
MissingFishjamIdException,
|
|
6339
6665
|
PeerNotFoundException,
|
|
6340
6666
|
PeerStatus,
|
|
6667
|
+
QuotaExceededException,
|
|
6341
6668
|
RoomNotFoundException,
|
|
6342
6669
|
RoomType,
|
|
6343
6670
|
ServerMessage,
|