cloudflare
Version:
The official TypeScript library for the Cloudflare API
118 lines • 4.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Registrations = exports.BaseRegistrations = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseRegistrations = /* @__PURE__ */ (() => {
class BaseRegistrations extends resource_1.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((0, path_1.path) `/accounts/${account_id}/devices/registrations`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/devices/registrations/unrevoke`, {
query: { id },
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseRegistrations._key = Object.freeze([
'zeroTrust',
'devices',
'registrations',
]);
return BaseRegistrations;
})();
exports.BaseRegistrations = BaseRegistrations;
class Registrations extends BaseRegistrations {
}
exports.Registrations = Registrations;
//# sourceMappingURL=registrations.js.map