cloudflare
Version:
The official TypeScript library for the Cloudflare API
97 lines • 5.16 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { SinglePage, V4PagePaginationArray, } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
/**
* @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.
*/
export 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 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(path `/zones/${zone_id}/filters`, (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(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(path `/zones/${zone_id}/filters`, (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(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(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(path `/zones/${zone_id}/filters`, (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(path `/zones/${zone_id}/filters/${filterID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseFilters._key = Object.freeze(['filters']);
return 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.
*/
export class Filters extends BaseFilters {
}
//# sourceMappingURL=filters.mjs.map