import { APIResource } from "../../core/resource.js"; import { APIPromise } from "../../core/api-promise.js"; import { PagePromise, SinglePage } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class BaseAssets extends APIResource { static readonly _key: readonly ['pages', 'assets']; /** * Check which of the provided file hashes are missing from the Pages asset store. * Returns a list of missing hashes that need to be uploaded. Used as part of the * Pages Direct Upload workflow. * * Authenticate with the JWT obtained from the upload-token endpoint: GET * /accounts/{account_id}/pages/projects/{project_name}/upload-token * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const assetCheckMissingResponse of client.pages.assets.checkMissing( * { * hashes: [ * 'a948904f2f0f479b8f936b8a0c5d9882', * 'b026324c6904b2a9cb4b88d6d61c81d1', * ], * }, * )) { * // ... * } * ``` */ checkMissing(body: AssetCheckMissingParams, options?: RequestOptions): PagePromise; /** * Upload one or more files to the Pages asset store. Each file is identified by * its content hash and is uploaded using the same JSON shape as the Cloudflare KV * bulk write API. Used as part of the Pages Direct Upload workflow. * * Authenticate with the JWT obtained from the upload-token endpoint: GET * /accounts/{account_id}/pages/projects/{project_name}/upload-token * * @example * ```ts * const response = await client.pages.assets.upload({ * body: [ * { * base64: true, * key: 'b026324c6904b2a9cb4b88d6d61c81d1', * metadata: { contentType: 'text/plain' }, * value: 'SGVsbG8sIFdvcmxkIQ==', * }, * ], * }); * ``` */ upload(params: AssetUploadParams, options?: RequestOptions): APIPromise; /** * Register the provided file hashes as recently uploaded to the Pages asset store. * Used as part of the Pages Direct Upload workflow so future deployments can avoid * re-uploading files that are already present. * * Authenticate with the JWT obtained from the upload-token endpoint: GET * /accounts/{account_id}/pages/projects/{project_name}/upload-token * * @example * ```ts * const response = await client.pages.assets.upsertHashes({ * hashes: [ * 'a948904f2f0f479b8f936b8a0c5d9882', * 'b026324c6904b2a9cb4b88d6d61c81d1', * ], * }); * ``` */ upsertHashes(body: AssetUpsertHashesParams, options?: RequestOptions): APIPromise; } export declare class Assets extends BaseAssets { } export type AssetCheckMissingResponsesSinglePage = SinglePage; export type AssetCheckMissingResponse = string; export interface AssetUploadResponse { errors: Array; messages: Array; /** * Whether the API call was successful. */ success: true; } export declare namespace AssetUploadResponse { interface Error { code: number; message: string; documentation_url?: string; source?: Error.Source; } namespace Error { interface Source { pointer?: string; } } interface Message { code: number; message: string; documentation_url?: string; source?: Message.Source; } namespace Message { interface Source { pointer?: string; } } } export interface AssetUpsertHashesResponse { errors: Array; messages: Array; /** * Whether the API call was successful. */ success: true; } export declare namespace AssetUpsertHashesResponse { interface Error { code: number; message: string; documentation_url?: string; source?: Error.Source; } namespace Error { interface Source { pointer?: string; } } interface Message { code: number; message: string; documentation_url?: string; source?: Message.Source; } namespace Message { interface Source { pointer?: string; } } } export interface AssetCheckMissingParams { /** * List of file content hashes to check for existence in the asset store. */ hashes: Array; } export interface AssetUploadParams { body: Array; } export declare namespace AssetUploadParams { interface Body { /** * Whether value is base64 encoded. */ base64: boolean; /** * File content hash used as the object key in the Pages asset store. */ key: string; metadata: Body.Metadata; /** * File content. When base64 is true, this value is base64 encoded. */ value: string; } namespace Body { interface Metadata { /** * MIME type for the uploaded file. */ contentType: string; } } } export interface AssetUpsertHashesParams { /** * List of file content hashes to register in the asset store. */ hashes: Array; } export declare namespace Assets { export { type AssetCheckMissingResponse as AssetCheckMissingResponse, type AssetUploadResponse as AssetUploadResponse, type AssetUpsertHashesResponse as AssetUpsertHashesResponse, type AssetCheckMissingResponsesSinglePage as AssetCheckMissingResponsesSinglePage, type AssetCheckMissingParams as AssetCheckMissingParams, type AssetUploadParams as AssetUploadParams, type AssetUpsertHashesParams as AssetUpsertHashesParams, }; } //# sourceMappingURL=assets.d.ts.map