cloudflare
Version:
The official TypeScript library for the Cloudflare API
193 lines • 6.92 kB
text/typescript
import { APIResource } from "../../core/resource.mjs";
import { PagePromise, SinglePage } from "../../core/pagination.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
export declare class BasePayloads extends APIResource {
static readonly _key: readonly ['contentScanning', 'payloads'];
/**
* Create one or more Content Scanning custom expressions, appending them to the
* existing list of the zone, and return the updated list. Each expression reaches
* content objects the scanner cannot find automatically, for example
* `lookup_json_string(http.request.body.raw, "file")`.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const payloadCreateResponse of client.contentScanning.payloads.create(
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* body: [
* {
* payload:
* 'lookup_json_string(http.request.body.raw, "file")',
* },
* ],
* },
* )) {
* // ...
* }
* ```
*/
create(params: PayloadCreateParams, options?: RequestOptions): PagePromise<PayloadCreateResponsesSinglePage, PayloadCreateResponse>;
/**
* Update the Content Scanning custom expression with the given identifier and
* return the updated list of expressions.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const payloadUpdateResponse of client.contentScanning.payloads.update(
* 'a350a054caa840c9becd89c3b4f0195b',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* payload:
* 'lookup_json_string(http.request.body.raw, "file")',
* },
* )) {
* // ...
* }
* ```
*/
update(expressionID: string, params: PayloadUpdateParams, options?: RequestOptions): PagePromise<PayloadUpdateResponsesSinglePage, PayloadUpdateResponse>;
/**
* List the Content Scanning custom expressions configured for the zone, each with
* its own identifier. A custom expression tells the scanner how to reach content
* objects in a request it cannot parse on its own, such as files Base64-encoded
* inside a JSON body.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const payloadListResponse of client.contentScanning.payloads.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params: PayloadListParams, options?: RequestOptions): PagePromise<PayloadListResponsesSinglePage, PayloadListResponse>;
/**
* Delete the Content Scanning custom expression with the given identifier and
* return the expressions that remain. Content objects reached only by the deleted
* expression are no longer scanned.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const payloadDeleteResponse of client.contentScanning.payloads.delete(
* 'a350a054caa840c9becd89c3b4f0195b',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
delete(expressionID: string, params: PayloadDeleteParams, options?: RequestOptions): PagePromise<PayloadDeleteResponsesSinglePage, PayloadDeleteResponse>;
}
export declare class Payloads extends BasePayloads {
}
export type PayloadCreateResponsesSinglePage = SinglePage<PayloadCreateResponse>;
export type PayloadUpdateResponsesSinglePage = SinglePage<PayloadUpdateResponse>;
export type PayloadListResponsesSinglePage = SinglePage<PayloadListResponse>;
export type PayloadDeleteResponsesSinglePage = SinglePage<PayloadDeleteResponse>;
/**
* Defines a Content Scanning custom expression.
*/
export interface PayloadCreateResponse {
/**
* Defines the unique ID for this Content Scanning custom expression.
*/
id?: string;
/**
* Defines the custom content extraction expression used to reach content objects
* in the request.
*/
payload?: string;
}
/**
* Defines a Content Scanning custom expression.
*/
export interface PayloadUpdateResponse {
/**
* Defines the unique ID for this Content Scanning custom expression.
*/
id?: string;
/**
* Defines the custom content extraction expression used to reach content objects
* in the request.
*/
payload?: string;
}
/**
* Defines a Content Scanning custom expression.
*/
export interface PayloadListResponse {
/**
* Defines the unique ID for this Content Scanning custom expression.
*/
id?: string;
/**
* Defines the custom content extraction expression used to reach content objects
* in the request.
*/
payload?: string;
}
/**
* Defines a Content Scanning custom expression.
*/
export interface PayloadDeleteResponse {
/**
* Defines the unique ID for this Content Scanning custom expression.
*/
id?: string;
/**
* Defines the custom content extraction expression used to reach content objects
* in the request.
*/
payload?: string;
}
export interface PayloadCreateParams {
/**
* Path param: Defines an identifier.
*/
zone_id: string;
/**
* Body param
*/
body: Array<PayloadCreateParams.Body>;
}
export declare namespace PayloadCreateParams {
interface Body {
/**
* Defines the custom content extraction expression used to reach content objects
* in the request.
*/
payload: string;
}
}
export interface PayloadUpdateParams {
/**
* Path param: Defines an identifier.
*/
zone_id: string;
/**
* Body param: Defines the custom content extraction expression used to reach
* content objects in the request.
*/
payload: string;
}
export interface PayloadListParams {
/**
* Defines an identifier.
*/
zone_id: string;
}
export interface PayloadDeleteParams {
/**
* Defines an identifier.
*/
zone_id: string;
}
export declare namespace Payloads {
export { type PayloadCreateResponse as PayloadCreateResponse, type PayloadUpdateResponse as PayloadUpdateResponse, type PayloadListResponse as PayloadListResponse, type PayloadDeleteResponse as PayloadDeleteResponse, type PayloadCreateResponsesSinglePage as PayloadCreateResponsesSinglePage, type PayloadUpdateResponsesSinglePage as PayloadUpdateResponsesSinglePage, type PayloadListResponsesSinglePage as PayloadListResponsesSinglePage, type PayloadDeleteResponsesSinglePage as PayloadDeleteResponsesSinglePage, type PayloadCreateParams as PayloadCreateParams, type PayloadUpdateParams as PayloadUpdateParams, type PayloadListParams as PayloadListParams, type PayloadDeleteParams as PayloadDeleteParams, };
}
//# sourceMappingURL=payloads.d.mts.map