UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

93 lines • 3.35 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { SinglePage } from "../../core/pagination.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseSFU = /* @__PURE__ */ (() => { class BaseSFU extends 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(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(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(path `/accounts/${account_id}/calls/apps`, (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(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(path `/accounts/${account_id}/calls/apps/${appID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSFU._key = Object.freeze(['calls', 'sfu']); return BaseSFU; })(); export class SFU extends BaseSFU { } //# sourceMappingURL=sfu.mjs.map