UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

88 lines • 3.92 kB
// 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 BaseCacheReserveResource = /* @__PURE__ */ (() => { class BaseCacheReserveResource extends APIResource { /** * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first * disable Cache Reserve. In most cases, this will be accomplished within 24 hours. * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind * that you cannot undo or cancel this operation. * * @example * ```ts * const response = await client.cache.cacheReserve.clear({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ clear(params, options) { const { zone_id } = params; return this._client.post(path `/zones/${zone_id}/cache/cache_reserve_clear`, options)._thenUnwrap((obj) => obj.result); } /** * Increase cache lifetimes by automatically storing all cacheable files into * Cloudflare's persistent object storage buckets. Requires Cache Reserve * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended * to reduce Reserve operations costs. See the * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) * for more information. * * @example * ```ts * const response = await client.cache.cacheReserve.edit({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * value: 'on', * }); * ``` */ edit(params, options) { const { zone_id, ...body } = params; return this._client.patch(path `/zones/${zone_id}/cache/cache_reserve`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Increase cache lifetimes by automatically storing all cacheable files into * Cloudflare's persistent object storage buckets. Requires Cache Reserve * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended * to reduce Reserve operations costs. See the * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) * for more information. * * @example * ```ts * const cacheReserve = await client.cache.cacheReserve.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/cache/cache_reserve`, options)._thenUnwrap((obj) => obj.result); } /** * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first * disable Cache Reserve. In most cases, this will be accomplished within 24 hours. * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind * that you cannot undo or cancel this operation. * * @example * ```ts * const response = await client.cache.cacheReserve.status({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ status(params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/cache/cache_reserve_clear`, options)._thenUnwrap((obj) => obj.result); } } BaseCacheReserveResource._key = Object.freeze([ 'cache', 'cacheReserve', ]); return BaseCacheReserveResource; })(); export class CacheReserveResource extends BaseCacheReserveResource { } //# sourceMappingURL=cache-reserve.mjs.map