2025-11-13 13:13:34 -07:00

84 lines
3.0 KiB
JavaScript

"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.DetectionListResponsesSinglePage = exports.Detections = void 0;
const resource_1 = require("../../resource.js");
const pagination_1 = require("../../pagination.js");
class Detections extends resource_1.APIResource {
/**
* Create user-defined detection pattern for Leaked Credential Checks.
*
* @example
* ```ts
* const detection =
* await client.leakedCredentialChecks.detections.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post(`/zones/${zone_id}/leaked-credential-checks/detections`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update user-defined detection pattern for Leaked Credential Checks.
*
* @example
* ```ts
* const detection =
* await client.leakedCredentialChecks.detections.update(
* '18a14bafaa8eb1df04ce683ec18c765e',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
update(detectionId, params, options) {
const { zone_id, ...body } = params;
return this._client.put(`/zones/${zone_id}/leaked-credential-checks/detections/${detectionId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List user-defined detection patterns for Leaked Credential Checks.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const detectionListResponse of client.leakedCredentialChecks.detections.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id } = params;
return this._client.getAPIList(`/zones/${zone_id}/leaked-credential-checks/detections`, DetectionListResponsesSinglePage, options);
}
/**
* Remove user-defined detection pattern for Leaked Credential Checks.
*
* @example
* ```ts
* const detection =
* await client.leakedCredentialChecks.detections.delete(
* '18a14bafaa8eb1df04ce683ec18c765e',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(detectionId, params, options) {
const { zone_id } = params;
return this._client.delete(`/zones/${zone_id}/leaked-credential-checks/detections/${detectionId}`, options)._thenUnwrap((obj) => obj.result);
}
}
exports.Detections = Detections;
class DetectionListResponsesSinglePage extends pagination_1.SinglePage {
}
exports.DetectionListResponsesSinglePage = DetectionListResponsesSinglePage;
Detections.DetectionListResponsesSinglePage = DetectionListResponsesSinglePage;
//# sourceMappingURL=detections.js.map