UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

239 lines • 7.46 kB
import { APIResource } from "../../core/resource.js"; import { APIPromise } from "../../core/api-promise.js"; import { PagePromise, V4PagePaginationArray, type V4PagePaginationArrayParams } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class BaseAssets extends APIResource { static readonly _key: readonly ['customPages', 'assets']; /** * Creates a custom asset for an account or zone. * * @example * ```ts * const asset = await client.customPages.assets.create({ * description: 'Custom 500 error page', * name: 'my_custom_error_page', * url: 'https://example.com/error.html', * account_id: 'account_id', * }); * ``` */ create(params: AssetCreateParams, options?: RequestOptions): APIPromise<AssetCreateResponse>; /** * Updates a custom asset for an account or zone. * * @example * ```ts * const asset = await client.customPages.assets.update( * 'my_custom_error_page', * { * description: 'Custom 500 error page', * url: 'https://example.com/error.html', * account_id: 'account_id', * }, * ); * ``` */ update(assetName: string, params: AssetUpdateParams, options?: RequestOptions): APIPromise<AssetUpdateResponse>; /** * Lists custom assets for an account or zone. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const assetListResponse of client.customPages.assets.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params?: AssetListParams | null | undefined, options?: RequestOptions): PagePromise<AssetListResponsesV4PagePaginationArray, AssetListResponse>; /** * Deletes a custom asset from an account or zone. * * @example * ```ts * await client.customPages.assets.delete( * 'my_custom_error_page', * { account_id: 'account_id' }, * ); * ``` */ delete(assetName: string, params?: AssetDeleteParams | null | undefined, options?: RequestOptions): APIPromise<void>; /** * Returns a custom asset for an account or zone. * * @example * ```ts * const asset = await client.customPages.assets.get( * 'my_custom_error_page', * { account_id: 'account_id' }, * ); * ``` */ get(assetName: string, params?: AssetGetParams | null | undefined, options?: RequestOptions): APIPromise<AssetGetResponse>; } export declare class Assets extends BaseAssets { } export type AssetListResponsesV4PagePaginationArray = V4PagePaginationArray<AssetListResponse>; export interface AssetCreateResponse { /** * A short description of the custom asset. */ description?: string; last_updated?: string; /** * The unique name of the custom asset. Can only contain letters (A-Z, a-z), * numbers (0-9), and underscores (\_). */ name?: string; /** * The size of the asset content in bytes. */ size_bytes?: number; /** * The URL where the asset content is fetched from. */ url?: string; } export interface AssetUpdateResponse { /** * A short description of the custom asset. */ description?: string; last_updated?: string; /** * The unique name of the custom asset. Can only contain letters (A-Z, a-z), * numbers (0-9), and underscores (\_). */ name?: string; /** * The size of the asset content in bytes. */ size_bytes?: number; /** * The URL where the asset content is fetched from. */ url?: string; } export interface AssetListResponse { /** * A short description of the custom asset. */ description?: string; last_updated?: string; /** * The unique name of the custom asset. Can only contain letters (A-Z, a-z), * numbers (0-9), and underscores (\_). */ name?: string; /** * The size of the asset content in bytes. */ size_bytes?: number; /** * The URL where the asset content is fetched from. */ url?: string; } export interface AssetGetResponse { /** * A short description of the custom asset. */ description?: string; last_updated?: string; /** * The unique name of the custom asset. Can only contain letters (A-Z, a-z), * numbers (0-9), and underscores (\_). */ name?: string; /** * The size of the asset content in bytes. */ size_bytes?: number; /** * The URL where the asset content is fetched from. */ url?: string; } export interface AssetCreateParams { /** * Body param: A short description of the custom asset. */ description: string; /** * Body param: The unique name of the custom asset. Can only contain letters (A-Z, * a-z), numbers (0-9), and underscores (\_). */ name: string; /** * Body param: The URL where the asset content is fetched from. */ url: string; /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. */ account_id?: string; /** * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the * Account ID. */ zone_id?: string; } export interface AssetUpdateParams { /** * Body param: A short description of the custom asset. */ description: string; /** * Body param: The URL where the asset content is fetched from. */ url: string; /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. */ account_id?: string; /** * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the * Account ID. */ zone_id?: string; } export interface AssetListParams extends V4PagePaginationArrayParams { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. */ account_id?: string; /** * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the * Account ID. */ zone_id?: string; } export interface AssetDeleteParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. */ account_id?: string; /** * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. */ zone_id?: string; } export interface AssetGetParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. */ account_id?: string; /** * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. */ zone_id?: string; } export declare namespace Assets { export { type AssetCreateResponse as AssetCreateResponse, type AssetUpdateResponse as AssetUpdateResponse, type AssetListResponse as AssetListResponse, type AssetGetResponse as AssetGetResponse, type AssetListResponsesV4PagePaginationArray as AssetListResponsesV4PagePaginationArray, type AssetCreateParams as AssetCreateParams, type AssetUpdateParams as AssetUpdateParams, type AssetListParams as AssetListParams, type AssetDeleteParams as AssetDeleteParams, type AssetGetParams as AssetGetParams, }; } //# sourceMappingURL=assets.d.ts.map