UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

40 lines • 1.52 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseDirectUpload = /* @__PURE__ */ (() => { class BaseDirectUpload extends APIResource { /** * Creates a direct upload endpoint that allows an end-user to upload a video * without an API key. * * @example * ```ts * const directUpload = * await client.stream.directUpload.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * maxDurationSeconds: 1, * }); * ``` */ create(params, options) { const { account_id, 'Upload-Creator': uploadCreator, ...body } = params; return this._client.post(path `/accounts/${account_id}/stream/direct_upload`, { body, ...options, headers: buildHeaders([ { ...(uploadCreator != null ? { 'Upload-Creator': uploadCreator } : undefined) }, options?.headers, ]), })._thenUnwrap((obj) => obj.result); } } BaseDirectUpload._key = Object.freeze([ 'stream', 'directUpload', ]); return BaseDirectUpload; })(); export class DirectUpload extends BaseDirectUpload { } //# sourceMappingURL=direct-upload.mjs.map