UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

75 lines • 3.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Variants = exports.BaseVariants = 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 BaseVariants = /* @__PURE__ */ (() => { class BaseVariants extends resource_1.APIResource { /** * Variant support enables caching variants of images with certain file extensions * in addition to the original. This only applies when the origin server sends the * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but * does not serve the variant requested, the response will not be cached. This will * be indicated with BYPASS cache status in the response headers. * * @example * ```ts * const variant = await client.cache.variants.delete({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ delete(params, options) { const { zone_id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/cache/variants`, options)._thenUnwrap((obj) => obj.result); } /** * Variant support enables caching variants of images with certain file extensions * in addition to the original. This only applies when the origin server sends the * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but * does not serve the variant requested, the response will not be cached. This will * be indicated with BYPASS cache status in the response headers. * * @example * ```ts * const response = await client.cache.variants.edit({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * value: {}, * }); * ``` */ edit(params, options) { const { zone_id, ...body } = params; return this._client.patch((0, path_1.path) `/zones/${zone_id}/cache/variants`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Variant support enables caching variants of images with certain file extensions * in addition to the original. This only applies when the origin server sends the * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but * does not serve the variant requested, the response will not be cached. This will * be indicated with BYPASS cache status in the response headers. * * @example * ```ts * const variant = await client.cache.variants.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/cache/variants`, options)._thenUnwrap((obj) => obj.result); } } BaseVariants._key = Object.freeze([ 'cache', 'variants', ]); return BaseVariants; })(); exports.BaseVariants = BaseVariants; class Variants extends BaseVariants { } exports.Variants = Variants; //# sourceMappingURL=variants.js.map