UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

66 lines 2.49 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as HealthchecksAPI from 'cloudflare/resources/healthchecks/healthchecks'; import * as PreviewsAPI from 'cloudflare/resources/healthchecks/previews'; import { SinglePage } from 'cloudflare/pagination'; export class Healthchecks extends APIResource { constructor() { super(...arguments); this.previews = new PreviewsAPI.Previews(this._client); } /** * Create a new health check. */ create(params, options) { const { zone_id, ...body } = params; return this._client.post(`/zones/${zone_id}/healthchecks`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Update a configured health check. */ update(healthcheckId, params, options) { const { zone_id, ...body } = params; return this._client.put(`/zones/${zone_id}/healthchecks/${healthcheckId}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List configured health checks. */ list(params, options) { const { zone_id } = params; return this._client.getAPIList(`/zones/${zone_id}/healthchecks`, HealthchecksSinglePage, options); } /** * Delete a health check. */ delete(healthcheckId, params, options) { const { zone_id } = params; return this._client.delete(`/zones/${zone_id}/healthchecks/${healthcheckId}`, options)._thenUnwrap((obj) => obj.result); } /** * Patch a configured health check. */ edit(healthcheckId, params, options) { const { zone_id, ...body } = params; return this._client.patch(`/zones/${zone_id}/healthchecks/${healthcheckId}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetch a single configured health check. */ get(healthcheckId, params, options) { const { zone_id } = params; return this._client.get(`/zones/${zone_id}/healthchecks/${healthcheckId}`, options)._thenUnwrap((obj) => obj.result); } } export class HealthchecksSinglePage extends SinglePage { } (function (Healthchecks) { Healthchecks.HealthchecksSinglePage = HealthchecksAPI.HealthchecksSinglePage; Healthchecks.Previews = PreviewsAPI.Previews; })(Healthchecks || (Healthchecks = {})); //# sourceMappingURL=healthchecks.mjs.map