cloudflare
Version:
The official TypeScript library for the Cloudflare API
85 lines • 3.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = exports.BaseSettings = void 0;
const tslib_1 = require("../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const OperationsAPI = tslib_1.__importStar(require("./operations.js"));
const operations_1 = require("./operations.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseSettings = /* @__PURE__ */ (() => {
class BaseSettings extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/zones/${zone_id}/schema_validation/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSettings._key = Object.freeze([
'schemaValidation',
'settings',
]);
return BaseSettings;
})();
exports.BaseSettings = BaseSettings;
var Settings = /* @__PURE__ */ (() => {
class Settings extends BaseSettings {
constructor() {
super(...arguments);
this.operations = new OperationsAPI.Operations(this._client);
}
}
Settings.Operations = operations_1.Operations;
Settings.BaseOperations = operations_1.BaseOperations;
return Settings;
})();
exports.Settings = Settings;
//# sourceMappingURL=settings.js.map