UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

107 lines • 4.38 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { V4PagePaginationArray, } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseURLIgnorePatterns = /* @__PURE__ */ (() => { class BaseURLIgnorePatterns extends 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(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(path `/accounts/${account_id}/email-security/settings/url_ignore_patterns`, (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(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(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(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; })(); export class URLIgnorePatterns extends BaseURLIgnorePatterns { } //# sourceMappingURL=url-ignore-patterns.mjs.map