cloudflare
Version:
The official TypeScript library for the Cloudflare API
115 lines • 4.45 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { V4PagePaginationArray, } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseOperations = /* @__PURE__ */ (() => {
class BaseOperations extends APIResource {
/**
* Fully updates schema validation settings for a specific API operation.
*
* @example
* ```ts
* const operation =
* await client.schemaValidation.settings.operations.update(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* mitigation_action: 'block',
* },
* );
* ```
*/
update(operationID, params, options) {
const { zone_id, ...body } = params;
return this._client.put(path `/zones/${zone_id}/schema_validation/settings/operations/${operationID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists per-operation schema validation settings configured for the zone.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const operationListResponse of client.schemaValidation.settings.operations.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList(path `/zones/${zone_id}/schema_validation/settings/operations`, (V4PagePaginationArray), { query, ...options });
}
/**
* Removes custom schema validation settings for a specific API operation,
* reverting to zone-level defaults.
*
* @example
* ```ts
* const operation =
* await client.schemaValidation.settings.operations.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(operationID, params, options) {
const { zone_id } = params;
return this._client.delete(path `/zones/${zone_id}/schema_validation/settings/operations/${operationID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates schema validation settings for multiple API operations in a single
* request. Efficient for applying consistent validation rules across endpoints.
*
* @example
* ```ts
* const response =
* await client.schemaValidation.settings.operations.bulkEdit(
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* body: {
* '3818d821-5901-4147-a474-f5f5aec1d54e': {},
* 'b17c8043-99a0-4202-b7d9-8f7cdbee02cd': {},
* },
* },
* );
* ```
*/
bulkEdit(params, options) {
const { zone_id, body } = params;
return this._client.patch(path `/zones/${zone_id}/schema_validation/settings/operations`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves the schema validation settings configured for a specific API
* operation.
*
* @example
* ```ts
* const operation =
* await client.schemaValidation.settings.operations.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(operationID, params, options) {
const { zone_id } = params;
return this._client.get(path `/zones/${zone_id}/schema_validation/settings/operations/${operationID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseOperations._key = Object.freeze([
'schemaValidation',
'settings',
'operations',
]);
return BaseOperations;
})();
export class Operations extends BaseOperations {
}
//# sourceMappingURL=operations.mjs.map