cloudflare
Version:
The official TypeScript library for the Cloudflare API
98 lines • 3.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SFU = exports.BaseSFU = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseSFU = /* @__PURE__ */ (() => {
class BaseSFU extends resource_1.APIResource {
/**
* Creates a Realtime SFU app. An app is an isolated namespace in which sessions
* can access the app's tracks.
*
* @example
* ```ts
* const sfu = await client.calls.sfu.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/calls/apps`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates details for a single Realtime SFU app.
*
* @example
* ```ts
* const sfu = await client.calls.sfu.update(
* '2a95132c15732412d22c1476fa83f27a',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
update(appID, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/calls/apps/${appID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists all apps in the Cloudflare account
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const sfuListResponse of client.calls.sfu.list({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* })) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/calls/apps`, (pagination_1.SinglePage), options);
}
/**
* Deletes a Realtime SFU app.
*
* @example
* ```ts
* const sfu = await client.calls.sfu.delete(
* '2a95132c15732412d22c1476fa83f27a',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(appID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/calls/apps/${appID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Fetches details for a single Realtime SFU app.
*
* @example
* ```ts
* const sfu = await client.calls.sfu.get(
* '2a95132c15732412d22c1476fa83f27a',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(appID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/calls/apps/${appID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSFU._key = Object.freeze(['calls', 'sfu']);
return BaseSFU;
})();
exports.BaseSFU = BaseSFU;
class SFU extends BaseSFU {
}
exports.SFU = SFU;
//# sourceMappingURL=sfu.js.map