@fishjam-cloud/js-server-sdk 0.29.0-rc.2 → 0.29.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-ZKMES6M4.mjs → chunk-3EYSX4WM.mjs} +5 -4
- package/dist/index.d.mts +456 -184
- package/dist/index.d.ts +456 -184
- package/dist/index.js +1602 -1100
- package/dist/index.mjs +1587 -1077
- package/dist/integrations/gemini.js +5 -4
- package/dist/integrations/gemini.mjs +1 -1
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -49,1052 +39,1541 @@ __export(index_exports, {
|
|
|
49
39
|
UnauthorizedException: () => UnauthorizedException,
|
|
50
40
|
UnknownException: () => UnknownException,
|
|
51
41
|
VideoCodec: () => VideoCodec,
|
|
52
|
-
decodeServerNotifications: () => decodeServerNotifications
|
|
42
|
+
decodeServerNotifications: () => decodeServerNotifications,
|
|
43
|
+
verifyWebhookSignature: () => verifyWebhookSignature
|
|
53
44
|
});
|
|
54
45
|
module.exports = __toCommonJS(index_exports);
|
|
55
46
|
|
|
56
47
|
// ../fishjam-openapi/dist/index.js
|
|
57
|
-
var import_axios = __toESM(require("axios"), 1);
|
|
58
|
-
var import_axios2 = __toESM(require("axios"), 1);
|
|
59
48
|
var BASE_PATH = "https://fishjam.io/api/v1/connect".replace(/\/+$/, "");
|
|
60
|
-
var
|
|
61
|
-
constructor(configuration
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
var Configuration = class {
|
|
50
|
+
constructor(configuration = {}) {
|
|
51
|
+
this.configuration = configuration;
|
|
52
|
+
}
|
|
53
|
+
set config(configuration) {
|
|
54
|
+
this.configuration = configuration;
|
|
55
|
+
}
|
|
56
|
+
get basePath() {
|
|
57
|
+
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
58
|
+
}
|
|
59
|
+
get fetchApi() {
|
|
60
|
+
return this.configuration.fetchApi;
|
|
61
|
+
}
|
|
62
|
+
get middleware() {
|
|
63
|
+
return this.configuration.middleware || [];
|
|
64
|
+
}
|
|
65
|
+
get queryParamsStringify() {
|
|
66
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
67
|
+
}
|
|
68
|
+
get username() {
|
|
69
|
+
return this.configuration.username;
|
|
70
|
+
}
|
|
71
|
+
get password() {
|
|
72
|
+
return this.configuration.password;
|
|
73
|
+
}
|
|
74
|
+
get apiKey() {
|
|
75
|
+
const apiKey = this.configuration.apiKey;
|
|
76
|
+
if (apiKey) {
|
|
77
|
+
return typeof apiKey === "function" ? apiKey : () => apiKey;
|
|
78
|
+
}
|
|
79
|
+
return void 0;
|
|
80
|
+
}
|
|
81
|
+
get accessToken() {
|
|
82
|
+
const accessToken = this.configuration.accessToken;
|
|
83
|
+
if (accessToken) {
|
|
84
|
+
return typeof accessToken === "function" ? accessToken : async () => accessToken;
|
|
85
|
+
}
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
get headers() {
|
|
89
|
+
return this.configuration.headers;
|
|
90
|
+
}
|
|
91
|
+
get credentials() {
|
|
92
|
+
return this.configuration.credentials;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var DefaultConfig = new Configuration();
|
|
96
|
+
var BaseAPI = class _BaseAPI {
|
|
97
|
+
constructor(configuration = DefaultConfig) {
|
|
98
|
+
this.configuration = configuration;
|
|
99
|
+
this.middleware = configuration.middleware;
|
|
100
|
+
}
|
|
101
|
+
static jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
|
|
102
|
+
middleware;
|
|
103
|
+
withMiddleware(...middlewares) {
|
|
104
|
+
const next = this.clone();
|
|
105
|
+
next.middleware = next.middleware.concat(...middlewares);
|
|
106
|
+
return next;
|
|
107
|
+
}
|
|
108
|
+
withPreMiddleware(...preMiddlewares) {
|
|
109
|
+
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
110
|
+
return this.withMiddleware(...middlewares);
|
|
111
|
+
}
|
|
112
|
+
withPostMiddleware(...postMiddlewares) {
|
|
113
|
+
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
114
|
+
return this.withMiddleware(...middlewares);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if the given MIME is a JSON MIME.
|
|
118
|
+
* JSON MIME examples:
|
|
119
|
+
* application/json
|
|
120
|
+
* application/json; charset=UTF8
|
|
121
|
+
* APPLICATION/JSON
|
|
122
|
+
* application/vnd.company+json
|
|
123
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
124
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
125
|
+
*/
|
|
126
|
+
isJsonMime(mime) {
|
|
127
|
+
if (!mime) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return _BaseAPI.jsonRegex.test(mime);
|
|
131
|
+
}
|
|
132
|
+
async request(context, initOverrides) {
|
|
133
|
+
const { url, init } = await this.createFetchParams(context, initOverrides);
|
|
134
|
+
const response = await this.fetchApi(url, init);
|
|
135
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
136
|
+
return response;
|
|
137
|
+
}
|
|
138
|
+
throw new ResponseError(response, "Response returned an error code");
|
|
139
|
+
}
|
|
140
|
+
async createFetchParams(context, initOverrides) {
|
|
141
|
+
let url = this.configuration.basePath + context.path;
|
|
142
|
+
if (context.query !== void 0 && Object.keys(context.query).length !== 0) {
|
|
143
|
+
url += "?" + this.configuration.queryParamsStringify(context.query);
|
|
144
|
+
}
|
|
145
|
+
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
146
|
+
Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {});
|
|
147
|
+
const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
|
|
148
|
+
const initParams = {
|
|
149
|
+
method: context.method,
|
|
150
|
+
headers,
|
|
151
|
+
body: context.body,
|
|
152
|
+
credentials: this.configuration.credentials
|
|
153
|
+
};
|
|
154
|
+
const overriddenInit = {
|
|
155
|
+
...initParams,
|
|
156
|
+
...await initOverrideFn({
|
|
157
|
+
init: initParams,
|
|
158
|
+
context
|
|
159
|
+
})
|
|
160
|
+
};
|
|
161
|
+
let body;
|
|
162
|
+
if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
|
|
163
|
+
body = overriddenInit.body;
|
|
164
|
+
} else if (this.isJsonMime(headers["Content-Type"])) {
|
|
165
|
+
body = JSON.stringify(overriddenInit.body);
|
|
166
|
+
} else {
|
|
167
|
+
body = overriddenInit.body;
|
|
168
|
+
}
|
|
169
|
+
const init = {
|
|
170
|
+
...overriddenInit,
|
|
171
|
+
body
|
|
172
|
+
};
|
|
173
|
+
return { url, init };
|
|
174
|
+
}
|
|
175
|
+
fetchApi = async (url, init) => {
|
|
176
|
+
let fetchParams = { url, init };
|
|
177
|
+
for (const middleware of this.middleware) {
|
|
178
|
+
if (middleware.pre) {
|
|
179
|
+
fetchParams = await middleware.pre({
|
|
180
|
+
fetch: this.fetchApi,
|
|
181
|
+
...fetchParams
|
|
182
|
+
}) || fetchParams;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
let response = void 0;
|
|
186
|
+
try {
|
|
187
|
+
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
for (const middleware of this.middleware) {
|
|
190
|
+
if (middleware.onError) {
|
|
191
|
+
response = await middleware.onError({
|
|
192
|
+
fetch: this.fetchApi,
|
|
193
|
+
url: fetchParams.url,
|
|
194
|
+
init: fetchParams.init,
|
|
195
|
+
error: e,
|
|
196
|
+
response: response ? response.clone() : void 0
|
|
197
|
+
}) || response;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (response === void 0) {
|
|
201
|
+
if (e instanceof Error) {
|
|
202
|
+
throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
|
|
203
|
+
} else {
|
|
204
|
+
throw e;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (const middleware of this.middleware) {
|
|
209
|
+
if (middleware.post) {
|
|
210
|
+
response = await middleware.post({
|
|
211
|
+
fetch: this.fetchApi,
|
|
212
|
+
url: fetchParams.url,
|
|
213
|
+
init: fetchParams.init,
|
|
214
|
+
response: response.clone()
|
|
215
|
+
}) || response;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return response;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
222
|
+
* and then shallow cloning data members.
|
|
223
|
+
*/
|
|
224
|
+
clone() {
|
|
225
|
+
const constructor = this.constructor;
|
|
226
|
+
const next = new constructor(this.configuration);
|
|
227
|
+
next.middleware = this.middleware.slice();
|
|
228
|
+
return next;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function isBlob(value) {
|
|
232
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
233
|
+
}
|
|
234
|
+
function isFormData(value) {
|
|
235
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
236
|
+
}
|
|
237
|
+
var ResponseError = class extends Error {
|
|
238
|
+
constructor(response, msg) {
|
|
239
|
+
super(msg);
|
|
240
|
+
this.response = response;
|
|
241
|
+
const actualProto = new.target.prototype;
|
|
242
|
+
if (Object.setPrototypeOf) {
|
|
243
|
+
Object.setPrototypeOf(this, actualProto);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
name = "ResponseError";
|
|
247
|
+
};
|
|
248
|
+
var FetchError = class extends Error {
|
|
249
|
+
constructor(cause, msg) {
|
|
250
|
+
super(msg);
|
|
251
|
+
this.cause = cause;
|
|
252
|
+
const actualProto = new.target.prototype;
|
|
253
|
+
if (Object.setPrototypeOf) {
|
|
254
|
+
Object.setPrototypeOf(this, actualProto);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
name = "FetchError";
|
|
258
|
+
};
|
|
259
|
+
var RequiredError = class extends Error {
|
|
260
|
+
constructor(field, msg) {
|
|
261
|
+
super(msg);
|
|
262
|
+
this.field = field;
|
|
263
|
+
const actualProto = new.target.prototype;
|
|
264
|
+
if (Object.setPrototypeOf) {
|
|
265
|
+
Object.setPrototypeOf(this, actualProto);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
name = "RequiredError";
|
|
269
|
+
};
|
|
270
|
+
function querystring(params, prefix = "") {
|
|
271
|
+
return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
|
|
272
|
+
}
|
|
273
|
+
function querystringSingleKey(key, value, keyPrefix = "") {
|
|
274
|
+
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
|
|
275
|
+
if (value instanceof Array) {
|
|
276
|
+
const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
|
|
277
|
+
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
|
278
|
+
}
|
|
279
|
+
if (value instanceof Set) {
|
|
280
|
+
const valueAsArray = Array.from(value);
|
|
281
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
282
|
+
}
|
|
283
|
+
if (value instanceof Date) {
|
|
284
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
|
|
285
|
+
}
|
|
286
|
+
if (value instanceof Object) {
|
|
287
|
+
return querystring(value, fullKey);
|
|
288
|
+
}
|
|
289
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
290
|
+
}
|
|
291
|
+
var JSONApiResponse = class {
|
|
292
|
+
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
293
|
+
this.raw = raw;
|
|
294
|
+
this.transformer = transformer;
|
|
295
|
+
}
|
|
296
|
+
async value() {
|
|
297
|
+
return this.transformer(await this.raw.json());
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
var VoidApiResponse = class {
|
|
301
|
+
constructor(raw) {
|
|
302
|
+
this.raw = raw;
|
|
303
|
+
}
|
|
304
|
+
async value() {
|
|
305
|
+
return void 0;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
var CredentialsApi = class extends BaseAPI {
|
|
309
|
+
/**
|
|
310
|
+
* Creates request options for validateCredentials without sending the request
|
|
311
|
+
*/
|
|
312
|
+
async validateCredentialsRequestOpts() {
|
|
313
|
+
const queryParameters = {};
|
|
314
|
+
const headerParameters = {};
|
|
315
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
316
|
+
const token = this.configuration.accessToken;
|
|
317
|
+
const tokenString = await token("management_token", []);
|
|
318
|
+
if (tokenString) {
|
|
319
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
let urlPath = `/validate`;
|
|
323
|
+
return {
|
|
324
|
+
path: urlPath,
|
|
325
|
+
method: "GET",
|
|
326
|
+
headers: headerParameters,
|
|
327
|
+
query: queryParameters
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
332
|
+
* Validate Fishjam Management Token
|
|
333
|
+
*/
|
|
334
|
+
async validateCredentialsRaw(initOverrides) {
|
|
335
|
+
const requestOptions = await this.validateCredentialsRequestOpts();
|
|
336
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
337
|
+
return new VoidApiResponse(response);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
341
|
+
* Validate Fishjam Management Token
|
|
342
|
+
*/
|
|
343
|
+
async validateCredentials(initOverrides) {
|
|
344
|
+
await this.validateCredentialsRaw(initOverrides);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
function MoqAccessFromJSON(json) {
|
|
348
|
+
return MoqAccessFromJSONTyped(json, false);
|
|
349
|
+
}
|
|
350
|
+
function MoqAccessFromJSONTyped(json, ignoreDiscriminator) {
|
|
351
|
+
if (json == null) {
|
|
352
|
+
return json;
|
|
353
|
+
}
|
|
354
|
+
return {
|
|
355
|
+
"connection_url": json["connection_url"],
|
|
356
|
+
"token": json["token"]
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function MoqAccessConfigToJSON(json) {
|
|
360
|
+
return MoqAccessConfigToJSONTyped(json, false);
|
|
361
|
+
}
|
|
362
|
+
function MoqAccessConfigToJSONTyped(value, ignoreDiscriminator = false) {
|
|
363
|
+
if (value == null) {
|
|
364
|
+
return value;
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
"publishPath": value["publishPath"],
|
|
368
|
+
"subscribePath": value["subscribePath"]
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
var MoQApi = class extends BaseAPI {
|
|
372
|
+
/**
|
|
373
|
+
* Creates request options for createMoqAccess without sending the request
|
|
374
|
+
*/
|
|
375
|
+
async createMoqAccessRequestOpts(requestParameters) {
|
|
376
|
+
const queryParameters = {};
|
|
377
|
+
const headerParameters = {};
|
|
378
|
+
headerParameters["Content-Type"] = "application/json";
|
|
379
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
380
|
+
const token = this.configuration.accessToken;
|
|
381
|
+
const tokenString = await token("management_token", []);
|
|
382
|
+
if (tokenString) {
|
|
383
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
let urlPath = `/moq/access`;
|
|
387
|
+
return {
|
|
388
|
+
path: urlPath,
|
|
389
|
+
method: "POST",
|
|
390
|
+
headers: headerParameters,
|
|
391
|
+
query: queryParameters,
|
|
392
|
+
body: MoqAccessConfigToJSON(requestParameters["moqAccessConfig"])
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
397
|
+
* Create MoQ access
|
|
398
|
+
*/
|
|
399
|
+
async createMoqAccessRaw(requestParameters, initOverrides) {
|
|
400
|
+
const requestOptions = await this.createMoqAccessRequestOpts(requestParameters);
|
|
401
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
402
|
+
return new JSONApiResponse(response, (jsonValue) => MoqAccessFromJSON(jsonValue));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
406
|
+
* Create MoQ access
|
|
407
|
+
*/
|
|
408
|
+
async createMoqAccess(requestParameters = {}, initOverrides) {
|
|
409
|
+
const response = await this.createMoqAccessRaw(requestParameters, initOverrides);
|
|
410
|
+
return await response.value();
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
function AudioSampleRateToJSON(value) {
|
|
414
|
+
return value;
|
|
415
|
+
}
|
|
416
|
+
function AudioFormatToJSON(value) {
|
|
417
|
+
return value;
|
|
418
|
+
}
|
|
419
|
+
function AgentOutputToJSON(json) {
|
|
420
|
+
return AgentOutputToJSONTyped(json, false);
|
|
421
|
+
}
|
|
422
|
+
function AgentOutputToJSONTyped(value, ignoreDiscriminator = false) {
|
|
423
|
+
if (value == null) {
|
|
424
|
+
return value;
|
|
425
|
+
}
|
|
426
|
+
return {
|
|
427
|
+
"audioFormat": AudioFormatToJSON(value["audioFormat"]),
|
|
428
|
+
"audioSampleRate": AudioSampleRateToJSON(value["audioSampleRate"])
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function SubscribeModeFromJSON(json) {
|
|
432
|
+
return SubscribeModeFromJSONTyped(json, false);
|
|
433
|
+
}
|
|
434
|
+
function SubscribeModeFromJSONTyped(json, ignoreDiscriminator) {
|
|
435
|
+
return json;
|
|
436
|
+
}
|
|
437
|
+
function SubscribeModeToJSON(value) {
|
|
438
|
+
return value;
|
|
439
|
+
}
|
|
440
|
+
function PeerOptionsAgentToJSON(json) {
|
|
441
|
+
return PeerOptionsAgentToJSONTyped(json, false);
|
|
442
|
+
}
|
|
443
|
+
function PeerOptionsAgentToJSONTyped(value, ignoreDiscriminator = false) {
|
|
444
|
+
if (value == null) {
|
|
445
|
+
return value;
|
|
446
|
+
}
|
|
447
|
+
return {
|
|
448
|
+
"output": AgentOutputToJSON(value["output"]),
|
|
449
|
+
"subscribeMode": SubscribeModeToJSON(value["subscribeMode"])
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function PeerConfigAgentToJSON(json) {
|
|
453
|
+
return PeerConfigAgentToJSONTyped(json, false);
|
|
454
|
+
}
|
|
455
|
+
function PeerConfigAgentToJSONTyped(value, ignoreDiscriminator = false) {
|
|
456
|
+
if (value == null) {
|
|
457
|
+
return value;
|
|
458
|
+
}
|
|
459
|
+
return {
|
|
460
|
+
"options": PeerOptionsAgentToJSON(value["options"]),
|
|
461
|
+
"type": value["type"]
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function PeerOptionsVapiToJSON(json) {
|
|
465
|
+
return PeerOptionsVapiToJSONTyped(json, false);
|
|
466
|
+
}
|
|
467
|
+
function PeerOptionsVapiToJSONTyped(value, ignoreDiscriminator = false) {
|
|
468
|
+
if (value == null) {
|
|
469
|
+
return value;
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
"apiKey": value["apiKey"],
|
|
473
|
+
"callId": value["callId"],
|
|
474
|
+
"subscribeMode": SubscribeModeToJSON(value["subscribeMode"])
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function PeerConfigVAPIToJSON(json) {
|
|
478
|
+
return PeerConfigVAPIToJSONTyped(json, false);
|
|
479
|
+
}
|
|
480
|
+
function PeerConfigVAPIToJSONTyped(value, ignoreDiscriminator = false) {
|
|
481
|
+
if (value == null) {
|
|
482
|
+
return value;
|
|
483
|
+
}
|
|
484
|
+
return {
|
|
485
|
+
"options": PeerOptionsVapiToJSON(value["options"]),
|
|
486
|
+
"type": value["type"]
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function PeerOptionsWebRTCToJSON(json) {
|
|
490
|
+
return PeerOptionsWebRTCToJSONTyped(json, false);
|
|
491
|
+
}
|
|
492
|
+
function PeerOptionsWebRTCToJSONTyped(value, ignoreDiscriminator = false) {
|
|
493
|
+
if (value == null) {
|
|
494
|
+
return value;
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
"metadata": value["metadata"],
|
|
498
|
+
"subscribeMode": SubscribeModeToJSON(value["subscribeMode"])
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function PeerConfigWebRTCToJSON(json) {
|
|
502
|
+
return PeerConfigWebRTCToJSONTyped(json, false);
|
|
503
|
+
}
|
|
504
|
+
function PeerConfigWebRTCToJSONTyped(value, ignoreDiscriminator = false) {
|
|
505
|
+
if (value == null) {
|
|
506
|
+
return value;
|
|
507
|
+
}
|
|
508
|
+
return {
|
|
509
|
+
"options": PeerOptionsWebRTCToJSON(value["options"]),
|
|
510
|
+
"type": value["type"]
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
function PeerConfigToJSON(json) {
|
|
514
|
+
return PeerConfigToJSONTyped(json, false);
|
|
515
|
+
}
|
|
516
|
+
function PeerConfigToJSONTyped(value, ignoreDiscriminator = false) {
|
|
517
|
+
if (value == null) {
|
|
518
|
+
return value;
|
|
519
|
+
}
|
|
520
|
+
switch (value["type"]) {
|
|
521
|
+
case "agent":
|
|
522
|
+
return Object.assign({}, PeerConfigAgentToJSON(value), { "type": "agent" });
|
|
523
|
+
case "vapi":
|
|
524
|
+
return Object.assign({}, PeerConfigVAPIToJSON(value), { "type": "vapi" });
|
|
525
|
+
case "webrtc":
|
|
526
|
+
return Object.assign({}, PeerConfigWebRTCToJSON(value), { "type": "webrtc" });
|
|
527
|
+
default:
|
|
528
|
+
return value;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function SubscriptionsFromJSON(json) {
|
|
532
|
+
return SubscriptionsFromJSONTyped(json, false);
|
|
533
|
+
}
|
|
534
|
+
function SubscriptionsFromJSONTyped(json, ignoreDiscriminator) {
|
|
535
|
+
if (json == null) {
|
|
536
|
+
return json;
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
"peers": json["peers"],
|
|
540
|
+
"tracks": json["tracks"]
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
var PeerStatus = {
|
|
544
|
+
Connected: "connected",
|
|
545
|
+
Disconnected: "disconnected"
|
|
546
|
+
};
|
|
547
|
+
function PeerStatusFromJSON(json) {
|
|
548
|
+
return PeerStatusFromJSONTyped(json, false);
|
|
549
|
+
}
|
|
550
|
+
function PeerStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
551
|
+
return json;
|
|
552
|
+
}
|
|
553
|
+
function PeerTypeFromJSON(json) {
|
|
554
|
+
return PeerTypeFromJSONTyped(json, false);
|
|
555
|
+
}
|
|
556
|
+
function PeerTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
557
|
+
return json;
|
|
558
|
+
}
|
|
559
|
+
function TrackTypeFromJSON(json) {
|
|
560
|
+
return TrackTypeFromJSONTyped(json, false);
|
|
561
|
+
}
|
|
562
|
+
function TrackTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
563
|
+
return json;
|
|
564
|
+
}
|
|
565
|
+
function TrackFromJSON(json) {
|
|
566
|
+
return TrackFromJSONTyped(json, false);
|
|
567
|
+
}
|
|
568
|
+
function TrackFromJSONTyped(json, ignoreDiscriminator) {
|
|
569
|
+
if (json == null) {
|
|
570
|
+
return json;
|
|
571
|
+
}
|
|
572
|
+
return {
|
|
573
|
+
"id": json["id"] == null ? void 0 : json["id"],
|
|
574
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"],
|
|
575
|
+
"type": json["type"] == null ? void 0 : TrackTypeFromJSON(json["type"])
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function PeerFromJSON(json) {
|
|
579
|
+
return PeerFromJSONTyped(json, false);
|
|
580
|
+
}
|
|
581
|
+
function PeerFromJSONTyped(json, ignoreDiscriminator) {
|
|
582
|
+
if (json == null) {
|
|
583
|
+
return json;
|
|
584
|
+
}
|
|
585
|
+
return {
|
|
586
|
+
"id": json["id"],
|
|
587
|
+
"metadata": json["metadata"],
|
|
588
|
+
"status": PeerStatusFromJSON(json["status"]),
|
|
589
|
+
"subscribeMode": SubscribeModeFromJSON(json["subscribeMode"]),
|
|
590
|
+
"subscriptions": SubscriptionsFromJSON(json["subscriptions"]),
|
|
591
|
+
"tracks": json["tracks"].map(TrackFromJSON),
|
|
592
|
+
"type": PeerTypeFromJSON(json["type"])
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function PeerDetailsResponseDataFromJSON(json) {
|
|
596
|
+
return PeerDetailsResponseDataFromJSONTyped(json, false);
|
|
597
|
+
}
|
|
598
|
+
function PeerDetailsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
599
|
+
if (json == null) {
|
|
600
|
+
return json;
|
|
601
|
+
}
|
|
602
|
+
return {
|
|
603
|
+
"peer": PeerFromJSON(json["peer"]),
|
|
604
|
+
"peer_websocket_url": json["peer_websocket_url"] == null ? void 0 : json["peer_websocket_url"],
|
|
605
|
+
"token": json["token"]
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function PeerDetailsResponseFromJSON(json) {
|
|
609
|
+
return PeerDetailsResponseFromJSONTyped(json, false);
|
|
610
|
+
}
|
|
611
|
+
function PeerDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
612
|
+
if (json == null) {
|
|
613
|
+
return json;
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
"data": PeerDetailsResponseDataFromJSON(json["data"])
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function PeerRefreshTokenResponseDataFromJSON(json) {
|
|
620
|
+
return PeerRefreshTokenResponseDataFromJSONTyped(json, false);
|
|
621
|
+
}
|
|
622
|
+
function PeerRefreshTokenResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
623
|
+
if (json == null) {
|
|
624
|
+
return json;
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
"token": json["token"]
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
function PeerRefreshTokenResponseFromJSON(json) {
|
|
631
|
+
return PeerRefreshTokenResponseFromJSONTyped(json, false);
|
|
632
|
+
}
|
|
633
|
+
function PeerRefreshTokenResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
634
|
+
if (json == null) {
|
|
635
|
+
return json;
|
|
636
|
+
}
|
|
637
|
+
return {
|
|
638
|
+
"data": PeerRefreshTokenResponseDataFromJSON(json["data"])
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
var RoomType = {
|
|
642
|
+
FullFeature: "full_feature",
|
|
643
|
+
AudioOnly: "audio_only",
|
|
644
|
+
Broadcaster: "broadcaster",
|
|
645
|
+
Livestream: "livestream",
|
|
646
|
+
Conference: "conference",
|
|
647
|
+
AudioOnlyLivestream: "audio_only_livestream"
|
|
648
|
+
};
|
|
649
|
+
function RoomTypeFromJSON(json) {
|
|
650
|
+
return RoomTypeFromJSONTyped(json, false);
|
|
651
|
+
}
|
|
652
|
+
function RoomTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
653
|
+
return json;
|
|
654
|
+
}
|
|
655
|
+
function RoomTypeToJSON(value) {
|
|
656
|
+
return value;
|
|
657
|
+
}
|
|
658
|
+
var VideoCodec = {
|
|
659
|
+
H264: "h264",
|
|
660
|
+
Vp8: "vp8"
|
|
661
|
+
};
|
|
662
|
+
function VideoCodecFromJSON(json) {
|
|
663
|
+
return VideoCodecFromJSONTyped(json, false);
|
|
664
|
+
}
|
|
665
|
+
function VideoCodecFromJSONTyped(json, ignoreDiscriminator) {
|
|
666
|
+
return json;
|
|
667
|
+
}
|
|
668
|
+
function VideoCodecToJSON(value) {
|
|
669
|
+
return value;
|
|
670
|
+
}
|
|
671
|
+
function RoomConfigFromJSON(json) {
|
|
672
|
+
return RoomConfigFromJSONTyped(json, false);
|
|
673
|
+
}
|
|
674
|
+
function RoomConfigFromJSONTyped(json, ignoreDiscriminator) {
|
|
675
|
+
if (json == null) {
|
|
676
|
+
return json;
|
|
677
|
+
}
|
|
678
|
+
return {
|
|
679
|
+
"batchWebhookNotifications": json["batchWebhookNotifications"] == null ? void 0 : json["batchWebhookNotifications"],
|
|
680
|
+
"maxPeers": json["maxPeers"] == null ? void 0 : json["maxPeers"],
|
|
681
|
+
"public": json["public"] == null ? void 0 : json["public"],
|
|
682
|
+
"roomType": json["roomType"] == null ? void 0 : RoomTypeFromJSON(json["roomType"]),
|
|
683
|
+
"videoCodec": json["videoCodec"] == null ? void 0 : VideoCodecFromJSON(json["videoCodec"]),
|
|
684
|
+
"webhookUrl": json["webhookUrl"] == null ? void 0 : json["webhookUrl"]
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
function RoomConfigToJSON(json) {
|
|
688
|
+
return RoomConfigToJSONTyped(json, false);
|
|
689
|
+
}
|
|
690
|
+
function RoomConfigToJSONTyped(value, ignoreDiscriminator = false) {
|
|
691
|
+
if (value == null) {
|
|
692
|
+
return value;
|
|
693
|
+
}
|
|
694
|
+
return {
|
|
695
|
+
"batchWebhookNotifications": value["batchWebhookNotifications"],
|
|
696
|
+
"maxPeers": value["maxPeers"],
|
|
697
|
+
"public": value["public"],
|
|
698
|
+
"roomType": RoomTypeToJSON(value["roomType"]),
|
|
699
|
+
"videoCodec": VideoCodecToJSON(value["videoCodec"]),
|
|
700
|
+
"webhookUrl": value["webhookUrl"]
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function TrackForwardingInfoFromJSON(json) {
|
|
704
|
+
return TrackForwardingInfoFromJSONTyped(json, false);
|
|
705
|
+
}
|
|
706
|
+
function TrackForwardingInfoFromJSONTyped(json, ignoreDiscriminator) {
|
|
707
|
+
if (json == null) {
|
|
708
|
+
return json;
|
|
709
|
+
}
|
|
710
|
+
return {
|
|
711
|
+
"audioTrackId": json["audioTrackId"] == null ? void 0 : json["audioTrackId"],
|
|
712
|
+
"inputId": json["inputId"],
|
|
713
|
+
"peerId": json["peerId"],
|
|
714
|
+
"videoTrackId": json["videoTrackId"] == null ? void 0 : json["videoTrackId"]
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
function CompositionInfoFromJSON(json) {
|
|
718
|
+
return CompositionInfoFromJSONTyped(json, false);
|
|
719
|
+
}
|
|
720
|
+
function CompositionInfoFromJSONTyped(json, ignoreDiscriminator) {
|
|
721
|
+
if (json == null) {
|
|
722
|
+
return json;
|
|
723
|
+
}
|
|
724
|
+
return {
|
|
725
|
+
"compositionUrl": json["compositionUrl"],
|
|
726
|
+
"forwardings": json["forwardings"].map(TrackForwardingInfoFromJSON)
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function RoomFromJSON(json) {
|
|
730
|
+
return RoomFromJSONTyped(json, false);
|
|
731
|
+
}
|
|
732
|
+
function RoomFromJSONTyped(json, ignoreDiscriminator) {
|
|
733
|
+
if (json == null) {
|
|
734
|
+
return json;
|
|
735
|
+
}
|
|
736
|
+
return {
|
|
737
|
+
"compositionInfo": json["compositionInfo"] == null ? void 0 : CompositionInfoFromJSON(json["compositionInfo"]),
|
|
738
|
+
"config": RoomConfigFromJSON(json["config"]),
|
|
739
|
+
"id": json["id"],
|
|
740
|
+
"peers": json["peers"].map(PeerFromJSON)
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function RoomCreateDetailsResponseDataFromJSON(json) {
|
|
744
|
+
return RoomCreateDetailsResponseDataFromJSONTyped(json, false);
|
|
745
|
+
}
|
|
746
|
+
function RoomCreateDetailsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
747
|
+
if (json == null) {
|
|
748
|
+
return json;
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
"room": RoomFromJSON(json["room"])
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function RoomCreateDetailsResponseFromJSON(json) {
|
|
755
|
+
return RoomCreateDetailsResponseFromJSONTyped(json, false);
|
|
756
|
+
}
|
|
757
|
+
function RoomCreateDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
758
|
+
if (json == null) {
|
|
759
|
+
return json;
|
|
760
|
+
}
|
|
761
|
+
return {
|
|
762
|
+
"data": RoomCreateDetailsResponseDataFromJSON(json["data"])
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
function RoomDetailsResponseFromJSON(json) {
|
|
766
|
+
return RoomDetailsResponseFromJSONTyped(json, false);
|
|
767
|
+
}
|
|
768
|
+
function RoomDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
769
|
+
if (json == null) {
|
|
770
|
+
return json;
|
|
771
|
+
}
|
|
772
|
+
return {
|
|
773
|
+
"data": RoomFromJSON(json["data"])
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function RoomsListingResponseFromJSON(json) {
|
|
777
|
+
return RoomsListingResponseFromJSONTyped(json, false);
|
|
778
|
+
}
|
|
779
|
+
function RoomsListingResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
780
|
+
if (json == null) {
|
|
781
|
+
return json;
|
|
782
|
+
}
|
|
783
|
+
return {
|
|
784
|
+
"data": json["data"].map(RoomFromJSON)
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
function SubscribeTracksRequestToJSON(json) {
|
|
788
|
+
return SubscribeTracksRequestToJSONTyped(json, false);
|
|
789
|
+
}
|
|
790
|
+
function SubscribeTracksRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
791
|
+
if (value == null) {
|
|
792
|
+
return value;
|
|
793
|
+
}
|
|
794
|
+
return {
|
|
795
|
+
"track_ids": value["track_ids"]
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
var RoomsApi = class extends BaseAPI {
|
|
799
|
+
/**
|
|
800
|
+
* Creates request options for addPeer without sending the request
|
|
801
|
+
*/
|
|
802
|
+
async addPeerRequestOpts(requestParameters) {
|
|
803
|
+
if (requestParameters["roomId"] == null) {
|
|
804
|
+
throw new RequiredError(
|
|
805
|
+
"roomId",
|
|
806
|
+
'Required parameter "roomId" was null or undefined when calling addPeer().'
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
const queryParameters = {};
|
|
810
|
+
const headerParameters = {};
|
|
811
|
+
headerParameters["Content-Type"] = "application/json";
|
|
812
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
813
|
+
const token = this.configuration.accessToken;
|
|
814
|
+
const tokenString = await token("management_token", []);
|
|
815
|
+
if (tokenString) {
|
|
816
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
let urlPath = `/room/{room_id}/peer`;
|
|
820
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
821
|
+
return {
|
|
822
|
+
path: urlPath,
|
|
823
|
+
method: "POST",
|
|
824
|
+
headers: headerParameters,
|
|
825
|
+
query: queryParameters,
|
|
826
|
+
body: PeerConfigToJSON(requestParameters["peerConfig"])
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Add a peer to a room and return its connection token.
|
|
831
|
+
* Create a peer
|
|
832
|
+
*/
|
|
833
|
+
async addPeerRaw(requestParameters, initOverrides) {
|
|
834
|
+
const requestOptions = await this.addPeerRequestOpts(requestParameters);
|
|
835
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
836
|
+
return new JSONApiResponse(response, (jsonValue) => PeerDetailsResponseFromJSON(jsonValue));
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Add a peer to a room and return its connection token.
|
|
840
|
+
* Create a peer
|
|
841
|
+
*/
|
|
842
|
+
async addPeer(requestParameters, initOverrides) {
|
|
843
|
+
const response = await this.addPeerRaw(requestParameters, initOverrides);
|
|
844
|
+
return await response.value();
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Creates request options for createRoom without sending the request
|
|
848
|
+
*/
|
|
849
|
+
async createRoomRequestOpts(requestParameters) {
|
|
850
|
+
const queryParameters = {};
|
|
851
|
+
const headerParameters = {};
|
|
852
|
+
headerParameters["Content-Type"] = "application/json";
|
|
853
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
854
|
+
const token = this.configuration.accessToken;
|
|
855
|
+
const tokenString = await token("management_token", []);
|
|
856
|
+
if (tokenString) {
|
|
857
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
let urlPath = `/room`;
|
|
861
|
+
return {
|
|
862
|
+
path: urlPath,
|
|
863
|
+
method: "POST",
|
|
864
|
+
headers: headerParameters,
|
|
865
|
+
query: queryParameters,
|
|
866
|
+
body: RoomConfigToJSON(requestParameters["roomConfig"])
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Create a new room with the given configuration.
|
|
871
|
+
* Create a room
|
|
872
|
+
*/
|
|
873
|
+
async createRoomRaw(requestParameters, initOverrides) {
|
|
874
|
+
const requestOptions = await this.createRoomRequestOpts(requestParameters);
|
|
875
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
876
|
+
return new JSONApiResponse(response, (jsonValue) => RoomCreateDetailsResponseFromJSON(jsonValue));
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Create a new room with the given configuration.
|
|
880
|
+
* Create a room
|
|
881
|
+
*/
|
|
882
|
+
async createRoom(requestParameters = {}, initOverrides) {
|
|
883
|
+
const response = await this.createRoomRaw(requestParameters, initOverrides);
|
|
884
|
+
return await response.value();
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Creates request options for deletePeer without sending the request
|
|
888
|
+
*/
|
|
889
|
+
async deletePeerRequestOpts(requestParameters) {
|
|
890
|
+
if (requestParameters["roomId"] == null) {
|
|
891
|
+
throw new RequiredError(
|
|
892
|
+
"roomId",
|
|
893
|
+
'Required parameter "roomId" was null or undefined when calling deletePeer().'
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
if (requestParameters["id"] == null) {
|
|
897
|
+
throw new RequiredError(
|
|
898
|
+
"id",
|
|
899
|
+
'Required parameter "id" was null or undefined when calling deletePeer().'
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
const queryParameters = {};
|
|
903
|
+
const headerParameters = {};
|
|
904
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
905
|
+
const token = this.configuration.accessToken;
|
|
906
|
+
const tokenString = await token("management_token", []);
|
|
907
|
+
if (tokenString) {
|
|
908
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
let urlPath = `/room/{room_id}/peer/{id}`;
|
|
912
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
913
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
914
|
+
return {
|
|
915
|
+
path: urlPath,
|
|
916
|
+
method: "DELETE",
|
|
917
|
+
headers: headerParameters,
|
|
918
|
+
query: queryParameters
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Remove a peer from a room and disconnect it.
|
|
923
|
+
* Delete a peer
|
|
924
|
+
*/
|
|
925
|
+
async deletePeerRaw(requestParameters, initOverrides) {
|
|
926
|
+
const requestOptions = await this.deletePeerRequestOpts(requestParameters);
|
|
927
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
928
|
+
return new VoidApiResponse(response);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Remove a peer from a room and disconnect it.
|
|
932
|
+
* Delete a peer
|
|
933
|
+
*/
|
|
934
|
+
async deletePeer(requestParameters, initOverrides) {
|
|
935
|
+
await this.deletePeerRaw(requestParameters, initOverrides);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Creates request options for deleteRoom without sending the request
|
|
939
|
+
*/
|
|
940
|
+
async deleteRoomRequestOpts(requestParameters) {
|
|
941
|
+
if (requestParameters["roomId"] == null) {
|
|
942
|
+
throw new RequiredError(
|
|
943
|
+
"roomId",
|
|
944
|
+
'Required parameter "roomId" was null or undefined when calling deleteRoom().'
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
const queryParameters = {};
|
|
948
|
+
const headerParameters = {};
|
|
949
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
950
|
+
const token = this.configuration.accessToken;
|
|
951
|
+
const tokenString = await token("management_token", []);
|
|
952
|
+
if (tokenString) {
|
|
953
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
let urlPath = `/room/{room_id}`;
|
|
957
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
958
|
+
return {
|
|
959
|
+
path: urlPath,
|
|
960
|
+
method: "DELETE",
|
|
961
|
+
headers: headerParameters,
|
|
962
|
+
query: queryParameters
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Delete a room by id and disconnect all of its peers.
|
|
967
|
+
* Delete a room
|
|
968
|
+
*/
|
|
969
|
+
async deleteRoomRaw(requestParameters, initOverrides) {
|
|
970
|
+
const requestOptions = await this.deleteRoomRequestOpts(requestParameters);
|
|
971
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
972
|
+
return new VoidApiResponse(response);
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Delete a room by id and disconnect all of its peers.
|
|
976
|
+
* Delete a room
|
|
977
|
+
*/
|
|
978
|
+
async deleteRoom(requestParameters, initOverrides) {
|
|
979
|
+
await this.deleteRoomRaw(requestParameters, initOverrides);
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Creates request options for getAllRooms without sending the request
|
|
983
|
+
*/
|
|
984
|
+
async getAllRoomsRequestOpts() {
|
|
985
|
+
const queryParameters = {};
|
|
986
|
+
const headerParameters = {};
|
|
987
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
988
|
+
const token = this.configuration.accessToken;
|
|
989
|
+
const tokenString = await token("management_token", []);
|
|
990
|
+
if (tokenString) {
|
|
991
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
let urlPath = `/room`;
|
|
995
|
+
return {
|
|
996
|
+
path: urlPath,
|
|
997
|
+
method: "GET",
|
|
998
|
+
headers: headerParameters,
|
|
999
|
+
query: queryParameters
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* List all rooms and livestreams.
|
|
1004
|
+
* List all rooms
|
|
1005
|
+
*/
|
|
1006
|
+
async getAllRoomsRaw(initOverrides) {
|
|
1007
|
+
const requestOptions = await this.getAllRoomsRequestOpts();
|
|
1008
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1009
|
+
return new JSONApiResponse(response, (jsonValue) => RoomsListingResponseFromJSON(jsonValue));
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* List all rooms and livestreams.
|
|
1013
|
+
* List all rooms
|
|
1014
|
+
*/
|
|
1015
|
+
async getAllRooms(initOverrides) {
|
|
1016
|
+
const response = await this.getAllRoomsRaw(initOverrides);
|
|
1017
|
+
return await response.value();
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Creates request options for getRoom without sending the request
|
|
1021
|
+
*/
|
|
1022
|
+
async getRoomRequestOpts(requestParameters) {
|
|
1023
|
+
if (requestParameters["roomId"] == null) {
|
|
1024
|
+
throw new RequiredError(
|
|
1025
|
+
"roomId",
|
|
1026
|
+
'Required parameter "roomId" was null or undefined when calling getRoom().'
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
const queryParameters = {};
|
|
1030
|
+
const headerParameters = {};
|
|
1031
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1032
|
+
const token = this.configuration.accessToken;
|
|
1033
|
+
const tokenString = await token("management_token", []);
|
|
1034
|
+
if (tokenString) {
|
|
1035
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
let urlPath = `/room/{room_id}`;
|
|
1039
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1040
|
+
return {
|
|
1041
|
+
path: urlPath,
|
|
1042
|
+
method: "GET",
|
|
1043
|
+
headers: headerParameters,
|
|
1044
|
+
query: queryParameters
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Get a room by id.
|
|
1049
|
+
* Get a room
|
|
1050
|
+
*/
|
|
1051
|
+
async getRoomRaw(requestParameters, initOverrides) {
|
|
1052
|
+
const requestOptions = await this.getRoomRequestOpts(requestParameters);
|
|
1053
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1054
|
+
return new JSONApiResponse(response, (jsonValue) => RoomDetailsResponseFromJSON(jsonValue));
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Get a room by id.
|
|
1058
|
+
* Get a room
|
|
1059
|
+
*/
|
|
1060
|
+
async getRoom(requestParameters, initOverrides) {
|
|
1061
|
+
const response = await this.getRoomRaw(requestParameters, initOverrides);
|
|
1062
|
+
return await response.value();
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Creates request options for refreshToken without sending the request
|
|
1066
|
+
*/
|
|
1067
|
+
async refreshTokenRequestOpts(requestParameters) {
|
|
1068
|
+
if (requestParameters["roomId"] == null) {
|
|
1069
|
+
throw new RequiredError(
|
|
1070
|
+
"roomId",
|
|
1071
|
+
'Required parameter "roomId" was null or undefined when calling refreshToken().'
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
if (requestParameters["id"] == null) {
|
|
1075
|
+
throw new RequiredError(
|
|
1076
|
+
"id",
|
|
1077
|
+
'Required parameter "id" was null or undefined when calling refreshToken().'
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
const queryParameters = {};
|
|
1081
|
+
const headerParameters = {};
|
|
1082
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1083
|
+
const token = this.configuration.accessToken;
|
|
1084
|
+
const tokenString = await token("management_token", []);
|
|
1085
|
+
if (tokenString) {
|
|
1086
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
let urlPath = `/room/{room_id}/peer/{id}/refresh_token`;
|
|
1090
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1091
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
1092
|
+
return {
|
|
1093
|
+
path: urlPath,
|
|
1094
|
+
method: "POST",
|
|
1095
|
+
headers: headerParameters,
|
|
1096
|
+
query: queryParameters
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Issue a fresh connection token for an existing peer.
|
|
1101
|
+
* Refresh a peer token
|
|
1102
|
+
*/
|
|
1103
|
+
async refreshTokenRaw(requestParameters, initOverrides) {
|
|
1104
|
+
const requestOptions = await this.refreshTokenRequestOpts(requestParameters);
|
|
1105
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1106
|
+
return new JSONApiResponse(response, (jsonValue) => PeerRefreshTokenResponseFromJSON(jsonValue));
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Issue a fresh connection token for an existing peer.
|
|
1110
|
+
* Refresh a peer token
|
|
1111
|
+
*/
|
|
1112
|
+
async refreshToken(requestParameters, initOverrides) {
|
|
1113
|
+
const response = await this.refreshTokenRaw(requestParameters, initOverrides);
|
|
1114
|
+
return await response.value();
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Creates request options for subscribePeer without sending the request
|
|
1118
|
+
*/
|
|
1119
|
+
async subscribePeerRequestOpts(requestParameters) {
|
|
1120
|
+
if (requestParameters["roomId"] == null) {
|
|
1121
|
+
throw new RequiredError(
|
|
1122
|
+
"roomId",
|
|
1123
|
+
'Required parameter "roomId" was null or undefined when calling subscribePeer().'
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
if (requestParameters["id"] == null) {
|
|
1127
|
+
throw new RequiredError(
|
|
1128
|
+
"id",
|
|
1129
|
+
'Required parameter "id" was null or undefined when calling subscribePeer().'
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
const queryParameters = {};
|
|
1133
|
+
if (requestParameters["peerId"] != null) {
|
|
1134
|
+
queryParameters["peer_id"] = requestParameters["peerId"];
|
|
1135
|
+
}
|
|
1136
|
+
const headerParameters = {};
|
|
1137
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1138
|
+
const token = this.configuration.accessToken;
|
|
1139
|
+
const tokenString = await token("management_token", []);
|
|
1140
|
+
if (tokenString) {
|
|
1141
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1142
|
+
}
|
|
67
1143
|
}
|
|
1144
|
+
let urlPath = `/room/{room_id}/peer/{id}/subscribe_peer`;
|
|
1145
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1146
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
1147
|
+
return {
|
|
1148
|
+
path: urlPath,
|
|
1149
|
+
method: "POST",
|
|
1150
|
+
headers: headerParameters,
|
|
1151
|
+
query: queryParameters
|
|
1152
|
+
};
|
|
68
1153
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
var operationServerMap = {};
|
|
79
|
-
var DUMMY_BASE_URL = "https://example.com";
|
|
80
|
-
var assertParamExists = function(functionName, paramName, paramValue) {
|
|
81
|
-
if (paramValue === null || paramValue === void 0) {
|
|
82
|
-
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
1154
|
+
/**
|
|
1155
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
1156
|
+
* Subscribe a peer to another peer\'s tracks
|
|
1157
|
+
*/
|
|
1158
|
+
async subscribePeerRaw(requestParameters, initOverrides) {
|
|
1159
|
+
const requestOptions = await this.subscribePeerRequestOpts(requestParameters);
|
|
1160
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1161
|
+
return new VoidApiResponse(response);
|
|
83
1162
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1163
|
+
/**
|
|
1164
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
1165
|
+
* Subscribe a peer to another peer\'s tracks
|
|
1166
|
+
*/
|
|
1167
|
+
async subscribePeer(requestParameters, initOverrides) {
|
|
1168
|
+
await this.subscribePeerRaw(requestParameters, initOverrides);
|
|
89
1169
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
(currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`)
|
|
1170
|
+
/**
|
|
1171
|
+
* Creates request options for subscribeTracks without sending the request
|
|
1172
|
+
*/
|
|
1173
|
+
async subscribeTracksRequestOpts(requestParameters) {
|
|
1174
|
+
if (requestParameters["roomId"] == null) {
|
|
1175
|
+
throw new RequiredError(
|
|
1176
|
+
"roomId",
|
|
1177
|
+
'Required parameter "roomId" was null or undefined when calling subscribeTracks().'
|
|
99
1178
|
);
|
|
100
1179
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1180
|
+
if (requestParameters["id"] == null) {
|
|
1181
|
+
throw new RequiredError(
|
|
1182
|
+
"id",
|
|
1183
|
+
'Required parameter "id" was null or undefined when calling subscribeTracks().'
|
|
1184
|
+
);
|
|
106
1185
|
}
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const nonString = typeof value !== "string";
|
|
116
|
-
const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) : nonString;
|
|
117
|
-
return needsSerialization ? JSON.stringify(value !== void 0 ? value : {}) : value || "";
|
|
118
|
-
};
|
|
119
|
-
var toPathString = function(url) {
|
|
120
|
-
return url.pathname + url.search + url.hash;
|
|
121
|
-
};
|
|
122
|
-
var createRequestFunction = function(axiosArgs, globalAxios3, BASE_PATH2, configuration) {
|
|
123
|
-
return (axios2 = globalAxios3, basePath = BASE_PATH2) => {
|
|
124
|
-
const axiosRequestArgs = { ...axiosArgs.options, url: (axios2.defaults.baseURL ? "" : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
125
|
-
return axios2.request(axiosRequestArgs);
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
var PeerStatus = {
|
|
129
|
-
Connected: "connected",
|
|
130
|
-
Disconnected: "disconnected"
|
|
131
|
-
};
|
|
132
|
-
var RoomType = {
|
|
133
|
-
FullFeature: "full_feature",
|
|
134
|
-
AudioOnly: "audio_only",
|
|
135
|
-
Broadcaster: "broadcaster",
|
|
136
|
-
Livestream: "livestream",
|
|
137
|
-
Conference: "conference",
|
|
138
|
-
AudioOnlyLivestream: "audio_only_livestream"
|
|
139
|
-
};
|
|
140
|
-
var VideoCodec = {
|
|
141
|
-
H264: "h264",
|
|
142
|
-
Vp8: "vp8"
|
|
143
|
-
};
|
|
144
|
-
var CredentialsApiAxiosParamCreator = function(configuration) {
|
|
145
|
-
return {
|
|
146
|
-
/**
|
|
147
|
-
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
148
|
-
* @summary Validate Fishjam Management Token
|
|
149
|
-
* @param {*} [options] Override http request option.
|
|
150
|
-
* @throws {RequiredError}
|
|
151
|
-
*/
|
|
152
|
-
validateCredentials: async (options = {}) => {
|
|
153
|
-
const localVarPath = `/validate`;
|
|
154
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
155
|
-
let baseOptions;
|
|
156
|
-
if (configuration) {
|
|
157
|
-
baseOptions = configuration.baseOptions;
|
|
1186
|
+
const queryParameters = {};
|
|
1187
|
+
const headerParameters = {};
|
|
1188
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1189
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1190
|
+
const token = this.configuration.accessToken;
|
|
1191
|
+
const tokenString = await token("management_token", []);
|
|
1192
|
+
if (tokenString) {
|
|
1193
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
158
1194
|
}
|
|
159
|
-
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
160
|
-
const localVarHeaderParameter = {};
|
|
161
|
-
const localVarQueryParameter = {};
|
|
162
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
163
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
164
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
165
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
166
|
-
return {
|
|
167
|
-
url: toPathString(localVarUrlObj),
|
|
168
|
-
options: localVarRequestOptions
|
|
169
|
-
};
|
|
170
1195
|
}
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
async validateCredentials(options) {
|
|
183
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options);
|
|
184
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
185
|
-
const localVarOperationServerBasePath = operationServerMap["CredentialsApi.validateCredentials"]?.[localVarOperationServerIndex]?.url;
|
|
186
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
var CredentialsApi = class extends BaseAPI {
|
|
1196
|
+
let urlPath = `/room/{room_id}/peer/{id}/subscribe_tracks`;
|
|
1197
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1198
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
1199
|
+
return {
|
|
1200
|
+
path: urlPath,
|
|
1201
|
+
method: "POST",
|
|
1202
|
+
headers: headerParameters,
|
|
1203
|
+
query: queryParameters,
|
|
1204
|
+
body: SubscribeTracksRequestToJSON(requestParameters["subscribeTracksRequest"])
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
191
1207
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* @param {*} [options] Override http request option.
|
|
195
|
-
* @throws {RequiredError}
|
|
196
|
-
* @memberof CredentialsApi
|
|
1208
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
1209
|
+
* Subscribe a peer to specific tracks
|
|
197
1210
|
*/
|
|
198
|
-
|
|
199
|
-
|
|
1211
|
+
async subscribeTracksRaw(requestParameters, initOverrides) {
|
|
1212
|
+
const requestOptions = await this.subscribeTracksRequestOpts(requestParameters);
|
|
1213
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1214
|
+
return new VoidApiResponse(response);
|
|
200
1215
|
}
|
|
201
|
-
};
|
|
202
|
-
var MoQApiAxiosParamCreator = function(configuration) {
|
|
203
|
-
return {
|
|
204
|
-
/**
|
|
205
|
-
* Issue a short-lived JWT for a Media over QUIC client.
|
|
206
|
-
* @summary Create MoQ access
|
|
207
|
-
* @param {MoqAccessConfig} [moqAccessConfig]
|
|
208
|
-
* @param {*} [options] Override http request option.
|
|
209
|
-
* @throws {RequiredError}
|
|
210
|
-
*/
|
|
211
|
-
createMoqAccess: async (moqAccessConfig, options = {}) => {
|
|
212
|
-
const localVarPath = `/moq/access`;
|
|
213
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
214
|
-
let baseOptions;
|
|
215
|
-
if (configuration) {
|
|
216
|
-
baseOptions = configuration.baseOptions;
|
|
217
|
-
}
|
|
218
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
219
|
-
const localVarHeaderParameter = {};
|
|
220
|
-
const localVarQueryParameter = {};
|
|
221
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
222
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
223
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
224
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
225
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
226
|
-
localVarRequestOptions.data = serializeDataIfNeeded(moqAccessConfig, localVarRequestOptions, configuration);
|
|
227
|
-
return {
|
|
228
|
-
url: toPathString(localVarUrlObj),
|
|
229
|
-
options: localVarRequestOptions
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
var MoQApiFp = function(configuration) {
|
|
235
|
-
const localVarAxiosParamCreator = MoQApiAxiosParamCreator(configuration);
|
|
236
|
-
return {
|
|
237
|
-
/**
|
|
238
|
-
* Issue a short-lived JWT for a Media over QUIC client.
|
|
239
|
-
* @summary Create MoQ access
|
|
240
|
-
* @param {MoqAccessConfig} [moqAccessConfig]
|
|
241
|
-
* @param {*} [options] Override http request option.
|
|
242
|
-
* @throws {RequiredError}
|
|
243
|
-
*/
|
|
244
|
-
async createMoqAccess(moqAccessConfig, options) {
|
|
245
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqAccess(moqAccessConfig, options);
|
|
246
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
247
|
-
const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqAccess"]?.[localVarOperationServerIndex]?.url;
|
|
248
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
var MoQApi = class extends BaseAPI {
|
|
253
1216
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* @param {MoqAccessConfig} [moqAccessConfig]
|
|
257
|
-
* @param {*} [options] Override http request option.
|
|
258
|
-
* @throws {RequiredError}
|
|
259
|
-
* @memberof MoQApi
|
|
1217
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
1218
|
+
* Subscribe a peer to specific tracks
|
|
260
1219
|
*/
|
|
261
|
-
|
|
262
|
-
|
|
1220
|
+
async subscribeTracks(requestParameters, initOverrides) {
|
|
1221
|
+
await this.subscribeTracksRaw(requestParameters, initOverrides);
|
|
263
1222
|
}
|
|
264
1223
|
};
|
|
265
|
-
|
|
1224
|
+
function StreamerFromJSON(json) {
|
|
1225
|
+
return StreamerFromJSONTyped(json, false);
|
|
1226
|
+
}
|
|
1227
|
+
function StreamerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1228
|
+
if (json == null) {
|
|
1229
|
+
return json;
|
|
1230
|
+
}
|
|
266
1231
|
return {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
* @param {string} roomId Room id
|
|
271
|
-
* @param {PeerConfig} [peerConfig]
|
|
272
|
-
* @param {*} [options] Override http request option.
|
|
273
|
-
* @throws {RequiredError}
|
|
274
|
-
*/
|
|
275
|
-
addPeer: async (roomId, peerConfig, options = {}) => {
|
|
276
|
-
assertParamExists("addPeer", "roomId", roomId);
|
|
277
|
-
const localVarPath = `/room/{room_id}/peer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
278
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
279
|
-
let baseOptions;
|
|
280
|
-
if (configuration) {
|
|
281
|
-
baseOptions = configuration.baseOptions;
|
|
282
|
-
}
|
|
283
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
284
|
-
const localVarHeaderParameter = {};
|
|
285
|
-
const localVarQueryParameter = {};
|
|
286
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
287
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
288
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
289
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
290
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
291
|
-
localVarRequestOptions.data = serializeDataIfNeeded(peerConfig, localVarRequestOptions, configuration);
|
|
292
|
-
return {
|
|
293
|
-
url: toPathString(localVarUrlObj),
|
|
294
|
-
options: localVarRequestOptions
|
|
295
|
-
};
|
|
296
|
-
},
|
|
297
|
-
/**
|
|
298
|
-
* Create a new room with the given configuration.
|
|
299
|
-
* @summary Create a room
|
|
300
|
-
* @param {RoomConfig} [roomConfig]
|
|
301
|
-
* @param {*} [options] Override http request option.
|
|
302
|
-
* @throws {RequiredError}
|
|
303
|
-
*/
|
|
304
|
-
createRoom: async (roomConfig, options = {}) => {
|
|
305
|
-
const localVarPath = `/room`;
|
|
306
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
307
|
-
let baseOptions;
|
|
308
|
-
if (configuration) {
|
|
309
|
-
baseOptions = configuration.baseOptions;
|
|
310
|
-
}
|
|
311
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
312
|
-
const localVarHeaderParameter = {};
|
|
313
|
-
const localVarQueryParameter = {};
|
|
314
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
315
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
316
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
317
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
318
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
319
|
-
localVarRequestOptions.data = serializeDataIfNeeded(roomConfig, localVarRequestOptions, configuration);
|
|
320
|
-
return {
|
|
321
|
-
url: toPathString(localVarUrlObj),
|
|
322
|
-
options: localVarRequestOptions
|
|
323
|
-
};
|
|
324
|
-
},
|
|
325
|
-
/**
|
|
326
|
-
* Remove a peer from a room and disconnect it.
|
|
327
|
-
* @summary Delete a peer
|
|
328
|
-
* @param {string} roomId Room id
|
|
329
|
-
* @param {string} id Peer id
|
|
330
|
-
* @param {*} [options] Override http request option.
|
|
331
|
-
* @throws {RequiredError}
|
|
332
|
-
*/
|
|
333
|
-
deletePeer: async (roomId, id, options = {}) => {
|
|
334
|
-
assertParamExists("deletePeer", "roomId", roomId);
|
|
335
|
-
assertParamExists("deletePeer", "id", id);
|
|
336
|
-
const localVarPath = `/room/{room_id}/peer/{id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
337
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
338
|
-
let baseOptions;
|
|
339
|
-
if (configuration) {
|
|
340
|
-
baseOptions = configuration.baseOptions;
|
|
341
|
-
}
|
|
342
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
343
|
-
const localVarHeaderParameter = {};
|
|
344
|
-
const localVarQueryParameter = {};
|
|
345
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
346
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
347
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
348
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
349
|
-
return {
|
|
350
|
-
url: toPathString(localVarUrlObj),
|
|
351
|
-
options: localVarRequestOptions
|
|
352
|
-
};
|
|
353
|
-
},
|
|
354
|
-
/**
|
|
355
|
-
* Delete a room by id and disconnect all of its peers.
|
|
356
|
-
* @summary Delete a room
|
|
357
|
-
* @param {string} roomId Room id
|
|
358
|
-
* @param {*} [options] Override http request option.
|
|
359
|
-
* @throws {RequiredError}
|
|
360
|
-
*/
|
|
361
|
-
deleteRoom: async (roomId, options = {}) => {
|
|
362
|
-
assertParamExists("deleteRoom", "roomId", roomId);
|
|
363
|
-
const localVarPath = `/room/{room_id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
364
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
365
|
-
let baseOptions;
|
|
366
|
-
if (configuration) {
|
|
367
|
-
baseOptions = configuration.baseOptions;
|
|
368
|
-
}
|
|
369
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
370
|
-
const localVarHeaderParameter = {};
|
|
371
|
-
const localVarQueryParameter = {};
|
|
372
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
373
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
374
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
375
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
376
|
-
return {
|
|
377
|
-
url: toPathString(localVarUrlObj),
|
|
378
|
-
options: localVarRequestOptions
|
|
379
|
-
};
|
|
380
|
-
},
|
|
381
|
-
/**
|
|
382
|
-
* List all rooms and livestreams.
|
|
383
|
-
* @summary List all rooms
|
|
384
|
-
* @param {*} [options] Override http request option.
|
|
385
|
-
* @throws {RequiredError}
|
|
386
|
-
*/
|
|
387
|
-
getAllRooms: async (options = {}) => {
|
|
388
|
-
const localVarPath = `/room`;
|
|
389
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
390
|
-
let baseOptions;
|
|
391
|
-
if (configuration) {
|
|
392
|
-
baseOptions = configuration.baseOptions;
|
|
393
|
-
}
|
|
394
|
-
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
395
|
-
const localVarHeaderParameter = {};
|
|
396
|
-
const localVarQueryParameter = {};
|
|
397
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
398
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
399
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
400
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
401
|
-
return {
|
|
402
|
-
url: toPathString(localVarUrlObj),
|
|
403
|
-
options: localVarRequestOptions
|
|
404
|
-
};
|
|
405
|
-
},
|
|
406
|
-
/**
|
|
407
|
-
* Get a room by id.
|
|
408
|
-
* @summary Get a room
|
|
409
|
-
* @param {string} roomId Room ID
|
|
410
|
-
* @param {*} [options] Override http request option.
|
|
411
|
-
* @throws {RequiredError}
|
|
412
|
-
*/
|
|
413
|
-
getRoom: async (roomId, options = {}) => {
|
|
414
|
-
assertParamExists("getRoom", "roomId", roomId);
|
|
415
|
-
const localVarPath = `/room/{room_id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
416
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
417
|
-
let baseOptions;
|
|
418
|
-
if (configuration) {
|
|
419
|
-
baseOptions = configuration.baseOptions;
|
|
420
|
-
}
|
|
421
|
-
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
422
|
-
const localVarHeaderParameter = {};
|
|
423
|
-
const localVarQueryParameter = {};
|
|
424
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
425
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
426
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
427
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
428
|
-
return {
|
|
429
|
-
url: toPathString(localVarUrlObj),
|
|
430
|
-
options: localVarRequestOptions
|
|
431
|
-
};
|
|
432
|
-
},
|
|
433
|
-
/**
|
|
434
|
-
* Issue a fresh connection token for an existing peer.
|
|
435
|
-
* @summary Refresh a peer token
|
|
436
|
-
* @param {string} roomId Room id
|
|
437
|
-
* @param {string} id Peer id
|
|
438
|
-
* @param {*} [options] Override http request option.
|
|
439
|
-
* @throws {RequiredError}
|
|
440
|
-
*/
|
|
441
|
-
refreshToken: async (roomId, id, options = {}) => {
|
|
442
|
-
assertParamExists("refreshToken", "roomId", roomId);
|
|
443
|
-
assertParamExists("refreshToken", "id", id);
|
|
444
|
-
const localVarPath = `/room/{room_id}/peer/{id}/refresh_token`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
445
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
446
|
-
let baseOptions;
|
|
447
|
-
if (configuration) {
|
|
448
|
-
baseOptions = configuration.baseOptions;
|
|
449
|
-
}
|
|
450
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
451
|
-
const localVarHeaderParameter = {};
|
|
452
|
-
const localVarQueryParameter = {};
|
|
453
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
454
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
455
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
456
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
457
|
-
return {
|
|
458
|
-
url: toPathString(localVarUrlObj),
|
|
459
|
-
options: localVarRequestOptions
|
|
460
|
-
};
|
|
461
|
-
},
|
|
462
|
-
/**
|
|
463
|
-
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
464
|
-
* @summary Subscribe a peer to another peer\'s tracks
|
|
465
|
-
* @param {string} roomId Room id
|
|
466
|
-
* @param {string} id Peer id
|
|
467
|
-
* @param {string} [peerId] ID of the peer that produces the track
|
|
468
|
-
* @param {*} [options] Override http request option.
|
|
469
|
-
* @throws {RequiredError}
|
|
470
|
-
*/
|
|
471
|
-
subscribePeer: async (roomId, id, peerId, options = {}) => {
|
|
472
|
-
assertParamExists("subscribePeer", "roomId", roomId);
|
|
473
|
-
assertParamExists("subscribePeer", "id", id);
|
|
474
|
-
const localVarPath = `/room/{room_id}/peer/{id}/subscribe_peer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
475
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
476
|
-
let baseOptions;
|
|
477
|
-
if (configuration) {
|
|
478
|
-
baseOptions = configuration.baseOptions;
|
|
479
|
-
}
|
|
480
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
481
|
-
const localVarHeaderParameter = {};
|
|
482
|
-
const localVarQueryParameter = {};
|
|
483
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
484
|
-
if (peerId !== void 0) {
|
|
485
|
-
localVarQueryParameter["peer_id"] = peerId;
|
|
486
|
-
}
|
|
487
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
488
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
489
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
490
|
-
return {
|
|
491
|
-
url: toPathString(localVarUrlObj),
|
|
492
|
-
options: localVarRequestOptions
|
|
493
|
-
};
|
|
494
|
-
},
|
|
495
|
-
/**
|
|
496
|
-
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
497
|
-
* @summary Subscribe a peer to specific tracks
|
|
498
|
-
* @param {string} roomId Room id
|
|
499
|
-
* @param {string} id Peer id
|
|
500
|
-
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
501
|
-
* @param {*} [options] Override http request option.
|
|
502
|
-
* @throws {RequiredError}
|
|
503
|
-
*/
|
|
504
|
-
subscribeTracks: async (roomId, id, subscribeTracksRequest, options = {}) => {
|
|
505
|
-
assertParamExists("subscribeTracks", "roomId", roomId);
|
|
506
|
-
assertParamExists("subscribeTracks", "id", id);
|
|
507
|
-
const localVarPath = `/room/{room_id}/peer/{id}/subscribe_tracks`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
508
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
509
|
-
let baseOptions;
|
|
510
|
-
if (configuration) {
|
|
511
|
-
baseOptions = configuration.baseOptions;
|
|
512
|
-
}
|
|
513
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
514
|
-
const localVarHeaderParameter = {};
|
|
515
|
-
const localVarQueryParameter = {};
|
|
516
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
517
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
518
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
519
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
520
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
521
|
-
localVarRequestOptions.data = serializeDataIfNeeded(subscribeTracksRequest, localVarRequestOptions, configuration);
|
|
522
|
-
return {
|
|
523
|
-
url: toPathString(localVarUrlObj),
|
|
524
|
-
options: localVarRequestOptions
|
|
525
|
-
};
|
|
526
|
-
}
|
|
1232
|
+
"id": json["id"],
|
|
1233
|
+
"status": json["status"],
|
|
1234
|
+
"token": json["token"]
|
|
527
1235
|
};
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
|
|
1236
|
+
}
|
|
1237
|
+
function StreamerDetailsResponseFromJSON(json) {
|
|
1238
|
+
return StreamerDetailsResponseFromJSONTyped(json, false);
|
|
1239
|
+
}
|
|
1240
|
+
function StreamerDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1241
|
+
if (json == null) {
|
|
1242
|
+
return json;
|
|
1243
|
+
}
|
|
531
1244
|
return {
|
|
532
|
-
|
|
533
|
-
* Add a peer to a room and return its connection token.
|
|
534
|
-
* @summary Create a peer
|
|
535
|
-
* @param {string} roomId Room id
|
|
536
|
-
* @param {PeerConfig} [peerConfig]
|
|
537
|
-
* @param {*} [options] Override http request option.
|
|
538
|
-
* @throws {RequiredError}
|
|
539
|
-
*/
|
|
540
|
-
async addPeer(roomId, peerConfig, options) {
|
|
541
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
|
|
542
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
543
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
|
|
544
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
545
|
-
},
|
|
546
|
-
/**
|
|
547
|
-
* Create a new room with the given configuration.
|
|
548
|
-
* @summary Create a room
|
|
549
|
-
* @param {RoomConfig} [roomConfig]
|
|
550
|
-
* @param {*} [options] Override http request option.
|
|
551
|
-
* @throws {RequiredError}
|
|
552
|
-
*/
|
|
553
|
-
async createRoom(roomConfig, options) {
|
|
554
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
|
|
555
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
556
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
|
|
557
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
558
|
-
},
|
|
559
|
-
/**
|
|
560
|
-
* Remove a peer from a room and disconnect it.
|
|
561
|
-
* @summary Delete a peer
|
|
562
|
-
* @param {string} roomId Room id
|
|
563
|
-
* @param {string} id Peer id
|
|
564
|
-
* @param {*} [options] Override http request option.
|
|
565
|
-
* @throws {RequiredError}
|
|
566
|
-
*/
|
|
567
|
-
async deletePeer(roomId, id, options) {
|
|
568
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
|
|
569
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
570
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
|
|
571
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
572
|
-
},
|
|
573
|
-
/**
|
|
574
|
-
* Delete a room by id and disconnect all of its peers.
|
|
575
|
-
* @summary Delete a room
|
|
576
|
-
* @param {string} roomId Room id
|
|
577
|
-
* @param {*} [options] Override http request option.
|
|
578
|
-
* @throws {RequiredError}
|
|
579
|
-
*/
|
|
580
|
-
async deleteRoom(roomId, options) {
|
|
581
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
|
|
582
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
583
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
|
|
584
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
585
|
-
},
|
|
586
|
-
/**
|
|
587
|
-
* List all rooms and livestreams.
|
|
588
|
-
* @summary List all rooms
|
|
589
|
-
* @param {*} [options] Override http request option.
|
|
590
|
-
* @throws {RequiredError}
|
|
591
|
-
*/
|
|
592
|
-
async getAllRooms(options) {
|
|
593
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
|
|
594
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
595
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
|
|
596
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
597
|
-
},
|
|
598
|
-
/**
|
|
599
|
-
* Get a room by id.
|
|
600
|
-
* @summary Get a room
|
|
601
|
-
* @param {string} roomId Room ID
|
|
602
|
-
* @param {*} [options] Override http request option.
|
|
603
|
-
* @throws {RequiredError}
|
|
604
|
-
*/
|
|
605
|
-
async getRoom(roomId, options) {
|
|
606
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
|
|
607
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
608
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
|
|
609
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
610
|
-
},
|
|
611
|
-
/**
|
|
612
|
-
* Issue a fresh connection token for an existing peer.
|
|
613
|
-
* @summary Refresh a peer token
|
|
614
|
-
* @param {string} roomId Room id
|
|
615
|
-
* @param {string} id Peer id
|
|
616
|
-
* @param {*} [options] Override http request option.
|
|
617
|
-
* @throws {RequiredError}
|
|
618
|
-
*/
|
|
619
|
-
async refreshToken(roomId, id, options) {
|
|
620
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
|
|
621
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
622
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
|
|
623
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
624
|
-
},
|
|
625
|
-
/**
|
|
626
|
-
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
627
|
-
* @summary Subscribe a peer to another peer\'s tracks
|
|
628
|
-
* @param {string} roomId Room id
|
|
629
|
-
* @param {string} id Peer id
|
|
630
|
-
* @param {string} [peerId] ID of the peer that produces the track
|
|
631
|
-
* @param {*} [options] Override http request option.
|
|
632
|
-
* @throws {RequiredError}
|
|
633
|
-
*/
|
|
634
|
-
async subscribePeer(roomId, id, peerId, options) {
|
|
635
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
|
|
636
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
637
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
|
|
638
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
639
|
-
},
|
|
640
|
-
/**
|
|
641
|
-
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
642
|
-
* @summary Subscribe a peer to specific tracks
|
|
643
|
-
* @param {string} roomId Room id
|
|
644
|
-
* @param {string} id Peer id
|
|
645
|
-
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
646
|
-
* @param {*} [options] Override http request option.
|
|
647
|
-
* @throws {RequiredError}
|
|
648
|
-
*/
|
|
649
|
-
async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
650
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(roomId, id, subscribeTracksRequest, options);
|
|
651
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
652
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
|
|
653
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
654
|
-
}
|
|
1245
|
+
"data": StreamerFromJSON(json["data"])
|
|
655
1246
|
};
|
|
656
|
-
}
|
|
657
|
-
|
|
1247
|
+
}
|
|
1248
|
+
function StreamerTokenFromJSON(json) {
|
|
1249
|
+
return StreamerTokenFromJSONTyped(json, false);
|
|
1250
|
+
}
|
|
1251
|
+
function StreamerTokenFromJSONTyped(json, ignoreDiscriminator) {
|
|
1252
|
+
if (json == null) {
|
|
1253
|
+
return json;
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
"token": json["token"]
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
var StreamersApi = class extends BaseAPI {
|
|
658
1260
|
/**
|
|
659
|
-
*
|
|
660
|
-
* @summary Create a peer
|
|
661
|
-
* @param {string} roomId Room id
|
|
662
|
-
* @param {PeerConfig} [peerConfig]
|
|
663
|
-
* @param {*} [options] Override http request option.
|
|
664
|
-
* @throws {RequiredError}
|
|
665
|
-
* @memberof RoomsApi
|
|
1261
|
+
* Creates request options for createStreamer without sending the request
|
|
666
1262
|
*/
|
|
667
|
-
|
|
668
|
-
|
|
1263
|
+
async createStreamerRequestOpts(requestParameters) {
|
|
1264
|
+
if (requestParameters["streamId"] == null) {
|
|
1265
|
+
throw new RequiredError(
|
|
1266
|
+
"streamId",
|
|
1267
|
+
'Required parameter "streamId" was null or undefined when calling createStreamer().'
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
const queryParameters = {};
|
|
1271
|
+
const headerParameters = {};
|
|
1272
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1273
|
+
const token = this.configuration.accessToken;
|
|
1274
|
+
const tokenString = await token("management_token", []);
|
|
1275
|
+
if (tokenString) {
|
|
1276
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
let urlPath = `/livestream/{stream_id}/streamer`;
|
|
1280
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1281
|
+
return {
|
|
1282
|
+
path: urlPath,
|
|
1283
|
+
method: "POST",
|
|
1284
|
+
headers: headerParameters,
|
|
1285
|
+
query: queryParameters
|
|
1286
|
+
};
|
|
669
1287
|
}
|
|
670
1288
|
/**
|
|
671
|
-
* Create a
|
|
672
|
-
*
|
|
673
|
-
* @param {RoomConfig} [roomConfig]
|
|
674
|
-
* @param {*} [options] Override http request option.
|
|
675
|
-
* @throws {RequiredError}
|
|
676
|
-
* @memberof RoomsApi
|
|
1289
|
+
* Create a streamer for a stream and return its credentials.
|
|
1290
|
+
* Create a streamer
|
|
677
1291
|
*/
|
|
678
|
-
|
|
679
|
-
|
|
1292
|
+
async createStreamerRaw(requestParameters, initOverrides) {
|
|
1293
|
+
const requestOptions = await this.createStreamerRequestOpts(requestParameters);
|
|
1294
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1295
|
+
return new JSONApiResponse(response, (jsonValue) => StreamerDetailsResponseFromJSON(jsonValue));
|
|
680
1296
|
}
|
|
681
1297
|
/**
|
|
682
|
-
*
|
|
683
|
-
*
|
|
684
|
-
* @param {string} roomId Room id
|
|
685
|
-
* @param {string} id Peer id
|
|
686
|
-
* @param {*} [options] Override http request option.
|
|
687
|
-
* @throws {RequiredError}
|
|
688
|
-
* @memberof RoomsApi
|
|
1298
|
+
* Create a streamer for a stream and return its credentials.
|
|
1299
|
+
* Create a streamer
|
|
689
1300
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
1301
|
+
async createStreamer(requestParameters, initOverrides) {
|
|
1302
|
+
const response = await this.createStreamerRaw(requestParameters, initOverrides);
|
|
1303
|
+
return await response.value();
|
|
692
1304
|
}
|
|
693
1305
|
/**
|
|
694
|
-
*
|
|
695
|
-
* @summary Delete a room
|
|
696
|
-
* @param {string} roomId Room id
|
|
697
|
-
* @param {*} [options] Override http request option.
|
|
698
|
-
* @throws {RequiredError}
|
|
699
|
-
* @memberof RoomsApi
|
|
1306
|
+
* Creates request options for deleteStreamer without sending the request
|
|
700
1307
|
*/
|
|
701
|
-
|
|
702
|
-
|
|
1308
|
+
async deleteStreamerRequestOpts(requestParameters) {
|
|
1309
|
+
if (requestParameters["streamId"] == null) {
|
|
1310
|
+
throw new RequiredError(
|
|
1311
|
+
"streamId",
|
|
1312
|
+
'Required parameter "streamId" was null or undefined when calling deleteStreamer().'
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
if (requestParameters["streamerId"] == null) {
|
|
1316
|
+
throw new RequiredError(
|
|
1317
|
+
"streamerId",
|
|
1318
|
+
'Required parameter "streamerId" was null or undefined when calling deleteStreamer().'
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
const queryParameters = {};
|
|
1322
|
+
const headerParameters = {};
|
|
1323
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1324
|
+
const token = this.configuration.accessToken;
|
|
1325
|
+
const tokenString = await token("management_token", []);
|
|
1326
|
+
if (tokenString) {
|
|
1327
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
let urlPath = `/livestream/{stream_id}/streamer/{streamer_id}`;
|
|
1331
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1332
|
+
urlPath = urlPath.replace("{streamer_id}", encodeURIComponent(String(requestParameters["streamerId"])));
|
|
1333
|
+
return {
|
|
1334
|
+
path: urlPath,
|
|
1335
|
+
method: "DELETE",
|
|
1336
|
+
headers: headerParameters,
|
|
1337
|
+
query: queryParameters
|
|
1338
|
+
};
|
|
703
1339
|
}
|
|
704
1340
|
/**
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
* @param {*} [options] Override http request option.
|
|
708
|
-
* @throws {RequiredError}
|
|
709
|
-
* @memberof RoomsApi
|
|
1341
|
+
* Delete a streamer from a stream and revoke its token.
|
|
1342
|
+
* Delete a streamer
|
|
710
1343
|
*/
|
|
711
|
-
|
|
712
|
-
|
|
1344
|
+
async deleteStreamerRaw(requestParameters, initOverrides) {
|
|
1345
|
+
const requestOptions = await this.deleteStreamerRequestOpts(requestParameters);
|
|
1346
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1347
|
+
return new VoidApiResponse(response);
|
|
713
1348
|
}
|
|
714
1349
|
/**
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
* @param {string} roomId Room ID
|
|
718
|
-
* @param {*} [options] Override http request option.
|
|
719
|
-
* @throws {RequiredError}
|
|
720
|
-
* @memberof RoomsApi
|
|
1350
|
+
* Delete a streamer from a stream and revoke its token.
|
|
1351
|
+
* Delete a streamer
|
|
721
1352
|
*/
|
|
722
|
-
|
|
723
|
-
|
|
1353
|
+
async deleteStreamer(requestParameters, initOverrides) {
|
|
1354
|
+
await this.deleteStreamerRaw(requestParameters, initOverrides);
|
|
724
1355
|
}
|
|
725
1356
|
/**
|
|
726
|
-
*
|
|
727
|
-
* @summary Refresh a peer token
|
|
728
|
-
* @param {string} roomId Room id
|
|
729
|
-
* @param {string} id Peer id
|
|
730
|
-
* @param {*} [options] Override http request option.
|
|
731
|
-
* @throws {RequiredError}
|
|
732
|
-
* @memberof RoomsApi
|
|
1357
|
+
* Creates request options for generateStreamerToken without sending the request
|
|
733
1358
|
*/
|
|
734
|
-
|
|
735
|
-
|
|
1359
|
+
async generateStreamerTokenRequestOpts(requestParameters) {
|
|
1360
|
+
if (requestParameters["roomId"] == null) {
|
|
1361
|
+
throw new RequiredError(
|
|
1362
|
+
"roomId",
|
|
1363
|
+
'Required parameter "roomId" was null or undefined when calling generateStreamerToken().'
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1366
|
+
const queryParameters = {};
|
|
1367
|
+
const headerParameters = {};
|
|
1368
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1369
|
+
const token = this.configuration.accessToken;
|
|
1370
|
+
const tokenString = await token("management_token", []);
|
|
1371
|
+
if (tokenString) {
|
|
1372
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
let urlPath = `/room/{room_id}/streamer`;
|
|
1376
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1377
|
+
return {
|
|
1378
|
+
path: urlPath,
|
|
1379
|
+
method: "POST",
|
|
1380
|
+
headers: headerParameters,
|
|
1381
|
+
query: queryParameters
|
|
1382
|
+
};
|
|
736
1383
|
}
|
|
737
1384
|
/**
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
* @param {string} roomId Room id
|
|
741
|
-
* @param {string} id Peer id
|
|
742
|
-
* @param {string} [peerId] ID of the peer that produces the track
|
|
743
|
-
* @param {*} [options] Override http request option.
|
|
744
|
-
* @throws {RequiredError}
|
|
745
|
-
* @memberof RoomsApi
|
|
1385
|
+
* Issue a fresh streamer token.
|
|
1386
|
+
* Create a streamer token
|
|
746
1387
|
*/
|
|
747
|
-
|
|
748
|
-
|
|
1388
|
+
async generateStreamerTokenRaw(requestParameters, initOverrides) {
|
|
1389
|
+
const requestOptions = await this.generateStreamerTokenRequestOpts(requestParameters);
|
|
1390
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1391
|
+
return new JSONApiResponse(response, (jsonValue) => StreamerTokenFromJSON(jsonValue));
|
|
749
1392
|
}
|
|
750
1393
|
/**
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
* @param {string} roomId Room id
|
|
754
|
-
* @param {string} id Peer id
|
|
755
|
-
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
756
|
-
* @param {*} [options] Override http request option.
|
|
757
|
-
* @throws {RequiredError}
|
|
758
|
-
* @memberof RoomsApi
|
|
1394
|
+
* Issue a fresh streamer token.
|
|
1395
|
+
* Create a streamer token
|
|
759
1396
|
*/
|
|
760
|
-
|
|
761
|
-
|
|
1397
|
+
async generateStreamerToken(requestParameters, initOverrides) {
|
|
1398
|
+
const response = await this.generateStreamerTokenRaw(requestParameters, initOverrides);
|
|
1399
|
+
return await response.value();
|
|
762
1400
|
}
|
|
763
1401
|
};
|
|
764
|
-
|
|
1402
|
+
function ViewerFromJSON(json) {
|
|
1403
|
+
return ViewerFromJSONTyped(json, false);
|
|
1404
|
+
}
|
|
1405
|
+
function ViewerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1406
|
+
if (json == null) {
|
|
1407
|
+
return json;
|
|
1408
|
+
}
|
|
765
1409
|
return {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
* @summary Create a streamer
|
|
769
|
-
* @param {string} streamId Stream id
|
|
770
|
-
* @param {*} [options] Override http request option.
|
|
771
|
-
* @throws {RequiredError}
|
|
772
|
-
*/
|
|
773
|
-
createStreamer: async (streamId, options = {}) => {
|
|
774
|
-
assertParamExists("createStreamer", "streamId", streamId);
|
|
775
|
-
const localVarPath = `/livestream/{stream_id}/streamer`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
|
|
776
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
777
|
-
let baseOptions;
|
|
778
|
-
if (configuration) {
|
|
779
|
-
baseOptions = configuration.baseOptions;
|
|
780
|
-
}
|
|
781
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
782
|
-
const localVarHeaderParameter = {};
|
|
783
|
-
const localVarQueryParameter = {};
|
|
784
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
785
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
786
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
787
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
788
|
-
return {
|
|
789
|
-
url: toPathString(localVarUrlObj),
|
|
790
|
-
options: localVarRequestOptions
|
|
791
|
-
};
|
|
792
|
-
},
|
|
793
|
-
/**
|
|
794
|
-
* Delete a streamer from a stream and revoke its token.
|
|
795
|
-
* @summary Delete a streamer
|
|
796
|
-
* @param {string} streamId Stream id
|
|
797
|
-
* @param {string} streamerId Streamer id
|
|
798
|
-
* @param {*} [options] Override http request option.
|
|
799
|
-
* @throws {RequiredError}
|
|
800
|
-
*/
|
|
801
|
-
deleteStreamer: async (streamId, streamerId, options = {}) => {
|
|
802
|
-
assertParamExists("deleteStreamer", "streamId", streamId);
|
|
803
|
-
assertParamExists("deleteStreamer", "streamerId", streamerId);
|
|
804
|
-
const localVarPath = `/livestream/{stream_id}/streamer/{streamer_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))).replace(`{${"streamer_id"}}`, encodeURIComponent(String(streamerId)));
|
|
805
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
806
|
-
let baseOptions;
|
|
807
|
-
if (configuration) {
|
|
808
|
-
baseOptions = configuration.baseOptions;
|
|
809
|
-
}
|
|
810
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
811
|
-
const localVarHeaderParameter = {};
|
|
812
|
-
const localVarQueryParameter = {};
|
|
813
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
814
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
815
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
816
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
817
|
-
return {
|
|
818
|
-
url: toPathString(localVarUrlObj),
|
|
819
|
-
options: localVarRequestOptions
|
|
820
|
-
};
|
|
821
|
-
},
|
|
822
|
-
/**
|
|
823
|
-
* Issue a fresh streamer token.
|
|
824
|
-
* @summary Create a streamer token
|
|
825
|
-
* @param {string} roomId ID of the stream.
|
|
826
|
-
* @param {*} [options] Override http request option.
|
|
827
|
-
* @throws {RequiredError}
|
|
828
|
-
*/
|
|
829
|
-
generateStreamerToken: async (roomId, options = {}) => {
|
|
830
|
-
assertParamExists("generateStreamerToken", "roomId", roomId);
|
|
831
|
-
const localVarPath = `/room/{room_id}/streamer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
832
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
833
|
-
let baseOptions;
|
|
834
|
-
if (configuration) {
|
|
835
|
-
baseOptions = configuration.baseOptions;
|
|
836
|
-
}
|
|
837
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
838
|
-
const localVarHeaderParameter = {};
|
|
839
|
-
const localVarQueryParameter = {};
|
|
840
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
841
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
842
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
843
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
844
|
-
return {
|
|
845
|
-
url: toPathString(localVarUrlObj),
|
|
846
|
-
options: localVarRequestOptions
|
|
847
|
-
};
|
|
848
|
-
}
|
|
1410
|
+
"id": json["id"],
|
|
1411
|
+
"token": json["token"]
|
|
849
1412
|
};
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
1413
|
+
}
|
|
1414
|
+
function ViewerDetailsResponseFromJSON(json) {
|
|
1415
|
+
return ViewerDetailsResponseFromJSONTyped(json, false);
|
|
1416
|
+
}
|
|
1417
|
+
function ViewerDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1418
|
+
if (json == null) {
|
|
1419
|
+
return json;
|
|
1420
|
+
}
|
|
853
1421
|
return {
|
|
854
|
-
|
|
855
|
-
* Create a streamer for a stream and return its credentials.
|
|
856
|
-
* @summary Create a streamer
|
|
857
|
-
* @param {string} streamId Stream id
|
|
858
|
-
* @param {*} [options] Override http request option.
|
|
859
|
-
* @throws {RequiredError}
|
|
860
|
-
*/
|
|
861
|
-
async createStreamer(streamId, options) {
|
|
862
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
|
|
863
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
864
|
-
const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
865
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
866
|
-
},
|
|
867
|
-
/**
|
|
868
|
-
* Delete a streamer from a stream and revoke its token.
|
|
869
|
-
* @summary Delete a streamer
|
|
870
|
-
* @param {string} streamId Stream id
|
|
871
|
-
* @param {string} streamerId Streamer id
|
|
872
|
-
* @param {*} [options] Override http request option.
|
|
873
|
-
* @throws {RequiredError}
|
|
874
|
-
*/
|
|
875
|
-
async deleteStreamer(streamId, streamerId, options) {
|
|
876
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
|
|
877
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
878
|
-
const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
879
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
880
|
-
},
|
|
881
|
-
/**
|
|
882
|
-
* Issue a fresh streamer token.
|
|
883
|
-
* @summary Create a streamer token
|
|
884
|
-
* @param {string} roomId ID of the stream.
|
|
885
|
-
* @param {*} [options] Override http request option.
|
|
886
|
-
* @throws {RequiredError}
|
|
887
|
-
*/
|
|
888
|
-
async generateStreamerToken(roomId, options) {
|
|
889
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
|
|
890
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
891
|
-
const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
|
|
892
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
893
|
-
}
|
|
1422
|
+
"data": ViewerFromJSON(json["data"])
|
|
894
1423
|
};
|
|
895
|
-
}
|
|
896
|
-
|
|
1424
|
+
}
|
|
1425
|
+
function ViewerTokenFromJSON(json) {
|
|
1426
|
+
return ViewerTokenFromJSONTyped(json, false);
|
|
1427
|
+
}
|
|
1428
|
+
function ViewerTokenFromJSONTyped(json, ignoreDiscriminator) {
|
|
1429
|
+
if (json == null) {
|
|
1430
|
+
return json;
|
|
1431
|
+
}
|
|
1432
|
+
return {
|
|
1433
|
+
"token": json["token"]
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
var ViewersApi = class extends BaseAPI {
|
|
897
1437
|
/**
|
|
898
|
-
*
|
|
899
|
-
* @summary Create a streamer
|
|
900
|
-
* @param {string} streamId Stream id
|
|
901
|
-
* @param {*} [options] Override http request option.
|
|
902
|
-
* @throws {RequiredError}
|
|
903
|
-
* @memberof StreamersApi
|
|
1438
|
+
* Creates request options for createViewer without sending the request
|
|
904
1439
|
*/
|
|
905
|
-
|
|
906
|
-
|
|
1440
|
+
async createViewerRequestOpts(requestParameters) {
|
|
1441
|
+
if (requestParameters["streamId"] == null) {
|
|
1442
|
+
throw new RequiredError(
|
|
1443
|
+
"streamId",
|
|
1444
|
+
'Required parameter "streamId" was null or undefined when calling createViewer().'
|
|
1445
|
+
);
|
|
1446
|
+
}
|
|
1447
|
+
const queryParameters = {};
|
|
1448
|
+
const headerParameters = {};
|
|
1449
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1450
|
+
const token = this.configuration.accessToken;
|
|
1451
|
+
const tokenString = await token("management_token", []);
|
|
1452
|
+
if (tokenString) {
|
|
1453
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
let urlPath = `/livestream/{stream_id}/viewer`;
|
|
1457
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1458
|
+
return {
|
|
1459
|
+
path: urlPath,
|
|
1460
|
+
method: "POST",
|
|
1461
|
+
headers: headerParameters,
|
|
1462
|
+
query: queryParameters
|
|
1463
|
+
};
|
|
907
1464
|
}
|
|
908
1465
|
/**
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
* @param {string} streamId Stream id
|
|
912
|
-
* @param {string} streamerId Streamer id
|
|
913
|
-
* @param {*} [options] Override http request option.
|
|
914
|
-
* @throws {RequiredError}
|
|
915
|
-
* @memberof StreamersApi
|
|
1466
|
+
* Create a viewer for a stream and return its credentials.
|
|
1467
|
+
* Create a viewer
|
|
916
1468
|
*/
|
|
917
|
-
|
|
918
|
-
|
|
1469
|
+
async createViewerRaw(requestParameters, initOverrides) {
|
|
1470
|
+
const requestOptions = await this.createViewerRequestOpts(requestParameters);
|
|
1471
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1472
|
+
return new JSONApiResponse(response, (jsonValue) => ViewerDetailsResponseFromJSON(jsonValue));
|
|
919
1473
|
}
|
|
920
1474
|
/**
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
* @param {string} roomId ID of the stream.
|
|
924
|
-
* @param {*} [options] Override http request option.
|
|
925
|
-
* @throws {RequiredError}
|
|
926
|
-
* @memberof StreamersApi
|
|
1475
|
+
* Create a viewer for a stream and return its credentials.
|
|
1476
|
+
* Create a viewer
|
|
927
1477
|
*/
|
|
928
|
-
|
|
929
|
-
|
|
1478
|
+
async createViewer(requestParameters, initOverrides) {
|
|
1479
|
+
const response = await this.createViewerRaw(requestParameters, initOverrides);
|
|
1480
|
+
return await response.value();
|
|
930
1481
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
*/
|
|
941
|
-
createViewer: async (streamId, options = {}) => {
|
|
942
|
-
assertParamExists("createViewer", "streamId", streamId);
|
|
943
|
-
const localVarPath = `/livestream/{stream_id}/viewer`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
|
|
944
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
945
|
-
let baseOptions;
|
|
946
|
-
if (configuration) {
|
|
947
|
-
baseOptions = configuration.baseOptions;
|
|
948
|
-
}
|
|
949
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
950
|
-
const localVarHeaderParameter = {};
|
|
951
|
-
const localVarQueryParameter = {};
|
|
952
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
953
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
954
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
955
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
956
|
-
return {
|
|
957
|
-
url: toPathString(localVarUrlObj),
|
|
958
|
-
options: localVarRequestOptions
|
|
959
|
-
};
|
|
960
|
-
},
|
|
961
|
-
/**
|
|
962
|
-
* Delete a viewer from a stream and revoke its token.
|
|
963
|
-
* @summary Delete a viewer
|
|
964
|
-
* @param {string} streamId Stream id
|
|
965
|
-
* @param {string} viewerId Viewer id
|
|
966
|
-
* @param {*} [options] Override http request option.
|
|
967
|
-
* @throws {RequiredError}
|
|
968
|
-
*/
|
|
969
|
-
deleteViewer: async (streamId, viewerId, options = {}) => {
|
|
970
|
-
assertParamExists("deleteViewer", "streamId", streamId);
|
|
971
|
-
assertParamExists("deleteViewer", "viewerId", viewerId);
|
|
972
|
-
const localVarPath = `/livestream/{stream_id}/viewer/{viewer_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))).replace(`{${"viewer_id"}}`, encodeURIComponent(String(viewerId)));
|
|
973
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
974
|
-
let baseOptions;
|
|
975
|
-
if (configuration) {
|
|
976
|
-
baseOptions = configuration.baseOptions;
|
|
977
|
-
}
|
|
978
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
979
|
-
const localVarHeaderParameter = {};
|
|
980
|
-
const localVarQueryParameter = {};
|
|
981
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
982
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
983
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
984
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
985
|
-
return {
|
|
986
|
-
url: toPathString(localVarUrlObj),
|
|
987
|
-
options: localVarRequestOptions
|
|
988
|
-
};
|
|
989
|
-
},
|
|
990
|
-
/**
|
|
991
|
-
* Issue a fresh viewer token.
|
|
992
|
-
* @summary Create a viewer token
|
|
993
|
-
* @param {string} roomId ID of the stream.
|
|
994
|
-
* @param {*} [options] Override http request option.
|
|
995
|
-
* @throws {RequiredError}
|
|
996
|
-
*/
|
|
997
|
-
generateViewerToken: async (roomId, options = {}) => {
|
|
998
|
-
assertParamExists("generateViewerToken", "roomId", roomId);
|
|
999
|
-
const localVarPath = `/room/{room_id}/viewer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
1000
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
1001
|
-
let baseOptions;
|
|
1002
|
-
if (configuration) {
|
|
1003
|
-
baseOptions = configuration.baseOptions;
|
|
1004
|
-
}
|
|
1005
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
1006
|
-
const localVarHeaderParameter = {};
|
|
1007
|
-
const localVarQueryParameter = {};
|
|
1008
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1009
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1010
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1011
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
1012
|
-
return {
|
|
1013
|
-
url: toPathString(localVarUrlObj),
|
|
1014
|
-
options: localVarRequestOptions
|
|
1015
|
-
};
|
|
1482
|
+
/**
|
|
1483
|
+
* Creates request options for deleteViewer without sending the request
|
|
1484
|
+
*/
|
|
1485
|
+
async deleteViewerRequestOpts(requestParameters) {
|
|
1486
|
+
if (requestParameters["streamId"] == null) {
|
|
1487
|
+
throw new RequiredError(
|
|
1488
|
+
"streamId",
|
|
1489
|
+
'Required parameter "streamId" was null or undefined when calling deleteViewer().'
|
|
1490
|
+
);
|
|
1016
1491
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* Create a viewer for a stream and return its credentials.
|
|
1024
|
-
* @summary Create a viewer
|
|
1025
|
-
* @param {string} streamId Stream id
|
|
1026
|
-
* @param {*} [options] Override http request option.
|
|
1027
|
-
* @throws {RequiredError}
|
|
1028
|
-
*/
|
|
1029
|
-
async createViewer(streamId, options) {
|
|
1030
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
|
|
1031
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
1032
|
-
const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
|
|
1033
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
1034
|
-
},
|
|
1035
|
-
/**
|
|
1036
|
-
* Delete a viewer from a stream and revoke its token.
|
|
1037
|
-
* @summary Delete a viewer
|
|
1038
|
-
* @param {string} streamId Stream id
|
|
1039
|
-
* @param {string} viewerId Viewer id
|
|
1040
|
-
* @param {*} [options] Override http request option.
|
|
1041
|
-
* @throws {RequiredError}
|
|
1042
|
-
*/
|
|
1043
|
-
async deleteViewer(streamId, viewerId, options) {
|
|
1044
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
|
|
1045
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
1046
|
-
const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
|
|
1047
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
1048
|
-
},
|
|
1049
|
-
/**
|
|
1050
|
-
* Issue a fresh viewer token.
|
|
1051
|
-
* @summary Create a viewer token
|
|
1052
|
-
* @param {string} roomId ID of the stream.
|
|
1053
|
-
* @param {*} [options] Override http request option.
|
|
1054
|
-
* @throws {RequiredError}
|
|
1055
|
-
*/
|
|
1056
|
-
async generateViewerToken(roomId, options) {
|
|
1057
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
|
|
1058
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
1059
|
-
const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
|
|
1060
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
1492
|
+
if (requestParameters["viewerId"] == null) {
|
|
1493
|
+
throw new RequiredError(
|
|
1494
|
+
"viewerId",
|
|
1495
|
+
'Required parameter "viewerId" was null or undefined when calling deleteViewer().'
|
|
1496
|
+
);
|
|
1061
1497
|
}
|
|
1062
|
-
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1498
|
+
const queryParameters = {};
|
|
1499
|
+
const headerParameters = {};
|
|
1500
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1501
|
+
const token = this.configuration.accessToken;
|
|
1502
|
+
const tokenString = await token("management_token", []);
|
|
1503
|
+
if (tokenString) {
|
|
1504
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
let urlPath = `/livestream/{stream_id}/viewer/{viewer_id}`;
|
|
1508
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1509
|
+
urlPath = urlPath.replace("{viewer_id}", encodeURIComponent(String(requestParameters["viewerId"])));
|
|
1510
|
+
return {
|
|
1511
|
+
path: urlPath,
|
|
1512
|
+
method: "DELETE",
|
|
1513
|
+
headers: headerParameters,
|
|
1514
|
+
query: queryParameters
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1065
1517
|
/**
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
* @param {string} streamId Stream id
|
|
1069
|
-
* @param {*} [options] Override http request option.
|
|
1070
|
-
* @throws {RequiredError}
|
|
1071
|
-
* @memberof ViewersApi
|
|
1518
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1519
|
+
* Delete a viewer
|
|
1072
1520
|
*/
|
|
1073
|
-
|
|
1074
|
-
|
|
1521
|
+
async deleteViewerRaw(requestParameters, initOverrides) {
|
|
1522
|
+
const requestOptions = await this.deleteViewerRequestOpts(requestParameters);
|
|
1523
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1524
|
+
return new VoidApiResponse(response);
|
|
1075
1525
|
}
|
|
1076
1526
|
/**
|
|
1077
1527
|
* Delete a viewer from a stream and revoke its token.
|
|
1078
|
-
*
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1528
|
+
* Delete a viewer
|
|
1529
|
+
*/
|
|
1530
|
+
async deleteViewer(requestParameters, initOverrides) {
|
|
1531
|
+
await this.deleteViewerRaw(requestParameters, initOverrides);
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Creates request options for generateViewerToken without sending the request
|
|
1535
|
+
*/
|
|
1536
|
+
async generateViewerTokenRequestOpts(requestParameters) {
|
|
1537
|
+
if (requestParameters["roomId"] == null) {
|
|
1538
|
+
throw new RequiredError(
|
|
1539
|
+
"roomId",
|
|
1540
|
+
'Required parameter "roomId" was null or undefined when calling generateViewerToken().'
|
|
1541
|
+
);
|
|
1542
|
+
}
|
|
1543
|
+
const queryParameters = {};
|
|
1544
|
+
const headerParameters = {};
|
|
1545
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1546
|
+
const token = this.configuration.accessToken;
|
|
1547
|
+
const tokenString = await token("management_token", []);
|
|
1548
|
+
if (tokenString) {
|
|
1549
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
let urlPath = `/room/{room_id}/viewer`;
|
|
1553
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1554
|
+
return {
|
|
1555
|
+
path: urlPath,
|
|
1556
|
+
method: "POST",
|
|
1557
|
+
headers: headerParameters,
|
|
1558
|
+
query: queryParameters
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* Issue a fresh viewer token.
|
|
1563
|
+
* Create a viewer token
|
|
1084
1564
|
*/
|
|
1085
|
-
|
|
1086
|
-
|
|
1565
|
+
async generateViewerTokenRaw(requestParameters, initOverrides) {
|
|
1566
|
+
const requestOptions = await this.generateViewerTokenRequestOpts(requestParameters);
|
|
1567
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1568
|
+
return new JSONApiResponse(response, (jsonValue) => ViewerTokenFromJSON(jsonValue));
|
|
1087
1569
|
}
|
|
1088
1570
|
/**
|
|
1089
1571
|
* Issue a fresh viewer token.
|
|
1090
|
-
*
|
|
1091
|
-
* @param {string} roomId ID of the stream.
|
|
1092
|
-
* @param {*} [options] Override http request option.
|
|
1093
|
-
* @throws {RequiredError}
|
|
1094
|
-
* @memberof ViewersApi
|
|
1572
|
+
* Create a viewer token
|
|
1095
1573
|
*/
|
|
1096
|
-
generateViewerToken(
|
|
1097
|
-
|
|
1574
|
+
async generateViewerToken(requestParameters, initOverrides) {
|
|
1575
|
+
const response = await this.generateViewerTokenRaw(requestParameters, initOverrides);
|
|
1576
|
+
return await response.value();
|
|
1098
1577
|
}
|
|
1099
1578
|
};
|
|
1100
1579
|
|
|
@@ -5864,13 +6343,11 @@ var MissingFishjamIdException = class extends Error {
|
|
|
5864
6343
|
};
|
|
5865
6344
|
var FishjamBaseException = class extends Error {
|
|
5866
6345
|
statusCode;
|
|
5867
|
-
axiosCode;
|
|
5868
6346
|
details;
|
|
5869
|
-
constructor(
|
|
5870
|
-
super(
|
|
5871
|
-
this.statusCode =
|
|
5872
|
-
this.
|
|
5873
|
-
this.details = error.response?.data["detail"] ?? error.response?.data["errors"] ?? "Unknown error";
|
|
6347
|
+
constructor(info) {
|
|
6348
|
+
super(info.message);
|
|
6349
|
+
this.statusCode = info.statusCode ?? 500;
|
|
6350
|
+
this.details = info.details;
|
|
5874
6351
|
}
|
|
5875
6352
|
};
|
|
5876
6353
|
var BadRequestException = class extends FishjamBaseException {
|
|
@@ -5908,6 +6385,16 @@ var getFishjamUrl = (config) => {
|
|
|
5908
6385
|
return `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
|
|
5909
6386
|
}
|
|
5910
6387
|
};
|
|
6388
|
+
var AGENT_SOCKET_PATH = "/socket/agent/websocket";
|
|
6389
|
+
var getAgentWebsocketUrl = (config, peerWebsocketUrl) => {
|
|
6390
|
+
if (peerWebsocketUrl) {
|
|
6391
|
+
const url = new URL(peerWebsocketUrl.includes("://") ? peerWebsocketUrl : `https://${peerWebsocketUrl}`);
|
|
6392
|
+
url.protocol = url.protocol.replace("http", "ws");
|
|
6393
|
+
url.pathname = url.pathname.replace(/\/socket\/peer\/websocket$/, AGENT_SOCKET_PATH);
|
|
6394
|
+
return url.href;
|
|
6395
|
+
}
|
|
6396
|
+
return `${httpToWebsocket(getFishjamUrl(config))}${AGENT_SOCKET_PATH}`;
|
|
6397
|
+
};
|
|
5911
6398
|
|
|
5912
6399
|
// src/notifications.ts
|
|
5913
6400
|
var peerTypeMap = {
|
|
@@ -6035,7 +6522,14 @@ var FishjamWSNotifier = class extends import_events.EventEmitter {
|
|
|
6035
6522
|
};
|
|
6036
6523
|
|
|
6037
6524
|
// src/webhook.ts
|
|
6525
|
+
var import_node_crypto = require("crypto");
|
|
6038
6526
|
var decodeServerNotifications = (data) => extractNotifications(ServerMessage.decode(data instanceof Uint8Array ? data : new Uint8Array(data)));
|
|
6527
|
+
var verifyWebhookSignature = (body, signature, secret) => {
|
|
6528
|
+
const expected = (0, import_node_crypto.createHmac)("sha256", secret).update(body instanceof Uint8Array ? body : new Uint8Array(body)).digest("hex");
|
|
6529
|
+
const provided = Buffer.from(signature.trim().replace(/^sha256=/, ""), "utf8");
|
|
6530
|
+
const wanted = Buffer.from(expected, "utf8");
|
|
6531
|
+
return provided.length === wanted.length && (0, import_node_crypto.timingSafeEqual)(provided, wanted);
|
|
6532
|
+
};
|
|
6039
6533
|
|
|
6040
6534
|
// src/agent.ts
|
|
6041
6535
|
var import_events2 = require("events");
|
|
@@ -6044,23 +6538,32 @@ var expectedEventsList2 = ["trackData"];
|
|
|
6044
6538
|
var FishjamAgent = class extends import_events2.EventEmitter {
|
|
6045
6539
|
client;
|
|
6046
6540
|
resolveConnectionPromise = null;
|
|
6541
|
+
rejectConnectionPromise = null;
|
|
6047
6542
|
connectionPromise;
|
|
6048
6543
|
pendingImageCaptures = /* @__PURE__ */ new Map();
|
|
6049
|
-
constructor(config, agentToken, callbacks) {
|
|
6544
|
+
constructor(config, agentToken, callbacks, peerWebsocketUrl) {
|
|
6050
6545
|
super();
|
|
6051
|
-
const
|
|
6052
|
-
const websocketUrl = `${httpToWebsocket(fishjamUrl)}/socket/agent/websocket`;
|
|
6546
|
+
const websocketUrl = getAgentWebsocketUrl(config, peerWebsocketUrl);
|
|
6053
6547
|
this.client = new WebSocket(websocketUrl);
|
|
6054
6548
|
this.client.binaryType = "arraybuffer";
|
|
6055
6549
|
this.client.onclose = (message) => {
|
|
6056
6550
|
this.rejectPendingCaptures("WebSocket closed");
|
|
6551
|
+
this.rejectConnectionPromise?.(
|
|
6552
|
+
new Error(
|
|
6553
|
+
`Agent websocket closed before connecting (code ${message.code}${message.reason ? `: ${message.reason}` : ""})`
|
|
6554
|
+
)
|
|
6555
|
+
);
|
|
6556
|
+
this.settleConnection();
|
|
6057
6557
|
callbacks?.onClose?.(message.code, message.reason);
|
|
6058
6558
|
};
|
|
6059
6559
|
this.client.onerror = (message) => callbacks?.onError?.(message);
|
|
6060
6560
|
this.client.onmessage = (message) => this.dispatchNotification(message);
|
|
6061
6561
|
this.client.onopen = () => this.setupConnection(agentToken);
|
|
6062
|
-
this.connectionPromise = new Promise((resolve) => {
|
|
6562
|
+
this.connectionPromise = new Promise((resolve, reject) => {
|
|
6063
6563
|
this.resolveConnectionPromise = resolve;
|
|
6564
|
+
this.rejectConnectionPromise = reject;
|
|
6565
|
+
});
|
|
6566
|
+
this.connectionPromise.catch(() => {
|
|
6064
6567
|
});
|
|
6065
6568
|
}
|
|
6066
6569
|
/**
|
|
@@ -6171,10 +6674,12 @@ var FishjamAgent = class extends import_events2.EventEmitter {
|
|
|
6171
6674
|
setupConnection(agentToken) {
|
|
6172
6675
|
const auth = AgentRequest.encode({ authRequest: { token: agentToken } }).finish();
|
|
6173
6676
|
this.client.send(auth);
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6677
|
+
this.resolveConnectionPromise?.();
|
|
6678
|
+
this.settleConnection();
|
|
6679
|
+
}
|
|
6680
|
+
settleConnection() {
|
|
6681
|
+
this.resolveConnectionPromise = null;
|
|
6682
|
+
this.rejectConnectionPromise = null;
|
|
6178
6683
|
}
|
|
6179
6684
|
isExpectedEvent(notification) {
|
|
6180
6685
|
return expectedEventsList2.includes(notification);
|
|
@@ -6185,48 +6690,53 @@ var toProtoEncoding = (encoding) => {
|
|
|
6185
6690
|
return TrackEncoding.TRACK_ENCODING_OPUS;
|
|
6186
6691
|
};
|
|
6187
6692
|
|
|
6188
|
-
// src/client.ts
|
|
6189
|
-
var import_axios3 = __toESM(require("axios"));
|
|
6190
|
-
|
|
6191
6693
|
// src/exceptions/mapper.ts
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
case "peer":
|
|
6210
|
-
return new PeerNotFoundException(error);
|
|
6211
|
-
case "room":
|
|
6212
|
-
return new RoomNotFoundException(error);
|
|
6213
|
-
default:
|
|
6214
|
-
return new FishjamNotFoundException(error);
|
|
6215
|
-
}
|
|
6216
|
-
case 503:
|
|
6217
|
-
return new ServiceUnavailableException(error);
|
|
6218
|
-
default:
|
|
6219
|
-
return new UnknownException(error);
|
|
6220
|
-
}
|
|
6221
|
-
} else {
|
|
6694
|
+
var notFoundException = (info, entity) => {
|
|
6695
|
+
switch (entity) {
|
|
6696
|
+
case "credentials":
|
|
6697
|
+
return new InvalidFishjamCredentialsException(info);
|
|
6698
|
+
case "peer":
|
|
6699
|
+
return new PeerNotFoundException(info);
|
|
6700
|
+
case "room":
|
|
6701
|
+
return new RoomNotFoundException(info);
|
|
6702
|
+
default:
|
|
6703
|
+
return new FishjamNotFoundException(info);
|
|
6704
|
+
}
|
|
6705
|
+
};
|
|
6706
|
+
var mapException = async (error, entity) => {
|
|
6707
|
+
if (error instanceof FetchError) {
|
|
6708
|
+
return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message });
|
|
6709
|
+
}
|
|
6710
|
+
if (!(error instanceof ResponseError)) {
|
|
6222
6711
|
return error;
|
|
6223
6712
|
}
|
|
6713
|
+
const status = error.response.status;
|
|
6714
|
+
const body = await error.response.json().catch(() => ({}));
|
|
6715
|
+
const info = {
|
|
6716
|
+
message: `Request failed with status code ${status}`,
|
|
6717
|
+
statusCode: status,
|
|
6718
|
+
details: body["detail"] ?? body["errors"] ?? "Unknown error"
|
|
6719
|
+
};
|
|
6720
|
+
switch (status) {
|
|
6721
|
+
case 400:
|
|
6722
|
+
return new BadRequestException(info);
|
|
6723
|
+
case 402:
|
|
6724
|
+
return new QuotaExceededException(info);
|
|
6725
|
+
case 401:
|
|
6726
|
+
return new UnauthorizedException(info);
|
|
6727
|
+
case 404:
|
|
6728
|
+
return notFoundException(info, entity);
|
|
6729
|
+
case 503:
|
|
6730
|
+
return new ServiceUnavailableException(info);
|
|
6731
|
+
default:
|
|
6732
|
+
return new UnknownException(info);
|
|
6733
|
+
}
|
|
6224
6734
|
};
|
|
6225
6735
|
|
|
6226
6736
|
// package.json
|
|
6227
6737
|
var package_default = {
|
|
6228
6738
|
name: "@fishjam-cloud/js-server-sdk",
|
|
6229
|
-
version: "0.29.0
|
|
6739
|
+
version: "0.29.0",
|
|
6230
6740
|
description: "Fishjam server SDK for JavaScript",
|
|
6231
6741
|
homepage: "https://github.com/fishjam-cloud/js-server-sdk",
|
|
6232
6742
|
author: "Fishjam Team",
|
|
@@ -6288,9 +6798,11 @@ var package_default = {
|
|
|
6288
6798
|
outDir: "dist"
|
|
6289
6799
|
},
|
|
6290
6800
|
dependencies: {
|
|
6291
|
-
axios: "^1.7.9",
|
|
6292
6801
|
uuid: "^11.1.0"
|
|
6293
6802
|
},
|
|
6803
|
+
engines: {
|
|
6804
|
+
node: ">=18"
|
|
6805
|
+
},
|
|
6294
6806
|
peerDependencies: {
|
|
6295
6807
|
"@google/genai": "^1.0.0"
|
|
6296
6808
|
},
|
|
@@ -6315,8 +6827,7 @@ var package_default = {
|
|
|
6315
6827
|
"*.{js,ts,tsx,mjs,cjs}": [
|
|
6316
6828
|
"eslint --fix --config eslint.config.mjs"
|
|
6317
6829
|
]
|
|
6318
|
-
}
|
|
6319
|
-
stableVersion: "0.28.1"
|
|
6830
|
+
}
|
|
6320
6831
|
};
|
|
6321
6832
|
|
|
6322
6833
|
// src/client.ts
|
|
@@ -6344,22 +6855,25 @@ var FishjamClient = class _FishjamClient {
|
|
|
6344
6855
|
* ```
|
|
6345
6856
|
*/
|
|
6346
6857
|
constructor(config) {
|
|
6347
|
-
const
|
|
6858
|
+
const deprecationMiddleware = {
|
|
6859
|
+
post: async ({ response }) => {
|
|
6860
|
+
this.handleDeprecationHeader(response.headers);
|
|
6861
|
+
return response;
|
|
6862
|
+
}
|
|
6863
|
+
};
|
|
6864
|
+
const apiConfig = new Configuration({
|
|
6865
|
+
basePath: getFishjamUrl(config),
|
|
6348
6866
|
headers: {
|
|
6349
6867
|
Authorization: `Bearer ${config.managementToken}`,
|
|
6350
6868
|
"x-fishjam-api-client": `js-server/${package_default.version}`
|
|
6351
|
-
}
|
|
6352
|
-
|
|
6353
|
-
client.interceptors.response.use((response) => {
|
|
6354
|
-
this.handleDeprecationHeader(response.headers);
|
|
6355
|
-
return response;
|
|
6869
|
+
},
|
|
6870
|
+
middleware: [deprecationMiddleware]
|
|
6356
6871
|
});
|
|
6357
|
-
|
|
6358
|
-
this.
|
|
6359
|
-
this.
|
|
6360
|
-
this.
|
|
6361
|
-
this.
|
|
6362
|
-
this.credentialsApi = new CredentialsApi(void 0, fishjamUrl, client);
|
|
6872
|
+
this.moqApi = new MoQApi(apiConfig);
|
|
6873
|
+
this.roomApi = new RoomsApi(apiConfig);
|
|
6874
|
+
this.viewerApi = new ViewersApi(apiConfig);
|
|
6875
|
+
this.streamerApi = new StreamersApi(apiConfig);
|
|
6876
|
+
this.credentialsApi = new CredentialsApi(apiConfig);
|
|
6363
6877
|
this.fishjamConfig = config;
|
|
6364
6878
|
}
|
|
6365
6879
|
/**
|
|
@@ -6392,12 +6906,12 @@ var FishjamClient = class _FishjamClient {
|
|
|
6392
6906
|
try {
|
|
6393
6907
|
await this.credentialsApi.validateCredentials();
|
|
6394
6908
|
} catch (error) {
|
|
6395
|
-
throw mapException(error);
|
|
6909
|
+
throw await mapException(error, "credentials");
|
|
6396
6910
|
}
|
|
6397
6911
|
}
|
|
6398
6912
|
handleDeprecationHeader(headers) {
|
|
6399
6913
|
try {
|
|
6400
|
-
const deprecationHeader = headers
|
|
6914
|
+
const deprecationHeader = headers.get("x-fishjam-api-deprecated");
|
|
6401
6915
|
if (!deprecationHeader || this.deprecationWarningShown) return;
|
|
6402
6916
|
const deprecationStatus = JSON.parse(deprecationHeader);
|
|
6403
6917
|
if (deprecationStatus.status === "unsupported") {
|
|
@@ -6414,15 +6928,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6414
6928
|
*/
|
|
6415
6929
|
async createRoom(config = {}) {
|
|
6416
6930
|
try {
|
|
6417
|
-
const
|
|
6418
|
-
|
|
6419
|
-
data: {
|
|
6420
|
-
data: { room }
|
|
6421
|
-
}
|
|
6422
|
-
} = response;
|
|
6423
|
-
return room;
|
|
6931
|
+
const { data } = await this.roomApi.createRoom({ roomConfig: config });
|
|
6932
|
+
return data.room;
|
|
6424
6933
|
} catch (error) {
|
|
6425
|
-
throw mapException(error);
|
|
6934
|
+
throw await mapException(error);
|
|
6426
6935
|
}
|
|
6427
6936
|
}
|
|
6428
6937
|
/**
|
|
@@ -6430,9 +6939,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6430
6939
|
*/
|
|
6431
6940
|
async deleteRoom(roomId) {
|
|
6432
6941
|
try {
|
|
6433
|
-
await this.roomApi.deleteRoom(roomId);
|
|
6942
|
+
await this.roomApi.deleteRoom({ roomId });
|
|
6434
6943
|
} catch (error) {
|
|
6435
|
-
throw mapException(error, "room");
|
|
6944
|
+
throw await mapException(error, "room");
|
|
6436
6945
|
}
|
|
6437
6946
|
}
|
|
6438
6947
|
/**
|
|
@@ -6440,10 +6949,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6440
6949
|
*/
|
|
6441
6950
|
async getAllRooms() {
|
|
6442
6951
|
try {
|
|
6443
|
-
const
|
|
6444
|
-
return
|
|
6952
|
+
const { data } = await this.roomApi.getAllRooms();
|
|
6953
|
+
return data ?? [];
|
|
6445
6954
|
} catch (error) {
|
|
6446
|
-
throw mapException(error);
|
|
6955
|
+
throw await mapException(error);
|
|
6447
6956
|
}
|
|
6448
6957
|
}
|
|
6449
6958
|
/**
|
|
@@ -6451,16 +6960,13 @@ var FishjamClient = class _FishjamClient {
|
|
|
6451
6960
|
*/
|
|
6452
6961
|
async createPeer(roomId, options = {}) {
|
|
6453
6962
|
try {
|
|
6454
|
-
const
|
|
6455
|
-
|
|
6456
|
-
options
|
|
6963
|
+
const { data } = await this.roomApi.addPeer({
|
|
6964
|
+
roomId,
|
|
6965
|
+
peerConfig: { type: "webrtc", options }
|
|
6457
6966
|
});
|
|
6458
|
-
const {
|
|
6459
|
-
data: { data }
|
|
6460
|
-
} = response;
|
|
6461
6967
|
return { peer: data.peer, peerToken: data.token };
|
|
6462
6968
|
} catch (error) {
|
|
6463
|
-
throw mapException(error);
|
|
6969
|
+
throw await mapException(error);
|
|
6464
6970
|
}
|
|
6465
6971
|
}
|
|
6466
6972
|
/**
|
|
@@ -6468,18 +6974,15 @@ var FishjamClient = class _FishjamClient {
|
|
|
6468
6974
|
*/
|
|
6469
6975
|
async createAgent(roomId, options = {}, callbacks) {
|
|
6470
6976
|
try {
|
|
6471
|
-
const
|
|
6472
|
-
|
|
6473
|
-
options
|
|
6977
|
+
const { data } = await this.roomApi.addPeer({
|
|
6978
|
+
roomId,
|
|
6979
|
+
peerConfig: { type: "agent", options }
|
|
6474
6980
|
});
|
|
6475
|
-
const
|
|
6476
|
-
data: { data }
|
|
6477
|
-
} = response;
|
|
6478
|
-
const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
|
|
6981
|
+
const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks, data.peer_websocket_url);
|
|
6479
6982
|
await agent.awaitConnected();
|
|
6480
6983
|
return { agent, peer: data.peer };
|
|
6481
6984
|
} catch (error) {
|
|
6482
|
-
throw mapException(error);
|
|
6985
|
+
throw await mapException(error);
|
|
6483
6986
|
}
|
|
6484
6987
|
}
|
|
6485
6988
|
/**
|
|
@@ -6487,16 +6990,13 @@ var FishjamClient = class _FishjamClient {
|
|
|
6487
6990
|
*/
|
|
6488
6991
|
async createVapiAgent(roomId, options) {
|
|
6489
6992
|
try {
|
|
6490
|
-
const
|
|
6491
|
-
|
|
6492
|
-
options
|
|
6993
|
+
const { data } = await this.roomApi.addPeer({
|
|
6994
|
+
roomId,
|
|
6995
|
+
peerConfig: { type: "vapi", options }
|
|
6493
6996
|
});
|
|
6494
|
-
const {
|
|
6495
|
-
data: { data }
|
|
6496
|
-
} = response;
|
|
6497
6997
|
return { peer: data.peer };
|
|
6498
6998
|
} catch (error) {
|
|
6499
|
-
throw mapException(error);
|
|
6999
|
+
throw await mapException(error);
|
|
6500
7000
|
}
|
|
6501
7001
|
}
|
|
6502
7002
|
/**
|
|
@@ -6504,10 +7004,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6504
7004
|
*/
|
|
6505
7005
|
async getRoom(roomId) {
|
|
6506
7006
|
try {
|
|
6507
|
-
const
|
|
6508
|
-
return
|
|
7007
|
+
const { data } = await this.roomApi.getRoom({ roomId });
|
|
7008
|
+
return data;
|
|
6509
7009
|
} catch (error) {
|
|
6510
|
-
throw mapException(error, "room");
|
|
7010
|
+
throw await mapException(error, "room");
|
|
6511
7011
|
}
|
|
6512
7012
|
}
|
|
6513
7013
|
/**
|
|
@@ -6515,9 +7015,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6515
7015
|
*/
|
|
6516
7016
|
async deletePeer(roomId, peerId) {
|
|
6517
7017
|
try {
|
|
6518
|
-
await this.roomApi.deletePeer(roomId, peerId);
|
|
7018
|
+
await this.roomApi.deletePeer({ roomId, id: peerId });
|
|
6519
7019
|
} catch (error) {
|
|
6520
|
-
throw mapException(error, "peer");
|
|
7020
|
+
throw await mapException(error, "peer");
|
|
6521
7021
|
}
|
|
6522
7022
|
}
|
|
6523
7023
|
/**
|
|
@@ -6526,9 +7026,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6526
7026
|
*/
|
|
6527
7027
|
async subscribePeer(roomId, subscriberPeerId, publisherPeerId) {
|
|
6528
7028
|
try {
|
|
6529
|
-
await this.roomApi.subscribePeer(roomId, subscriberPeerId, publisherPeerId);
|
|
7029
|
+
await this.roomApi.subscribePeer({ roomId, id: subscriberPeerId, peerId: publisherPeerId });
|
|
6530
7030
|
} catch (error) {
|
|
6531
|
-
throw mapException(error, "peer");
|
|
7031
|
+
throw await mapException(error, "peer");
|
|
6532
7032
|
}
|
|
6533
7033
|
}
|
|
6534
7034
|
/**
|
|
@@ -6537,9 +7037,13 @@ var FishjamClient = class _FishjamClient {
|
|
|
6537
7037
|
*/
|
|
6538
7038
|
async subscribeTracks(roomId, subscriberPeerId, tracks) {
|
|
6539
7039
|
try {
|
|
6540
|
-
await this.roomApi.subscribeTracks(
|
|
7040
|
+
await this.roomApi.subscribeTracks({
|
|
7041
|
+
roomId,
|
|
7042
|
+
id: subscriberPeerId,
|
|
7043
|
+
subscribeTracksRequest: { track_ids: tracks }
|
|
7044
|
+
});
|
|
6541
7045
|
} catch (error) {
|
|
6542
|
-
throw mapException(error, "peer");
|
|
7046
|
+
throw await mapException(error, "peer");
|
|
6543
7047
|
}
|
|
6544
7048
|
}
|
|
6545
7049
|
/**
|
|
@@ -6549,10 +7053,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6549
7053
|
*/
|
|
6550
7054
|
async refreshPeerToken(roomId, peerId) {
|
|
6551
7055
|
try {
|
|
6552
|
-
const
|
|
6553
|
-
return
|
|
7056
|
+
const { data } = await this.roomApi.refreshToken({ roomId, id: peerId });
|
|
7057
|
+
return data.token;
|
|
6554
7058
|
} catch (error) {
|
|
6555
|
-
throw mapException(error, "peer");
|
|
7059
|
+
throw await mapException(error, "peer");
|
|
6556
7060
|
}
|
|
6557
7061
|
}
|
|
6558
7062
|
/**
|
|
@@ -6561,10 +7065,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6561
7065
|
*/
|
|
6562
7066
|
async createLivestreamViewerToken(roomId) {
|
|
6563
7067
|
try {
|
|
6564
|
-
|
|
6565
|
-
return tokenResponse.data;
|
|
7068
|
+
return await this.viewerApi.generateViewerToken({ roomId });
|
|
6566
7069
|
} catch (error) {
|
|
6567
|
-
throw mapException(error);
|
|
7070
|
+
throw await mapException(error);
|
|
6568
7071
|
}
|
|
6569
7072
|
}
|
|
6570
7073
|
/**
|
|
@@ -6573,10 +7076,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6573
7076
|
*/
|
|
6574
7077
|
async createLivestreamStreamerToken(roomId) {
|
|
6575
7078
|
try {
|
|
6576
|
-
|
|
6577
|
-
return tokenResponse.data;
|
|
7079
|
+
return await this.streamerApi.generateStreamerToken({ roomId });
|
|
6578
7080
|
} catch (error) {
|
|
6579
|
-
throw mapException(error);
|
|
7081
|
+
throw await mapException(error);
|
|
6580
7082
|
}
|
|
6581
7083
|
}
|
|
6582
7084
|
/**
|
|
@@ -6585,10 +7087,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6585
7087
|
*/
|
|
6586
7088
|
async createMoqAccess(config) {
|
|
6587
7089
|
try {
|
|
6588
|
-
|
|
6589
|
-
return accessResponse.data;
|
|
7090
|
+
return await this.moqApi.createMoqAccess({ moqAccessConfig: config });
|
|
6590
7091
|
} catch (error) {
|
|
6591
|
-
throw mapException(error);
|
|
7092
|
+
throw await mapException(error);
|
|
6592
7093
|
}
|
|
6593
7094
|
}
|
|
6594
7095
|
};
|
|
@@ -6613,5 +7114,6 @@ var FishjamClient = class _FishjamClient {
|
|
|
6613
7114
|
UnauthorizedException,
|
|
6614
7115
|
UnknownException,
|
|
6615
7116
|
VideoCodec,
|
|
6616
|
-
decodeServerNotifications
|
|
7117
|
+
decodeServerNotifications,
|
|
7118
|
+
verifyWebhookSignature
|
|
6617
7119
|
});
|