UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

113 lines • 3.99 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 BaseRegistrations = /* @__PURE__ */ (() => { class BaseRegistrations extends APIResource { /** * Lists WARP registrations. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const registrationListResponse of client.zeroTrust.devices.registrations.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/devices/registrations`, (CursorPagination), { query, ...options }); } /** * Deletes a WARP registration. * * @example * ```ts * const registration = * await client.zeroTrust.devices.registrations.delete( * 'registration_id', * { account_id: 'account_id' }, * ); * ``` */ delete(registrationID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/devices/registrations/${registrationID}`, options)._thenUnwrap((obj) => obj.result); } /** * Deletes a list of WARP registrations. * * @example * ```ts * const response = * await client.zeroTrust.devices.registrations.bulkDelete({ * account_id: 'account_id', * id: ['string'], * }); * ``` */ bulkDelete(params, options) { const { account_id, id } = params; return this._client.delete(path `/accounts/${account_id}/devices/registrations`, { query: { id }, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetches a single WARP registration. * * @example * ```ts * const registration = * await client.zeroTrust.devices.registrations.get( * 'registration_id', * { account_id: 'account_id' }, * ); * ``` */ get(registrationID, params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/devices/registrations/${registrationID}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } /** * Revokes a list of WARP registrations. Prefer "delete" operation instead, * "revoke" does not release virtual IPs. * * @deprecated */ revoke(params, options) { const { account_id, id } = params; return this._client.post(path `/accounts/${account_id}/devices/registrations/revoke`, { query: { id }, ...options, })._thenUnwrap((obj) => obj.result); } /** * Unrevokes a list of WARP registrations. * * @deprecated */ unrevoke(params, options) { const { account_id, id } = params; return this._client.post(path `/accounts/${account_id}/devices/registrations/unrevoke`, { query: { id }, ...options, })._thenUnwrap((obj) => obj.result); } } BaseRegistrations._key = Object.freeze([ 'zeroTrust', 'devices', 'registrations', ]); return BaseRegistrations; })(); export class Registrations extends BaseRegistrations { } //# sourceMappingURL=registrations.mjs.map