UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

120 lines • 4.21 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { V4PagePaginationArray, } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseDEXTests = /* @__PURE__ */ (() => { class BaseDEXTests extends APIResource { /** * Create a DEX test. * * @example * ```ts * const schemaHTTP = * await client.zeroTrust.devices.dexTests.create({ * account_id: '01a7362d577a6c3019a474fd6f485823', * data: { * host: 'https://dash.cloudflare.com', * kind: 'http', * }, * enabled: true, * interval: '30m', * name: 'HTTP dash health check', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/dex/devices/dex_tests`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Update a DEX test. * * @example * ```ts * const schemaHTTP = * await client.zeroTrust.devices.dexTests.update( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { * account_id: '01a7362d577a6c3019a474fd6f485823', * data: { * host: 'https://dash.cloudflare.com', * kind: 'http', * }, * enabled: true, * interval: '30m', * name: 'HTTP dash health check', * }, * ); * ``` */ update(dexTestID, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/dex/devices/dex_tests/${dexTestID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetch all DEX tests. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const schemaHTTP of client.zeroTrust.devices.dexTests.list( * { account_id: '01a7362d577a6c3019a474fd6f485823' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/dex/devices/dex_tests`, (V4PagePaginationArray), { query, ...options }); } /** * Delete a Device DEX test. Returns the remaining device dex tests for the * account. * * @example * ```ts * const dexTest = * await client.zeroTrust.devices.dexTests.delete( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '01a7362d577a6c3019a474fd6f485823' }, * ); * ``` */ delete(dexTestID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/dex/devices/dex_tests/${dexTestID}`, options)._thenUnwrap((obj) => obj.result); } /** * Fetch a single DEX test. * * @example * ```ts * const schemaHTTP = * await client.zeroTrust.devices.dexTests.get( * '372e67954025e0ba6aaa6d586b9e0b59', * { account_id: '01a7362d577a6c3019a474fd6f485823' }, * ); * ``` */ get(dexTestID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/dex/devices/dex_tests/${dexTestID}`, options)._thenUnwrap((obj) => obj.result); } } BaseDEXTests._key = Object.freeze([ 'zeroTrust', 'devices', 'dexTests', ]); return BaseDEXTests; })(); export class DEXTests extends BaseDEXTests { } //# sourceMappingURL=dex-tests.mjs.map