UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

40 lines 2.06 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.HotlinkProtection = void 0; const resource_1 = require("cloudflare/resource"); class HotlinkProtection extends resource_1.APIResource { /** * When enabled, the Hotlink Protection option ensures that other sites cannot suck * up your bandwidth by building pages that use images hosted on your site. Anytime * a request for an image on your site hits Cloudflare, we check to ensure that * it's not another site requesting them. People will still be able to download and * view images from your page, but other sites won't be able to steal them for use * on their own pages. * (https://support.cloudflare.com/hc/en-us/articles/200170026). */ edit(params, options) { const { zone_id, ...body } = params; return this._client.patch(`/zones/${zone_id}/settings/hotlink_protection`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * When enabled, the Hotlink Protection option ensures that other sites cannot suck * up your bandwidth by building pages that use images hosted on your site. Anytime * a request for an image on your site hits Cloudflare, we check to ensure that * it's not another site requesting them. People will still be able to download and * view images from your page, but other sites won't be able to steal them for use * on their own pages. * (https://support.cloudflare.com/hc/en-us/articles/200170026). */ get(params, options) { const { zone_id } = params; return this._client.get(`/zones/${zone_id}/settings/hotlink_protection`, options)._thenUnwrap((obj) => obj.result); } } exports.HotlinkProtection = HotlinkProtection; (function (HotlinkProtection) { })(HotlinkProtection = exports.HotlinkProtection || (exports.HotlinkProtection = {})); //# sourceMappingURL=hotlink-protection.js.map