UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

68 lines • 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Downloads = exports.BaseDownloads = 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 BaseDownloads = /* @__PURE__ */ (() => { class BaseDownloads extends resource_1.APIResource { /** * Creates a download for a video when a video is ready to view. Use * `/downloads/{download_type}` instead for type-specific downloads. Available * types are `default` and `audio`. * * @example * ```ts * const download = await client.stream.downloads.create( * 'ea95132c15732412d22c1476fa83f27a', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ create(identifier, params, options) { const { account_id } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/stream/${identifier}/downloads`, options)._thenUnwrap((obj) => obj.result); } /** * Delete the downloads for a video. Use `/downloads/{download_type}` instead for * type-specific downloads. Available types are `default` and `audio`. * * @example * ```ts * const download = await client.stream.downloads.delete( * 'ea95132c15732412d22c1476fa83f27a', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(identifier, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/stream/${identifier}/downloads`, options)._thenUnwrap((obj) => obj.result); } /** * Lists the downloads created for a video. * * @example * ```ts * const download = await client.stream.downloads.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}/downloads`, options)._thenUnwrap((obj) => obj.result); } } BaseDownloads._key = Object.freeze([ 'stream', 'downloads', ]); return BaseDownloads; })(); exports.BaseDownloads = BaseDownloads; class Downloads extends BaseDownloads { } exports.Downloads = Downloads; //# sourceMappingURL=downloads.js.map