UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

62 lines • 2.46 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseAccountTags = /* @__PURE__ */ (() => { class BaseAccountTags extends 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(path `/accounts/${account_id}/tags`, { body, ...options, headers: 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(path `/accounts/${account_id}/tags`, { ...options, headers: 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(path `/accounts/${account_id}/tags`, { query, ...options })._thenUnwrap((obj) => obj.result); } } BaseAccountTags._key = Object.freeze([ 'resourceTagging', 'accountTags', ]); return BaseAccountTags; })(); export class AccountTags extends BaseAccountTags { } //# sourceMappingURL=account-tags.mjs.map