UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

76 lines 2.5 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../resource.mjs"; import { CursorPagination } from "../../../pagination.mjs"; export class Devices 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(`/accounts/${account_id}/devices/physical-devices`, DeviceListResponsesCursorPagination, { 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(`/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(`/accounts/${account_id}/devices/physical-devices/${deviceId}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } /** * Revokes all WARP registrations associated with the specified device. * * @example * ```ts * const response = * await client.zeroTrust.devices.devices.revoke( * 'device_id', * { account_id: 'account_id' }, * ); * ``` */ revoke(deviceId, params, options) { const { account_id } = params; return this._client.post(`/accounts/${account_id}/devices/physical-devices/${deviceId}/revoke`, options)._thenUnwrap((obj) => obj.result); } } export class DeviceListResponsesCursorPagination extends CursorPagination { } Devices.DeviceListResponsesCursorPagination = DeviceListResponsesCursorPagination; //# sourceMappingURL=devices_.mjs.map