UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

51 lines • 2.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NEL = exports.BaseNEL = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const path_1 = require("../../internal/utils/path.js"); var BaseNEL = /* @__PURE__ */ (() => { class BaseNEL extends resource_1.APIResource { /** * Updates the Network Error Logging (NEL) setting for a zone. Requires the NEL * product feature to be enabled for the zone. The setting controls whether * browsers report network errors to Cloudflare's NEL endpoint. * * @example * ```ts * const setting = await client.zones.nel.edit({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * value: { enabled: false }, * }); * ``` */ edit(params, options) { const { zone_id, ...body } = params; return this._client.patch((0, path_1.path) `/zones/${zone_id}/settings/nel`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Fetches the Network Error Logging (NEL) setting for a zone. NEL allows browsers * to report network errors to a configured endpoint. The setting is enabled by * default for free and pro zones, and disabled by default for business and * enterprise zones unless the NEL product feature is enabled. * * @example * ```ts * const setting = await client.zones.nel.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/settings/nel`, options)._thenUnwrap((obj) => obj.result); } } BaseNEL._key = Object.freeze(['zones', 'nel']); return BaseNEL; })(); exports.BaseNEL = BaseNEL; class NEL extends BaseNEL { } exports.NEL = NEL; //# sourceMappingURL=nel.js.map