cloudflare
Version:
The official TypeScript library for the Cloudflare API
155 lines • 5.98 kB
text/typescript
import { APIResource } from "../../../core/resource.mjs";
import * as V1API from "../v1/v1.mjs";
import * as DirectUploadsAPI from "./direct-uploads.mjs";
import { BaseDirectUploads, DirectUploadCreateParams, DirectUploadCreateResponse, DirectUploads } from "./direct-uploads.mjs";
import { APIPromise } from "../../../core/api-promise.mjs";
import { RequestOptions } from "../../../internal/request-options.mjs";
export declare class BaseV2 extends APIResource {
static readonly _key: readonly ['images', 'v2'];
/**
* List up to 10000 images from CF Images, with up to 1000 results per page. Use
* the optional parameters below to get a specific range of images. Pagination is
* supported via continuation_token.
*
* **Metadata Filtering (Optional):**
*
* You can optionally filter images by custom metadata fields using the
* `meta.<field>[<operator>]=<value>` syntax.
*
* **Supported Operators:**
*
* - `eq` / `eq:string` / `eq:number` / `eq:boolean` - Exact match
* - `gt` / `gt:number` - Greater than (number only)
* - `gte` / `gte:number` - Greater than or equal (number only)
* - `lt` / `lt:number` - Less than (number only)
* - `lte` / `lte:number` - Less than or equal (number only)
* - `in` / `in:string` / `in:number` - Match any value in list (pipe-separated)
*
* **Metadata Filter Constraints:**
*
* - Maximum 5 metadata filters per request
* - Maximum 5 levels of nesting (e.g., `meta.first.second.third.fourth.fifth`)
* - Maximum 10 elements for list operators (`in`)
* - Supports string, number, and boolean value types
* - Range operators (`gt`, `gte`, `lt`, `lte`) only accept numeric values
*
* **Filter Consistency:** Filters are combined with AND logic. The system does not
* validate whether filter combinations are logically consistent. For example,
* `meta.priority[eq:number]=5&meta.priority[lte:number]=3` will return zero
* results because no value can satisfy both conditions simultaneously. It is the
* caller's responsibility to ensure filter combinations make sense.
*
* **Examples:**
*
* ```
* # List all images
* /images/v2
*
* # Filter by metadata [eq]
* /images/v2?meta.status[eq:string]=active
*
* # Filter by metadata [in]
* /images/v2?meta.status[in]=pending|deleted|flagged
*
* # Filter by metadata [in:number]
* /images/v2?meta.ratings[in:number]=4|5
*
* # Filter by metadata range [gte:number]
* /images/v2?meta.priority[gte:number]=1
*
* # Filter by bounded range
* /images/v2?meta.priority[gte:number]=1&meta.priority[lte:number]=5
*
* # Filter by nested metadata
* /images/v2?meta.region.name[eq]=eu-west
*
* # Combine metadata filters with creator
* /images/v2?meta.status[eq]=active&creator=user123
*
* # Multiple metadata filters (AND logic)
* /images/v2?meta.status[eq]=active&meta.priority[eq:number]=5
* ```
*
* @example
* ```ts
* const v2s = await client.images.v2.list({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
list(params: V2ListParams, options?: RequestOptions): APIPromise<V2ListResponse>;
}
export declare class V2 extends BaseV2 {
directUploads: DirectUploadsAPI.DirectUploads;
}
export interface V2ListResponse {
/**
* Continuation token to fetch next page. Passed as a query param when requesting
* List V2 api endpoint.
*/
continuation_token?: string | null;
images?: Array<V1API.Image>;
}
export interface V2ListParams {
/**
* Path param: Account identifier tag.
*/
account_id: string;
/**
* Query param: Continuation token to fetch next page. Passed as a query param when
* requesting List V2 api endpoint.
*/
continuation_token?: string | null;
/**
* Query param: Internal user ID set within the creator field. Setting to empty
* string "" will return images where creator field is not set
*/
creator?: string | null;
/**
* Query param
*/
meta?: V2ListParams.Meta;
/**
* Query param: Number of items per page
*/
per_page?: number;
/**
* Query param: Sorting order by upload time
*/
sort_order?: 'asc' | 'desc';
}
export declare namespace V2ListParams {
interface Meta {
/**
* Optional metadata filter(s). Multiple filters can be combined with AND logic.
*
* **Operators:**
*
* - `eq`, `eq:string`, `eq:number`, `eq:boolean` - Exact match
* - `gt`, `gt:number` - Greater than (number only)
* - `gte`, `gte:number` - Greater than or equal (number only)
* - `lt`, `lt:number` - Less than (number only)
* - `lte`, `lte:number` - Less than or equal (number only)
* - `in`, `in:string`, `in:number` - Match any value in pipe-separated list
*
* **Examples:**
*
* - `meta.status[eq]=active`
* - `meta.priority[eq:number]=5`
* - `meta.enabled[eq:boolean]=true`
* - `meta.priority[gte:number]=1`
* - `meta.score[lt:number]=100`
* - `meta.region[in]=us-east|us-west|eu-west`
*
* **Note:** Filter consistency is not validated. Contradictory filters (e.g.,
* `meta.priority[eq:number]=5&meta.priority[lte:number]=3`) will return zero
* results.
*/
'<field>[<operator>]'?: string;
}
}
export declare namespace V2 {
export { type V2ListResponse as V2ListResponse, type V2ListParams as V2ListParams };
export { DirectUploads as DirectUploads, BaseDirectUploads as BaseDirectUploads, type DirectUploadCreateResponse as DirectUploadCreateResponse, type DirectUploadCreateParams as DirectUploadCreateParams, };
}
//# sourceMappingURL=v2.d.mts.map