@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.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GERVP75S.mjs";
|
|
4
4
|
|
|
5
5
|
// ../fishjam-openapi/dist/index.js
|
|
6
6
|
import globalAxios2 from "axios";
|
|
@@ -90,12 +90,75 @@ var VideoCodec = {
|
|
|
90
90
|
H264: "h264",
|
|
91
91
|
Vp8: "vp8"
|
|
92
92
|
};
|
|
93
|
-
var
|
|
93
|
+
var CredentialsApiAxiosParamCreator = function(configuration) {
|
|
94
94
|
return {
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
* @summary
|
|
98
|
-
* @param {
|
|
96
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
97
|
+
* @summary Validate Fishjam Management Token
|
|
98
|
+
* @param {*} [options] Override http request option.
|
|
99
|
+
* @throws {RequiredError}
|
|
100
|
+
*/
|
|
101
|
+
validateCredentials: async (options = {}) => {
|
|
102
|
+
const localVarPath = `/validate`;
|
|
103
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
104
|
+
let baseOptions;
|
|
105
|
+
if (configuration) {
|
|
106
|
+
baseOptions = configuration.baseOptions;
|
|
107
|
+
}
|
|
108
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
109
|
+
const localVarHeaderParameter = {};
|
|
110
|
+
const localVarQueryParameter = {};
|
|
111
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
112
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
113
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
114
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
115
|
+
return {
|
|
116
|
+
url: toPathString(localVarUrlObj),
|
|
117
|
+
options: localVarRequestOptions
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
var CredentialsApiFp = function(configuration) {
|
|
123
|
+
const localVarAxiosParamCreator = CredentialsApiAxiosParamCreator(configuration);
|
|
124
|
+
return {
|
|
125
|
+
/**
|
|
126
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
127
|
+
* @summary Validate Fishjam Management Token
|
|
128
|
+
* @param {*} [options] Override http request option.
|
|
129
|
+
* @throws {RequiredError}
|
|
130
|
+
*/
|
|
131
|
+
async validateCredentials(options) {
|
|
132
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options);
|
|
133
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
134
|
+
const localVarOperationServerBasePath = operationServerMap["CredentialsApi.validateCredentials"]?.[localVarOperationServerIndex]?.url;
|
|
135
|
+
return (axios2, basePath) => createRequestFunction(
|
|
136
|
+
localVarAxiosArgs,
|
|
137
|
+
globalAxios2,
|
|
138
|
+
BASE_PATH,
|
|
139
|
+
configuration
|
|
140
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
var CredentialsApi = class extends BaseAPI {
|
|
145
|
+
/**
|
|
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
|
+
* @memberof CredentialsApi
|
|
151
|
+
*/
|
|
152
|
+
validateCredentials(options) {
|
|
153
|
+
return CredentialsApiFp(this.configuration).validateCredentials(options).then((request) => request(this.axios, this.basePath));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var MoQApiAxiosParamCreator = function(configuration) {
|
|
157
|
+
return {
|
|
158
|
+
/**
|
|
159
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
160
|
+
* @summary Create a MoQ token
|
|
161
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
99
162
|
* @param {*} [options] Override http request option.
|
|
100
163
|
* @throws {RequiredError}
|
|
101
164
|
*/
|
|
@@ -122,44 +185,49 @@ var MoqApiAxiosParamCreator = function(configuration) {
|
|
|
122
185
|
}
|
|
123
186
|
};
|
|
124
187
|
};
|
|
125
|
-
var
|
|
126
|
-
const localVarAxiosParamCreator =
|
|
188
|
+
var MoQApiFp = function(configuration) {
|
|
189
|
+
const localVarAxiosParamCreator = MoQApiAxiosParamCreator(configuration);
|
|
127
190
|
return {
|
|
128
191
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @summary
|
|
131
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
192
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
193
|
+
* @summary Create a MoQ token
|
|
194
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
132
195
|
* @param {*} [options] Override http request option.
|
|
133
196
|
* @throws {RequiredError}
|
|
134
197
|
*/
|
|
135
198
|
async createMoqToken(moqTokenConfig, options) {
|
|
136
199
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqToken(moqTokenConfig, options);
|
|
137
200
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
138
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
139
|
-
return (axios2, basePath) => createRequestFunction(
|
|
201
|
+
const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqToken"]?.[localVarOperationServerIndex]?.url;
|
|
202
|
+
return (axios2, basePath) => createRequestFunction(
|
|
203
|
+
localVarAxiosArgs,
|
|
204
|
+
globalAxios2,
|
|
205
|
+
BASE_PATH,
|
|
206
|
+
configuration
|
|
207
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
140
208
|
}
|
|
141
209
|
};
|
|
142
210
|
};
|
|
143
|
-
var
|
|
211
|
+
var MoQApi = class extends BaseAPI {
|
|
144
212
|
/**
|
|
145
|
-
*
|
|
146
|
-
* @summary
|
|
147
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
213
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
214
|
+
* @summary Create a MoQ token
|
|
215
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
148
216
|
* @param {*} [options] Override http request option.
|
|
149
217
|
* @throws {RequiredError}
|
|
150
|
-
* @memberof
|
|
218
|
+
* @memberof MoQApi
|
|
151
219
|
*/
|
|
152
220
|
createMoqToken(moqTokenConfig, options) {
|
|
153
|
-
return
|
|
221
|
+
return MoQApiFp(this.configuration).createMoqToken(moqTokenConfig, options).then((request) => request(this.axios, this.basePath));
|
|
154
222
|
}
|
|
155
223
|
};
|
|
156
|
-
var
|
|
224
|
+
var RoomsApiAxiosParamCreator = function(configuration) {
|
|
157
225
|
return {
|
|
158
226
|
/**
|
|
159
|
-
*
|
|
160
|
-
* @summary Create peer
|
|
227
|
+
* Add a peer to a room and return its connection token.
|
|
228
|
+
* @summary Create a peer
|
|
161
229
|
* @param {string} roomId Room id
|
|
162
|
-
* @param {PeerConfig} [peerConfig]
|
|
230
|
+
* @param {PeerConfig} [peerConfig]
|
|
163
231
|
* @param {*} [options] Override http request option.
|
|
164
232
|
* @throws {RequiredError}
|
|
165
233
|
*/
|
|
@@ -186,9 +254,9 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
186
254
|
};
|
|
187
255
|
},
|
|
188
256
|
/**
|
|
189
|
-
*
|
|
190
|
-
* @summary
|
|
191
|
-
* @param {RoomConfig} [roomConfig]
|
|
257
|
+
* Create a new room with the given configuration.
|
|
258
|
+
* @summary Create a room
|
|
259
|
+
* @param {RoomConfig} [roomConfig]
|
|
192
260
|
* @param {*} [options] Override http request option.
|
|
193
261
|
* @throws {RequiredError}
|
|
194
262
|
*/
|
|
@@ -214,8 +282,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
214
282
|
};
|
|
215
283
|
},
|
|
216
284
|
/**
|
|
217
|
-
*
|
|
218
|
-
* @summary Delete peer
|
|
285
|
+
* Remove a peer from a room and disconnect it.
|
|
286
|
+
* @summary Delete a peer
|
|
219
287
|
* @param {string} roomId Room id
|
|
220
288
|
* @param {string} id Peer id
|
|
221
289
|
* @param {*} [options] Override http request option.
|
|
@@ -243,8 +311,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
243
311
|
};
|
|
244
312
|
},
|
|
245
313
|
/**
|
|
246
|
-
*
|
|
247
|
-
* @summary Delete
|
|
314
|
+
* Delete a room by id and disconnect all of its peers.
|
|
315
|
+
* @summary Delete a room
|
|
248
316
|
* @param {string} roomId Room id
|
|
249
317
|
* @param {*} [options] Override http request option.
|
|
250
318
|
* @throws {RequiredError}
|
|
@@ -270,8 +338,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
270
338
|
};
|
|
271
339
|
},
|
|
272
340
|
/**
|
|
273
|
-
*
|
|
274
|
-
* @summary
|
|
341
|
+
* List all rooms and livestreams.
|
|
342
|
+
* @summary List all rooms
|
|
275
343
|
* @param {*} [options] Override http request option.
|
|
276
344
|
* @throws {RequiredError}
|
|
277
345
|
*/
|
|
@@ -295,8 +363,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
295
363
|
};
|
|
296
364
|
},
|
|
297
365
|
/**
|
|
298
|
-
*
|
|
299
|
-
* @summary
|
|
366
|
+
* Get a room by id.
|
|
367
|
+
* @summary Get a room
|
|
300
368
|
* @param {string} roomId Room ID
|
|
301
369
|
* @param {*} [options] Override http request option.
|
|
302
370
|
* @throws {RequiredError}
|
|
@@ -322,8 +390,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
322
390
|
};
|
|
323
391
|
},
|
|
324
392
|
/**
|
|
325
|
-
*
|
|
326
|
-
* @summary Refresh peer token
|
|
393
|
+
* Issue a fresh connection token for an existing peer.
|
|
394
|
+
* @summary Refresh a peer token
|
|
327
395
|
* @param {string} roomId Room id
|
|
328
396
|
* @param {string} id Peer id
|
|
329
397
|
* @param {*} [options] Override http request option.
|
|
@@ -351,8 +419,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
351
419
|
};
|
|
352
420
|
},
|
|
353
421
|
/**
|
|
354
|
-
*
|
|
355
|
-
* @summary Subscribe peer to another peer\'s tracks
|
|
422
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
423
|
+
* @summary Subscribe a peer to another peer\'s tracks
|
|
356
424
|
* @param {string} roomId Room id
|
|
357
425
|
* @param {string} id Peer id
|
|
358
426
|
* @param {string} [peerId] ID of the peer that produces the track
|
|
@@ -384,8 +452,8 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
384
452
|
};
|
|
385
453
|
},
|
|
386
454
|
/**
|
|
387
|
-
*
|
|
388
|
-
* @summary Subscribe peer to specific tracks
|
|
455
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
456
|
+
* @summary Subscribe a peer to specific tracks
|
|
389
457
|
* @param {string} roomId Room id
|
|
390
458
|
* @param {string} id Peer id
|
|
391
459
|
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
@@ -409,7 +477,11 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
409
477
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
410
478
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
411
479
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
412
|
-
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
480
|
+
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
481
|
+
subscribeTracksRequest,
|
|
482
|
+
localVarRequestOptions,
|
|
483
|
+
configuration
|
|
484
|
+
);
|
|
413
485
|
return {
|
|
414
486
|
url: toPathString(localVarUrlObj),
|
|
415
487
|
options: localVarRequestOptions
|
|
@@ -417,39 +489,49 @@ var RoomApiAxiosParamCreator = function(configuration) {
|
|
|
417
489
|
}
|
|
418
490
|
};
|
|
419
491
|
};
|
|
420
|
-
var
|
|
421
|
-
const localVarAxiosParamCreator =
|
|
492
|
+
var RoomsApiFp = function(configuration) {
|
|
493
|
+
const localVarAxiosParamCreator = RoomsApiAxiosParamCreator(configuration);
|
|
422
494
|
return {
|
|
423
495
|
/**
|
|
424
|
-
*
|
|
425
|
-
* @summary Create peer
|
|
496
|
+
* Add a peer to a room and return its connection token.
|
|
497
|
+
* @summary Create a peer
|
|
426
498
|
* @param {string} roomId Room id
|
|
427
|
-
* @param {PeerConfig} [peerConfig]
|
|
499
|
+
* @param {PeerConfig} [peerConfig]
|
|
428
500
|
* @param {*} [options] Override http request option.
|
|
429
501
|
* @throws {RequiredError}
|
|
430
502
|
*/
|
|
431
503
|
async addPeer(roomId, peerConfig, options) {
|
|
432
504
|
const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
|
|
433
505
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
434
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
435
|
-
return (axios2, basePath) => createRequestFunction(
|
|
506
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
|
|
507
|
+
return (axios2, basePath) => createRequestFunction(
|
|
508
|
+
localVarAxiosArgs,
|
|
509
|
+
globalAxios2,
|
|
510
|
+
BASE_PATH,
|
|
511
|
+
configuration
|
|
512
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
436
513
|
},
|
|
437
514
|
/**
|
|
438
|
-
*
|
|
439
|
-
* @summary
|
|
440
|
-
* @param {RoomConfig} [roomConfig]
|
|
515
|
+
* Create a new room with the given configuration.
|
|
516
|
+
* @summary Create a room
|
|
517
|
+
* @param {RoomConfig} [roomConfig]
|
|
441
518
|
* @param {*} [options] Override http request option.
|
|
442
519
|
* @throws {RequiredError}
|
|
443
520
|
*/
|
|
444
521
|
async createRoom(roomConfig, options) {
|
|
445
522
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
|
|
446
523
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
447
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
448
|
-
return (axios2, basePath) => createRequestFunction(
|
|
524
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
|
|
525
|
+
return (axios2, basePath) => createRequestFunction(
|
|
526
|
+
localVarAxiosArgs,
|
|
527
|
+
globalAxios2,
|
|
528
|
+
BASE_PATH,
|
|
529
|
+
configuration
|
|
530
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
449
531
|
},
|
|
450
532
|
/**
|
|
451
|
-
*
|
|
452
|
-
* @summary Delete peer
|
|
533
|
+
* Remove a peer from a room and disconnect it.
|
|
534
|
+
* @summary Delete a peer
|
|
453
535
|
* @param {string} roomId Room id
|
|
454
536
|
* @param {string} id Peer id
|
|
455
537
|
* @param {*} [options] Override http request option.
|
|
@@ -458,12 +540,17 @@ var RoomApiFp = function(configuration) {
|
|
|
458
540
|
async deletePeer(roomId, id, options) {
|
|
459
541
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
|
|
460
542
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
461
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
462
|
-
return (axios2, basePath) => createRequestFunction(
|
|
543
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
|
|
544
|
+
return (axios2, basePath) => createRequestFunction(
|
|
545
|
+
localVarAxiosArgs,
|
|
546
|
+
globalAxios2,
|
|
547
|
+
BASE_PATH,
|
|
548
|
+
configuration
|
|
549
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
463
550
|
},
|
|
464
551
|
/**
|
|
465
|
-
*
|
|
466
|
-
* @summary Delete
|
|
552
|
+
* Delete a room by id and disconnect all of its peers.
|
|
553
|
+
* @summary Delete a room
|
|
467
554
|
* @param {string} roomId Room id
|
|
468
555
|
* @param {*} [options] Override http request option.
|
|
469
556
|
* @throws {RequiredError}
|
|
@@ -471,24 +558,34 @@ var RoomApiFp = function(configuration) {
|
|
|
471
558
|
async deleteRoom(roomId, options) {
|
|
472
559
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
|
|
473
560
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
474
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
475
|
-
return (axios2, basePath) => createRequestFunction(
|
|
561
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
|
|
562
|
+
return (axios2, basePath) => createRequestFunction(
|
|
563
|
+
localVarAxiosArgs,
|
|
564
|
+
globalAxios2,
|
|
565
|
+
BASE_PATH,
|
|
566
|
+
configuration
|
|
567
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
476
568
|
},
|
|
477
569
|
/**
|
|
478
|
-
*
|
|
479
|
-
* @summary
|
|
570
|
+
* List all rooms and livestreams.
|
|
571
|
+
* @summary List all rooms
|
|
480
572
|
* @param {*} [options] Override http request option.
|
|
481
573
|
* @throws {RequiredError}
|
|
482
574
|
*/
|
|
483
575
|
async getAllRooms(options) {
|
|
484
576
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
|
|
485
577
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
486
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
487
|
-
return (axios2, basePath) => createRequestFunction(
|
|
578
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
|
|
579
|
+
return (axios2, basePath) => createRequestFunction(
|
|
580
|
+
localVarAxiosArgs,
|
|
581
|
+
globalAxios2,
|
|
582
|
+
BASE_PATH,
|
|
583
|
+
configuration
|
|
584
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
488
585
|
},
|
|
489
586
|
/**
|
|
490
|
-
*
|
|
491
|
-
* @summary
|
|
587
|
+
* Get a room by id.
|
|
588
|
+
* @summary Get a room
|
|
492
589
|
* @param {string} roomId Room ID
|
|
493
590
|
* @param {*} [options] Override http request option.
|
|
494
591
|
* @throws {RequiredError}
|
|
@@ -496,12 +593,17 @@ var RoomApiFp = function(configuration) {
|
|
|
496
593
|
async getRoom(roomId, options) {
|
|
497
594
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
|
|
498
595
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
499
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
500
|
-
return (axios2, basePath) => createRequestFunction(
|
|
596
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
|
|
597
|
+
return (axios2, basePath) => createRequestFunction(
|
|
598
|
+
localVarAxiosArgs,
|
|
599
|
+
globalAxios2,
|
|
600
|
+
BASE_PATH,
|
|
601
|
+
configuration
|
|
602
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
501
603
|
},
|
|
502
604
|
/**
|
|
503
|
-
*
|
|
504
|
-
* @summary Refresh peer token
|
|
605
|
+
* Issue a fresh connection token for an existing peer.
|
|
606
|
+
* @summary Refresh a peer token
|
|
505
607
|
* @param {string} roomId Room id
|
|
506
608
|
* @param {string} id Peer id
|
|
507
609
|
* @param {*} [options] Override http request option.
|
|
@@ -510,12 +612,17 @@ var RoomApiFp = function(configuration) {
|
|
|
510
612
|
async refreshToken(roomId, id, options) {
|
|
511
613
|
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
|
|
512
614
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
513
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
514
|
-
return (axios2, basePath) => createRequestFunction(
|
|
615
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
|
|
616
|
+
return (axios2, basePath) => createRequestFunction(
|
|
617
|
+
localVarAxiosArgs,
|
|
618
|
+
globalAxios2,
|
|
619
|
+
BASE_PATH,
|
|
620
|
+
configuration
|
|
621
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
515
622
|
},
|
|
516
623
|
/**
|
|
517
|
-
*
|
|
518
|
-
* @summary Subscribe peer to another peer\'s tracks
|
|
624
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
625
|
+
* @summary Subscribe a peer to another peer\'s tracks
|
|
519
626
|
* @param {string} roomId Room id
|
|
520
627
|
* @param {string} id Peer id
|
|
521
628
|
* @param {string} [peerId] ID of the peer that produces the track
|
|
@@ -525,12 +632,17 @@ var RoomApiFp = function(configuration) {
|
|
|
525
632
|
async subscribePeer(roomId, id, peerId, options) {
|
|
526
633
|
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
|
|
527
634
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
528
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
529
|
-
return (axios2, basePath) => createRequestFunction(
|
|
635
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
|
|
636
|
+
return (axios2, basePath) => createRequestFunction(
|
|
637
|
+
localVarAxiosArgs,
|
|
638
|
+
globalAxios2,
|
|
639
|
+
BASE_PATH,
|
|
640
|
+
configuration
|
|
641
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
530
642
|
},
|
|
531
643
|
/**
|
|
532
|
-
*
|
|
533
|
-
* @summary Subscribe peer to specific tracks
|
|
644
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
645
|
+
* @summary Subscribe a peer to specific tracks
|
|
534
646
|
* @param {string} roomId Room id
|
|
535
647
|
* @param {string} id Peer id
|
|
536
648
|
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
@@ -538,132 +650,145 @@ var RoomApiFp = function(configuration) {
|
|
|
538
650
|
* @throws {RequiredError}
|
|
539
651
|
*/
|
|
540
652
|
async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
541
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
653
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
654
|
+
roomId,
|
|
655
|
+
id,
|
|
656
|
+
subscribeTracksRequest,
|
|
657
|
+
options
|
|
658
|
+
);
|
|
542
659
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
543
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
544
|
-
return (axios2, basePath) => createRequestFunction(
|
|
660
|
+
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
|
|
661
|
+
return (axios2, basePath) => createRequestFunction(
|
|
662
|
+
localVarAxiosArgs,
|
|
663
|
+
globalAxios2,
|
|
664
|
+
BASE_PATH,
|
|
665
|
+
configuration
|
|
666
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
545
667
|
}
|
|
546
668
|
};
|
|
547
669
|
};
|
|
548
|
-
var
|
|
670
|
+
var RoomsApi = class extends BaseAPI {
|
|
549
671
|
/**
|
|
550
|
-
*
|
|
551
|
-
* @summary Create peer
|
|
672
|
+
* Add a peer to a room and return its connection token.
|
|
673
|
+
* @summary Create a peer
|
|
552
674
|
* @param {string} roomId Room id
|
|
553
|
-
* @param {PeerConfig} [peerConfig]
|
|
675
|
+
* @param {PeerConfig} [peerConfig]
|
|
554
676
|
* @param {*} [options] Override http request option.
|
|
555
677
|
* @throws {RequiredError}
|
|
556
|
-
* @memberof
|
|
678
|
+
* @memberof RoomsApi
|
|
557
679
|
*/
|
|
558
680
|
addPeer(roomId, peerConfig, options) {
|
|
559
|
-
return
|
|
681
|
+
return RoomsApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath));
|
|
560
682
|
}
|
|
561
683
|
/**
|
|
562
|
-
*
|
|
563
|
-
* @summary
|
|
564
|
-
* @param {RoomConfig} [roomConfig]
|
|
684
|
+
* Create a new room with the given configuration.
|
|
685
|
+
* @summary Create a room
|
|
686
|
+
* @param {RoomConfig} [roomConfig]
|
|
565
687
|
* @param {*} [options] Override http request option.
|
|
566
688
|
* @throws {RequiredError}
|
|
567
|
-
* @memberof
|
|
689
|
+
* @memberof RoomsApi
|
|
568
690
|
*/
|
|
569
691
|
createRoom(roomConfig, options) {
|
|
570
|
-
return
|
|
692
|
+
return RoomsApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath));
|
|
571
693
|
}
|
|
572
694
|
/**
|
|
573
|
-
*
|
|
574
|
-
* @summary Delete peer
|
|
695
|
+
* Remove a peer from a room and disconnect it.
|
|
696
|
+
* @summary Delete a peer
|
|
575
697
|
* @param {string} roomId Room id
|
|
576
698
|
* @param {string} id Peer id
|
|
577
699
|
* @param {*} [options] Override http request option.
|
|
578
700
|
* @throws {RequiredError}
|
|
579
|
-
* @memberof
|
|
701
|
+
* @memberof RoomsApi
|
|
580
702
|
*/
|
|
581
703
|
deletePeer(roomId, id, options) {
|
|
582
|
-
return
|
|
704
|
+
return RoomsApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath));
|
|
583
705
|
}
|
|
584
706
|
/**
|
|
585
|
-
*
|
|
586
|
-
* @summary Delete
|
|
707
|
+
* Delete a room by id and disconnect all of its peers.
|
|
708
|
+
* @summary Delete a room
|
|
587
709
|
* @param {string} roomId Room id
|
|
588
710
|
* @param {*} [options] Override http request option.
|
|
589
711
|
* @throws {RequiredError}
|
|
590
|
-
* @memberof
|
|
712
|
+
* @memberof RoomsApi
|
|
591
713
|
*/
|
|
592
714
|
deleteRoom(roomId, options) {
|
|
593
|
-
return
|
|
715
|
+
return RoomsApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
594
716
|
}
|
|
595
717
|
/**
|
|
596
|
-
*
|
|
597
|
-
* @summary
|
|
718
|
+
* List all rooms and livestreams.
|
|
719
|
+
* @summary List all rooms
|
|
598
720
|
* @param {*} [options] Override http request option.
|
|
599
721
|
* @throws {RequiredError}
|
|
600
|
-
* @memberof
|
|
722
|
+
* @memberof RoomsApi
|
|
601
723
|
*/
|
|
602
724
|
getAllRooms(options) {
|
|
603
|
-
return
|
|
725
|
+
return RoomsApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath));
|
|
604
726
|
}
|
|
605
727
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @summary
|
|
728
|
+
* Get a room by id.
|
|
729
|
+
* @summary Get a room
|
|
608
730
|
* @param {string} roomId Room ID
|
|
609
731
|
* @param {*} [options] Override http request option.
|
|
610
732
|
* @throws {RequiredError}
|
|
611
|
-
* @memberof
|
|
733
|
+
* @memberof RoomsApi
|
|
612
734
|
*/
|
|
613
735
|
getRoom(roomId, options) {
|
|
614
|
-
return
|
|
736
|
+
return RoomsApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
615
737
|
}
|
|
616
738
|
/**
|
|
617
|
-
*
|
|
618
|
-
* @summary Refresh peer token
|
|
739
|
+
* Issue a fresh connection token for an existing peer.
|
|
740
|
+
* @summary Refresh a peer token
|
|
619
741
|
* @param {string} roomId Room id
|
|
620
742
|
* @param {string} id Peer id
|
|
621
743
|
* @param {*} [options] Override http request option.
|
|
622
744
|
* @throws {RequiredError}
|
|
623
|
-
* @memberof
|
|
745
|
+
* @memberof RoomsApi
|
|
624
746
|
*/
|
|
625
747
|
refreshToken(roomId, id, options) {
|
|
626
|
-
return
|
|
748
|
+
return RoomsApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath));
|
|
627
749
|
}
|
|
628
750
|
/**
|
|
629
|
-
*
|
|
630
|
-
* @summary Subscribe peer to another peer\'s tracks
|
|
751
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
752
|
+
* @summary Subscribe a peer to another peer\'s tracks
|
|
631
753
|
* @param {string} roomId Room id
|
|
632
754
|
* @param {string} id Peer id
|
|
633
755
|
* @param {string} [peerId] ID of the peer that produces the track
|
|
634
756
|
* @param {*} [options] Override http request option.
|
|
635
757
|
* @throws {RequiredError}
|
|
636
|
-
* @memberof
|
|
758
|
+
* @memberof RoomsApi
|
|
637
759
|
*/
|
|
638
760
|
subscribePeer(roomId, id, peerId, options) {
|
|
639
|
-
return
|
|
761
|
+
return RoomsApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath));
|
|
640
762
|
}
|
|
641
763
|
/**
|
|
642
|
-
*
|
|
643
|
-
* @summary Subscribe peer to specific tracks
|
|
764
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
765
|
+
* @summary Subscribe a peer to specific tracks
|
|
644
766
|
* @param {string} roomId Room id
|
|
645
767
|
* @param {string} id Peer id
|
|
646
768
|
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
647
769
|
* @param {*} [options] Override http request option.
|
|
648
770
|
* @throws {RequiredError}
|
|
649
|
-
* @memberof
|
|
771
|
+
* @memberof RoomsApi
|
|
650
772
|
*/
|
|
651
773
|
subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
652
|
-
return
|
|
774
|
+
return RoomsApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath));
|
|
653
775
|
}
|
|
654
776
|
};
|
|
655
|
-
var
|
|
777
|
+
var StreamersApiAxiosParamCreator = function(configuration) {
|
|
656
778
|
return {
|
|
657
779
|
/**
|
|
658
|
-
*
|
|
659
|
-
* @summary
|
|
780
|
+
* Create a streamer for a stream and return its credentials.
|
|
781
|
+
* @summary Create a streamer
|
|
660
782
|
* @param {string} streamId Stream id
|
|
661
783
|
* @param {*} [options] Override http request option.
|
|
662
784
|
* @throws {RequiredError}
|
|
663
785
|
*/
|
|
664
786
|
createStreamer: async (streamId, options = {}) => {
|
|
665
787
|
assertParamExists("createStreamer", "streamId", streamId);
|
|
666
|
-
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
788
|
+
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
789
|
+
`{${"stream_id"}}`,
|
|
790
|
+
encodeURIComponent(String(streamId))
|
|
791
|
+
);
|
|
667
792
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
668
793
|
let baseOptions;
|
|
669
794
|
if (configuration) {
|
|
@@ -682,8 +807,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
|
|
|
682
807
|
};
|
|
683
808
|
},
|
|
684
809
|
/**
|
|
685
|
-
*
|
|
686
|
-
* @summary
|
|
810
|
+
* Delete a streamer from a stream and revoke its token.
|
|
811
|
+
* @summary Delete a streamer
|
|
687
812
|
* @param {string} streamId Stream id
|
|
688
813
|
* @param {string} streamerId Streamer id
|
|
689
814
|
* @param {*} [options] Override http request option.
|
|
@@ -711,8 +836,8 @@ var StreamerApiAxiosParamCreator = function(configuration) {
|
|
|
711
836
|
};
|
|
712
837
|
},
|
|
713
838
|
/**
|
|
714
|
-
*
|
|
715
|
-
* @summary
|
|
839
|
+
* Issue a fresh streamer token.
|
|
840
|
+
* @summary Create a streamer token
|
|
716
841
|
* @param {string} roomId ID of the stream.
|
|
717
842
|
* @param {*} [options] Override http request option.
|
|
718
843
|
* @throws {RequiredError}
|
|
@@ -739,12 +864,12 @@ var StreamerApiAxiosParamCreator = function(configuration) {
|
|
|
739
864
|
}
|
|
740
865
|
};
|
|
741
866
|
};
|
|
742
|
-
var
|
|
743
|
-
const localVarAxiosParamCreator =
|
|
867
|
+
var StreamersApiFp = function(configuration) {
|
|
868
|
+
const localVarAxiosParamCreator = StreamersApiAxiosParamCreator(configuration);
|
|
744
869
|
return {
|
|
745
870
|
/**
|
|
746
|
-
*
|
|
747
|
-
* @summary
|
|
871
|
+
* Create a streamer for a stream and return its credentials.
|
|
872
|
+
* @summary Create a streamer
|
|
748
873
|
* @param {string} streamId Stream id
|
|
749
874
|
* @param {*} [options] Override http request option.
|
|
750
875
|
* @throws {RequiredError}
|
|
@@ -752,12 +877,17 @@ var StreamerApiFp = function(configuration) {
|
|
|
752
877
|
async createStreamer(streamId, options) {
|
|
753
878
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
|
|
754
879
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
755
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
756
|
-
return (axios2, basePath) => createRequestFunction(
|
|
880
|
+
const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
881
|
+
return (axios2, basePath) => createRequestFunction(
|
|
882
|
+
localVarAxiosArgs,
|
|
883
|
+
globalAxios2,
|
|
884
|
+
BASE_PATH,
|
|
885
|
+
configuration
|
|
886
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
757
887
|
},
|
|
758
888
|
/**
|
|
759
|
-
*
|
|
760
|
-
* @summary
|
|
889
|
+
* Delete a streamer from a stream and revoke its token.
|
|
890
|
+
* @summary Delete a streamer
|
|
761
891
|
* @param {string} streamId Stream id
|
|
762
892
|
* @param {string} streamerId Streamer id
|
|
763
893
|
* @param {*} [options] Override http request option.
|
|
@@ -766,12 +896,17 @@ var StreamerApiFp = function(configuration) {
|
|
|
766
896
|
async deleteStreamer(streamId, streamerId, options) {
|
|
767
897
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
|
|
768
898
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
769
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
770
|
-
return (axios2, basePath) => createRequestFunction(
|
|
899
|
+
const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
900
|
+
return (axios2, basePath) => createRequestFunction(
|
|
901
|
+
localVarAxiosArgs,
|
|
902
|
+
globalAxios2,
|
|
903
|
+
BASE_PATH,
|
|
904
|
+
configuration
|
|
905
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
771
906
|
},
|
|
772
907
|
/**
|
|
773
|
-
*
|
|
774
|
-
* @summary
|
|
908
|
+
* Issue a fresh streamer token.
|
|
909
|
+
* @summary Create a streamer token
|
|
775
910
|
* @param {string} roomId ID of the stream.
|
|
776
911
|
* @param {*} [options] Override http request option.
|
|
777
912
|
* @throws {RequiredError}
|
|
@@ -779,59 +914,67 @@ var StreamerApiFp = function(configuration) {
|
|
|
779
914
|
async generateStreamerToken(roomId, options) {
|
|
780
915
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
|
|
781
916
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
782
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
783
|
-
return (axios2, basePath) => createRequestFunction(
|
|
917
|
+
const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
|
|
918
|
+
return (axios2, basePath) => createRequestFunction(
|
|
919
|
+
localVarAxiosArgs,
|
|
920
|
+
globalAxios2,
|
|
921
|
+
BASE_PATH,
|
|
922
|
+
configuration
|
|
923
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
784
924
|
}
|
|
785
925
|
};
|
|
786
926
|
};
|
|
787
|
-
var
|
|
927
|
+
var StreamersApi = class extends BaseAPI {
|
|
788
928
|
/**
|
|
789
|
-
*
|
|
790
|
-
* @summary
|
|
929
|
+
* Create a streamer for a stream and return its credentials.
|
|
930
|
+
* @summary Create a streamer
|
|
791
931
|
* @param {string} streamId Stream id
|
|
792
932
|
* @param {*} [options] Override http request option.
|
|
793
933
|
* @throws {RequiredError}
|
|
794
|
-
* @memberof
|
|
934
|
+
* @memberof StreamersApi
|
|
795
935
|
*/
|
|
796
936
|
createStreamer(streamId, options) {
|
|
797
|
-
return
|
|
937
|
+
return StreamersApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath));
|
|
798
938
|
}
|
|
799
939
|
/**
|
|
800
|
-
*
|
|
801
|
-
* @summary
|
|
940
|
+
* Delete a streamer from a stream and revoke its token.
|
|
941
|
+
* @summary Delete a streamer
|
|
802
942
|
* @param {string} streamId Stream id
|
|
803
943
|
* @param {string} streamerId Streamer id
|
|
804
944
|
* @param {*} [options] Override http request option.
|
|
805
945
|
* @throws {RequiredError}
|
|
806
|
-
* @memberof
|
|
946
|
+
* @memberof StreamersApi
|
|
807
947
|
*/
|
|
808
948
|
deleteStreamer(streamId, streamerId, options) {
|
|
809
|
-
return
|
|
949
|
+
return StreamersApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath));
|
|
810
950
|
}
|
|
811
951
|
/**
|
|
812
|
-
*
|
|
813
|
-
* @summary
|
|
952
|
+
* Issue a fresh streamer token.
|
|
953
|
+
* @summary Create a streamer token
|
|
814
954
|
* @param {string} roomId ID of the stream.
|
|
815
955
|
* @param {*} [options] Override http request option.
|
|
816
956
|
* @throws {RequiredError}
|
|
817
|
-
* @memberof
|
|
957
|
+
* @memberof StreamersApi
|
|
818
958
|
*/
|
|
819
959
|
generateStreamerToken(roomId, options) {
|
|
820
|
-
return
|
|
960
|
+
return StreamersApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
821
961
|
}
|
|
822
962
|
};
|
|
823
|
-
var
|
|
963
|
+
var ViewersApiAxiosParamCreator = function(configuration) {
|
|
824
964
|
return {
|
|
825
965
|
/**
|
|
826
|
-
*
|
|
827
|
-
* @summary
|
|
966
|
+
* Create a viewer for a stream and return its credentials.
|
|
967
|
+
* @summary Create a viewer
|
|
828
968
|
* @param {string} streamId Stream id
|
|
829
969
|
* @param {*} [options] Override http request option.
|
|
830
970
|
* @throws {RequiredError}
|
|
831
971
|
*/
|
|
832
972
|
createViewer: async (streamId, options = {}) => {
|
|
833
973
|
assertParamExists("createViewer", "streamId", streamId);
|
|
834
|
-
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
974
|
+
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
975
|
+
`{${"stream_id"}}`,
|
|
976
|
+
encodeURIComponent(String(streamId))
|
|
977
|
+
);
|
|
835
978
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
836
979
|
let baseOptions;
|
|
837
980
|
if (configuration) {
|
|
@@ -850,8 +993,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
|
|
|
850
993
|
};
|
|
851
994
|
},
|
|
852
995
|
/**
|
|
853
|
-
*
|
|
854
|
-
* @summary
|
|
996
|
+
* Delete a viewer from a stream and revoke its token.
|
|
997
|
+
* @summary Delete a viewer
|
|
855
998
|
* @param {string} streamId Stream id
|
|
856
999
|
* @param {string} viewerId Viewer id
|
|
857
1000
|
* @param {*} [options] Override http request option.
|
|
@@ -879,8 +1022,8 @@ var ViewerApiAxiosParamCreator = function(configuration) {
|
|
|
879
1022
|
};
|
|
880
1023
|
},
|
|
881
1024
|
/**
|
|
882
|
-
*
|
|
883
|
-
* @summary
|
|
1025
|
+
* Issue a fresh viewer token.
|
|
1026
|
+
* @summary Create a viewer token
|
|
884
1027
|
* @param {string} roomId ID of the stream.
|
|
885
1028
|
* @param {*} [options] Override http request option.
|
|
886
1029
|
* @throws {RequiredError}
|
|
@@ -907,12 +1050,12 @@ var ViewerApiAxiosParamCreator = function(configuration) {
|
|
|
907
1050
|
}
|
|
908
1051
|
};
|
|
909
1052
|
};
|
|
910
|
-
var
|
|
911
|
-
const localVarAxiosParamCreator =
|
|
1053
|
+
var ViewersApiFp = function(configuration) {
|
|
1054
|
+
const localVarAxiosParamCreator = ViewersApiAxiosParamCreator(configuration);
|
|
912
1055
|
return {
|
|
913
1056
|
/**
|
|
914
|
-
*
|
|
915
|
-
* @summary
|
|
1057
|
+
* Create a viewer for a stream and return its credentials.
|
|
1058
|
+
* @summary Create a viewer
|
|
916
1059
|
* @param {string} streamId Stream id
|
|
917
1060
|
* @param {*} [options] Override http request option.
|
|
918
1061
|
* @throws {RequiredError}
|
|
@@ -920,12 +1063,17 @@ var ViewerApiFp = function(configuration) {
|
|
|
920
1063
|
async createViewer(streamId, options) {
|
|
921
1064
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
|
|
922
1065
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
923
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
924
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1066
|
+
const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
|
|
1067
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1068
|
+
localVarAxiosArgs,
|
|
1069
|
+
globalAxios2,
|
|
1070
|
+
BASE_PATH,
|
|
1071
|
+
configuration
|
|
1072
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
925
1073
|
},
|
|
926
1074
|
/**
|
|
927
|
-
*
|
|
928
|
-
* @summary
|
|
1075
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1076
|
+
* @summary Delete a viewer
|
|
929
1077
|
* @param {string} streamId Stream id
|
|
930
1078
|
* @param {string} viewerId Viewer id
|
|
931
1079
|
* @param {*} [options] Override http request option.
|
|
@@ -934,12 +1082,17 @@ var ViewerApiFp = function(configuration) {
|
|
|
934
1082
|
async deleteViewer(streamId, viewerId, options) {
|
|
935
1083
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
|
|
936
1084
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
937
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
938
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1085
|
+
const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
|
|
1086
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1087
|
+
localVarAxiosArgs,
|
|
1088
|
+
globalAxios2,
|
|
1089
|
+
BASE_PATH,
|
|
1090
|
+
configuration
|
|
1091
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
939
1092
|
},
|
|
940
1093
|
/**
|
|
941
|
-
*
|
|
942
|
-
* @summary
|
|
1094
|
+
* Issue a fresh viewer token.
|
|
1095
|
+
* @summary Create a viewer token
|
|
943
1096
|
* @param {string} roomId ID of the stream.
|
|
944
1097
|
* @param {*} [options] Override http request option.
|
|
945
1098
|
* @throws {RequiredError}
|
|
@@ -947,45 +1100,50 @@ var ViewerApiFp = function(configuration) {
|
|
|
947
1100
|
async generateViewerToken(roomId, options) {
|
|
948
1101
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
|
|
949
1102
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
950
|
-
const localVarOperationServerBasePath = operationServerMap["
|
|
951
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1103
|
+
const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
|
|
1104
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1105
|
+
localVarAxiosArgs,
|
|
1106
|
+
globalAxios2,
|
|
1107
|
+
BASE_PATH,
|
|
1108
|
+
configuration
|
|
1109
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
952
1110
|
}
|
|
953
1111
|
};
|
|
954
1112
|
};
|
|
955
|
-
var
|
|
1113
|
+
var ViewersApi = class extends BaseAPI {
|
|
956
1114
|
/**
|
|
957
|
-
*
|
|
958
|
-
* @summary
|
|
1115
|
+
* Create a viewer for a stream and return its credentials.
|
|
1116
|
+
* @summary Create a viewer
|
|
959
1117
|
* @param {string} streamId Stream id
|
|
960
1118
|
* @param {*} [options] Override http request option.
|
|
961
1119
|
* @throws {RequiredError}
|
|
962
|
-
* @memberof
|
|
1120
|
+
* @memberof ViewersApi
|
|
963
1121
|
*/
|
|
964
1122
|
createViewer(streamId, options) {
|
|
965
|
-
return
|
|
1123
|
+
return ViewersApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath));
|
|
966
1124
|
}
|
|
967
1125
|
/**
|
|
968
|
-
*
|
|
969
|
-
* @summary
|
|
1126
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1127
|
+
* @summary Delete a viewer
|
|
970
1128
|
* @param {string} streamId Stream id
|
|
971
1129
|
* @param {string} viewerId Viewer id
|
|
972
1130
|
* @param {*} [options] Override http request option.
|
|
973
1131
|
* @throws {RequiredError}
|
|
974
|
-
* @memberof
|
|
1132
|
+
* @memberof ViewersApi
|
|
975
1133
|
*/
|
|
976
1134
|
deleteViewer(streamId, viewerId, options) {
|
|
977
|
-
return
|
|
1135
|
+
return ViewersApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath));
|
|
978
1136
|
}
|
|
979
1137
|
/**
|
|
980
|
-
*
|
|
981
|
-
* @summary
|
|
1138
|
+
* Issue a fresh viewer token.
|
|
1139
|
+
* @summary Create a viewer token
|
|
982
1140
|
* @param {string} roomId ID of the stream.
|
|
983
1141
|
* @param {*} [options] Override http request option.
|
|
984
1142
|
* @throws {RequiredError}
|
|
985
|
-
* @memberof
|
|
1143
|
+
* @memberof ViewersApi
|
|
986
1144
|
*/
|
|
987
1145
|
generateViewerToken(roomId, options) {
|
|
988
|
-
return
|
|
1146
|
+
return ViewersApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
|
|
989
1147
|
}
|
|
990
1148
|
};
|
|
991
1149
|
|
|
@@ -1858,6 +2016,14 @@ var Track = {
|
|
|
1858
2016
|
function isSet(value) {
|
|
1859
2017
|
return value !== null && value !== void 0;
|
|
1860
2018
|
}
|
|
2019
|
+
var ServerMessage_PeerType = /* @__PURE__ */ ((ServerMessage_PeerType2) => {
|
|
2020
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_UNSPECIFIED"] = 0] = "PEER_TYPE_UNSPECIFIED";
|
|
2021
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_WEBRTC"] = 1] = "PEER_TYPE_WEBRTC";
|
|
2022
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_AGENT"] = 2] = "PEER_TYPE_AGENT";
|
|
2023
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["PEER_TYPE_VAPI"] = 3] = "PEER_TYPE_VAPI";
|
|
2024
|
+
ServerMessage_PeerType2[ServerMessage_PeerType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
2025
|
+
return ServerMessage_PeerType2;
|
|
2026
|
+
})(ServerMessage_PeerType || {});
|
|
1861
2027
|
function serverMessage_PeerTypeFromJSON(object) {
|
|
1862
2028
|
switch (object) {
|
|
1863
2029
|
case 0:
|
|
@@ -1981,6 +2147,7 @@ function createBaseServerMessage() {
|
|
|
1981
2147
|
viewerDisconnected: void 0,
|
|
1982
2148
|
streamerConnected: void 0,
|
|
1983
2149
|
streamerDisconnected: void 0,
|
|
2150
|
+
notificationBatch: void 0,
|
|
1984
2151
|
streamConnected: void 0,
|
|
1985
2152
|
streamDisconnected: void 0,
|
|
1986
2153
|
hlsPlayable: void 0,
|
|
@@ -2066,6 +2233,9 @@ var ServerMessage = {
|
|
|
2066
2233
|
if (message.streamerDisconnected !== void 0) {
|
|
2067
2234
|
ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
|
|
2068
2235
|
}
|
|
2236
|
+
if (message.notificationBatch !== void 0) {
|
|
2237
|
+
ServerMessage_NotificationBatch.encode(message.notificationBatch, writer.uint32(266).fork()).join();
|
|
2238
|
+
}
|
|
2069
2239
|
if (message.streamConnected !== void 0) {
|
|
2070
2240
|
ServerMessage_StreamConnected.encode(message.streamConnected, writer.uint32(178).fork()).join();
|
|
2071
2241
|
}
|
|
@@ -2268,6 +2438,13 @@ var ServerMessage = {
|
|
|
2268
2438
|
message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
|
|
2269
2439
|
continue;
|
|
2270
2440
|
}
|
|
2441
|
+
case 33: {
|
|
2442
|
+
if (tag !== 266) {
|
|
2443
|
+
break;
|
|
2444
|
+
}
|
|
2445
|
+
message.notificationBatch = ServerMessage_NotificationBatch.decode(reader, reader.uint32());
|
|
2446
|
+
continue;
|
|
2447
|
+
}
|
|
2271
2448
|
case 22: {
|
|
2272
2449
|
if (tag !== 178) {
|
|
2273
2450
|
break;
|
|
@@ -2345,6 +2522,7 @@ var ServerMessage = {
|
|
|
2345
2522
|
viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
|
|
2346
2523
|
streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
|
|
2347
2524
|
streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0,
|
|
2525
|
+
notificationBatch: isSet2(object.notificationBatch) ? ServerMessage_NotificationBatch.fromJSON(object.notificationBatch) : void 0,
|
|
2348
2526
|
streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
|
|
2349
2527
|
streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
|
|
2350
2528
|
hlsPlayable: isSet2(object.hlsPlayable) ? ServerMessage_HlsPlayable.fromJSON(object.hlsPlayable) : void 0,
|
|
@@ -2430,6 +2608,9 @@ var ServerMessage = {
|
|
|
2430
2608
|
if (message.streamerDisconnected !== void 0) {
|
|
2431
2609
|
obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
|
|
2432
2610
|
}
|
|
2611
|
+
if (message.notificationBatch !== void 0) {
|
|
2612
|
+
obj.notificationBatch = ServerMessage_NotificationBatch.toJSON(message.notificationBatch);
|
|
2613
|
+
}
|
|
2433
2614
|
if (message.streamConnected !== void 0) {
|
|
2434
2615
|
obj.streamConnected = ServerMessage_StreamConnected.toJSON(message.streamConnected);
|
|
2435
2616
|
}
|
|
@@ -2480,6 +2661,7 @@ var ServerMessage = {
|
|
|
2480
2661
|
message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
|
|
2481
2662
|
message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
|
|
2482
2663
|
message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
|
|
2664
|
+
message.notificationBatch = object.notificationBatch !== void 0 && object.notificationBatch !== null ? ServerMessage_NotificationBatch.fromPartial(object.notificationBatch) : void 0;
|
|
2483
2665
|
message.streamConnected = object.streamConnected !== void 0 && object.streamConnected !== null ? ServerMessage_StreamConnected.fromPartial(object.streamConnected) : void 0;
|
|
2484
2666
|
message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
|
|
2485
2667
|
message.hlsPlayable = object.hlsPlayable !== void 0 && object.hlsPlayable !== null ? ServerMessage_HlsPlayable.fromPartial(object.hlsPlayable) : void 0;
|
|
@@ -4786,6 +4968,59 @@ var ServerMessage_StreamerDisconnected = {
|
|
|
4786
4968
|
return message;
|
|
4787
4969
|
}
|
|
4788
4970
|
};
|
|
4971
|
+
function createBaseServerMessage_NotificationBatch() {
|
|
4972
|
+
return { notifications: [] };
|
|
4973
|
+
}
|
|
4974
|
+
var ServerMessage_NotificationBatch = {
|
|
4975
|
+
encode(message, writer = new BinaryWriter()) {
|
|
4976
|
+
for (const v of message.notifications) {
|
|
4977
|
+
ServerMessage.encode(v, writer.uint32(10).fork()).join();
|
|
4978
|
+
}
|
|
4979
|
+
return writer;
|
|
4980
|
+
},
|
|
4981
|
+
decode(input, length) {
|
|
4982
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4983
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
4984
|
+
const message = createBaseServerMessage_NotificationBatch();
|
|
4985
|
+
while (reader.pos < end) {
|
|
4986
|
+
const tag = reader.uint32();
|
|
4987
|
+
switch (tag >>> 3) {
|
|
4988
|
+
case 1: {
|
|
4989
|
+
if (tag !== 10) {
|
|
4990
|
+
break;
|
|
4991
|
+
}
|
|
4992
|
+
message.notifications.push(ServerMessage.decode(reader, reader.uint32()));
|
|
4993
|
+
continue;
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4997
|
+
break;
|
|
4998
|
+
}
|
|
4999
|
+
reader.skip(tag & 7);
|
|
5000
|
+
}
|
|
5001
|
+
return message;
|
|
5002
|
+
},
|
|
5003
|
+
fromJSON(object) {
|
|
5004
|
+
return {
|
|
5005
|
+
notifications: globalThis.Array.isArray(object?.notifications) ? object.notifications.map((e) => ServerMessage.fromJSON(e)) : []
|
|
5006
|
+
};
|
|
5007
|
+
},
|
|
5008
|
+
toJSON(message) {
|
|
5009
|
+
const obj = {};
|
|
5010
|
+
if (message.notifications?.length) {
|
|
5011
|
+
obj.notifications = message.notifications.map((e) => ServerMessage.toJSON(e));
|
|
5012
|
+
}
|
|
5013
|
+
return obj;
|
|
5014
|
+
},
|
|
5015
|
+
create(base) {
|
|
5016
|
+
return ServerMessage_NotificationBatch.fromPartial(base ?? {});
|
|
5017
|
+
},
|
|
5018
|
+
fromPartial(object) {
|
|
5019
|
+
const message = createBaseServerMessage_NotificationBatch();
|
|
5020
|
+
message.notifications = object.notifications?.map((e) => ServerMessage.fromPartial(e)) || [];
|
|
5021
|
+
return message;
|
|
5022
|
+
}
|
|
5023
|
+
};
|
|
4789
5024
|
function isSet2(value) {
|
|
4790
5025
|
return value !== null && value !== void 0;
|
|
4791
5026
|
}
|
|
@@ -5690,10 +5925,14 @@ var RoomNotFoundException = class extends FishjamBaseException {
|
|
|
5690
5925
|
};
|
|
5691
5926
|
var FishjamNotFoundException = class extends FishjamBaseException {
|
|
5692
5927
|
};
|
|
5928
|
+
var InvalidFishjamCredentialsException = class extends FishjamBaseException {
|
|
5929
|
+
};
|
|
5693
5930
|
var PeerNotFoundException = class extends FishjamBaseException {
|
|
5694
5931
|
};
|
|
5695
5932
|
var ServiceUnavailableException = class extends FishjamBaseException {
|
|
5696
5933
|
};
|
|
5934
|
+
var QuotaExceededException = class extends FishjamBaseException {
|
|
5935
|
+
};
|
|
5697
5936
|
var UnknownException = class extends FishjamBaseException {
|
|
5698
5937
|
};
|
|
5699
5938
|
|
|
@@ -5712,7 +5951,20 @@ var getFishjamUrl = (config) => {
|
|
|
5712
5951
|
}
|
|
5713
5952
|
};
|
|
5714
5953
|
|
|
5715
|
-
// src/
|
|
5954
|
+
// src/notifications.ts
|
|
5955
|
+
var peerTypeMap = {
|
|
5956
|
+
[ServerMessage_PeerType.PEER_TYPE_UNSPECIFIED]: "unspecified",
|
|
5957
|
+
[ServerMessage_PeerType.PEER_TYPE_WEBRTC]: "webrtc",
|
|
5958
|
+
[ServerMessage_PeerType.PEER_TYPE_AGENT]: "agent",
|
|
5959
|
+
[ServerMessage_PeerType.PEER_TYPE_VAPI]: "vapi",
|
|
5960
|
+
[ServerMessage_PeerType.UNRECOGNIZED]: "unspecified"
|
|
5961
|
+
};
|
|
5962
|
+
var trackTypeMap = {
|
|
5963
|
+
[TrackType.TRACK_TYPE_UNSPECIFIED]: "unspecified",
|
|
5964
|
+
[TrackType.TRACK_TYPE_VIDEO]: "video",
|
|
5965
|
+
[TrackType.TRACK_TYPE_AUDIO]: "audio",
|
|
5966
|
+
[TrackType.UNRECOGNIZED]: "unspecified"
|
|
5967
|
+
};
|
|
5716
5968
|
var expectedEventsList = [
|
|
5717
5969
|
"roomCreated",
|
|
5718
5970
|
"roomDeleted",
|
|
@@ -5723,14 +5975,39 @@ var expectedEventsList = [
|
|
|
5723
5975
|
"peerDisconnected",
|
|
5724
5976
|
"peerMetadataUpdated",
|
|
5725
5977
|
"peerCrashed",
|
|
5726
|
-
"
|
|
5727
|
-
"
|
|
5978
|
+
"streamerConnected",
|
|
5979
|
+
"streamerDisconnected",
|
|
5728
5980
|
"viewerConnected",
|
|
5729
5981
|
"viewerDisconnected",
|
|
5730
5982
|
"trackAdded",
|
|
5731
5983
|
"trackRemoved",
|
|
5732
|
-
"trackMetadataUpdated"
|
|
5984
|
+
"trackMetadataUpdated",
|
|
5985
|
+
"channelAdded",
|
|
5986
|
+
"channelRemoved"
|
|
5733
5987
|
];
|
|
5988
|
+
var peerEventsWithPeerType = /* @__PURE__ */ new Set([
|
|
5989
|
+
"peerAdded",
|
|
5990
|
+
"peerDeleted",
|
|
5991
|
+
"peerConnected",
|
|
5992
|
+
"peerDisconnected",
|
|
5993
|
+
"peerMetadataUpdated",
|
|
5994
|
+
"peerCrashed"
|
|
5995
|
+
]);
|
|
5996
|
+
var trackEvents = /* @__PURE__ */ new Set(["trackAdded", "trackRemoved", "trackMetadataUpdated"]);
|
|
5997
|
+
var mapTrack = (track) => track && { id: track.id, type: trackTypeMap[track.type], metadata: track.metadata };
|
|
5998
|
+
var mapNotification = (event, msg) => {
|
|
5999
|
+
if (peerEventsWithPeerType.has(event)) {
|
|
6000
|
+
const peerMsg = msg;
|
|
6001
|
+
return { ...peerMsg, peerType: peerTypeMap[peerMsg.peerType] };
|
|
6002
|
+
}
|
|
6003
|
+
if (trackEvents.has(event)) {
|
|
6004
|
+
const trackMsg = msg;
|
|
6005
|
+
return { ...trackMsg, track: mapTrack(trackMsg.track) };
|
|
6006
|
+
}
|
|
6007
|
+
return msg;
|
|
6008
|
+
};
|
|
6009
|
+
|
|
6010
|
+
// src/ws_notifier.ts
|
|
5734
6011
|
var FishjamWSNotifier = class extends EventEmitter {
|
|
5735
6012
|
client;
|
|
5736
6013
|
constructor(config, onError, onClose) {
|
|
@@ -5750,7 +6027,8 @@ var FishjamWSNotifier = class extends EventEmitter {
|
|
|
5750
6027
|
const decodedMessage = ServerMessage.decode(data);
|
|
5751
6028
|
const [notification, msg] = Object.entries(decodedMessage).find(([_k, v]) => v);
|
|
5752
6029
|
if (!this.isExpectedEvent(notification)) return;
|
|
5753
|
-
this.emit
|
|
6030
|
+
const emit = this.emit;
|
|
6031
|
+
emit(notification, mapNotification(notification, msg));
|
|
5754
6032
|
} catch (e) {
|
|
5755
6033
|
console.error("Couldn't decode websocket server message", e, message);
|
|
5756
6034
|
}
|
|
@@ -5928,9 +6206,14 @@ var mapException = (error, entity) => {
|
|
|
5928
6206
|
switch (error.response?.status) {
|
|
5929
6207
|
case 400:
|
|
5930
6208
|
return new BadRequestException(error);
|
|
6209
|
+
case 402:
|
|
6210
|
+
return new QuotaExceededException(error);
|
|
5931
6211
|
case 401:
|
|
5932
6212
|
throw new UnauthorizedException(error);
|
|
5933
6213
|
case 404:
|
|
6214
|
+
if (error.request.path.includes("validate")) {
|
|
6215
|
+
return new InvalidFishjamCredentialsException(error);
|
|
6216
|
+
}
|
|
5934
6217
|
switch (entity) {
|
|
5935
6218
|
case "peer":
|
|
5936
6219
|
return new PeerNotFoundException(error);
|
|
@@ -5950,16 +6233,21 @@ var mapException = (error, entity) => {
|
|
|
5950
6233
|
};
|
|
5951
6234
|
|
|
5952
6235
|
// src/client.ts
|
|
5953
|
-
var FishjamClient = class {
|
|
6236
|
+
var FishjamClient = class _FishjamClient {
|
|
5954
6237
|
moqApi;
|
|
5955
6238
|
roomApi;
|
|
5956
6239
|
viewerApi;
|
|
5957
6240
|
streamerApi;
|
|
6241
|
+
credentialsApi;
|
|
5958
6242
|
fishjamConfig;
|
|
5959
6243
|
deprecationWarningShown = false;
|
|
5960
6244
|
/**
|
|
5961
6245
|
* Create new instance of Fishjam Client.
|
|
5962
6246
|
*
|
|
6247
|
+
* Does not verify credentials against the backend — use
|
|
6248
|
+
* {@link FishjamClient.create} or call
|
|
6249
|
+
* {@link FishjamClient.checkCredentials} afterwards for that.
|
|
6250
|
+
*
|
|
5963
6251
|
* Example usage:
|
|
5964
6252
|
* ```
|
|
5965
6253
|
* const fishjamClient = new FishjamClient({
|
|
@@ -5980,12 +6268,46 @@ var FishjamClient = class {
|
|
|
5980
6268
|
return response;
|
|
5981
6269
|
});
|
|
5982
6270
|
const fishjamUrl = getFishjamUrl(config);
|
|
5983
|
-
this.moqApi = new
|
|
5984
|
-
this.roomApi = new
|
|
5985
|
-
this.viewerApi = new
|
|
5986
|
-
this.streamerApi = new
|
|
6271
|
+
this.moqApi = new MoQApi(void 0, fishjamUrl, client);
|
|
6272
|
+
this.roomApi = new RoomsApi(void 0, fishjamUrl, client);
|
|
6273
|
+
this.viewerApi = new ViewersApi(void 0, fishjamUrl, client);
|
|
6274
|
+
this.streamerApi = new StreamersApi(void 0, fishjamUrl, client);
|
|
6275
|
+
this.credentialsApi = new CredentialsApi(void 0, fishjamUrl, client);
|
|
5987
6276
|
this.fishjamConfig = config;
|
|
5988
6277
|
}
|
|
6278
|
+
/**
|
|
6279
|
+
* Async factory: constructs a client and verifies credentials against
|
|
6280
|
+
* the backend.
|
|
6281
|
+
*
|
|
6282
|
+
* Throws {@link InvalidFishjamCredentialsException} when the
|
|
6283
|
+
* `fishjamId` / `managementToken` pair is rejected by the backend.
|
|
6284
|
+
*
|
|
6285
|
+
* Example:
|
|
6286
|
+
* ```
|
|
6287
|
+
* const client = await FishjamClient.create({
|
|
6288
|
+
* fishjamId: process.env.FISHJAM_ID!,
|
|
6289
|
+
* managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
|
|
6290
|
+
* });
|
|
6291
|
+
* ```
|
|
6292
|
+
*/
|
|
6293
|
+
static async create(config) {
|
|
6294
|
+
const client = new _FishjamClient(config);
|
|
6295
|
+
await client.checkCredentials();
|
|
6296
|
+
return client;
|
|
6297
|
+
}
|
|
6298
|
+
/**
|
|
6299
|
+
* Verifies the configured credentials by making a single lightweight
|
|
6300
|
+
* call to the Fishjam backend. Resolves on success, throws
|
|
6301
|
+
* {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
|
|
6302
|
+
* otherwise rethrows the standard mapped exception.
|
|
6303
|
+
*/
|
|
6304
|
+
async checkCredentials() {
|
|
6305
|
+
try {
|
|
6306
|
+
await this.credentialsApi.validateCredentials();
|
|
6307
|
+
} catch (error) {
|
|
6308
|
+
throw mapException(error);
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
5989
6311
|
handleDeprecationHeader(headers) {
|
|
5990
6312
|
try {
|
|
5991
6313
|
const deprecationHeader = headers["x-fishjam-api-deprecated"];
|
|
@@ -6191,9 +6513,11 @@ export {
|
|
|
6191
6513
|
FishjamNotFoundException,
|
|
6192
6514
|
FishjamWSNotifier,
|
|
6193
6515
|
ForbiddenException,
|
|
6516
|
+
InvalidFishjamCredentialsException,
|
|
6194
6517
|
MissingFishjamIdException,
|
|
6195
6518
|
PeerNotFoundException,
|
|
6196
6519
|
PeerStatus,
|
|
6520
|
+
QuotaExceededException,
|
|
6197
6521
|
RoomNotFoundException,
|
|
6198
6522
|
RoomType,
|
|
6199
6523
|
ServerMessage,
|