cloudflare
Version:
The official TypeScript library for the Cloudflare API
107 lines • 3.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tags = exports.BaseTags = 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 BaseTags = /* @__PURE__ */ (() => {
class BaseTags extends resource_1.APIResource {
/**
* Create a tag
*
* @example
* ```ts
* const tag = await client.zeroTrust.access.tags.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/access/tags`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Update a tag
*
* @example
* ```ts
* const tag = await client.zeroTrust.access.tags.update(
* 'engineers',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* name: 'engineers',
* },
* );
* ```
*/
update(tagName, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/access/tags/${tagName}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List tags
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const tag of client.zeroTrust.access.tags.list({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* })) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/access/tags`, (pagination_1.V4PagePaginationArray), {
query,
...options,
});
}
/**
* Delete a tag
*
* @example
* ```ts
* const tag = await client.zeroTrust.access.tags.delete(
* 'engineers',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(tagName, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/access/tags/${tagName}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get a tag
*
* @example
* ```ts
* const tag = await client.zeroTrust.access.tags.get(
* 'engineers',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(tagName, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/access/tags/${tagName}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseTags._key = Object.freeze([
'zeroTrust',
'access',
'tags',
]);
return BaseTags;
})();
exports.BaseTags = BaseTags;
class Tags extends BaseTags {
}
exports.Tags = Tags;
//# sourceMappingURL=tags.js.map