UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

34 lines • 1.66 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../../core/resource.mjs"; import { path } from "../../../../../internal/utils/path.mjs"; export var BaseAssetUpload = /* @__PURE__ */ (() => { class BaseAssetUpload extends APIResource { /** * Start uploading a collection of assets for use in a Workers for Platforms script * version. To learn more about the direct uploads of assets, see * https://developers.cloudflare.com/workers/static-assets/direct-upload/. * * @example * ```ts * const assetUpload = * await client.workersForPlatforms.dispatch.namespaces.scripts.assetUpload.create( * 'this-is_my_script-01', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * dispatch_namespace: 'my-dispatch-namespace', * manifest: { foo: { hash: 'hash', size: 0 } }, * }, * ); * ``` */ create(scriptName, params, options) { const { account_id, dispatch_namespace, ...body } = params; return this._client.post(path `/accounts/${account_id}/workers/dispatch/namespaces/${dispatch_namespace}/scripts/${scriptName}/assets-upload-session`, { body, ...options })._thenUnwrap((obj) => obj.result); } } BaseAssetUpload._key = Object.freeze(['workersForPlatforms', 'dispatch', 'namespaces', 'scripts', 'assetUpload']); return BaseAssetUpload; })(); export class AssetUpload extends BaseAssetUpload { } //# sourceMappingURL=asset-upload.mjs.map