UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

66 lines • 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZoneTags = exports.BaseZoneTags = 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 BaseZoneTags = /* @__PURE__ */ (() => { class BaseZoneTags extends resource_1.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((0, path_1.path) `/zones/${zone_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 zone-level resource. */ delete(params, options) { const { zone_id, 'If-Match': ifMatch } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/tags`, { ...options, headers: (0, headers_1.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((0, path_1.path) `/zones/${zone_id}/tags`, { query, ...options })._thenUnwrap((obj) => obj.result); } } BaseZoneTags._key = Object.freeze([ 'resourceTagging', 'zoneTags', ]); return BaseZoneTags; })(); exports.BaseZoneTags = BaseZoneTags; class ZoneTags extends BaseZoneTags { } exports.ZoneTags = ZoneTags; //# sourceMappingURL=zone-tags.js.map