cloudflare
Version:
The official TypeScript library for the Cloudflare API
36 lines • 1.42 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseMetadata = /* @__PURE__ */ (() => {
class BaseMetadata extends 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(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;
})();
export class Metadata extends BaseMetadata {
}
//# sourceMappingURL=metadata.mjs.map