UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

58 lines • 2.61 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 BaseAlerting = /* @__PURE__ */ (() => { class BaseAlerting extends APIResource { /** * Create or update the Certificate Transparency alerting subscription for a zone. * Enables or disables email notifications when certificates are issued for the * zone's domains. The `enabled` field is required on every request and controls * whether the subscription is active. The `emails` field is optional and, when * provided, replaces the stored recipient list for the zone. When `emails` is * omitted, the stored recipient list is preserved and only the enabled state is * toggled. A maximum of 100 email addresses may be configured per zone. Requests * that omit `enabled` are rejected with error code 1008. Subscribe and unsubscribe * notification emails are only sent for recipients whose effective subscription * state changes. Idempotent requests (no state change) send no notification email. * * @example * ```ts * const ctAlertingSubscription = * await client.zones.ct.alerting.edit({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * enabled: true, * }); * ``` */ edit(params, options) { const { zone_id, ...body } = params; return this._client.patch(path `/zones/${zone_id}/ct/alerting`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieve the Certificate Transparency alerting subscription settings for a zone. * Returns whether CT monitoring is enabled and the list of email addresses that * receive alerts, if any have been configured. * * @example * ```ts * const ctAlertingSubscription = * await client.zones.ct.alerting.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/ct/alerting`, options)._thenUnwrap((obj) => obj.result); } } BaseAlerting._key = Object.freeze([ 'zones', 'ct', 'alerting', ]); return BaseAlerting; })(); export class Alerting extends BaseAlerting { } //# sourceMappingURL=alerting.mjs.map