UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

67 lines • 2.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AccountTags = exports.BaseAccountTags = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const headers_1 = require("../../internal/headers.js"); const path_1 = require("../../internal/utils/path.js"); var BaseAccountTags = /* @__PURE__ */ (() => { class BaseAccountTags extends resource_1.APIResource { /** * Creates or updates tags for a specific account-level resource. Replaces all * existing tags for the resource. * * @example * ```ts * const accountTag = * await client.resourceTagging.accountTags.update({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * resource_id: '023e105f4ecef8ad9ca31a8372d0c353', * resource_type: 'worker_version', * worker_id: '3f72a691-44b3-4c11-8642-c18a88ddaa5e', * }); * ``` */ update(params, options) { const { account_id, 'If-Match': ifMatch, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/tags`, { body, ...options, headers: (0, headers_1.buildHeaders)([ { ...(ifMatch != null ? { 'If-Match': ifMatch } : undefined) }, options?.headers, ]), })._thenUnwrap((obj) => obj.result); } /** * Removes all tags from a specific account-level resource. */ delete(params, options) { const { account_id, 'If-Match': ifMatch } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/tags`, { ...options, headers: (0, headers_1.buildHeaders)([ { Accept: '*/*', ...(ifMatch != null ? { 'If-Match': ifMatch } : undefined) }, options?.headers, ]), }); } /** * Retrieves tags for a specific account-level resource. */ get(params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/tags`, { query, ...options })._thenUnwrap((obj) => obj.result); } } BaseAccountTags._key = Object.freeze([ 'resourceTagging', 'accountTags', ]); return BaseAccountTags; })(); exports.BaseAccountTags = BaseAccountTags; class AccountTags extends BaseAccountTags { } exports.AccountTags = AccountTags; //# sourceMappingURL=account-tags.js.map