UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

99 lines 3.26 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.EndpointHealthchecks = void 0; const resource_1 = require("../../resource.js"); class EndpointHealthchecks extends resource_1.APIResource { /** * Create Endpoint Health Check. * * @example * ```ts * const endpointHealthcheck = * await client.diagnostics.endpointHealthchecks.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * check_type: 'icmp', * endpoint: '203.0.113.1', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/diagnostics/endpoint-healthchecks`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Update a Endpoint Health Check. * * @example * ```ts * const endpointHealthcheck = * await client.diagnostics.endpointHealthchecks.update( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * check_type: 'icmp', * endpoint: '203.0.113.1', * }, * ); * ``` */ update(id, params, options) { const { account_id, ...body } = params; return this._client.put(`/accounts/${account_id}/diagnostics/endpoint-healthchecks/${id}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List Endpoint Health Checks. * * @example * ```ts * const endpointHealthchecks = * await client.diagnostics.endpointHealthchecks.list({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ list(params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/diagnostics/endpoint-healthchecks`, options)._thenUnwrap((obj) => obj.result); } /** * Delete Endpoint Health Check. * * @example * ```ts * const endpointHealthcheck = * await client.diagnostics.endpointHealthchecks.delete( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(id, params, options) { const { account_id } = params; return this._client.delete(`/accounts/${account_id}/diagnostics/endpoint-healthchecks/${id}`, options); } /** * Get a single Endpoint Health Check. * * @example * ```ts * const endpointHealthcheck = * await client.diagnostics.endpointHealthchecks.get( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(id, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/diagnostics/endpoint-healthchecks/${id}`, options)._thenUnwrap((obj) => obj.result); } } exports.EndpointHealthchecks = EndpointHealthchecks; //# sourceMappingURL=endpoint-healthchecks.js.map