// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import * as AudioTracksAPI from 'cloudflaredev/resources/stream/audio-tracks';
import * as ClipAPI from 'cloudflaredev/resources/stream/clip';
import * as CopyAPI from 'cloudflaredev/resources/stream/copy';
import * as DirectUploadAPI from 'cloudflaredev/resources/stream/direct-upload';
import * as DownloadsAPI from 'cloudflaredev/resources/stream/downloads';
import * as EmbedAPI from 'cloudflaredev/resources/stream/embed';
import * as KeysAPI from 'cloudflaredev/resources/stream/keys';
import * as TokenAPI from 'cloudflaredev/resources/stream/token';
import * as VideosAPI from 'cloudflaredev/resources/stream/videos';
import * as WatermarksAPI from 'cloudflaredev/resources/stream/watermarks';
import * as WebhooksAPI from 'cloudflaredev/resources/stream/webhooks';
import * as CaptionsAPI from 'cloudflaredev/resources/stream/captions/captions';
import * as LiveInputsAPI from 'cloudflaredev/resources/stream/live-inputs/live-inputs';
import { SinglePage } from 'cloudflaredev/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 } = params;
        return this._client.delete(`/accounts/${account_id}/stream/${identifier}`, {
            ...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