UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

78 lines • 2.79 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { CursorPagination } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseDevices = /* @__PURE__ */ (() => { class BaseDevices extends APIResource { /** * Lists WARP devices. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const deviceListResponse of client.zeroTrust.devices.devices.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/devices/physical-devices`, (CursorPagination), { query, ...options }); } /** * Deletes a WARP device. * * @example * ```ts * const device = * await client.zeroTrust.devices.devices.delete( * 'device_id', * { account_id: 'account_id' }, * ); * ``` */ delete(deviceID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/devices/physical-devices/${deviceID}`, options)._thenUnwrap((obj) => obj.result); } /** * Fetches a single WARP device. * * @example * ```ts * const device = await client.zeroTrust.devices.devices.get( * 'device_id', * { account_id: 'account_id' }, * ); * ``` */ get(deviceID, params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/devices/physical-devices/${deviceID}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } /** * Revokes all WARP registrations associated with the specified device. Prefer * "delete" operation instead, "revoke" does not release virtual IPs. * * @deprecated */ revoke(deviceID, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/devices/physical-devices/${deviceID}/revoke`, options)._thenUnwrap((obj) => obj.result); } } BaseDevices._key = Object.freeze([ 'zeroTrust', 'devices', 'devices', ]); return BaseDevices; })(); export class Devices extends BaseDevices { } //# sourceMappingURL=devices_.mjs.map