UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

99 lines • 3.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AudioTracks = exports.BaseAudioTracks = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const path_1 = require("../../internal/utils/path.js"); var BaseAudioTracks = /* @__PURE__ */ (() => { class BaseAudioTracks extends resource_1.APIResource { /** * Deletes additional audio tracks on a video. Deleting a default audio track is * not allowed. You must assign another audio track as default prior to deletion. * * @example * ```ts * const audioTrack = await client.stream.audioTracks.delete( * 'ea95132c15732412d22c1476fa83f27a', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * identifier: 'ea95132c15732412d22c1476fa83f27a', * }, * ); * ``` */ delete(audioIdentifier, params, options) { const { account_id, identifier } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/stream/${identifier}/audio/${audioIdentifier}`, options)._thenUnwrap((obj) => obj.result); } /** * Adds an additional audio track to a video using the provided audio track URL. * * @example * ```ts * const audio = await client.stream.audioTracks.copy( * 'ea95132c15732412d22c1476fa83f27a', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * label: 'director commentary', * }, * ); * ``` */ copy(identifier, params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/stream/${identifier}/audio/copy`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Edits additional audio tracks on a video. Editing the default status of an audio * track to `true` will mark all other audio tracks on the video default status to * `false`. * * @example * ```ts * const audio = await client.stream.audioTracks.edit( * 'ea95132c15732412d22c1476fa83f27a', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * identifier: 'ea95132c15732412d22c1476fa83f27a', * }, * ); * ``` */ edit(audioIdentifier, params, options) { const { account_id, identifier, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/stream/${identifier}/audio/${audioIdentifier}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists additional audio tracks on a video. Note this API will not return * information for audio attached to the video upload. * * @example * ```ts * const audioTrack = await client.stream.audioTracks.get( * 'ea95132c15732412d22c1476fa83f27a', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(identifier, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/stream/${identifier}/audio`, options)._thenUnwrap((obj) => obj.result); } } BaseAudioTracks._key = Object.freeze([ 'stream', 'audioTracks', ]); return BaseAudioTracks; })(); exports.BaseAudioTracks = BaseAudioTracks; class AudioTracks extends BaseAudioTracks { } exports.AudioTracks = AudioTracks; //# sourceMappingURL=audio-tracks.js.map