cloudflare
Version:
The official TypeScript library for the Cloudflare API
67 lines • 2.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Previews = exports.BasePreviews = 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 BasePreviews = /* @__PURE__ */ (() => {
class BasePreviews extends resource_1.APIResource {
/**
* Create a new preview health check.
*
* @example
* ```ts
* const healthcheck =
* await client.healthchecks.previews.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* address: 'www.example.com',
* name: 'server-1',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/healthchecks/preview`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Delete a health check.
*
* @example
* ```ts
* const preview = await client.healthchecks.previews.delete(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(healthcheckID, params, options) {
const { zone_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/healthchecks/preview/${healthcheckID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Fetch a single configured health check preview.
*
* @example
* ```ts
* const healthcheck = await client.healthchecks.previews.get(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(healthcheckID, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/healthchecks/preview/${healthcheckID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BasePreviews._key = Object.freeze([
'healthchecks',
'previews',
]);
return BasePreviews;
})();
exports.BasePreviews = BasePreviews;
class Previews extends BasePreviews {
}
exports.Previews = Previews;
//# sourceMappingURL=previews.js.map