UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

41 lines • 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Metadata = exports.BaseMetadata = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseMetadata = /* @__PURE__ */ (() => { class BaseMetadata extends resource_1.APIResource { /** * Returns the JSON metadata associated with the specified key in the Workers KV * namespace, without retrieving its value. Use URL-encoding for special characters * (for example, `:`, `!`, `%`) in the key name when constructing the request URL. * * @example * ```ts * const metadata = await client.kv.namespaces.metadata.get( * 'My-Key', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * namespace_id: '0f2ac74b498b48028cb68387c421e279', * }, * ); * ``` */ get(keyName, params, options) { const { account_id, namespace_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/storage/kv/namespaces/${namespace_id}/metadata/${keyName}`, options)._thenUnwrap((obj) => obj.result); } } BaseMetadata._key = Object.freeze([ 'kv', 'namespaces', 'metadata', ]); return BaseMetadata; })(); exports.BaseMetadata = BaseMetadata; class Metadata extends BaseMetadata { } exports.Metadata = Metadata; //# sourceMappingURL=metadata.js.map