UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

99 lines • 5.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Filters = exports.BaseFilters = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseFilters = /* @__PURE__ */ (() => { /** * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ class BaseFilters extends resource_1.APIResource { /** * Creates one or more filters. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ create(params, options) { const { zone_id, body } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/filters`, (pagination_1.SinglePage), { body: body, method: 'post', ...options, }); } /** * Updates an existing filter. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ update(filterID, params, options) { const { zone_id, ...body } = params; return this._client.put((0, path_1.path) `/zones/${zone_id}/filters/${filterID}`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Fetches filters in a zone. You can filter the results using several optional * parameters. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ list(params, options) { const { zone_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/filters`, (pagination_1.V4PagePaginationArray), { query, ...options, }); } /** * Deletes an existing filter. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ delete(filterID, params, options) { const { zone_id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/filters/${filterID}`, options)._thenUnwrap((obj) => obj.result); } /** * Deletes one or more existing filters. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ bulkDelete(params, options) { const { zone_id, id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/filters`, { query: { id }, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates one or more existing filters. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ bulkUpdate(params, options) { const { zone_id, body } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/filters`, (pagination_1.SinglePage), { body: body, method: 'put', ...options, }); } /** * Fetches the details of a filter. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ get(filterID, params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/filters/${filterID}`, options)._thenUnwrap((obj) => obj.result); } } BaseFilters._key = Object.freeze(['filters']); return BaseFilters; })(); exports.BaseFilters = BaseFilters; /** * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ class Filters extends BaseFilters { } exports.Filters = Filters; //# sourceMappingURL=filters.js.map