UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

100 lines 4.72 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as AudioTracksAPI from 'cloudflare/resources/stream/audio-tracks'; import * as ClipAPI from 'cloudflare/resources/stream/clip'; import * as CopyAPI from 'cloudflare/resources/stream/copy'; import * as DirectUploadAPI from 'cloudflare/resources/stream/direct-upload'; import * as DownloadsAPI from 'cloudflare/resources/stream/downloads'; import * as EmbedAPI from 'cloudflare/resources/stream/embed'; import * as KeysAPI from 'cloudflare/resources/stream/keys'; import * as TokenAPI from 'cloudflare/resources/stream/token'; import * as VideosAPI from 'cloudflare/resources/stream/videos'; import * as WatermarksAPI from 'cloudflare/resources/stream/watermarks'; import * as WebhooksAPI from 'cloudflare/resources/stream/webhooks'; import * as CaptionsAPI from 'cloudflare/resources/stream/captions/captions'; import * as LiveInputsAPI from 'cloudflare/resources/stream/live-inputs/live-inputs'; import { SinglePage } from 'cloudflare/pagination'; export class Stream extends APIResource { constructor() { super(...arguments); this.audioTracks = new AudioTracksAPI.AudioTracks(this._client); this.videos = new VideosAPI.Videos(this._client); this.clip = new ClipAPI.ClipResource(this._client); this.copy = new CopyAPI.Copy(this._client); this.directUpload = new DirectUploadAPI.DirectUpload(this._client); this.keys = new KeysAPI.Keys(this._client); this.liveInputs = new LiveInputsAPI.LiveInputs(this._client); this.watermarks = new WatermarksAPI.Watermarks(this._client); this.webhooks = new WebhooksAPI.Webhooks(this._client); this.captions = new CaptionsAPI.Captions(this._client); this.downloads = new DownloadsAPI.Downloads(this._client); this.embed = new EmbedAPI.Embed(this._client); this.token = new TokenAPI.Token(this._client); } /** * Initiates a video upload using the TUS protocol. On success, the server responds * with a status code 201 (created) and includes a `location` header to indicate * where the content should be uploaded. Refer to https://tus.io for protocol * details. */ create(params, options) { const { account_id, body, 'Tus-Resumable': tusResumable, 'Upload-Length': uploadLength, 'Upload-Creator': uploadCreator, 'Upload-Metadata': uploadMetadata, } = params; return this._client.post(`/accounts/${account_id}/stream`, { body: body, ...options, headers: { Accept: '*/*', 'Tus-Resumable': tusResumable.toString(), 'Upload-Length': uploadLength.toString(), 'Upload-Creator': uploadCreator || '', 'Upload-Metadata': uploadMetadata || '', ...options?.headers, }, }); } /** * Lists up to 1000 videos from a single request. For a specific range, refer to * the optional parameters. */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(`/accounts/${account_id}/stream`, VideosSinglePage, { query, ...options }); } /** * Deletes a video and its copies from Cloudflare Stream. */ delete(identifier, params, options) { const { account_id, body } = params; return this._client.delete(`/accounts/${account_id}/stream/${identifier}`, { body: body, ...options, headers: { Accept: '*/*', ...options?.headers }, }); } /** * Fetches details for a single video. */ get(identifier, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/stream/${identifier}`, options)._thenUnwrap((obj) => obj.result); } } export class VideosSinglePage extends SinglePage { } (function (Stream) { Stream.AudioTracks = AudioTracksAPI.AudioTracks; Stream.Videos = VideosAPI.Videos; Stream.ClipResource = ClipAPI.ClipResource; Stream.Copy = CopyAPI.Copy; Stream.DirectUpload = DirectUploadAPI.DirectUpload; Stream.Keys = KeysAPI.Keys; Stream.LiveInputs = LiveInputsAPI.LiveInputs; Stream.Watermarks = WatermarksAPI.Watermarks; Stream.WatermarksSinglePage = WatermarksAPI.WatermarksSinglePage; Stream.Webhooks = WebhooksAPI.Webhooks; Stream.Captions = CaptionsAPI.Captions; Stream.Downloads = DownloadsAPI.Downloads; Stream.Embed = EmbedAPI.Embed; Stream.Token = TokenAPI.Token; })(Stream || (Stream = {})); //# sourceMappingURL=stream.mjs.map