@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.mjs
CHANGED
|
@@ -1,1049 +1,1537 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3EYSX4WM.mjs";
|
|
4
4
|
|
|
5
5
|
// ../fishjam-openapi/dist/index.js
|
|
6
|
-
import globalAxios2 from "axios";
|
|
7
|
-
import globalAxios from "axios";
|
|
8
6
|
var BASE_PATH = "https://fishjam.io/api/v1/connect".replace(/\/+$/, "");
|
|
9
|
-
var
|
|
10
|
-
constructor(configuration
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
var Configuration = class {
|
|
8
|
+
constructor(configuration = {}) {
|
|
9
|
+
this.configuration = configuration;
|
|
10
|
+
}
|
|
11
|
+
set config(configuration) {
|
|
12
|
+
this.configuration = configuration;
|
|
13
|
+
}
|
|
14
|
+
get basePath() {
|
|
15
|
+
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
16
|
+
}
|
|
17
|
+
get fetchApi() {
|
|
18
|
+
return this.configuration.fetchApi;
|
|
19
|
+
}
|
|
20
|
+
get middleware() {
|
|
21
|
+
return this.configuration.middleware || [];
|
|
22
|
+
}
|
|
23
|
+
get queryParamsStringify() {
|
|
24
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
25
|
+
}
|
|
26
|
+
get username() {
|
|
27
|
+
return this.configuration.username;
|
|
28
|
+
}
|
|
29
|
+
get password() {
|
|
30
|
+
return this.configuration.password;
|
|
31
|
+
}
|
|
32
|
+
get apiKey() {
|
|
33
|
+
const apiKey = this.configuration.apiKey;
|
|
34
|
+
if (apiKey) {
|
|
35
|
+
return typeof apiKey === "function" ? apiKey : () => apiKey;
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
get accessToken() {
|
|
40
|
+
const accessToken = this.configuration.accessToken;
|
|
41
|
+
if (accessToken) {
|
|
42
|
+
return typeof accessToken === "function" ? accessToken : async () => accessToken;
|
|
43
|
+
}
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
get headers() {
|
|
47
|
+
return this.configuration.headers;
|
|
48
|
+
}
|
|
49
|
+
get credentials() {
|
|
50
|
+
return this.configuration.credentials;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var DefaultConfig = new Configuration();
|
|
54
|
+
var BaseAPI = class _BaseAPI {
|
|
55
|
+
constructor(configuration = DefaultConfig) {
|
|
56
|
+
this.configuration = configuration;
|
|
57
|
+
this.middleware = configuration.middleware;
|
|
58
|
+
}
|
|
59
|
+
static jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
|
|
60
|
+
middleware;
|
|
61
|
+
withMiddleware(...middlewares) {
|
|
62
|
+
const next = this.clone();
|
|
63
|
+
next.middleware = next.middleware.concat(...middlewares);
|
|
64
|
+
return next;
|
|
65
|
+
}
|
|
66
|
+
withPreMiddleware(...preMiddlewares) {
|
|
67
|
+
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
68
|
+
return this.withMiddleware(...middlewares);
|
|
69
|
+
}
|
|
70
|
+
withPostMiddleware(...postMiddlewares) {
|
|
71
|
+
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
72
|
+
return this.withMiddleware(...middlewares);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check if the given MIME is a JSON MIME.
|
|
76
|
+
* JSON MIME examples:
|
|
77
|
+
* application/json
|
|
78
|
+
* application/json; charset=UTF8
|
|
79
|
+
* APPLICATION/JSON
|
|
80
|
+
* application/vnd.company+json
|
|
81
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
82
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
83
|
+
*/
|
|
84
|
+
isJsonMime(mime) {
|
|
85
|
+
if (!mime) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return _BaseAPI.jsonRegex.test(mime);
|
|
89
|
+
}
|
|
90
|
+
async request(context, initOverrides) {
|
|
91
|
+
const { url, init } = await this.createFetchParams(context, initOverrides);
|
|
92
|
+
const response = await this.fetchApi(url, init);
|
|
93
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
throw new ResponseError(response, "Response returned an error code");
|
|
97
|
+
}
|
|
98
|
+
async createFetchParams(context, initOverrides) {
|
|
99
|
+
let url = this.configuration.basePath + context.path;
|
|
100
|
+
if (context.query !== void 0 && Object.keys(context.query).length !== 0) {
|
|
101
|
+
url += "?" + this.configuration.queryParamsStringify(context.query);
|
|
102
|
+
}
|
|
103
|
+
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
104
|
+
Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {});
|
|
105
|
+
const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
|
|
106
|
+
const initParams = {
|
|
107
|
+
method: context.method,
|
|
108
|
+
headers,
|
|
109
|
+
body: context.body,
|
|
110
|
+
credentials: this.configuration.credentials
|
|
111
|
+
};
|
|
112
|
+
const overriddenInit = {
|
|
113
|
+
...initParams,
|
|
114
|
+
...await initOverrideFn({
|
|
115
|
+
init: initParams,
|
|
116
|
+
context
|
|
117
|
+
})
|
|
118
|
+
};
|
|
119
|
+
let body;
|
|
120
|
+
if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
|
|
121
|
+
body = overriddenInit.body;
|
|
122
|
+
} else if (this.isJsonMime(headers["Content-Type"])) {
|
|
123
|
+
body = JSON.stringify(overriddenInit.body);
|
|
124
|
+
} else {
|
|
125
|
+
body = overriddenInit.body;
|
|
126
|
+
}
|
|
127
|
+
const init = {
|
|
128
|
+
...overriddenInit,
|
|
129
|
+
body
|
|
130
|
+
};
|
|
131
|
+
return { url, init };
|
|
132
|
+
}
|
|
133
|
+
fetchApi = async (url, init) => {
|
|
134
|
+
let fetchParams = { url, init };
|
|
135
|
+
for (const middleware of this.middleware) {
|
|
136
|
+
if (middleware.pre) {
|
|
137
|
+
fetchParams = await middleware.pre({
|
|
138
|
+
fetch: this.fetchApi,
|
|
139
|
+
...fetchParams
|
|
140
|
+
}) || fetchParams;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
let response = void 0;
|
|
144
|
+
try {
|
|
145
|
+
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
for (const middleware of this.middleware) {
|
|
148
|
+
if (middleware.onError) {
|
|
149
|
+
response = await middleware.onError({
|
|
150
|
+
fetch: this.fetchApi,
|
|
151
|
+
url: fetchParams.url,
|
|
152
|
+
init: fetchParams.init,
|
|
153
|
+
error: e,
|
|
154
|
+
response: response ? response.clone() : void 0
|
|
155
|
+
}) || response;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (response === void 0) {
|
|
159
|
+
if (e instanceof Error) {
|
|
160
|
+
throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
|
|
161
|
+
} else {
|
|
162
|
+
throw e;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const middleware of this.middleware) {
|
|
167
|
+
if (middleware.post) {
|
|
168
|
+
response = await middleware.post({
|
|
169
|
+
fetch: this.fetchApi,
|
|
170
|
+
url: fetchParams.url,
|
|
171
|
+
init: fetchParams.init,
|
|
172
|
+
response: response.clone()
|
|
173
|
+
}) || response;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return response;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
180
|
+
* and then shallow cloning data members.
|
|
181
|
+
*/
|
|
182
|
+
clone() {
|
|
183
|
+
const constructor = this.constructor;
|
|
184
|
+
const next = new constructor(this.configuration);
|
|
185
|
+
next.middleware = this.middleware.slice();
|
|
186
|
+
return next;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
function isBlob(value) {
|
|
190
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
191
|
+
}
|
|
192
|
+
function isFormData(value) {
|
|
193
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
194
|
+
}
|
|
195
|
+
var ResponseError = class extends Error {
|
|
196
|
+
constructor(response, msg) {
|
|
197
|
+
super(msg);
|
|
198
|
+
this.response = response;
|
|
199
|
+
const actualProto = new.target.prototype;
|
|
200
|
+
if (Object.setPrototypeOf) {
|
|
201
|
+
Object.setPrototypeOf(this, actualProto);
|
|
16
202
|
}
|
|
17
203
|
}
|
|
18
|
-
|
|
204
|
+
name = "ResponseError";
|
|
205
|
+
};
|
|
206
|
+
var FetchError = class extends Error {
|
|
207
|
+
constructor(cause, msg) {
|
|
208
|
+
super(msg);
|
|
209
|
+
this.cause = cause;
|
|
210
|
+
const actualProto = new.target.prototype;
|
|
211
|
+
if (Object.setPrototypeOf) {
|
|
212
|
+
Object.setPrototypeOf(this, actualProto);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
name = "FetchError";
|
|
19
216
|
};
|
|
20
217
|
var RequiredError = class extends Error {
|
|
21
218
|
constructor(field, msg) {
|
|
22
219
|
super(msg);
|
|
23
220
|
this.field = field;
|
|
24
|
-
|
|
221
|
+
const actualProto = new.target.prototype;
|
|
222
|
+
if (Object.setPrototypeOf) {
|
|
223
|
+
Object.setPrototypeOf(this, actualProto);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
name = "RequiredError";
|
|
227
|
+
};
|
|
228
|
+
function querystring(params, prefix = "") {
|
|
229
|
+
return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
|
|
230
|
+
}
|
|
231
|
+
function querystringSingleKey(key, value, keyPrefix = "") {
|
|
232
|
+
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
|
|
233
|
+
if (value instanceof Array) {
|
|
234
|
+
const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
|
|
235
|
+
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
|
236
|
+
}
|
|
237
|
+
if (value instanceof Set) {
|
|
238
|
+
const valueAsArray = Array.from(value);
|
|
239
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
240
|
+
}
|
|
241
|
+
if (value instanceof Date) {
|
|
242
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
|
|
243
|
+
}
|
|
244
|
+
if (value instanceof Object) {
|
|
245
|
+
return querystring(value, fullKey);
|
|
246
|
+
}
|
|
247
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
248
|
+
}
|
|
249
|
+
var JSONApiResponse = class {
|
|
250
|
+
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
251
|
+
this.raw = raw;
|
|
252
|
+
this.transformer = transformer;
|
|
253
|
+
}
|
|
254
|
+
async value() {
|
|
255
|
+
return this.transformer(await this.raw.json());
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var VoidApiResponse = class {
|
|
259
|
+
constructor(raw) {
|
|
260
|
+
this.raw = raw;
|
|
261
|
+
}
|
|
262
|
+
async value() {
|
|
263
|
+
return void 0;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
var CredentialsApi = class extends BaseAPI {
|
|
267
|
+
/**
|
|
268
|
+
* Creates request options for validateCredentials without sending the request
|
|
269
|
+
*/
|
|
270
|
+
async validateCredentialsRequestOpts() {
|
|
271
|
+
const queryParameters = {};
|
|
272
|
+
const headerParameters = {};
|
|
273
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
274
|
+
const token = this.configuration.accessToken;
|
|
275
|
+
const tokenString = await token("management_token", []);
|
|
276
|
+
if (tokenString) {
|
|
277
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
let urlPath = `/validate`;
|
|
281
|
+
return {
|
|
282
|
+
path: urlPath,
|
|
283
|
+
method: "GET",
|
|
284
|
+
headers: headerParameters,
|
|
285
|
+
query: queryParameters
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
290
|
+
* Validate Fishjam Management Token
|
|
291
|
+
*/
|
|
292
|
+
async validateCredentialsRaw(initOverrides) {
|
|
293
|
+
const requestOptions = await this.validateCredentialsRequestOpts();
|
|
294
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
295
|
+
return new VoidApiResponse(response);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
299
|
+
* Validate Fishjam Management Token
|
|
300
|
+
*/
|
|
301
|
+
async validateCredentials(initOverrides) {
|
|
302
|
+
await this.validateCredentialsRaw(initOverrides);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
function MoqAccessFromJSON(json) {
|
|
306
|
+
return MoqAccessFromJSONTyped(json, false);
|
|
307
|
+
}
|
|
308
|
+
function MoqAccessFromJSONTyped(json, ignoreDiscriminator) {
|
|
309
|
+
if (json == null) {
|
|
310
|
+
return json;
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
"connection_url": json["connection_url"],
|
|
314
|
+
"token": json["token"]
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function MoqAccessConfigToJSON(json) {
|
|
318
|
+
return MoqAccessConfigToJSONTyped(json, false);
|
|
319
|
+
}
|
|
320
|
+
function MoqAccessConfigToJSONTyped(value, ignoreDiscriminator = false) {
|
|
321
|
+
if (value == null) {
|
|
322
|
+
return value;
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
"publishPath": value["publishPath"],
|
|
326
|
+
"subscribePath": value["subscribePath"]
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
var MoQApi = class extends BaseAPI {
|
|
330
|
+
/**
|
|
331
|
+
* Creates request options for createMoqAccess without sending the request
|
|
332
|
+
*/
|
|
333
|
+
async createMoqAccessRequestOpts(requestParameters) {
|
|
334
|
+
const queryParameters = {};
|
|
335
|
+
const headerParameters = {};
|
|
336
|
+
headerParameters["Content-Type"] = "application/json";
|
|
337
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
338
|
+
const token = this.configuration.accessToken;
|
|
339
|
+
const tokenString = await token("management_token", []);
|
|
340
|
+
if (tokenString) {
|
|
341
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
let urlPath = `/moq/access`;
|
|
345
|
+
return {
|
|
346
|
+
path: urlPath,
|
|
347
|
+
method: "POST",
|
|
348
|
+
headers: headerParameters,
|
|
349
|
+
query: queryParameters,
|
|
350
|
+
body: MoqAccessConfigToJSON(requestParameters["moqAccessConfig"])
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
355
|
+
* Create MoQ access
|
|
356
|
+
*/
|
|
357
|
+
async createMoqAccessRaw(requestParameters, initOverrides) {
|
|
358
|
+
const requestOptions = await this.createMoqAccessRequestOpts(requestParameters);
|
|
359
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
360
|
+
return new JSONApiResponse(response, (jsonValue) => MoqAccessFromJSON(jsonValue));
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Issue a short-lived JWT for a Media over QUIC client.
|
|
364
|
+
* Create MoQ access
|
|
365
|
+
*/
|
|
366
|
+
async createMoqAccess(requestParameters = {}, initOverrides) {
|
|
367
|
+
const response = await this.createMoqAccessRaw(requestParameters, initOverrides);
|
|
368
|
+
return await response.value();
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
function AudioSampleRateToJSON(value) {
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
function AudioFormatToJSON(value) {
|
|
375
|
+
return value;
|
|
376
|
+
}
|
|
377
|
+
function AgentOutputToJSON(json) {
|
|
378
|
+
return AgentOutputToJSONTyped(json, false);
|
|
379
|
+
}
|
|
380
|
+
function AgentOutputToJSONTyped(value, ignoreDiscriminator = false) {
|
|
381
|
+
if (value == null) {
|
|
382
|
+
return value;
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
"audioFormat": AudioFormatToJSON(value["audioFormat"]),
|
|
386
|
+
"audioSampleRate": AudioSampleRateToJSON(value["audioSampleRate"])
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function SubscribeModeFromJSON(json) {
|
|
390
|
+
return SubscribeModeFromJSONTyped(json, false);
|
|
391
|
+
}
|
|
392
|
+
function SubscribeModeFromJSONTyped(json, ignoreDiscriminator) {
|
|
393
|
+
return json;
|
|
394
|
+
}
|
|
395
|
+
function SubscribeModeToJSON(value) {
|
|
396
|
+
return value;
|
|
397
|
+
}
|
|
398
|
+
function PeerOptionsAgentToJSON(json) {
|
|
399
|
+
return PeerOptionsAgentToJSONTyped(json, false);
|
|
400
|
+
}
|
|
401
|
+
function PeerOptionsAgentToJSONTyped(value, ignoreDiscriminator = false) {
|
|
402
|
+
if (value == null) {
|
|
403
|
+
return value;
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
"output": AgentOutputToJSON(value["output"]),
|
|
407
|
+
"subscribeMode": SubscribeModeToJSON(value["subscribeMode"])
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function PeerConfigAgentToJSON(json) {
|
|
411
|
+
return PeerConfigAgentToJSONTyped(json, false);
|
|
412
|
+
}
|
|
413
|
+
function PeerConfigAgentToJSONTyped(value, ignoreDiscriminator = false) {
|
|
414
|
+
if (value == null) {
|
|
415
|
+
return value;
|
|
416
|
+
}
|
|
417
|
+
return {
|
|
418
|
+
"options": PeerOptionsAgentToJSON(value["options"]),
|
|
419
|
+
"type": value["type"]
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function PeerOptionsVapiToJSON(json) {
|
|
423
|
+
return PeerOptionsVapiToJSONTyped(json, false);
|
|
424
|
+
}
|
|
425
|
+
function PeerOptionsVapiToJSONTyped(value, ignoreDiscriminator = false) {
|
|
426
|
+
if (value == null) {
|
|
427
|
+
return value;
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
"apiKey": value["apiKey"],
|
|
431
|
+
"callId": value["callId"],
|
|
432
|
+
"subscribeMode": SubscribeModeToJSON(value["subscribeMode"])
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function PeerConfigVAPIToJSON(json) {
|
|
436
|
+
return PeerConfigVAPIToJSONTyped(json, false);
|
|
437
|
+
}
|
|
438
|
+
function PeerConfigVAPIToJSONTyped(value, ignoreDiscriminator = false) {
|
|
439
|
+
if (value == null) {
|
|
440
|
+
return value;
|
|
441
|
+
}
|
|
442
|
+
return {
|
|
443
|
+
"options": PeerOptionsVapiToJSON(value["options"]),
|
|
444
|
+
"type": value["type"]
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function PeerOptionsWebRTCToJSON(json) {
|
|
448
|
+
return PeerOptionsWebRTCToJSONTyped(json, false);
|
|
449
|
+
}
|
|
450
|
+
function PeerOptionsWebRTCToJSONTyped(value, ignoreDiscriminator = false) {
|
|
451
|
+
if (value == null) {
|
|
452
|
+
return value;
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
"metadata": value["metadata"],
|
|
456
|
+
"subscribeMode": SubscribeModeToJSON(value["subscribeMode"])
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function PeerConfigWebRTCToJSON(json) {
|
|
460
|
+
return PeerConfigWebRTCToJSONTyped(json, false);
|
|
461
|
+
}
|
|
462
|
+
function PeerConfigWebRTCToJSONTyped(value, ignoreDiscriminator = false) {
|
|
463
|
+
if (value == null) {
|
|
464
|
+
return value;
|
|
465
|
+
}
|
|
466
|
+
return {
|
|
467
|
+
"options": PeerOptionsWebRTCToJSON(value["options"]),
|
|
468
|
+
"type": value["type"]
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function PeerConfigToJSON(json) {
|
|
472
|
+
return PeerConfigToJSONTyped(json, false);
|
|
473
|
+
}
|
|
474
|
+
function PeerConfigToJSONTyped(value, ignoreDiscriminator = false) {
|
|
475
|
+
if (value == null) {
|
|
476
|
+
return value;
|
|
477
|
+
}
|
|
478
|
+
switch (value["type"]) {
|
|
479
|
+
case "agent":
|
|
480
|
+
return Object.assign({}, PeerConfigAgentToJSON(value), { "type": "agent" });
|
|
481
|
+
case "vapi":
|
|
482
|
+
return Object.assign({}, PeerConfigVAPIToJSON(value), { "type": "vapi" });
|
|
483
|
+
case "webrtc":
|
|
484
|
+
return Object.assign({}, PeerConfigWebRTCToJSON(value), { "type": "webrtc" });
|
|
485
|
+
default:
|
|
486
|
+
return value;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function SubscriptionsFromJSON(json) {
|
|
490
|
+
return SubscriptionsFromJSONTyped(json, false);
|
|
491
|
+
}
|
|
492
|
+
function SubscriptionsFromJSONTyped(json, ignoreDiscriminator) {
|
|
493
|
+
if (json == null) {
|
|
494
|
+
return json;
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
"peers": json["peers"],
|
|
498
|
+
"tracks": json["tracks"]
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
var PeerStatus = {
|
|
502
|
+
Connected: "connected",
|
|
503
|
+
Disconnected: "disconnected"
|
|
504
|
+
};
|
|
505
|
+
function PeerStatusFromJSON(json) {
|
|
506
|
+
return PeerStatusFromJSONTyped(json, false);
|
|
507
|
+
}
|
|
508
|
+
function PeerStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
509
|
+
return json;
|
|
510
|
+
}
|
|
511
|
+
function PeerTypeFromJSON(json) {
|
|
512
|
+
return PeerTypeFromJSONTyped(json, false);
|
|
513
|
+
}
|
|
514
|
+
function PeerTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
515
|
+
return json;
|
|
516
|
+
}
|
|
517
|
+
function TrackTypeFromJSON(json) {
|
|
518
|
+
return TrackTypeFromJSONTyped(json, false);
|
|
519
|
+
}
|
|
520
|
+
function TrackTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
521
|
+
return json;
|
|
522
|
+
}
|
|
523
|
+
function TrackFromJSON(json) {
|
|
524
|
+
return TrackFromJSONTyped(json, false);
|
|
525
|
+
}
|
|
526
|
+
function TrackFromJSONTyped(json, ignoreDiscriminator) {
|
|
527
|
+
if (json == null) {
|
|
528
|
+
return json;
|
|
529
|
+
}
|
|
530
|
+
return {
|
|
531
|
+
"id": json["id"] == null ? void 0 : json["id"],
|
|
532
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"],
|
|
533
|
+
"type": json["type"] == null ? void 0 : TrackTypeFromJSON(json["type"])
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function PeerFromJSON(json) {
|
|
537
|
+
return PeerFromJSONTyped(json, false);
|
|
538
|
+
}
|
|
539
|
+
function PeerFromJSONTyped(json, ignoreDiscriminator) {
|
|
540
|
+
if (json == null) {
|
|
541
|
+
return json;
|
|
542
|
+
}
|
|
543
|
+
return {
|
|
544
|
+
"id": json["id"],
|
|
545
|
+
"metadata": json["metadata"],
|
|
546
|
+
"status": PeerStatusFromJSON(json["status"]),
|
|
547
|
+
"subscribeMode": SubscribeModeFromJSON(json["subscribeMode"]),
|
|
548
|
+
"subscriptions": SubscriptionsFromJSON(json["subscriptions"]),
|
|
549
|
+
"tracks": json["tracks"].map(TrackFromJSON),
|
|
550
|
+
"type": PeerTypeFromJSON(json["type"])
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function PeerDetailsResponseDataFromJSON(json) {
|
|
554
|
+
return PeerDetailsResponseDataFromJSONTyped(json, false);
|
|
555
|
+
}
|
|
556
|
+
function PeerDetailsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
557
|
+
if (json == null) {
|
|
558
|
+
return json;
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
"peer": PeerFromJSON(json["peer"]),
|
|
562
|
+
"peer_websocket_url": json["peer_websocket_url"] == null ? void 0 : json["peer_websocket_url"],
|
|
563
|
+
"token": json["token"]
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function PeerDetailsResponseFromJSON(json) {
|
|
567
|
+
return PeerDetailsResponseFromJSONTyped(json, false);
|
|
568
|
+
}
|
|
569
|
+
function PeerDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
570
|
+
if (json == null) {
|
|
571
|
+
return json;
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
"data": PeerDetailsResponseDataFromJSON(json["data"])
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function PeerRefreshTokenResponseDataFromJSON(json) {
|
|
578
|
+
return PeerRefreshTokenResponseDataFromJSONTyped(json, false);
|
|
579
|
+
}
|
|
580
|
+
function PeerRefreshTokenResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
581
|
+
if (json == null) {
|
|
582
|
+
return json;
|
|
25
583
|
}
|
|
584
|
+
return {
|
|
585
|
+
"token": json["token"]
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
function PeerRefreshTokenResponseFromJSON(json) {
|
|
589
|
+
return PeerRefreshTokenResponseFromJSONTyped(json, false);
|
|
590
|
+
}
|
|
591
|
+
function PeerRefreshTokenResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
592
|
+
if (json == null) {
|
|
593
|
+
return json;
|
|
594
|
+
}
|
|
595
|
+
return {
|
|
596
|
+
"data": PeerRefreshTokenResponseDataFromJSON(json["data"])
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
var RoomType = {
|
|
600
|
+
FullFeature: "full_feature",
|
|
601
|
+
AudioOnly: "audio_only",
|
|
602
|
+
Broadcaster: "broadcaster",
|
|
603
|
+
Livestream: "livestream",
|
|
604
|
+
Conference: "conference",
|
|
605
|
+
AudioOnlyLivestream: "audio_only_livestream"
|
|
606
|
+
};
|
|
607
|
+
function RoomTypeFromJSON(json) {
|
|
608
|
+
return RoomTypeFromJSONTyped(json, false);
|
|
609
|
+
}
|
|
610
|
+
function RoomTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
611
|
+
return json;
|
|
612
|
+
}
|
|
613
|
+
function RoomTypeToJSON(value) {
|
|
614
|
+
return value;
|
|
615
|
+
}
|
|
616
|
+
var VideoCodec = {
|
|
617
|
+
H264: "h264",
|
|
618
|
+
Vp8: "vp8"
|
|
26
619
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
620
|
+
function VideoCodecFromJSON(json) {
|
|
621
|
+
return VideoCodecFromJSONTyped(json, false);
|
|
622
|
+
}
|
|
623
|
+
function VideoCodecFromJSONTyped(json, ignoreDiscriminator) {
|
|
624
|
+
return json;
|
|
625
|
+
}
|
|
626
|
+
function VideoCodecToJSON(value) {
|
|
627
|
+
return value;
|
|
628
|
+
}
|
|
629
|
+
function RoomConfigFromJSON(json) {
|
|
630
|
+
return RoomConfigFromJSONTyped(json, false);
|
|
631
|
+
}
|
|
632
|
+
function RoomConfigFromJSONTyped(json, ignoreDiscriminator) {
|
|
633
|
+
if (json == null) {
|
|
634
|
+
return json;
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
"batchWebhookNotifications": json["batchWebhookNotifications"] == null ? void 0 : json["batchWebhookNotifications"],
|
|
638
|
+
"maxPeers": json["maxPeers"] == null ? void 0 : json["maxPeers"],
|
|
639
|
+
"public": json["public"] == null ? void 0 : json["public"],
|
|
640
|
+
"roomType": json["roomType"] == null ? void 0 : RoomTypeFromJSON(json["roomType"]),
|
|
641
|
+
"videoCodec": json["videoCodec"] == null ? void 0 : VideoCodecFromJSON(json["videoCodec"]),
|
|
642
|
+
"webhookUrl": json["webhookUrl"] == null ? void 0 : json["webhookUrl"]
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function RoomConfigToJSON(json) {
|
|
646
|
+
return RoomConfigToJSONTyped(json, false);
|
|
647
|
+
}
|
|
648
|
+
function RoomConfigToJSONTyped(value, ignoreDiscriminator = false) {
|
|
649
|
+
if (value == null) {
|
|
650
|
+
return value;
|
|
651
|
+
}
|
|
652
|
+
return {
|
|
653
|
+
"batchWebhookNotifications": value["batchWebhookNotifications"],
|
|
654
|
+
"maxPeers": value["maxPeers"],
|
|
655
|
+
"public": value["public"],
|
|
656
|
+
"roomType": RoomTypeToJSON(value["roomType"]),
|
|
657
|
+
"videoCodec": VideoCodecToJSON(value["videoCodec"]),
|
|
658
|
+
"webhookUrl": value["webhookUrl"]
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function TrackForwardingInfoFromJSON(json) {
|
|
662
|
+
return TrackForwardingInfoFromJSONTyped(json, false);
|
|
663
|
+
}
|
|
664
|
+
function TrackForwardingInfoFromJSONTyped(json, ignoreDiscriminator) {
|
|
665
|
+
if (json == null) {
|
|
666
|
+
return json;
|
|
667
|
+
}
|
|
668
|
+
return {
|
|
669
|
+
"audioTrackId": json["audioTrackId"] == null ? void 0 : json["audioTrackId"],
|
|
670
|
+
"inputId": json["inputId"],
|
|
671
|
+
"peerId": json["peerId"],
|
|
672
|
+
"videoTrackId": json["videoTrackId"] == null ? void 0 : json["videoTrackId"]
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function CompositionInfoFromJSON(json) {
|
|
676
|
+
return CompositionInfoFromJSONTyped(json, false);
|
|
677
|
+
}
|
|
678
|
+
function CompositionInfoFromJSONTyped(json, ignoreDiscriminator) {
|
|
679
|
+
if (json == null) {
|
|
680
|
+
return json;
|
|
681
|
+
}
|
|
682
|
+
return {
|
|
683
|
+
"compositionUrl": json["compositionUrl"],
|
|
684
|
+
"forwardings": json["forwardings"].map(TrackForwardingInfoFromJSON)
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
function RoomFromJSON(json) {
|
|
688
|
+
return RoomFromJSONTyped(json, false);
|
|
689
|
+
}
|
|
690
|
+
function RoomFromJSONTyped(json, ignoreDiscriminator) {
|
|
691
|
+
if (json == null) {
|
|
692
|
+
return json;
|
|
693
|
+
}
|
|
694
|
+
return {
|
|
695
|
+
"compositionInfo": json["compositionInfo"] == null ? void 0 : CompositionInfoFromJSON(json["compositionInfo"]),
|
|
696
|
+
"config": RoomConfigFromJSON(json["config"]),
|
|
697
|
+
"id": json["id"],
|
|
698
|
+
"peers": json["peers"].map(PeerFromJSON)
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
function RoomCreateDetailsResponseDataFromJSON(json) {
|
|
702
|
+
return RoomCreateDetailsResponseDataFromJSONTyped(json, false);
|
|
703
|
+
}
|
|
704
|
+
function RoomCreateDetailsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
705
|
+
if (json == null) {
|
|
706
|
+
return json;
|
|
707
|
+
}
|
|
708
|
+
return {
|
|
709
|
+
"room": RoomFromJSON(json["room"])
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function RoomCreateDetailsResponseFromJSON(json) {
|
|
713
|
+
return RoomCreateDetailsResponseFromJSONTyped(json, false);
|
|
714
|
+
}
|
|
715
|
+
function RoomCreateDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
716
|
+
if (json == null) {
|
|
717
|
+
return json;
|
|
718
|
+
}
|
|
719
|
+
return {
|
|
720
|
+
"data": RoomCreateDetailsResponseDataFromJSON(json["data"])
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
function RoomDetailsResponseFromJSON(json) {
|
|
724
|
+
return RoomDetailsResponseFromJSONTyped(json, false);
|
|
725
|
+
}
|
|
726
|
+
function RoomDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
727
|
+
if (json == null) {
|
|
728
|
+
return json;
|
|
729
|
+
}
|
|
730
|
+
return {
|
|
731
|
+
"data": RoomFromJSON(json["data"])
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function RoomsListingResponseFromJSON(json) {
|
|
735
|
+
return RoomsListingResponseFromJSONTyped(json, false);
|
|
736
|
+
}
|
|
737
|
+
function RoomsListingResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
738
|
+
if (json == null) {
|
|
739
|
+
return json;
|
|
740
|
+
}
|
|
741
|
+
return {
|
|
742
|
+
"data": json["data"].map(RoomFromJSON)
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
function SubscribeTracksRequestToJSON(json) {
|
|
746
|
+
return SubscribeTracksRequestToJSONTyped(json, false);
|
|
747
|
+
}
|
|
748
|
+
function SubscribeTracksRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
749
|
+
if (value == null) {
|
|
750
|
+
return value;
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
"track_ids": value["track_ids"]
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
var RoomsApi = class extends BaseAPI {
|
|
757
|
+
/**
|
|
758
|
+
* Creates request options for addPeer without sending the request
|
|
759
|
+
*/
|
|
760
|
+
async addPeerRequestOpts(requestParameters) {
|
|
761
|
+
if (requestParameters["roomId"] == null) {
|
|
762
|
+
throw new RequiredError(
|
|
763
|
+
"roomId",
|
|
764
|
+
'Required parameter "roomId" was null or undefined when calling addPeer().'
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
const queryParameters = {};
|
|
768
|
+
const headerParameters = {};
|
|
769
|
+
headerParameters["Content-Type"] = "application/json";
|
|
770
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
771
|
+
const token = this.configuration.accessToken;
|
|
772
|
+
const tokenString = await token("management_token", []);
|
|
773
|
+
if (tokenString) {
|
|
774
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
let urlPath = `/room/{room_id}/peer`;
|
|
778
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
779
|
+
return {
|
|
780
|
+
path: urlPath,
|
|
781
|
+
method: "POST",
|
|
782
|
+
headers: headerParameters,
|
|
783
|
+
query: queryParameters,
|
|
784
|
+
body: PeerConfigToJSON(requestParameters["peerConfig"])
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Add a peer to a room and return its connection token.
|
|
789
|
+
* Create a peer
|
|
790
|
+
*/
|
|
791
|
+
async addPeerRaw(requestParameters, initOverrides) {
|
|
792
|
+
const requestOptions = await this.addPeerRequestOpts(requestParameters);
|
|
793
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
794
|
+
return new JSONApiResponse(response, (jsonValue) => PeerDetailsResponseFromJSON(jsonValue));
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Add a peer to a room and return its connection token.
|
|
798
|
+
* Create a peer
|
|
799
|
+
*/
|
|
800
|
+
async addPeer(requestParameters, initOverrides) {
|
|
801
|
+
const response = await this.addPeerRaw(requestParameters, initOverrides);
|
|
802
|
+
return await response.value();
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Creates request options for createRoom without sending the request
|
|
806
|
+
*/
|
|
807
|
+
async createRoomRequestOpts(requestParameters) {
|
|
808
|
+
const queryParameters = {};
|
|
809
|
+
const headerParameters = {};
|
|
810
|
+
headerParameters["Content-Type"] = "application/json";
|
|
811
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
812
|
+
const token = this.configuration.accessToken;
|
|
813
|
+
const tokenString = await token("management_token", []);
|
|
814
|
+
if (tokenString) {
|
|
815
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
let urlPath = `/room`;
|
|
819
|
+
return {
|
|
820
|
+
path: urlPath,
|
|
821
|
+
method: "POST",
|
|
822
|
+
headers: headerParameters,
|
|
823
|
+
query: queryParameters,
|
|
824
|
+
body: RoomConfigToJSON(requestParameters["roomConfig"])
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Create a new room with the given configuration.
|
|
829
|
+
* Create a room
|
|
830
|
+
*/
|
|
831
|
+
async createRoomRaw(requestParameters, initOverrides) {
|
|
832
|
+
const requestOptions = await this.createRoomRequestOpts(requestParameters);
|
|
833
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
834
|
+
return new JSONApiResponse(response, (jsonValue) => RoomCreateDetailsResponseFromJSON(jsonValue));
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Create a new room with the given configuration.
|
|
838
|
+
* Create a room
|
|
839
|
+
*/
|
|
840
|
+
async createRoom(requestParameters = {}, initOverrides) {
|
|
841
|
+
const response = await this.createRoomRaw(requestParameters, initOverrides);
|
|
842
|
+
return await response.value();
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Creates request options for deletePeer without sending the request
|
|
846
|
+
*/
|
|
847
|
+
async deletePeerRequestOpts(requestParameters) {
|
|
848
|
+
if (requestParameters["roomId"] == null) {
|
|
849
|
+
throw new RequiredError(
|
|
850
|
+
"roomId",
|
|
851
|
+
'Required parameter "roomId" was null or undefined when calling deletePeer().'
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
if (requestParameters["id"] == null) {
|
|
855
|
+
throw new RequiredError(
|
|
856
|
+
"id",
|
|
857
|
+
'Required parameter "id" was null or undefined when calling deletePeer().'
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
const queryParameters = {};
|
|
861
|
+
const headerParameters = {};
|
|
862
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
863
|
+
const token = this.configuration.accessToken;
|
|
864
|
+
const tokenString = await token("management_token", []);
|
|
865
|
+
if (tokenString) {
|
|
866
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
let urlPath = `/room/{room_id}/peer/{id}`;
|
|
870
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
871
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
872
|
+
return {
|
|
873
|
+
path: urlPath,
|
|
874
|
+
method: "DELETE",
|
|
875
|
+
headers: headerParameters,
|
|
876
|
+
query: queryParameters
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Remove a peer from a room and disconnect it.
|
|
881
|
+
* Delete a peer
|
|
882
|
+
*/
|
|
883
|
+
async deletePeerRaw(requestParameters, initOverrides) {
|
|
884
|
+
const requestOptions = await this.deletePeerRequestOpts(requestParameters);
|
|
885
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
886
|
+
return new VoidApiResponse(response);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Remove a peer from a room and disconnect it.
|
|
890
|
+
* Delete a peer
|
|
891
|
+
*/
|
|
892
|
+
async deletePeer(requestParameters, initOverrides) {
|
|
893
|
+
await this.deletePeerRaw(requestParameters, initOverrides);
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Creates request options for deleteRoom without sending the request
|
|
897
|
+
*/
|
|
898
|
+
async deleteRoomRequestOpts(requestParameters) {
|
|
899
|
+
if (requestParameters["roomId"] == null) {
|
|
900
|
+
throw new RequiredError(
|
|
901
|
+
"roomId",
|
|
902
|
+
'Required parameter "roomId" was null or undefined when calling deleteRoom().'
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
const queryParameters = {};
|
|
906
|
+
const headerParameters = {};
|
|
907
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
908
|
+
const token = this.configuration.accessToken;
|
|
909
|
+
const tokenString = await token("management_token", []);
|
|
910
|
+
if (tokenString) {
|
|
911
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
let urlPath = `/room/{room_id}`;
|
|
915
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
916
|
+
return {
|
|
917
|
+
path: urlPath,
|
|
918
|
+
method: "DELETE",
|
|
919
|
+
headers: headerParameters,
|
|
920
|
+
query: queryParameters
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Delete a room by id and disconnect all of its peers.
|
|
925
|
+
* Delete a room
|
|
926
|
+
*/
|
|
927
|
+
async deleteRoomRaw(requestParameters, initOverrides) {
|
|
928
|
+
const requestOptions = await this.deleteRoomRequestOpts(requestParameters);
|
|
929
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
930
|
+
return new VoidApiResponse(response);
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Delete a room by id and disconnect all of its peers.
|
|
934
|
+
* Delete a room
|
|
935
|
+
*/
|
|
936
|
+
async deleteRoom(requestParameters, initOverrides) {
|
|
937
|
+
await this.deleteRoomRaw(requestParameters, initOverrides);
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Creates request options for getAllRooms without sending the request
|
|
941
|
+
*/
|
|
942
|
+
async getAllRoomsRequestOpts() {
|
|
943
|
+
const queryParameters = {};
|
|
944
|
+
const headerParameters = {};
|
|
945
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
946
|
+
const token = this.configuration.accessToken;
|
|
947
|
+
const tokenString = await token("management_token", []);
|
|
948
|
+
if (tokenString) {
|
|
949
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
let urlPath = `/room`;
|
|
953
|
+
return {
|
|
954
|
+
path: urlPath,
|
|
955
|
+
method: "GET",
|
|
956
|
+
headers: headerParameters,
|
|
957
|
+
query: queryParameters
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* List all rooms and livestreams.
|
|
962
|
+
* List all rooms
|
|
963
|
+
*/
|
|
964
|
+
async getAllRoomsRaw(initOverrides) {
|
|
965
|
+
const requestOptions = await this.getAllRoomsRequestOpts();
|
|
966
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
967
|
+
return new JSONApiResponse(response, (jsonValue) => RoomsListingResponseFromJSON(jsonValue));
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* List all rooms and livestreams.
|
|
971
|
+
* List all rooms
|
|
972
|
+
*/
|
|
973
|
+
async getAllRooms(initOverrides) {
|
|
974
|
+
const response = await this.getAllRoomsRaw(initOverrides);
|
|
975
|
+
return await response.value();
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Creates request options for getRoom without sending the request
|
|
979
|
+
*/
|
|
980
|
+
async getRoomRequestOpts(requestParameters) {
|
|
981
|
+
if (requestParameters["roomId"] == null) {
|
|
982
|
+
throw new RequiredError(
|
|
983
|
+
"roomId",
|
|
984
|
+
'Required parameter "roomId" was null or undefined when calling getRoom().'
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
const queryParameters = {};
|
|
988
|
+
const headerParameters = {};
|
|
989
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
990
|
+
const token = this.configuration.accessToken;
|
|
991
|
+
const tokenString = await token("management_token", []);
|
|
992
|
+
if (tokenString) {
|
|
993
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
let urlPath = `/room/{room_id}`;
|
|
997
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
998
|
+
return {
|
|
999
|
+
path: urlPath,
|
|
1000
|
+
method: "GET",
|
|
1001
|
+
headers: headerParameters,
|
|
1002
|
+
query: queryParameters
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Get a room by id.
|
|
1007
|
+
* Get a room
|
|
1008
|
+
*/
|
|
1009
|
+
async getRoomRaw(requestParameters, initOverrides) {
|
|
1010
|
+
const requestOptions = await this.getRoomRequestOpts(requestParameters);
|
|
1011
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1012
|
+
return new JSONApiResponse(response, (jsonValue) => RoomDetailsResponseFromJSON(jsonValue));
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Get a room by id.
|
|
1016
|
+
* Get a room
|
|
1017
|
+
*/
|
|
1018
|
+
async getRoom(requestParameters, initOverrides) {
|
|
1019
|
+
const response = await this.getRoomRaw(requestParameters, initOverrides);
|
|
1020
|
+
return await response.value();
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Creates request options for refreshToken without sending the request
|
|
1024
|
+
*/
|
|
1025
|
+
async refreshTokenRequestOpts(requestParameters) {
|
|
1026
|
+
if (requestParameters["roomId"] == null) {
|
|
1027
|
+
throw new RequiredError(
|
|
1028
|
+
"roomId",
|
|
1029
|
+
'Required parameter "roomId" was null or undefined when calling refreshToken().'
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
if (requestParameters["id"] == null) {
|
|
1033
|
+
throw new RequiredError(
|
|
1034
|
+
"id",
|
|
1035
|
+
'Required parameter "id" was null or undefined when calling refreshToken().'
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
const queryParameters = {};
|
|
1039
|
+
const headerParameters = {};
|
|
1040
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1041
|
+
const token = this.configuration.accessToken;
|
|
1042
|
+
const tokenString = await token("management_token", []);
|
|
1043
|
+
if (tokenString) {
|
|
1044
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
let urlPath = `/room/{room_id}/peer/{id}/refresh_token`;
|
|
1048
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1049
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
1050
|
+
return {
|
|
1051
|
+
path: urlPath,
|
|
1052
|
+
method: "POST",
|
|
1053
|
+
headers: headerParameters,
|
|
1054
|
+
query: queryParameters
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Issue a fresh connection token for an existing peer.
|
|
1059
|
+
* Refresh a peer token
|
|
1060
|
+
*/
|
|
1061
|
+
async refreshTokenRaw(requestParameters, initOverrides) {
|
|
1062
|
+
const requestOptions = await this.refreshTokenRequestOpts(requestParameters);
|
|
1063
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1064
|
+
return new JSONApiResponse(response, (jsonValue) => PeerRefreshTokenResponseFromJSON(jsonValue));
|
|
32
1065
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* Issue a fresh connection token for an existing peer.
|
|
1068
|
+
* Refresh a peer token
|
|
1069
|
+
*/
|
|
1070
|
+
async refreshToken(requestParameters, initOverrides) {
|
|
1071
|
+
const response = await this.refreshTokenRaw(requestParameters, initOverrides);
|
|
1072
|
+
return await response.value();
|
|
38
1073
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`)
|
|
1074
|
+
/**
|
|
1075
|
+
* Creates request options for subscribePeer without sending the request
|
|
1076
|
+
*/
|
|
1077
|
+
async subscribePeerRequestOpts(requestParameters) {
|
|
1078
|
+
if (requestParameters["roomId"] == null) {
|
|
1079
|
+
throw new RequiredError(
|
|
1080
|
+
"roomId",
|
|
1081
|
+
'Required parameter "roomId" was null or undefined when calling subscribePeer().'
|
|
48
1082
|
);
|
|
49
1083
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1084
|
+
if (requestParameters["id"] == null) {
|
|
1085
|
+
throw new RequiredError(
|
|
1086
|
+
"id",
|
|
1087
|
+
'Required parameter "id" was null or undefined when calling subscribePeer().'
|
|
1088
|
+
);
|
|
55
1089
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const searchParams = new URLSearchParams(url.search);
|
|
60
|
-
setFlattenedQueryParams(searchParams, objects);
|
|
61
|
-
url.search = searchParams.toString();
|
|
62
|
-
};
|
|
63
|
-
var serializeDataIfNeeded = function(value, requestOptions, configuration) {
|
|
64
|
-
const nonString = typeof value !== "string";
|
|
65
|
-
const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) : nonString;
|
|
66
|
-
return needsSerialization ? JSON.stringify(value !== void 0 ? value : {}) : value || "";
|
|
67
|
-
};
|
|
68
|
-
var toPathString = function(url) {
|
|
69
|
-
return url.pathname + url.search + url.hash;
|
|
70
|
-
};
|
|
71
|
-
var createRequestFunction = function(axiosArgs, globalAxios3, BASE_PATH2, configuration) {
|
|
72
|
-
return (axios2 = globalAxios3, basePath = BASE_PATH2) => {
|
|
73
|
-
const axiosRequestArgs = { ...axiosArgs.options, url: (axios2.defaults.baseURL ? "" : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
74
|
-
return axios2.request(axiosRequestArgs);
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
var PeerStatus = {
|
|
78
|
-
Connected: "connected",
|
|
79
|
-
Disconnected: "disconnected"
|
|
80
|
-
};
|
|
81
|
-
var RoomType = {
|
|
82
|
-
FullFeature: "full_feature",
|
|
83
|
-
AudioOnly: "audio_only",
|
|
84
|
-
Broadcaster: "broadcaster",
|
|
85
|
-
Livestream: "livestream",
|
|
86
|
-
Conference: "conference",
|
|
87
|
-
AudioOnlyLivestream: "audio_only_livestream"
|
|
88
|
-
};
|
|
89
|
-
var VideoCodec = {
|
|
90
|
-
H264: "h264",
|
|
91
|
-
Vp8: "vp8"
|
|
92
|
-
};
|
|
93
|
-
var CredentialsApiAxiosParamCreator = function(configuration) {
|
|
94
|
-
return {
|
|
95
|
-
/**
|
|
96
|
-
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
97
|
-
* @summary Validate Fishjam Management Token
|
|
98
|
-
* @param {*} [options] Override http request option.
|
|
99
|
-
* @throws {RequiredError}
|
|
100
|
-
*/
|
|
101
|
-
validateCredentials: async (options = {}) => {
|
|
102
|
-
const localVarPath = `/validate`;
|
|
103
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
104
|
-
let baseOptions;
|
|
105
|
-
if (configuration) {
|
|
106
|
-
baseOptions = configuration.baseOptions;
|
|
107
|
-
}
|
|
108
|
-
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
109
|
-
const localVarHeaderParameter = {};
|
|
110
|
-
const localVarQueryParameter = {};
|
|
111
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
112
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
113
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
114
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
115
|
-
return {
|
|
116
|
-
url: toPathString(localVarUrlObj),
|
|
117
|
-
options: localVarRequestOptions
|
|
118
|
-
};
|
|
1090
|
+
const queryParameters = {};
|
|
1091
|
+
if (requestParameters["peerId"] != null) {
|
|
1092
|
+
queryParameters["peer_id"] = requestParameters["peerId"];
|
|
119
1093
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
* @summary Validate Fishjam Management Token
|
|
128
|
-
* @param {*} [options] Override http request option.
|
|
129
|
-
* @throws {RequiredError}
|
|
130
|
-
*/
|
|
131
|
-
async validateCredentials(options) {
|
|
132
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options);
|
|
133
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
134
|
-
const localVarOperationServerBasePath = operationServerMap["CredentialsApi.validateCredentials"]?.[localVarOperationServerIndex]?.url;
|
|
135
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
1094
|
+
const headerParameters = {};
|
|
1095
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1096
|
+
const token = this.configuration.accessToken;
|
|
1097
|
+
const tokenString = await token("management_token", []);
|
|
1098
|
+
if (tokenString) {
|
|
1099
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1100
|
+
}
|
|
136
1101
|
}
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
|
|
1102
|
+
let urlPath = `/room/{room_id}/peer/{id}/subscribe_peer`;
|
|
1103
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1104
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
1105
|
+
return {
|
|
1106
|
+
path: urlPath,
|
|
1107
|
+
method: "POST",
|
|
1108
|
+
headers: headerParameters,
|
|
1109
|
+
query: queryParameters
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
140
1112
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @param {*} [options] Override http request option.
|
|
144
|
-
* @throws {RequiredError}
|
|
145
|
-
* @memberof CredentialsApi
|
|
1113
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
1114
|
+
* Subscribe a peer to another peer\'s tracks
|
|
146
1115
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
1116
|
+
async subscribePeerRaw(requestParameters, initOverrides) {
|
|
1117
|
+
const requestOptions = await this.subscribePeerRequestOpts(requestParameters);
|
|
1118
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1119
|
+
return new VoidApiResponse(response);
|
|
149
1120
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
168
|
-
const localVarHeaderParameter = {};
|
|
169
|
-
const localVarQueryParameter = {};
|
|
170
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
171
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
172
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
173
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
174
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
175
|
-
localVarRequestOptions.data = serializeDataIfNeeded(moqAccessConfig, localVarRequestOptions, configuration);
|
|
176
|
-
return {
|
|
177
|
-
url: toPathString(localVarUrlObj),
|
|
178
|
-
options: localVarRequestOptions
|
|
179
|
-
};
|
|
1121
|
+
/**
|
|
1122
|
+
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
1123
|
+
* Subscribe a peer to another peer\'s tracks
|
|
1124
|
+
*/
|
|
1125
|
+
async subscribePeer(requestParameters, initOverrides) {
|
|
1126
|
+
await this.subscribePeerRaw(requestParameters, initOverrides);
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Creates request options for subscribeTracks without sending the request
|
|
1130
|
+
*/
|
|
1131
|
+
async subscribeTracksRequestOpts(requestParameters) {
|
|
1132
|
+
if (requestParameters["roomId"] == null) {
|
|
1133
|
+
throw new RequiredError(
|
|
1134
|
+
"roomId",
|
|
1135
|
+
'Required parameter "roomId" was null or undefined when calling subscribeTracks().'
|
|
1136
|
+
);
|
|
180
1137
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Issue a short-lived JWT for a Media over QUIC client.
|
|
188
|
-
* @summary Create MoQ access
|
|
189
|
-
* @param {MoqAccessConfig} [moqAccessConfig]
|
|
190
|
-
* @param {*} [options] Override http request option.
|
|
191
|
-
* @throws {RequiredError}
|
|
192
|
-
*/
|
|
193
|
-
async createMoqAccess(moqAccessConfig, options) {
|
|
194
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqAccess(moqAccessConfig, options);
|
|
195
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
196
|
-
const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqAccess"]?.[localVarOperationServerIndex]?.url;
|
|
197
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
1138
|
+
if (requestParameters["id"] == null) {
|
|
1139
|
+
throw new RequiredError(
|
|
1140
|
+
"id",
|
|
1141
|
+
'Required parameter "id" was null or undefined when calling subscribeTracks().'
|
|
1142
|
+
);
|
|
198
1143
|
}
|
|
199
|
-
|
|
200
|
-
};
|
|
201
|
-
|
|
1144
|
+
const queryParameters = {};
|
|
1145
|
+
const headerParameters = {};
|
|
1146
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1147
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1148
|
+
const token = this.configuration.accessToken;
|
|
1149
|
+
const tokenString = await token("management_token", []);
|
|
1150
|
+
if (tokenString) {
|
|
1151
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
let urlPath = `/room/{room_id}/peer/{id}/subscribe_tracks`;
|
|
1155
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1156
|
+
urlPath = urlPath.replace("{id}", encodeURIComponent(String(requestParameters["id"])));
|
|
1157
|
+
return {
|
|
1158
|
+
path: urlPath,
|
|
1159
|
+
method: "POST",
|
|
1160
|
+
headers: headerParameters,
|
|
1161
|
+
query: queryParameters,
|
|
1162
|
+
body: SubscribeTracksRequestToJSON(requestParameters["subscribeTracksRequest"])
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
202
1165
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* @param {MoqAccessConfig} [moqAccessConfig]
|
|
206
|
-
* @param {*} [options] Override http request option.
|
|
207
|
-
* @throws {RequiredError}
|
|
208
|
-
* @memberof MoQApi
|
|
1166
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
1167
|
+
* Subscribe a peer to specific tracks
|
|
209
1168
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
1169
|
+
async subscribeTracksRaw(requestParameters, initOverrides) {
|
|
1170
|
+
const requestOptions = await this.subscribeTracksRequestOpts(requestParameters);
|
|
1171
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1172
|
+
return new VoidApiResponse(response);
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
1176
|
+
* Subscribe a peer to specific tracks
|
|
1177
|
+
*/
|
|
1178
|
+
async subscribeTracks(requestParameters, initOverrides) {
|
|
1179
|
+
await this.subscribeTracksRaw(requestParameters, initOverrides);
|
|
212
1180
|
}
|
|
213
1181
|
};
|
|
214
|
-
|
|
1182
|
+
function StreamerFromJSON(json) {
|
|
1183
|
+
return StreamerFromJSONTyped(json, false);
|
|
1184
|
+
}
|
|
1185
|
+
function StreamerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1186
|
+
if (json == null) {
|
|
1187
|
+
return json;
|
|
1188
|
+
}
|
|
215
1189
|
return {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* @param {string} roomId Room id
|
|
220
|
-
* @param {PeerConfig} [peerConfig]
|
|
221
|
-
* @param {*} [options] Override http request option.
|
|
222
|
-
* @throws {RequiredError}
|
|
223
|
-
*/
|
|
224
|
-
addPeer: async (roomId, peerConfig, options = {}) => {
|
|
225
|
-
assertParamExists("addPeer", "roomId", roomId);
|
|
226
|
-
const localVarPath = `/room/{room_id}/peer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
227
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
228
|
-
let baseOptions;
|
|
229
|
-
if (configuration) {
|
|
230
|
-
baseOptions = configuration.baseOptions;
|
|
231
|
-
}
|
|
232
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
233
|
-
const localVarHeaderParameter = {};
|
|
234
|
-
const localVarQueryParameter = {};
|
|
235
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
236
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
237
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
238
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
239
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
240
|
-
localVarRequestOptions.data = serializeDataIfNeeded(peerConfig, localVarRequestOptions, configuration);
|
|
241
|
-
return {
|
|
242
|
-
url: toPathString(localVarUrlObj),
|
|
243
|
-
options: localVarRequestOptions
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
/**
|
|
247
|
-
* Create a new room with the given configuration.
|
|
248
|
-
* @summary Create a room
|
|
249
|
-
* @param {RoomConfig} [roomConfig]
|
|
250
|
-
* @param {*} [options] Override http request option.
|
|
251
|
-
* @throws {RequiredError}
|
|
252
|
-
*/
|
|
253
|
-
createRoom: async (roomConfig, options = {}) => {
|
|
254
|
-
const localVarPath = `/room`;
|
|
255
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
256
|
-
let baseOptions;
|
|
257
|
-
if (configuration) {
|
|
258
|
-
baseOptions = configuration.baseOptions;
|
|
259
|
-
}
|
|
260
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
261
|
-
const localVarHeaderParameter = {};
|
|
262
|
-
const localVarQueryParameter = {};
|
|
263
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
264
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
265
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
266
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
267
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
268
|
-
localVarRequestOptions.data = serializeDataIfNeeded(roomConfig, localVarRequestOptions, configuration);
|
|
269
|
-
return {
|
|
270
|
-
url: toPathString(localVarUrlObj),
|
|
271
|
-
options: localVarRequestOptions
|
|
272
|
-
};
|
|
273
|
-
},
|
|
274
|
-
/**
|
|
275
|
-
* Remove a peer from a room and disconnect it.
|
|
276
|
-
* @summary Delete a peer
|
|
277
|
-
* @param {string} roomId Room id
|
|
278
|
-
* @param {string} id Peer id
|
|
279
|
-
* @param {*} [options] Override http request option.
|
|
280
|
-
* @throws {RequiredError}
|
|
281
|
-
*/
|
|
282
|
-
deletePeer: async (roomId, id, options = {}) => {
|
|
283
|
-
assertParamExists("deletePeer", "roomId", roomId);
|
|
284
|
-
assertParamExists("deletePeer", "id", id);
|
|
285
|
-
const localVarPath = `/room/{room_id}/peer/{id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
286
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
287
|
-
let baseOptions;
|
|
288
|
-
if (configuration) {
|
|
289
|
-
baseOptions = configuration.baseOptions;
|
|
290
|
-
}
|
|
291
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
292
|
-
const localVarHeaderParameter = {};
|
|
293
|
-
const localVarQueryParameter = {};
|
|
294
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
295
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
296
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
297
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
298
|
-
return {
|
|
299
|
-
url: toPathString(localVarUrlObj),
|
|
300
|
-
options: localVarRequestOptions
|
|
301
|
-
};
|
|
302
|
-
},
|
|
303
|
-
/**
|
|
304
|
-
* Delete a room by id and disconnect all of its peers.
|
|
305
|
-
* @summary Delete a room
|
|
306
|
-
* @param {string} roomId Room id
|
|
307
|
-
* @param {*} [options] Override http request option.
|
|
308
|
-
* @throws {RequiredError}
|
|
309
|
-
*/
|
|
310
|
-
deleteRoom: async (roomId, options = {}) => {
|
|
311
|
-
assertParamExists("deleteRoom", "roomId", roomId);
|
|
312
|
-
const localVarPath = `/room/{room_id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
313
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
314
|
-
let baseOptions;
|
|
315
|
-
if (configuration) {
|
|
316
|
-
baseOptions = configuration.baseOptions;
|
|
317
|
-
}
|
|
318
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
319
|
-
const localVarHeaderParameter = {};
|
|
320
|
-
const localVarQueryParameter = {};
|
|
321
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
322
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
323
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
324
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
325
|
-
return {
|
|
326
|
-
url: toPathString(localVarUrlObj),
|
|
327
|
-
options: localVarRequestOptions
|
|
328
|
-
};
|
|
329
|
-
},
|
|
330
|
-
/**
|
|
331
|
-
* List all rooms and livestreams.
|
|
332
|
-
* @summary List all rooms
|
|
333
|
-
* @param {*} [options] Override http request option.
|
|
334
|
-
* @throws {RequiredError}
|
|
335
|
-
*/
|
|
336
|
-
getAllRooms: async (options = {}) => {
|
|
337
|
-
const localVarPath = `/room`;
|
|
338
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
339
|
-
let baseOptions;
|
|
340
|
-
if (configuration) {
|
|
341
|
-
baseOptions = configuration.baseOptions;
|
|
342
|
-
}
|
|
343
|
-
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
344
|
-
const localVarHeaderParameter = {};
|
|
345
|
-
const localVarQueryParameter = {};
|
|
346
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
347
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
348
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
349
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
350
|
-
return {
|
|
351
|
-
url: toPathString(localVarUrlObj),
|
|
352
|
-
options: localVarRequestOptions
|
|
353
|
-
};
|
|
354
|
-
},
|
|
355
|
-
/**
|
|
356
|
-
* Get a room by id.
|
|
357
|
-
* @summary Get a room
|
|
358
|
-
* @param {string} roomId Room ID
|
|
359
|
-
* @param {*} [options] Override http request option.
|
|
360
|
-
* @throws {RequiredError}
|
|
361
|
-
*/
|
|
362
|
-
getRoom: async (roomId, options = {}) => {
|
|
363
|
-
assertParamExists("getRoom", "roomId", roomId);
|
|
364
|
-
const localVarPath = `/room/{room_id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
365
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
366
|
-
let baseOptions;
|
|
367
|
-
if (configuration) {
|
|
368
|
-
baseOptions = configuration.baseOptions;
|
|
369
|
-
}
|
|
370
|
-
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
371
|
-
const localVarHeaderParameter = {};
|
|
372
|
-
const localVarQueryParameter = {};
|
|
373
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
374
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
375
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
376
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
377
|
-
return {
|
|
378
|
-
url: toPathString(localVarUrlObj),
|
|
379
|
-
options: localVarRequestOptions
|
|
380
|
-
};
|
|
381
|
-
},
|
|
382
|
-
/**
|
|
383
|
-
* Issue a fresh connection token for an existing peer.
|
|
384
|
-
* @summary Refresh a peer token
|
|
385
|
-
* @param {string} roomId Room id
|
|
386
|
-
* @param {string} id Peer id
|
|
387
|
-
* @param {*} [options] Override http request option.
|
|
388
|
-
* @throws {RequiredError}
|
|
389
|
-
*/
|
|
390
|
-
refreshToken: async (roomId, id, options = {}) => {
|
|
391
|
-
assertParamExists("refreshToken", "roomId", roomId);
|
|
392
|
-
assertParamExists("refreshToken", "id", id);
|
|
393
|
-
const localVarPath = `/room/{room_id}/peer/{id}/refresh_token`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
394
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
395
|
-
let baseOptions;
|
|
396
|
-
if (configuration) {
|
|
397
|
-
baseOptions = configuration.baseOptions;
|
|
398
|
-
}
|
|
399
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
400
|
-
const localVarHeaderParameter = {};
|
|
401
|
-
const localVarQueryParameter = {};
|
|
402
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
403
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
404
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
405
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
406
|
-
return {
|
|
407
|
-
url: toPathString(localVarUrlObj),
|
|
408
|
-
options: localVarRequestOptions
|
|
409
|
-
};
|
|
410
|
-
},
|
|
411
|
-
/**
|
|
412
|
-
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
413
|
-
* @summary Subscribe a peer to another peer\'s tracks
|
|
414
|
-
* @param {string} roomId Room id
|
|
415
|
-
* @param {string} id Peer id
|
|
416
|
-
* @param {string} [peerId] ID of the peer that produces the track
|
|
417
|
-
* @param {*} [options] Override http request option.
|
|
418
|
-
* @throws {RequiredError}
|
|
419
|
-
*/
|
|
420
|
-
subscribePeer: async (roomId, id, peerId, options = {}) => {
|
|
421
|
-
assertParamExists("subscribePeer", "roomId", roomId);
|
|
422
|
-
assertParamExists("subscribePeer", "id", id);
|
|
423
|
-
const localVarPath = `/room/{room_id}/peer/{id}/subscribe_peer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
424
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
425
|
-
let baseOptions;
|
|
426
|
-
if (configuration) {
|
|
427
|
-
baseOptions = configuration.baseOptions;
|
|
428
|
-
}
|
|
429
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
430
|
-
const localVarHeaderParameter = {};
|
|
431
|
-
const localVarQueryParameter = {};
|
|
432
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
433
|
-
if (peerId !== void 0) {
|
|
434
|
-
localVarQueryParameter["peer_id"] = peerId;
|
|
435
|
-
}
|
|
436
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
437
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
438
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
439
|
-
return {
|
|
440
|
-
url: toPathString(localVarUrlObj),
|
|
441
|
-
options: localVarRequestOptions
|
|
442
|
-
};
|
|
443
|
-
},
|
|
444
|
-
/**
|
|
445
|
-
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
446
|
-
* @summary Subscribe a peer to specific tracks
|
|
447
|
-
* @param {string} roomId Room id
|
|
448
|
-
* @param {string} id Peer id
|
|
449
|
-
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
450
|
-
* @param {*} [options] Override http request option.
|
|
451
|
-
* @throws {RequiredError}
|
|
452
|
-
*/
|
|
453
|
-
subscribeTracks: async (roomId, id, subscribeTracksRequest, options = {}) => {
|
|
454
|
-
assertParamExists("subscribeTracks", "roomId", roomId);
|
|
455
|
-
assertParamExists("subscribeTracks", "id", id);
|
|
456
|
-
const localVarPath = `/room/{room_id}/peer/{id}/subscribe_tracks`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))).replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
457
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
458
|
-
let baseOptions;
|
|
459
|
-
if (configuration) {
|
|
460
|
-
baseOptions = configuration.baseOptions;
|
|
461
|
-
}
|
|
462
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
463
|
-
const localVarHeaderParameter = {};
|
|
464
|
-
const localVarQueryParameter = {};
|
|
465
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
466
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
467
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
468
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
469
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
470
|
-
localVarRequestOptions.data = serializeDataIfNeeded(subscribeTracksRequest, localVarRequestOptions, configuration);
|
|
471
|
-
return {
|
|
472
|
-
url: toPathString(localVarUrlObj),
|
|
473
|
-
options: localVarRequestOptions
|
|
474
|
-
};
|
|
475
|
-
}
|
|
1190
|
+
"id": json["id"],
|
|
1191
|
+
"status": json["status"],
|
|
1192
|
+
"token": json["token"]
|
|
476
1193
|
};
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
1194
|
+
}
|
|
1195
|
+
function StreamerDetailsResponseFromJSON(json) {
|
|
1196
|
+
return StreamerDetailsResponseFromJSONTyped(json, false);
|
|
1197
|
+
}
|
|
1198
|
+
function StreamerDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1199
|
+
if (json == null) {
|
|
1200
|
+
return json;
|
|
1201
|
+
}
|
|
480
1202
|
return {
|
|
481
|
-
|
|
482
|
-
* Add a peer to a room and return its connection token.
|
|
483
|
-
* @summary Create a peer
|
|
484
|
-
* @param {string} roomId Room id
|
|
485
|
-
* @param {PeerConfig} [peerConfig]
|
|
486
|
-
* @param {*} [options] Override http request option.
|
|
487
|
-
* @throws {RequiredError}
|
|
488
|
-
*/
|
|
489
|
-
async addPeer(roomId, peerConfig, options) {
|
|
490
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
|
|
491
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
492
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
|
|
493
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
494
|
-
},
|
|
495
|
-
/**
|
|
496
|
-
* Create a new room with the given configuration.
|
|
497
|
-
* @summary Create a room
|
|
498
|
-
* @param {RoomConfig} [roomConfig]
|
|
499
|
-
* @param {*} [options] Override http request option.
|
|
500
|
-
* @throws {RequiredError}
|
|
501
|
-
*/
|
|
502
|
-
async createRoom(roomConfig, options) {
|
|
503
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
|
|
504
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
505
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
|
|
506
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
507
|
-
},
|
|
508
|
-
/**
|
|
509
|
-
* Remove a peer from a room and disconnect it.
|
|
510
|
-
* @summary Delete a peer
|
|
511
|
-
* @param {string} roomId Room id
|
|
512
|
-
* @param {string} id Peer id
|
|
513
|
-
* @param {*} [options] Override http request option.
|
|
514
|
-
* @throws {RequiredError}
|
|
515
|
-
*/
|
|
516
|
-
async deletePeer(roomId, id, options) {
|
|
517
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
|
|
518
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
519
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
|
|
520
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
521
|
-
},
|
|
522
|
-
/**
|
|
523
|
-
* Delete a room by id and disconnect all of its peers.
|
|
524
|
-
* @summary Delete a room
|
|
525
|
-
* @param {string} roomId Room id
|
|
526
|
-
* @param {*} [options] Override http request option.
|
|
527
|
-
* @throws {RequiredError}
|
|
528
|
-
*/
|
|
529
|
-
async deleteRoom(roomId, options) {
|
|
530
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
|
|
531
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
532
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
|
|
533
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
534
|
-
},
|
|
535
|
-
/**
|
|
536
|
-
* List all rooms and livestreams.
|
|
537
|
-
* @summary List all rooms
|
|
538
|
-
* @param {*} [options] Override http request option.
|
|
539
|
-
* @throws {RequiredError}
|
|
540
|
-
*/
|
|
541
|
-
async getAllRooms(options) {
|
|
542
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
|
|
543
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
544
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
|
|
545
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
546
|
-
},
|
|
547
|
-
/**
|
|
548
|
-
* Get a room by id.
|
|
549
|
-
* @summary Get a room
|
|
550
|
-
* @param {string} roomId Room ID
|
|
551
|
-
* @param {*} [options] Override http request option.
|
|
552
|
-
* @throws {RequiredError}
|
|
553
|
-
*/
|
|
554
|
-
async getRoom(roomId, options) {
|
|
555
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
|
|
556
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
557
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
|
|
558
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* Issue a fresh connection token for an existing peer.
|
|
562
|
-
* @summary Refresh a peer token
|
|
563
|
-
* @param {string} roomId Room id
|
|
564
|
-
* @param {string} id Peer id
|
|
565
|
-
* @param {*} [options] Override http request option.
|
|
566
|
-
* @throws {RequiredError}
|
|
567
|
-
*/
|
|
568
|
-
async refreshToken(roomId, id, options) {
|
|
569
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
|
|
570
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
571
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
|
|
572
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
573
|
-
},
|
|
574
|
-
/**
|
|
575
|
-
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
576
|
-
* @summary Subscribe a peer to another peer\'s tracks
|
|
577
|
-
* @param {string} roomId Room id
|
|
578
|
-
* @param {string} id Peer id
|
|
579
|
-
* @param {string} [peerId] ID of the peer that produces the track
|
|
580
|
-
* @param {*} [options] Override http request option.
|
|
581
|
-
* @throws {RequiredError}
|
|
582
|
-
*/
|
|
583
|
-
async subscribePeer(roomId, id, peerId, options) {
|
|
584
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
|
|
585
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
586
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
|
|
587
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
588
|
-
},
|
|
589
|
-
/**
|
|
590
|
-
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
591
|
-
* @summary Subscribe a peer to specific tracks
|
|
592
|
-
* @param {string} roomId Room id
|
|
593
|
-
* @param {string} id Peer id
|
|
594
|
-
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
595
|
-
* @param {*} [options] Override http request option.
|
|
596
|
-
* @throws {RequiredError}
|
|
597
|
-
*/
|
|
598
|
-
async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
599
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(roomId, id, subscribeTracksRequest, options);
|
|
600
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
601
|
-
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
|
|
602
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
603
|
-
}
|
|
1203
|
+
"data": StreamerFromJSON(json["data"])
|
|
604
1204
|
};
|
|
605
|
-
}
|
|
606
|
-
|
|
1205
|
+
}
|
|
1206
|
+
function StreamerTokenFromJSON(json) {
|
|
1207
|
+
return StreamerTokenFromJSONTyped(json, false);
|
|
1208
|
+
}
|
|
1209
|
+
function StreamerTokenFromJSONTyped(json, ignoreDiscriminator) {
|
|
1210
|
+
if (json == null) {
|
|
1211
|
+
return json;
|
|
1212
|
+
}
|
|
1213
|
+
return {
|
|
1214
|
+
"token": json["token"]
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
var StreamersApi = class extends BaseAPI {
|
|
607
1218
|
/**
|
|
608
|
-
*
|
|
609
|
-
* @summary Create a peer
|
|
610
|
-
* @param {string} roomId Room id
|
|
611
|
-
* @param {PeerConfig} [peerConfig]
|
|
612
|
-
* @param {*} [options] Override http request option.
|
|
613
|
-
* @throws {RequiredError}
|
|
614
|
-
* @memberof RoomsApi
|
|
1219
|
+
* Creates request options for createStreamer without sending the request
|
|
615
1220
|
*/
|
|
616
|
-
|
|
617
|
-
|
|
1221
|
+
async createStreamerRequestOpts(requestParameters) {
|
|
1222
|
+
if (requestParameters["streamId"] == null) {
|
|
1223
|
+
throw new RequiredError(
|
|
1224
|
+
"streamId",
|
|
1225
|
+
'Required parameter "streamId" was null or undefined when calling createStreamer().'
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
const queryParameters = {};
|
|
1229
|
+
const headerParameters = {};
|
|
1230
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1231
|
+
const token = this.configuration.accessToken;
|
|
1232
|
+
const tokenString = await token("management_token", []);
|
|
1233
|
+
if (tokenString) {
|
|
1234
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
let urlPath = `/livestream/{stream_id}/streamer`;
|
|
1238
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1239
|
+
return {
|
|
1240
|
+
path: urlPath,
|
|
1241
|
+
method: "POST",
|
|
1242
|
+
headers: headerParameters,
|
|
1243
|
+
query: queryParameters
|
|
1244
|
+
};
|
|
618
1245
|
}
|
|
619
1246
|
/**
|
|
620
|
-
* Create a
|
|
621
|
-
*
|
|
622
|
-
* @param {RoomConfig} [roomConfig]
|
|
623
|
-
* @param {*} [options] Override http request option.
|
|
624
|
-
* @throws {RequiredError}
|
|
625
|
-
* @memberof RoomsApi
|
|
1247
|
+
* Create a streamer for a stream and return its credentials.
|
|
1248
|
+
* Create a streamer
|
|
626
1249
|
*/
|
|
627
|
-
|
|
628
|
-
|
|
1250
|
+
async createStreamerRaw(requestParameters, initOverrides) {
|
|
1251
|
+
const requestOptions = await this.createStreamerRequestOpts(requestParameters);
|
|
1252
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1253
|
+
return new JSONApiResponse(response, (jsonValue) => StreamerDetailsResponseFromJSON(jsonValue));
|
|
629
1254
|
}
|
|
630
1255
|
/**
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
* @param {string} roomId Room id
|
|
634
|
-
* @param {string} id Peer id
|
|
635
|
-
* @param {*} [options] Override http request option.
|
|
636
|
-
* @throws {RequiredError}
|
|
637
|
-
* @memberof RoomsApi
|
|
1256
|
+
* Create a streamer for a stream and return its credentials.
|
|
1257
|
+
* Create a streamer
|
|
638
1258
|
*/
|
|
639
|
-
|
|
640
|
-
|
|
1259
|
+
async createStreamer(requestParameters, initOverrides) {
|
|
1260
|
+
const response = await this.createStreamerRaw(requestParameters, initOverrides);
|
|
1261
|
+
return await response.value();
|
|
641
1262
|
}
|
|
642
1263
|
/**
|
|
643
|
-
*
|
|
644
|
-
* @summary Delete a room
|
|
645
|
-
* @param {string} roomId Room id
|
|
646
|
-
* @param {*} [options] Override http request option.
|
|
647
|
-
* @throws {RequiredError}
|
|
648
|
-
* @memberof RoomsApi
|
|
1264
|
+
* Creates request options for deleteStreamer without sending the request
|
|
649
1265
|
*/
|
|
650
|
-
|
|
651
|
-
|
|
1266
|
+
async deleteStreamerRequestOpts(requestParameters) {
|
|
1267
|
+
if (requestParameters["streamId"] == null) {
|
|
1268
|
+
throw new RequiredError(
|
|
1269
|
+
"streamId",
|
|
1270
|
+
'Required parameter "streamId" was null or undefined when calling deleteStreamer().'
|
|
1271
|
+
);
|
|
1272
|
+
}
|
|
1273
|
+
if (requestParameters["streamerId"] == null) {
|
|
1274
|
+
throw new RequiredError(
|
|
1275
|
+
"streamerId",
|
|
1276
|
+
'Required parameter "streamerId" was null or undefined when calling deleteStreamer().'
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1279
|
+
const queryParameters = {};
|
|
1280
|
+
const headerParameters = {};
|
|
1281
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1282
|
+
const token = this.configuration.accessToken;
|
|
1283
|
+
const tokenString = await token("management_token", []);
|
|
1284
|
+
if (tokenString) {
|
|
1285
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
let urlPath = `/livestream/{stream_id}/streamer/{streamer_id}`;
|
|
1289
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1290
|
+
urlPath = urlPath.replace("{streamer_id}", encodeURIComponent(String(requestParameters["streamerId"])));
|
|
1291
|
+
return {
|
|
1292
|
+
path: urlPath,
|
|
1293
|
+
method: "DELETE",
|
|
1294
|
+
headers: headerParameters,
|
|
1295
|
+
query: queryParameters
|
|
1296
|
+
};
|
|
652
1297
|
}
|
|
653
1298
|
/**
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
* @param {*} [options] Override http request option.
|
|
657
|
-
* @throws {RequiredError}
|
|
658
|
-
* @memberof RoomsApi
|
|
1299
|
+
* Delete a streamer from a stream and revoke its token.
|
|
1300
|
+
* Delete a streamer
|
|
659
1301
|
*/
|
|
660
|
-
|
|
661
|
-
|
|
1302
|
+
async deleteStreamerRaw(requestParameters, initOverrides) {
|
|
1303
|
+
const requestOptions = await this.deleteStreamerRequestOpts(requestParameters);
|
|
1304
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1305
|
+
return new VoidApiResponse(response);
|
|
662
1306
|
}
|
|
663
1307
|
/**
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
* @param {string} roomId Room ID
|
|
667
|
-
* @param {*} [options] Override http request option.
|
|
668
|
-
* @throws {RequiredError}
|
|
669
|
-
* @memberof RoomsApi
|
|
1308
|
+
* Delete a streamer from a stream and revoke its token.
|
|
1309
|
+
* Delete a streamer
|
|
670
1310
|
*/
|
|
671
|
-
|
|
672
|
-
|
|
1311
|
+
async deleteStreamer(requestParameters, initOverrides) {
|
|
1312
|
+
await this.deleteStreamerRaw(requestParameters, initOverrides);
|
|
673
1313
|
}
|
|
674
1314
|
/**
|
|
675
|
-
*
|
|
676
|
-
* @summary Refresh a peer token
|
|
677
|
-
* @param {string} roomId Room id
|
|
678
|
-
* @param {string} id Peer id
|
|
679
|
-
* @param {*} [options] Override http request option.
|
|
680
|
-
* @throws {RequiredError}
|
|
681
|
-
* @memberof RoomsApi
|
|
1315
|
+
* Creates request options for generateStreamerToken without sending the request
|
|
682
1316
|
*/
|
|
683
|
-
|
|
684
|
-
|
|
1317
|
+
async generateStreamerTokenRequestOpts(requestParameters) {
|
|
1318
|
+
if (requestParameters["roomId"] == null) {
|
|
1319
|
+
throw new RequiredError(
|
|
1320
|
+
"roomId",
|
|
1321
|
+
'Required parameter "roomId" was null or undefined when calling generateStreamerToken().'
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1324
|
+
const queryParameters = {};
|
|
1325
|
+
const headerParameters = {};
|
|
1326
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1327
|
+
const token = this.configuration.accessToken;
|
|
1328
|
+
const tokenString = await token("management_token", []);
|
|
1329
|
+
if (tokenString) {
|
|
1330
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
let urlPath = `/room/{room_id}/streamer`;
|
|
1334
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1335
|
+
return {
|
|
1336
|
+
path: urlPath,
|
|
1337
|
+
method: "POST",
|
|
1338
|
+
headers: headerParameters,
|
|
1339
|
+
query: queryParameters
|
|
1340
|
+
};
|
|
685
1341
|
}
|
|
686
1342
|
/**
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
* @param {string} roomId Room id
|
|
690
|
-
* @param {string} id Peer id
|
|
691
|
-
* @param {string} [peerId] ID of the peer that produces the track
|
|
692
|
-
* @param {*} [options] Override http request option.
|
|
693
|
-
* @throws {RequiredError}
|
|
694
|
-
* @memberof RoomsApi
|
|
1343
|
+
* Issue a fresh streamer token.
|
|
1344
|
+
* Create a streamer token
|
|
695
1345
|
*/
|
|
696
|
-
|
|
697
|
-
|
|
1346
|
+
async generateStreamerTokenRaw(requestParameters, initOverrides) {
|
|
1347
|
+
const requestOptions = await this.generateStreamerTokenRequestOpts(requestParameters);
|
|
1348
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1349
|
+
return new JSONApiResponse(response, (jsonValue) => StreamerTokenFromJSON(jsonValue));
|
|
698
1350
|
}
|
|
699
1351
|
/**
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
* @param {string} roomId Room id
|
|
703
|
-
* @param {string} id Peer id
|
|
704
|
-
* @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs
|
|
705
|
-
* @param {*} [options] Override http request option.
|
|
706
|
-
* @throws {RequiredError}
|
|
707
|
-
* @memberof RoomsApi
|
|
1352
|
+
* Issue a fresh streamer token.
|
|
1353
|
+
* Create a streamer token
|
|
708
1354
|
*/
|
|
709
|
-
|
|
710
|
-
|
|
1355
|
+
async generateStreamerToken(requestParameters, initOverrides) {
|
|
1356
|
+
const response = await this.generateStreamerTokenRaw(requestParameters, initOverrides);
|
|
1357
|
+
return await response.value();
|
|
711
1358
|
}
|
|
712
1359
|
};
|
|
713
|
-
|
|
1360
|
+
function ViewerFromJSON(json) {
|
|
1361
|
+
return ViewerFromJSONTyped(json, false);
|
|
1362
|
+
}
|
|
1363
|
+
function ViewerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1364
|
+
if (json == null) {
|
|
1365
|
+
return json;
|
|
1366
|
+
}
|
|
714
1367
|
return {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
* @summary Create a streamer
|
|
718
|
-
* @param {string} streamId Stream id
|
|
719
|
-
* @param {*} [options] Override http request option.
|
|
720
|
-
* @throws {RequiredError}
|
|
721
|
-
*/
|
|
722
|
-
createStreamer: async (streamId, options = {}) => {
|
|
723
|
-
assertParamExists("createStreamer", "streamId", streamId);
|
|
724
|
-
const localVarPath = `/livestream/{stream_id}/streamer`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
|
|
725
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
726
|
-
let baseOptions;
|
|
727
|
-
if (configuration) {
|
|
728
|
-
baseOptions = configuration.baseOptions;
|
|
729
|
-
}
|
|
730
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
731
|
-
const localVarHeaderParameter = {};
|
|
732
|
-
const localVarQueryParameter = {};
|
|
733
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
734
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
735
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
736
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
737
|
-
return {
|
|
738
|
-
url: toPathString(localVarUrlObj),
|
|
739
|
-
options: localVarRequestOptions
|
|
740
|
-
};
|
|
741
|
-
},
|
|
742
|
-
/**
|
|
743
|
-
* Delete a streamer from a stream and revoke its token.
|
|
744
|
-
* @summary Delete a streamer
|
|
745
|
-
* @param {string} streamId Stream id
|
|
746
|
-
* @param {string} streamerId Streamer id
|
|
747
|
-
* @param {*} [options] Override http request option.
|
|
748
|
-
* @throws {RequiredError}
|
|
749
|
-
*/
|
|
750
|
-
deleteStreamer: async (streamId, streamerId, options = {}) => {
|
|
751
|
-
assertParamExists("deleteStreamer", "streamId", streamId);
|
|
752
|
-
assertParamExists("deleteStreamer", "streamerId", streamerId);
|
|
753
|
-
const localVarPath = `/livestream/{stream_id}/streamer/{streamer_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))).replace(`{${"streamer_id"}}`, encodeURIComponent(String(streamerId)));
|
|
754
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
755
|
-
let baseOptions;
|
|
756
|
-
if (configuration) {
|
|
757
|
-
baseOptions = configuration.baseOptions;
|
|
758
|
-
}
|
|
759
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
760
|
-
const localVarHeaderParameter = {};
|
|
761
|
-
const localVarQueryParameter = {};
|
|
762
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
763
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
764
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
765
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
766
|
-
return {
|
|
767
|
-
url: toPathString(localVarUrlObj),
|
|
768
|
-
options: localVarRequestOptions
|
|
769
|
-
};
|
|
770
|
-
},
|
|
771
|
-
/**
|
|
772
|
-
* Issue a fresh streamer token.
|
|
773
|
-
* @summary Create a streamer token
|
|
774
|
-
* @param {string} roomId ID of the stream.
|
|
775
|
-
* @param {*} [options] Override http request option.
|
|
776
|
-
* @throws {RequiredError}
|
|
777
|
-
*/
|
|
778
|
-
generateStreamerToken: async (roomId, options = {}) => {
|
|
779
|
-
assertParamExists("generateStreamerToken", "roomId", roomId);
|
|
780
|
-
const localVarPath = `/room/{room_id}/streamer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
781
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
782
|
-
let baseOptions;
|
|
783
|
-
if (configuration) {
|
|
784
|
-
baseOptions = configuration.baseOptions;
|
|
785
|
-
}
|
|
786
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
787
|
-
const localVarHeaderParameter = {};
|
|
788
|
-
const localVarQueryParameter = {};
|
|
789
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
790
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
791
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
792
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
793
|
-
return {
|
|
794
|
-
url: toPathString(localVarUrlObj),
|
|
795
|
-
options: localVarRequestOptions
|
|
796
|
-
};
|
|
797
|
-
}
|
|
1368
|
+
"id": json["id"],
|
|
1369
|
+
"token": json["token"]
|
|
798
1370
|
};
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
1371
|
+
}
|
|
1372
|
+
function ViewerDetailsResponseFromJSON(json) {
|
|
1373
|
+
return ViewerDetailsResponseFromJSONTyped(json, false);
|
|
1374
|
+
}
|
|
1375
|
+
function ViewerDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1376
|
+
if (json == null) {
|
|
1377
|
+
return json;
|
|
1378
|
+
}
|
|
802
1379
|
return {
|
|
803
|
-
|
|
804
|
-
* Create a streamer for a stream and return its credentials.
|
|
805
|
-
* @summary Create a streamer
|
|
806
|
-
* @param {string} streamId Stream id
|
|
807
|
-
* @param {*} [options] Override http request option.
|
|
808
|
-
* @throws {RequiredError}
|
|
809
|
-
*/
|
|
810
|
-
async createStreamer(streamId, options) {
|
|
811
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
|
|
812
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
813
|
-
const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
814
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
815
|
-
},
|
|
816
|
-
/**
|
|
817
|
-
* Delete a streamer from a stream and revoke its token.
|
|
818
|
-
* @summary Delete a streamer
|
|
819
|
-
* @param {string} streamId Stream id
|
|
820
|
-
* @param {string} streamerId Streamer id
|
|
821
|
-
* @param {*} [options] Override http request option.
|
|
822
|
-
* @throws {RequiredError}
|
|
823
|
-
*/
|
|
824
|
-
async deleteStreamer(streamId, streamerId, options) {
|
|
825
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
|
|
826
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
827
|
-
const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
828
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
829
|
-
},
|
|
830
|
-
/**
|
|
831
|
-
* Issue a fresh streamer token.
|
|
832
|
-
* @summary Create a streamer token
|
|
833
|
-
* @param {string} roomId ID of the stream.
|
|
834
|
-
* @param {*} [options] Override http request option.
|
|
835
|
-
* @throws {RequiredError}
|
|
836
|
-
*/
|
|
837
|
-
async generateStreamerToken(roomId, options) {
|
|
838
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
|
|
839
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
840
|
-
const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
|
|
841
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
842
|
-
}
|
|
1380
|
+
"data": ViewerFromJSON(json["data"])
|
|
843
1381
|
};
|
|
844
|
-
}
|
|
845
|
-
|
|
1382
|
+
}
|
|
1383
|
+
function ViewerTokenFromJSON(json) {
|
|
1384
|
+
return ViewerTokenFromJSONTyped(json, false);
|
|
1385
|
+
}
|
|
1386
|
+
function ViewerTokenFromJSONTyped(json, ignoreDiscriminator) {
|
|
1387
|
+
if (json == null) {
|
|
1388
|
+
return json;
|
|
1389
|
+
}
|
|
1390
|
+
return {
|
|
1391
|
+
"token": json["token"]
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
var ViewersApi = class extends BaseAPI {
|
|
846
1395
|
/**
|
|
847
|
-
*
|
|
848
|
-
* @summary Create a streamer
|
|
849
|
-
* @param {string} streamId Stream id
|
|
850
|
-
* @param {*} [options] Override http request option.
|
|
851
|
-
* @throws {RequiredError}
|
|
852
|
-
* @memberof StreamersApi
|
|
1396
|
+
* Creates request options for createViewer without sending the request
|
|
853
1397
|
*/
|
|
854
|
-
|
|
855
|
-
|
|
1398
|
+
async createViewerRequestOpts(requestParameters) {
|
|
1399
|
+
if (requestParameters["streamId"] == null) {
|
|
1400
|
+
throw new RequiredError(
|
|
1401
|
+
"streamId",
|
|
1402
|
+
'Required parameter "streamId" was null or undefined when calling createViewer().'
|
|
1403
|
+
);
|
|
1404
|
+
}
|
|
1405
|
+
const queryParameters = {};
|
|
1406
|
+
const headerParameters = {};
|
|
1407
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1408
|
+
const token = this.configuration.accessToken;
|
|
1409
|
+
const tokenString = await token("management_token", []);
|
|
1410
|
+
if (tokenString) {
|
|
1411
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
let urlPath = `/livestream/{stream_id}/viewer`;
|
|
1415
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1416
|
+
return {
|
|
1417
|
+
path: urlPath,
|
|
1418
|
+
method: "POST",
|
|
1419
|
+
headers: headerParameters,
|
|
1420
|
+
query: queryParameters
|
|
1421
|
+
};
|
|
856
1422
|
}
|
|
857
1423
|
/**
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
* @param {string} streamId Stream id
|
|
861
|
-
* @param {string} streamerId Streamer id
|
|
862
|
-
* @param {*} [options] Override http request option.
|
|
863
|
-
* @throws {RequiredError}
|
|
864
|
-
* @memberof StreamersApi
|
|
1424
|
+
* Create a viewer for a stream and return its credentials.
|
|
1425
|
+
* Create a viewer
|
|
865
1426
|
*/
|
|
866
|
-
|
|
867
|
-
|
|
1427
|
+
async createViewerRaw(requestParameters, initOverrides) {
|
|
1428
|
+
const requestOptions = await this.createViewerRequestOpts(requestParameters);
|
|
1429
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1430
|
+
return new JSONApiResponse(response, (jsonValue) => ViewerDetailsResponseFromJSON(jsonValue));
|
|
868
1431
|
}
|
|
869
1432
|
/**
|
|
870
|
-
*
|
|
871
|
-
*
|
|
872
|
-
* @param {string} roomId ID of the stream.
|
|
873
|
-
* @param {*} [options] Override http request option.
|
|
874
|
-
* @throws {RequiredError}
|
|
875
|
-
* @memberof StreamersApi
|
|
1433
|
+
* Create a viewer for a stream and return its credentials.
|
|
1434
|
+
* Create a viewer
|
|
876
1435
|
*/
|
|
877
|
-
|
|
878
|
-
|
|
1436
|
+
async createViewer(requestParameters, initOverrides) {
|
|
1437
|
+
const response = await this.createViewerRaw(requestParameters, initOverrides);
|
|
1438
|
+
return await response.value();
|
|
879
1439
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
*/
|
|
890
|
-
createViewer: async (streamId, options = {}) => {
|
|
891
|
-
assertParamExists("createViewer", "streamId", streamId);
|
|
892
|
-
const localVarPath = `/livestream/{stream_id}/viewer`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
|
|
893
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
894
|
-
let baseOptions;
|
|
895
|
-
if (configuration) {
|
|
896
|
-
baseOptions = configuration.baseOptions;
|
|
897
|
-
}
|
|
898
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
899
|
-
const localVarHeaderParameter = {};
|
|
900
|
-
const localVarQueryParameter = {};
|
|
901
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
902
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
903
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
904
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
905
|
-
return {
|
|
906
|
-
url: toPathString(localVarUrlObj),
|
|
907
|
-
options: localVarRequestOptions
|
|
908
|
-
};
|
|
909
|
-
},
|
|
910
|
-
/**
|
|
911
|
-
* Delete a viewer from a stream and revoke its token.
|
|
912
|
-
* @summary Delete a viewer
|
|
913
|
-
* @param {string} streamId Stream id
|
|
914
|
-
* @param {string} viewerId Viewer id
|
|
915
|
-
* @param {*} [options] Override http request option.
|
|
916
|
-
* @throws {RequiredError}
|
|
917
|
-
*/
|
|
918
|
-
deleteViewer: async (streamId, viewerId, options = {}) => {
|
|
919
|
-
assertParamExists("deleteViewer", "streamId", streamId);
|
|
920
|
-
assertParamExists("deleteViewer", "viewerId", viewerId);
|
|
921
|
-
const localVarPath = `/livestream/{stream_id}/viewer/{viewer_id}`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))).replace(`{${"viewer_id"}}`, encodeURIComponent(String(viewerId)));
|
|
922
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
923
|
-
let baseOptions;
|
|
924
|
-
if (configuration) {
|
|
925
|
-
baseOptions = configuration.baseOptions;
|
|
926
|
-
}
|
|
927
|
-
const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
|
|
928
|
-
const localVarHeaderParameter = {};
|
|
929
|
-
const localVarQueryParameter = {};
|
|
930
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
931
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
932
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
933
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
934
|
-
return {
|
|
935
|
-
url: toPathString(localVarUrlObj),
|
|
936
|
-
options: localVarRequestOptions
|
|
937
|
-
};
|
|
938
|
-
},
|
|
939
|
-
/**
|
|
940
|
-
* Issue a fresh viewer token.
|
|
941
|
-
* @summary Create a viewer token
|
|
942
|
-
* @param {string} roomId ID of the stream.
|
|
943
|
-
* @param {*} [options] Override http request option.
|
|
944
|
-
* @throws {RequiredError}
|
|
945
|
-
*/
|
|
946
|
-
generateViewerToken: async (roomId, options = {}) => {
|
|
947
|
-
assertParamExists("generateViewerToken", "roomId", roomId);
|
|
948
|
-
const localVarPath = `/room/{room_id}/viewer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
|
|
949
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
950
|
-
let baseOptions;
|
|
951
|
-
if (configuration) {
|
|
952
|
-
baseOptions = configuration.baseOptions;
|
|
953
|
-
}
|
|
954
|
-
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
955
|
-
const localVarHeaderParameter = {};
|
|
956
|
-
const localVarQueryParameter = {};
|
|
957
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
958
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
959
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
960
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
961
|
-
return {
|
|
962
|
-
url: toPathString(localVarUrlObj),
|
|
963
|
-
options: localVarRequestOptions
|
|
964
|
-
};
|
|
1440
|
+
/**
|
|
1441
|
+
* Creates request options for deleteViewer without sending the request
|
|
1442
|
+
*/
|
|
1443
|
+
async deleteViewerRequestOpts(requestParameters) {
|
|
1444
|
+
if (requestParameters["streamId"] == null) {
|
|
1445
|
+
throw new RequiredError(
|
|
1446
|
+
"streamId",
|
|
1447
|
+
'Required parameter "streamId" was null or undefined when calling deleteViewer().'
|
|
1448
|
+
);
|
|
965
1449
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
/**
|
|
972
|
-
* Create a viewer for a stream and return its credentials.
|
|
973
|
-
* @summary Create a viewer
|
|
974
|
-
* @param {string} streamId Stream id
|
|
975
|
-
* @param {*} [options] Override http request option.
|
|
976
|
-
* @throws {RequiredError}
|
|
977
|
-
*/
|
|
978
|
-
async createViewer(streamId, options) {
|
|
979
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
|
|
980
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
981
|
-
const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
|
|
982
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
983
|
-
},
|
|
984
|
-
/**
|
|
985
|
-
* Delete a viewer from a stream and revoke its token.
|
|
986
|
-
* @summary Delete a viewer
|
|
987
|
-
* @param {string} streamId Stream id
|
|
988
|
-
* @param {string} viewerId Viewer id
|
|
989
|
-
* @param {*} [options] Override http request option.
|
|
990
|
-
* @throws {RequiredError}
|
|
991
|
-
*/
|
|
992
|
-
async deleteViewer(streamId, viewerId, options) {
|
|
993
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
|
|
994
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
995
|
-
const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
|
|
996
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
997
|
-
},
|
|
998
|
-
/**
|
|
999
|
-
* Issue a fresh viewer token.
|
|
1000
|
-
* @summary Create a viewer token
|
|
1001
|
-
* @param {string} roomId ID of the stream.
|
|
1002
|
-
* @param {*} [options] Override http request option.
|
|
1003
|
-
* @throws {RequiredError}
|
|
1004
|
-
*/
|
|
1005
|
-
async generateViewerToken(roomId, options) {
|
|
1006
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
|
|
1007
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
1008
|
-
const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
|
|
1009
|
-
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
1450
|
+
if (requestParameters["viewerId"] == null) {
|
|
1451
|
+
throw new RequiredError(
|
|
1452
|
+
"viewerId",
|
|
1453
|
+
'Required parameter "viewerId" was null or undefined when calling deleteViewer().'
|
|
1454
|
+
);
|
|
1010
1455
|
}
|
|
1011
|
-
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1456
|
+
const queryParameters = {};
|
|
1457
|
+
const headerParameters = {};
|
|
1458
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1459
|
+
const token = this.configuration.accessToken;
|
|
1460
|
+
const tokenString = await token("management_token", []);
|
|
1461
|
+
if (tokenString) {
|
|
1462
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
let urlPath = `/livestream/{stream_id}/viewer/{viewer_id}`;
|
|
1466
|
+
urlPath = urlPath.replace("{stream_id}", encodeURIComponent(String(requestParameters["streamId"])));
|
|
1467
|
+
urlPath = urlPath.replace("{viewer_id}", encodeURIComponent(String(requestParameters["viewerId"])));
|
|
1468
|
+
return {
|
|
1469
|
+
path: urlPath,
|
|
1470
|
+
method: "DELETE",
|
|
1471
|
+
headers: headerParameters,
|
|
1472
|
+
query: queryParameters
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1014
1475
|
/**
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
* @param {string} streamId Stream id
|
|
1018
|
-
* @param {*} [options] Override http request option.
|
|
1019
|
-
* @throws {RequiredError}
|
|
1020
|
-
* @memberof ViewersApi
|
|
1476
|
+
* Delete a viewer from a stream and revoke its token.
|
|
1477
|
+
* Delete a viewer
|
|
1021
1478
|
*/
|
|
1022
|
-
|
|
1023
|
-
|
|
1479
|
+
async deleteViewerRaw(requestParameters, initOverrides) {
|
|
1480
|
+
const requestOptions = await this.deleteViewerRequestOpts(requestParameters);
|
|
1481
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1482
|
+
return new VoidApiResponse(response);
|
|
1024
1483
|
}
|
|
1025
1484
|
/**
|
|
1026
1485
|
* Delete a viewer from a stream and revoke its token.
|
|
1027
|
-
*
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1486
|
+
* Delete a viewer
|
|
1487
|
+
*/
|
|
1488
|
+
async deleteViewer(requestParameters, initOverrides) {
|
|
1489
|
+
await this.deleteViewerRaw(requestParameters, initOverrides);
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Creates request options for generateViewerToken without sending the request
|
|
1493
|
+
*/
|
|
1494
|
+
async generateViewerTokenRequestOpts(requestParameters) {
|
|
1495
|
+
if (requestParameters["roomId"] == null) {
|
|
1496
|
+
throw new RequiredError(
|
|
1497
|
+
"roomId",
|
|
1498
|
+
'Required parameter "roomId" was null or undefined when calling generateViewerToken().'
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
const queryParameters = {};
|
|
1502
|
+
const headerParameters = {};
|
|
1503
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1504
|
+
const token = this.configuration.accessToken;
|
|
1505
|
+
const tokenString = await token("management_token", []);
|
|
1506
|
+
if (tokenString) {
|
|
1507
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
let urlPath = `/room/{room_id}/viewer`;
|
|
1511
|
+
urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
|
|
1512
|
+
return {
|
|
1513
|
+
path: urlPath,
|
|
1514
|
+
method: "POST",
|
|
1515
|
+
headers: headerParameters,
|
|
1516
|
+
query: queryParameters
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Issue a fresh viewer token.
|
|
1521
|
+
* Create a viewer token
|
|
1033
1522
|
*/
|
|
1034
|
-
|
|
1035
|
-
|
|
1523
|
+
async generateViewerTokenRaw(requestParameters, initOverrides) {
|
|
1524
|
+
const requestOptions = await this.generateViewerTokenRequestOpts(requestParameters);
|
|
1525
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1526
|
+
return new JSONApiResponse(response, (jsonValue) => ViewerTokenFromJSON(jsonValue));
|
|
1036
1527
|
}
|
|
1037
1528
|
/**
|
|
1038
1529
|
* Issue a fresh viewer token.
|
|
1039
|
-
*
|
|
1040
|
-
* @param {string} roomId ID of the stream.
|
|
1041
|
-
* @param {*} [options] Override http request option.
|
|
1042
|
-
* @throws {RequiredError}
|
|
1043
|
-
* @memberof ViewersApi
|
|
1530
|
+
* Create a viewer token
|
|
1044
1531
|
*/
|
|
1045
|
-
generateViewerToken(
|
|
1046
|
-
|
|
1532
|
+
async generateViewerToken(requestParameters, initOverrides) {
|
|
1533
|
+
const response = await this.generateViewerTokenRaw(requestParameters, initOverrides);
|
|
1534
|
+
return await response.value();
|
|
1047
1535
|
}
|
|
1048
1536
|
};
|
|
1049
1537
|
|
|
@@ -5813,13 +6301,11 @@ var MissingFishjamIdException = class extends Error {
|
|
|
5813
6301
|
};
|
|
5814
6302
|
var FishjamBaseException = class extends Error {
|
|
5815
6303
|
statusCode;
|
|
5816
|
-
axiosCode;
|
|
5817
6304
|
details;
|
|
5818
|
-
constructor(
|
|
5819
|
-
super(
|
|
5820
|
-
this.statusCode =
|
|
5821
|
-
this.
|
|
5822
|
-
this.details = error.response?.data["detail"] ?? error.response?.data["errors"] ?? "Unknown error";
|
|
6305
|
+
constructor(info) {
|
|
6306
|
+
super(info.message);
|
|
6307
|
+
this.statusCode = info.statusCode ?? 500;
|
|
6308
|
+
this.details = info.details;
|
|
5823
6309
|
}
|
|
5824
6310
|
};
|
|
5825
6311
|
var BadRequestException = class extends FishjamBaseException {
|
|
@@ -5857,6 +6343,16 @@ var getFishjamUrl = (config) => {
|
|
|
5857
6343
|
return `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
|
|
5858
6344
|
}
|
|
5859
6345
|
};
|
|
6346
|
+
var AGENT_SOCKET_PATH = "/socket/agent/websocket";
|
|
6347
|
+
var getAgentWebsocketUrl = (config, peerWebsocketUrl) => {
|
|
6348
|
+
if (peerWebsocketUrl) {
|
|
6349
|
+
const url = new URL(peerWebsocketUrl.includes("://") ? peerWebsocketUrl : `https://${peerWebsocketUrl}`);
|
|
6350
|
+
url.protocol = url.protocol.replace("http", "ws");
|
|
6351
|
+
url.pathname = url.pathname.replace(/\/socket\/peer\/websocket$/, AGENT_SOCKET_PATH);
|
|
6352
|
+
return url.href;
|
|
6353
|
+
}
|
|
6354
|
+
return `${httpToWebsocket(getFishjamUrl(config))}${AGENT_SOCKET_PATH}`;
|
|
6355
|
+
};
|
|
5860
6356
|
|
|
5861
6357
|
// src/notifications.ts
|
|
5862
6358
|
var peerTypeMap = {
|
|
@@ -5984,7 +6480,14 @@ var FishjamWSNotifier = class extends EventEmitter {
|
|
|
5984
6480
|
};
|
|
5985
6481
|
|
|
5986
6482
|
// src/webhook.ts
|
|
6483
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
5987
6484
|
var decodeServerNotifications = (data) => extractNotifications(ServerMessage.decode(data instanceof Uint8Array ? data : new Uint8Array(data)));
|
|
6485
|
+
var verifyWebhookSignature = (body, signature, secret) => {
|
|
6486
|
+
const expected = createHmac("sha256", secret).update(body instanceof Uint8Array ? body : new Uint8Array(body)).digest("hex");
|
|
6487
|
+
const provided = Buffer.from(signature.trim().replace(/^sha256=/, ""), "utf8");
|
|
6488
|
+
const wanted = Buffer.from(expected, "utf8");
|
|
6489
|
+
return provided.length === wanted.length && timingSafeEqual(provided, wanted);
|
|
6490
|
+
};
|
|
5988
6491
|
|
|
5989
6492
|
// src/agent.ts
|
|
5990
6493
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
@@ -5993,23 +6496,32 @@ var expectedEventsList2 = ["trackData"];
|
|
|
5993
6496
|
var FishjamAgent = class extends EventEmitter2 {
|
|
5994
6497
|
client;
|
|
5995
6498
|
resolveConnectionPromise = null;
|
|
6499
|
+
rejectConnectionPromise = null;
|
|
5996
6500
|
connectionPromise;
|
|
5997
6501
|
pendingImageCaptures = /* @__PURE__ */ new Map();
|
|
5998
|
-
constructor(config, agentToken, callbacks) {
|
|
6502
|
+
constructor(config, agentToken, callbacks, peerWebsocketUrl) {
|
|
5999
6503
|
super();
|
|
6000
|
-
const
|
|
6001
|
-
const websocketUrl = `${httpToWebsocket(fishjamUrl)}/socket/agent/websocket`;
|
|
6504
|
+
const websocketUrl = getAgentWebsocketUrl(config, peerWebsocketUrl);
|
|
6002
6505
|
this.client = new WebSocket(websocketUrl);
|
|
6003
6506
|
this.client.binaryType = "arraybuffer";
|
|
6004
6507
|
this.client.onclose = (message) => {
|
|
6005
6508
|
this.rejectPendingCaptures("WebSocket closed");
|
|
6509
|
+
this.rejectConnectionPromise?.(
|
|
6510
|
+
new Error(
|
|
6511
|
+
`Agent websocket closed before connecting (code ${message.code}${message.reason ? `: ${message.reason}` : ""})`
|
|
6512
|
+
)
|
|
6513
|
+
);
|
|
6514
|
+
this.settleConnection();
|
|
6006
6515
|
callbacks?.onClose?.(message.code, message.reason);
|
|
6007
6516
|
};
|
|
6008
6517
|
this.client.onerror = (message) => callbacks?.onError?.(message);
|
|
6009
6518
|
this.client.onmessage = (message) => this.dispatchNotification(message);
|
|
6010
6519
|
this.client.onopen = () => this.setupConnection(agentToken);
|
|
6011
|
-
this.connectionPromise = new Promise((resolve) => {
|
|
6520
|
+
this.connectionPromise = new Promise((resolve, reject) => {
|
|
6012
6521
|
this.resolveConnectionPromise = resolve;
|
|
6522
|
+
this.rejectConnectionPromise = reject;
|
|
6523
|
+
});
|
|
6524
|
+
this.connectionPromise.catch(() => {
|
|
6013
6525
|
});
|
|
6014
6526
|
}
|
|
6015
6527
|
/**
|
|
@@ -6120,10 +6632,12 @@ var FishjamAgent = class extends EventEmitter2 {
|
|
|
6120
6632
|
setupConnection(agentToken) {
|
|
6121
6633
|
const auth = AgentRequest.encode({ authRequest: { token: agentToken } }).finish();
|
|
6122
6634
|
this.client.send(auth);
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6635
|
+
this.resolveConnectionPromise?.();
|
|
6636
|
+
this.settleConnection();
|
|
6637
|
+
}
|
|
6638
|
+
settleConnection() {
|
|
6639
|
+
this.resolveConnectionPromise = null;
|
|
6640
|
+
this.rejectConnectionPromise = null;
|
|
6127
6641
|
}
|
|
6128
6642
|
isExpectedEvent(notification) {
|
|
6129
6643
|
return expectedEventsList2.includes(notification);
|
|
@@ -6134,42 +6648,47 @@ var toProtoEncoding = (encoding) => {
|
|
|
6134
6648
|
return TrackEncoding.TRACK_ENCODING_OPUS;
|
|
6135
6649
|
};
|
|
6136
6650
|
|
|
6137
|
-
// src/client.ts
|
|
6138
|
-
import axios from "axios";
|
|
6139
|
-
|
|
6140
6651
|
// src/exceptions/mapper.ts
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
case "peer":
|
|
6159
|
-
return new PeerNotFoundException(error);
|
|
6160
|
-
case "room":
|
|
6161
|
-
return new RoomNotFoundException(error);
|
|
6162
|
-
default:
|
|
6163
|
-
return new FishjamNotFoundException(error);
|
|
6164
|
-
}
|
|
6165
|
-
case 503:
|
|
6166
|
-
return new ServiceUnavailableException(error);
|
|
6167
|
-
default:
|
|
6168
|
-
return new UnknownException(error);
|
|
6169
|
-
}
|
|
6170
|
-
} else {
|
|
6652
|
+
var notFoundException = (info, entity) => {
|
|
6653
|
+
switch (entity) {
|
|
6654
|
+
case "credentials":
|
|
6655
|
+
return new InvalidFishjamCredentialsException(info);
|
|
6656
|
+
case "peer":
|
|
6657
|
+
return new PeerNotFoundException(info);
|
|
6658
|
+
case "room":
|
|
6659
|
+
return new RoomNotFoundException(info);
|
|
6660
|
+
default:
|
|
6661
|
+
return new FishjamNotFoundException(info);
|
|
6662
|
+
}
|
|
6663
|
+
};
|
|
6664
|
+
var mapException = async (error, entity) => {
|
|
6665
|
+
if (error instanceof FetchError) {
|
|
6666
|
+
return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message });
|
|
6667
|
+
}
|
|
6668
|
+
if (!(error instanceof ResponseError)) {
|
|
6171
6669
|
return error;
|
|
6172
6670
|
}
|
|
6671
|
+
const status = error.response.status;
|
|
6672
|
+
const body = await error.response.json().catch(() => ({}));
|
|
6673
|
+
const info = {
|
|
6674
|
+
message: `Request failed with status code ${status}`,
|
|
6675
|
+
statusCode: status,
|
|
6676
|
+
details: body["detail"] ?? body["errors"] ?? "Unknown error"
|
|
6677
|
+
};
|
|
6678
|
+
switch (status) {
|
|
6679
|
+
case 400:
|
|
6680
|
+
return new BadRequestException(info);
|
|
6681
|
+
case 402:
|
|
6682
|
+
return new QuotaExceededException(info);
|
|
6683
|
+
case 401:
|
|
6684
|
+
return new UnauthorizedException(info);
|
|
6685
|
+
case 404:
|
|
6686
|
+
return notFoundException(info, entity);
|
|
6687
|
+
case 503:
|
|
6688
|
+
return new ServiceUnavailableException(info);
|
|
6689
|
+
default:
|
|
6690
|
+
return new UnknownException(info);
|
|
6691
|
+
}
|
|
6173
6692
|
};
|
|
6174
6693
|
|
|
6175
6694
|
// src/client.ts
|
|
@@ -6197,22 +6716,25 @@ var FishjamClient = class _FishjamClient {
|
|
|
6197
6716
|
* ```
|
|
6198
6717
|
*/
|
|
6199
6718
|
constructor(config) {
|
|
6200
|
-
const
|
|
6719
|
+
const deprecationMiddleware = {
|
|
6720
|
+
post: async ({ response }) => {
|
|
6721
|
+
this.handleDeprecationHeader(response.headers);
|
|
6722
|
+
return response;
|
|
6723
|
+
}
|
|
6724
|
+
};
|
|
6725
|
+
const apiConfig = new Configuration({
|
|
6726
|
+
basePath: getFishjamUrl(config),
|
|
6201
6727
|
headers: {
|
|
6202
6728
|
Authorization: `Bearer ${config.managementToken}`,
|
|
6203
6729
|
"x-fishjam-api-client": `js-server/${package_default.version}`
|
|
6204
|
-
}
|
|
6205
|
-
|
|
6206
|
-
client.interceptors.response.use((response) => {
|
|
6207
|
-
this.handleDeprecationHeader(response.headers);
|
|
6208
|
-
return response;
|
|
6730
|
+
},
|
|
6731
|
+
middleware: [deprecationMiddleware]
|
|
6209
6732
|
});
|
|
6210
|
-
|
|
6211
|
-
this.
|
|
6212
|
-
this.
|
|
6213
|
-
this.
|
|
6214
|
-
this.
|
|
6215
|
-
this.credentialsApi = new CredentialsApi(void 0, fishjamUrl, client);
|
|
6733
|
+
this.moqApi = new MoQApi(apiConfig);
|
|
6734
|
+
this.roomApi = new RoomsApi(apiConfig);
|
|
6735
|
+
this.viewerApi = new ViewersApi(apiConfig);
|
|
6736
|
+
this.streamerApi = new StreamersApi(apiConfig);
|
|
6737
|
+
this.credentialsApi = new CredentialsApi(apiConfig);
|
|
6216
6738
|
this.fishjamConfig = config;
|
|
6217
6739
|
}
|
|
6218
6740
|
/**
|
|
@@ -6245,12 +6767,12 @@ var FishjamClient = class _FishjamClient {
|
|
|
6245
6767
|
try {
|
|
6246
6768
|
await this.credentialsApi.validateCredentials();
|
|
6247
6769
|
} catch (error) {
|
|
6248
|
-
throw mapException(error);
|
|
6770
|
+
throw await mapException(error, "credentials");
|
|
6249
6771
|
}
|
|
6250
6772
|
}
|
|
6251
6773
|
handleDeprecationHeader(headers) {
|
|
6252
6774
|
try {
|
|
6253
|
-
const deprecationHeader = headers
|
|
6775
|
+
const deprecationHeader = headers.get("x-fishjam-api-deprecated");
|
|
6254
6776
|
if (!deprecationHeader || this.deprecationWarningShown) return;
|
|
6255
6777
|
const deprecationStatus = JSON.parse(deprecationHeader);
|
|
6256
6778
|
if (deprecationStatus.status === "unsupported") {
|
|
@@ -6267,15 +6789,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6267
6789
|
*/
|
|
6268
6790
|
async createRoom(config = {}) {
|
|
6269
6791
|
try {
|
|
6270
|
-
const
|
|
6271
|
-
|
|
6272
|
-
data: {
|
|
6273
|
-
data: { room }
|
|
6274
|
-
}
|
|
6275
|
-
} = response;
|
|
6276
|
-
return room;
|
|
6792
|
+
const { data } = await this.roomApi.createRoom({ roomConfig: config });
|
|
6793
|
+
return data.room;
|
|
6277
6794
|
} catch (error) {
|
|
6278
|
-
throw mapException(error);
|
|
6795
|
+
throw await mapException(error);
|
|
6279
6796
|
}
|
|
6280
6797
|
}
|
|
6281
6798
|
/**
|
|
@@ -6283,9 +6800,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6283
6800
|
*/
|
|
6284
6801
|
async deleteRoom(roomId) {
|
|
6285
6802
|
try {
|
|
6286
|
-
await this.roomApi.deleteRoom(roomId);
|
|
6803
|
+
await this.roomApi.deleteRoom({ roomId });
|
|
6287
6804
|
} catch (error) {
|
|
6288
|
-
throw mapException(error, "room");
|
|
6805
|
+
throw await mapException(error, "room");
|
|
6289
6806
|
}
|
|
6290
6807
|
}
|
|
6291
6808
|
/**
|
|
@@ -6293,10 +6810,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6293
6810
|
*/
|
|
6294
6811
|
async getAllRooms() {
|
|
6295
6812
|
try {
|
|
6296
|
-
const
|
|
6297
|
-
return
|
|
6813
|
+
const { data } = await this.roomApi.getAllRooms();
|
|
6814
|
+
return data ?? [];
|
|
6298
6815
|
} catch (error) {
|
|
6299
|
-
throw mapException(error);
|
|
6816
|
+
throw await mapException(error);
|
|
6300
6817
|
}
|
|
6301
6818
|
}
|
|
6302
6819
|
/**
|
|
@@ -6304,16 +6821,13 @@ var FishjamClient = class _FishjamClient {
|
|
|
6304
6821
|
*/
|
|
6305
6822
|
async createPeer(roomId, options = {}) {
|
|
6306
6823
|
try {
|
|
6307
|
-
const
|
|
6308
|
-
|
|
6309
|
-
options
|
|
6824
|
+
const { data } = await this.roomApi.addPeer({
|
|
6825
|
+
roomId,
|
|
6826
|
+
peerConfig: { type: "webrtc", options }
|
|
6310
6827
|
});
|
|
6311
|
-
const {
|
|
6312
|
-
data: { data }
|
|
6313
|
-
} = response;
|
|
6314
6828
|
return { peer: data.peer, peerToken: data.token };
|
|
6315
6829
|
} catch (error) {
|
|
6316
|
-
throw mapException(error);
|
|
6830
|
+
throw await mapException(error);
|
|
6317
6831
|
}
|
|
6318
6832
|
}
|
|
6319
6833
|
/**
|
|
@@ -6321,18 +6835,15 @@ var FishjamClient = class _FishjamClient {
|
|
|
6321
6835
|
*/
|
|
6322
6836
|
async createAgent(roomId, options = {}, callbacks) {
|
|
6323
6837
|
try {
|
|
6324
|
-
const
|
|
6325
|
-
|
|
6326
|
-
options
|
|
6838
|
+
const { data } = await this.roomApi.addPeer({
|
|
6839
|
+
roomId,
|
|
6840
|
+
peerConfig: { type: "agent", options }
|
|
6327
6841
|
});
|
|
6328
|
-
const
|
|
6329
|
-
data: { data }
|
|
6330
|
-
} = response;
|
|
6331
|
-
const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
|
|
6842
|
+
const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks, data.peer_websocket_url);
|
|
6332
6843
|
await agent.awaitConnected();
|
|
6333
6844
|
return { agent, peer: data.peer };
|
|
6334
6845
|
} catch (error) {
|
|
6335
|
-
throw mapException(error);
|
|
6846
|
+
throw await mapException(error);
|
|
6336
6847
|
}
|
|
6337
6848
|
}
|
|
6338
6849
|
/**
|
|
@@ -6340,16 +6851,13 @@ var FishjamClient = class _FishjamClient {
|
|
|
6340
6851
|
*/
|
|
6341
6852
|
async createVapiAgent(roomId, options) {
|
|
6342
6853
|
try {
|
|
6343
|
-
const
|
|
6344
|
-
|
|
6345
|
-
options
|
|
6854
|
+
const { data } = await this.roomApi.addPeer({
|
|
6855
|
+
roomId,
|
|
6856
|
+
peerConfig: { type: "vapi", options }
|
|
6346
6857
|
});
|
|
6347
|
-
const {
|
|
6348
|
-
data: { data }
|
|
6349
|
-
} = response;
|
|
6350
6858
|
return { peer: data.peer };
|
|
6351
6859
|
} catch (error) {
|
|
6352
|
-
throw mapException(error);
|
|
6860
|
+
throw await mapException(error);
|
|
6353
6861
|
}
|
|
6354
6862
|
}
|
|
6355
6863
|
/**
|
|
@@ -6357,10 +6865,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6357
6865
|
*/
|
|
6358
6866
|
async getRoom(roomId) {
|
|
6359
6867
|
try {
|
|
6360
|
-
const
|
|
6361
|
-
return
|
|
6868
|
+
const { data } = await this.roomApi.getRoom({ roomId });
|
|
6869
|
+
return data;
|
|
6362
6870
|
} catch (error) {
|
|
6363
|
-
throw mapException(error, "room");
|
|
6871
|
+
throw await mapException(error, "room");
|
|
6364
6872
|
}
|
|
6365
6873
|
}
|
|
6366
6874
|
/**
|
|
@@ -6368,9 +6876,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6368
6876
|
*/
|
|
6369
6877
|
async deletePeer(roomId, peerId) {
|
|
6370
6878
|
try {
|
|
6371
|
-
await this.roomApi.deletePeer(roomId, peerId);
|
|
6879
|
+
await this.roomApi.deletePeer({ roomId, id: peerId });
|
|
6372
6880
|
} catch (error) {
|
|
6373
|
-
throw mapException(error, "peer");
|
|
6881
|
+
throw await mapException(error, "peer");
|
|
6374
6882
|
}
|
|
6375
6883
|
}
|
|
6376
6884
|
/**
|
|
@@ -6379,9 +6887,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6379
6887
|
*/
|
|
6380
6888
|
async subscribePeer(roomId, subscriberPeerId, publisherPeerId) {
|
|
6381
6889
|
try {
|
|
6382
|
-
await this.roomApi.subscribePeer(roomId, subscriberPeerId, publisherPeerId);
|
|
6890
|
+
await this.roomApi.subscribePeer({ roomId, id: subscriberPeerId, peerId: publisherPeerId });
|
|
6383
6891
|
} catch (error) {
|
|
6384
|
-
throw mapException(error, "peer");
|
|
6892
|
+
throw await mapException(error, "peer");
|
|
6385
6893
|
}
|
|
6386
6894
|
}
|
|
6387
6895
|
/**
|
|
@@ -6390,9 +6898,13 @@ var FishjamClient = class _FishjamClient {
|
|
|
6390
6898
|
*/
|
|
6391
6899
|
async subscribeTracks(roomId, subscriberPeerId, tracks) {
|
|
6392
6900
|
try {
|
|
6393
|
-
await this.roomApi.subscribeTracks(
|
|
6901
|
+
await this.roomApi.subscribeTracks({
|
|
6902
|
+
roomId,
|
|
6903
|
+
id: subscriberPeerId,
|
|
6904
|
+
subscribeTracksRequest: { track_ids: tracks }
|
|
6905
|
+
});
|
|
6394
6906
|
} catch (error) {
|
|
6395
|
-
throw mapException(error, "peer");
|
|
6907
|
+
throw await mapException(error, "peer");
|
|
6396
6908
|
}
|
|
6397
6909
|
}
|
|
6398
6910
|
/**
|
|
@@ -6402,10 +6914,10 @@ var FishjamClient = class _FishjamClient {
|
|
|
6402
6914
|
*/
|
|
6403
6915
|
async refreshPeerToken(roomId, peerId) {
|
|
6404
6916
|
try {
|
|
6405
|
-
const
|
|
6406
|
-
return
|
|
6917
|
+
const { data } = await this.roomApi.refreshToken({ roomId, id: peerId });
|
|
6918
|
+
return data.token;
|
|
6407
6919
|
} catch (error) {
|
|
6408
|
-
throw mapException(error, "peer");
|
|
6920
|
+
throw await mapException(error, "peer");
|
|
6409
6921
|
}
|
|
6410
6922
|
}
|
|
6411
6923
|
/**
|
|
@@ -6414,10 +6926,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6414
6926
|
*/
|
|
6415
6927
|
async createLivestreamViewerToken(roomId) {
|
|
6416
6928
|
try {
|
|
6417
|
-
|
|
6418
|
-
return tokenResponse.data;
|
|
6929
|
+
return await this.viewerApi.generateViewerToken({ roomId });
|
|
6419
6930
|
} catch (error) {
|
|
6420
|
-
throw mapException(error);
|
|
6931
|
+
throw await mapException(error);
|
|
6421
6932
|
}
|
|
6422
6933
|
}
|
|
6423
6934
|
/**
|
|
@@ -6426,10 +6937,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6426
6937
|
*/
|
|
6427
6938
|
async createLivestreamStreamerToken(roomId) {
|
|
6428
6939
|
try {
|
|
6429
|
-
|
|
6430
|
-
return tokenResponse.data;
|
|
6940
|
+
return await this.streamerApi.generateStreamerToken({ roomId });
|
|
6431
6941
|
} catch (error) {
|
|
6432
|
-
throw mapException(error);
|
|
6942
|
+
throw await mapException(error);
|
|
6433
6943
|
}
|
|
6434
6944
|
}
|
|
6435
6945
|
/**
|
|
@@ -6438,10 +6948,9 @@ var FishjamClient = class _FishjamClient {
|
|
|
6438
6948
|
*/
|
|
6439
6949
|
async createMoqAccess(config) {
|
|
6440
6950
|
try {
|
|
6441
|
-
|
|
6442
|
-
return accessResponse.data;
|
|
6951
|
+
return await this.moqApi.createMoqAccess({ moqAccessConfig: config });
|
|
6443
6952
|
} catch (error) {
|
|
6444
|
-
throw mapException(error);
|
|
6953
|
+
throw await mapException(error);
|
|
6445
6954
|
}
|
|
6446
6955
|
}
|
|
6447
6956
|
};
|
|
@@ -6465,5 +6974,6 @@ export {
|
|
|
6465
6974
|
UnauthorizedException,
|
|
6466
6975
|
UnknownException,
|
|
6467
6976
|
VideoCodec,
|
|
6468
|
-
decodeServerNotifications
|
|
6977
|
+
decodeServerNotifications,
|
|
6978
|
+
verifyWebhookSignature
|
|
6469
6979
|
};
|