cloudflare
Version:
The official TypeScript library for the Cloudflare API
79 lines • 2.81 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import * as OperationsAPI from "./operations.mjs";
import { BaseOperations, Operations, } from "./operations.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseSettings = /* @__PURE__ */ (() => {
class BaseSettings extends APIResource {
/**
* Fully updates global schema validation settings for a zone, replacing existing
* configuration.
*
* @example
* ```ts
* const setting =
* await client.schemaValidation.settings.update({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* validation_default_mitigation_action: 'block',
* });
* ```
*/
update(params, options) {
const { zone_id, ...body } = params;
return this._client.put(path `/zones/${zone_id}/schema_validation/settings`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Partially updates global schema validation settings for a zone using PATCH
* semantics.
*
* @example
* ```ts
* const response =
* await client.schemaValidation.settings.edit({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
edit(params, options) {
const { zone_id, ...body } = params;
return this._client.patch(path `/zones/${zone_id}/schema_validation/settings`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves the current global schema validation settings for a zone.
*
* @example
* ```ts
* const setting = await client.schemaValidation.settings.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { zone_id } = params;
return this._client.get(path `/zones/${zone_id}/schema_validation/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSettings._key = Object.freeze([
'schemaValidation',
'settings',
]);
return BaseSettings;
})();
export var Settings = /* @__PURE__ */ (() => {
class Settings extends BaseSettings {
constructor() {
super(...arguments);
this.operations = new OperationsAPI.Operations(this._client);
}
}
Settings.Operations = Operations;
Settings.BaseOperations = BaseOperations;
return Settings;
})();
//# sourceMappingURL=settings.mjs.map