cloudflare
Version:
The official TypeScript library for the Cloudflare API
106 lines • 4.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Outputs = exports.BaseOutputs = 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 headers_1 = require("../../../internal/headers.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseOutputs = /* @__PURE__ */ (() => {
class BaseOutputs extends resource_1.APIResource {
/**
* Creates a new output that can be used to simulcast or restream live video to
* other RTMP or SRT destinations. Outputs are always linked to a specific live
* input — one live input can have many outputs.
*
* @example
* ```ts
* const output =
* await client.stream.liveInputs.outputs.create(
* '66be4bf738797e01e1fca35a7bdecdcd',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* streamKey: 'uzya-f19y-g2g9-a2ee-51j2',
* url: 'rtmp://a.rtmp.youtube.com/live2',
* },
* );
* ```
*/
create(liveInputIdentifier, params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/stream/live_inputs/${liveInputIdentifier}/outputs`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates the state of an output.
*
* @example
* ```ts
* const output =
* await client.stream.liveInputs.outputs.update(
* 'baea4d9c515887b80289d5c33cf01145',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* live_input_identifier:
* '66be4bf738797e01e1fca35a7bdecdcd',
* enabled: true,
* },
* );
* ```
*/
update(outputIdentifier, params, options) {
const { account_id, live_input_identifier, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/stream/live_inputs/${live_input_identifier}/outputs/${outputIdentifier}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves all outputs associated with a specified live input.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const output of client.stream.liveInputs.outputs.list(
* '66be4bf738797e01e1fca35a7bdecdcd',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(liveInputIdentifier, params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/stream/live_inputs/${liveInputIdentifier}/outputs`, (pagination_1.SinglePage), options);
}
/**
* Deletes an output and removes it from the associated live input.
*
* @example
* ```ts
* await client.stream.liveInputs.outputs.delete(
* 'baea4d9c515887b80289d5c33cf01145',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* live_input_identifier:
* '66be4bf738797e01e1fca35a7bdecdcd',
* },
* );
* ```
*/
delete(outputIdentifier, params, options) {
const { account_id, live_input_identifier } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/stream/live_inputs/${live_input_identifier}/outputs/${outputIdentifier}`, { ...options, headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]) });
}
}
BaseOutputs._key = Object.freeze([
'stream',
'liveInputs',
'outputs',
]);
return BaseOutputs;
})();
exports.BaseOutputs = BaseOutputs;
class Outputs extends BaseOutputs {
}
exports.Outputs = Outputs;
//# sourceMappingURL=outputs.js.map