UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

61 lines • 2.32 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 BaseZoneTags = /* @__PURE__ */ (() => { class BaseZoneTags extends APIResource { /** * Creates or updates tags for a specific zone-level resource. Replaces all * existing tags for the resource. * * @example * ```ts * const zoneTag = * await client.resourceTagging.zoneTags.update({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * resource_id: '023e105f4ecef8ad9ca31a8372d0c353', * resource_type: 'zone', * }); * ``` */ update(params, options) { const { zone_id, 'If-Match': ifMatch, ...body } = params; return this._client.put(path `/zones/${zone_id}/tags`, { body, ...options, headers: buildHeaders([ { ...(ifMatch != null ? { 'If-Match': ifMatch } : undefined) }, options?.headers, ]), })._thenUnwrap((obj) => obj.result); } /** * Removes all tags from a specific zone-level resource. */ delete(params, options) { const { zone_id, 'If-Match': ifMatch } = params; return this._client.delete(path `/zones/${zone_id}/tags`, { ...options, headers: buildHeaders([ { Accept: '*/*', ...(ifMatch != null ? { 'If-Match': ifMatch } : undefined) }, options?.headers, ]), }); } /** * Retrieves tags for a specific zone-level resource. */ get(params, options) { const { zone_id, ...query } = params; return this._client.get(path `/zones/${zone_id}/tags`, { query, ...options })._thenUnwrap((obj) => obj.result); } } BaseZoneTags._key = Object.freeze([ 'resourceTagging', 'zoneTags', ]); return BaseZoneTags; })(); export class ZoneTags extends BaseZoneTags { } //# sourceMappingURL=zone-tags.mjs.map