UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

46 lines • 1.91 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseNEL = /* @__PURE__ */ (() => { class BaseNEL extends 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(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(path `/zones/${zone_id}/settings/nel`, options)._thenUnwrap((obj) => obj.result); } } BaseNEL._key = Object.freeze(['zones', 'nel']); return BaseNEL; })(); export class NEL extends BaseNEL { } //# sourceMappingURL=nel.mjs.map