cloudflare
Version:
The official TypeScript library for the Cloudflare API
112 lines • 4.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.URLIgnorePatterns = exports.BaseURLIgnorePatterns = 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 BaseURLIgnorePatterns = /* @__PURE__ */ (() => {
class BaseURLIgnorePatterns extends resource_1.APIResource {
/**
* Creates a new URL rewrite ignore pattern. URLs matching this pattern will not be
* rewritten.
*
* @example
* ```ts
* const urlIgnorePattern =
* await client.emailSecurity.settings.urlIgnorePatterns.create(
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* pattern: 'https://example\\.com/.*',
* },
* );
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/email-security/settings/url_ignore_patterns`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Returns a paginated list of URL rewrite ignore patterns for the account. URLs
* matching these patterns will not be rewritten.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const urlIgnorePatternListResponse of client.emailSecurity.settings.urlIgnorePatterns.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/email-security/settings/url_ignore_patterns`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Removes a URL rewrite ignore pattern. After deletion, URLs matching this pattern
* will be rewritten again.
*
* @example
* ```ts
* const urlIgnorePattern =
* await client.emailSecurity.settings.urlIgnorePatterns.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(patternID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/email-security/settings/url_ignore_patterns/${patternID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates an existing URL rewrite ignore pattern. Only provided fields will be
* modified.
*
* @example
* ```ts
* const response =
* await client.emailSecurity.settings.urlIgnorePatterns.edit(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
edit(patternID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/email-security/settings/url_ignore_patterns/${patternID}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Returns a single URL rewrite ignore pattern by its identifier.
*
* @example
* ```ts
* const urlIgnorePattern =
* await client.emailSecurity.settings.urlIgnorePatterns.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(patternID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/email-security/settings/url_ignore_patterns/${patternID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseURLIgnorePatterns._key = Object.freeze([
'emailSecurity',
'settings',
'urlIgnorePatterns',
]);
return BaseURLIgnorePatterns;
})();
exports.BaseURLIgnorePatterns = BaseURLIgnorePatterns;
class URLIgnorePatterns extends BaseURLIgnorePatterns {
}
exports.URLIgnorePatterns = URLIgnorePatterns;
//# sourceMappingURL=url-ignore-patterns.js.map