cloudflare
Version:
The official TypeScript library for the Cloudflare API
76 lines • 2.48 kB
text/typescript
import { APIResource } from "../../../../../core/resource.mjs";
import { APIPromise } from "../../../../../core/api-promise.mjs";
import { RequestOptions } from "../../../../../internal/request-options.mjs";
export declare class BaseAssetUpload extends APIResource {
static readonly _key: readonly [
'workersForPlatforms',
'dispatch',
'namespaces',
'scripts',
'assetUpload'
];
/**
* 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: string, params: AssetUploadCreateParams, options?: RequestOptions): APIPromise<AssetUploadCreateResponse>;
}
export declare class AssetUpload extends BaseAssetUpload {
}
export interface AssetUploadCreateResponse {
/**
* The requests to make to upload assets.
*/
buckets?: Array<Array<string>>;
/**
* A JWT to use as authentication for uploading assets.
*/
jwt?: string;
}
export interface AssetUploadCreateParams {
/**
* Path param: Identifier.
*/
account_id: string;
/**
* Path param: Name of the Workers for Platforms dispatch namespace.
*/
dispatch_namespace: string;
/**
* Body param: A manifest ([path]: {hash, size}) map of files to upload. As an
* example, `/blog/hello-world.html` would be a valid path key.
*/
manifest: {
[key: string]: AssetUploadCreateParams.Manifest;
};
}
export declare namespace AssetUploadCreateParams {
interface Manifest {
/**
* The hash of the file.
*/
hash: string;
/**
* The size of the file in bytes.
*/
size: number;
}
}
export declare namespace AssetUpload {
export { type AssetUploadCreateResponse as AssetUploadCreateResponse, type AssetUploadCreateParams as AssetUploadCreateParams, };
}
//# sourceMappingURL=asset-upload.d.mts.map