UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

64 lines • 2.65 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as DetectionsAPI from "./detections.mjs"; import { BaseDetections, Detections, } from "./detections.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseLeakedCredentialChecks = /* @__PURE__ */ (() => { class BaseLeakedCredentialChecks extends APIResource { /** * Update the Leaked Credential Checks status for the zone, enabling or disabling * the detection. While enabled, the detection populates the * `cf.waf.credential_check.*` fields, which you can reference in custom rules and * rate limiting rules to challenge or block requests carrying compromised * credentials. * * @example * ```ts * const leakedCredentialCheck = * await client.leakedCredentialChecks.create({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ create(params, options) { const { zone_id, ...body } = params; return this._client.post(path `/zones/${zone_id}/leaked-credential-checks`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get the current Leaked Credential Checks status for the zone. While enabled, * Cloudflare scans incoming requests for usernames and passwords that were exposed * in known data breaches. * * @example * ```ts * const leakedCredentialCheck = * await client.leakedCredentialChecks.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/leaked-credential-checks`, options)._thenUnwrap((obj) => obj.result); } } BaseLeakedCredentialChecks._key = Object.freeze([ 'leakedCredentialChecks', ]); return BaseLeakedCredentialChecks; })(); export var LeakedCredentialChecks = /* @__PURE__ */ (() => { class LeakedCredentialChecks extends BaseLeakedCredentialChecks { constructor() { super(...arguments); this.detections = new DetectionsAPI.Detections(this._client); } } LeakedCredentialChecks.Detections = Detections; LeakedCredentialChecks.BaseDetections = BaseDetections; return LeakedCredentialChecks; })(); //# sourceMappingURL=leaked-credential-checks.mjs.map