UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

115 lines • 5.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ImpersonationRegistry = exports.BaseImpersonationRegistry = 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 BaseImpersonationRegistry = /* @__PURE__ */ (() => { class BaseImpersonationRegistry extends resource_1.APIResource { /** * Creates a new entry in the impersonation registry to protect against * impersonation. Emails attempting to impersonate this identity will be flagged. * Supports regex patterns for flexible email matching. * * @example * ```ts * const impersonationRegistry = * await client.emailSecurity.settings.impersonationRegistry.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * email: 'john.doe@example.com', * is_email_regex: false, * name: 'John Doe', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/email-security/settings/impersonation_registry`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Returns a paginated list of protected identities in the impersonation registry. * These entries define identities and email addresses to protect from * impersonation attacks. Can be manually added or automatically synced from * directory integrations. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const impersonationRegistryListResponse of client.emailSecurity.settings.impersonationRegistry.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/impersonation_registry`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Removes an entry from the impersonation registry. After deletion, this identity * will no longer be protected from impersonation. * * @example * ```ts * const impersonationRegistry = * await client.emailSecurity.settings.impersonationRegistry.delete( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(impersonationRegistryID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/email-security/settings/impersonation_registry/${impersonationRegistryID}`, options)._thenUnwrap((obj) => obj.result); } /** * Updates an existing impersonation registry entry. Only provided fields will be * modified. Directory-synced entries can't be updated. * * @example * ```ts * const response = * await client.emailSecurity.settings.impersonationRegistry.edit( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ edit(impersonationRegistryID, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/email-security/settings/impersonation_registry/${impersonationRegistryID}`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves details for a specific impersonation registry entry including the * protected identity, email pattern, and synchronization source if * directory-synced. * * @example * ```ts * const impersonationRegistry = * await client.emailSecurity.settings.impersonationRegistry.get( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(impersonationRegistryID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/email-security/settings/impersonation_registry/${impersonationRegistryID}`, options)._thenUnwrap((obj) => obj.result); } } BaseImpersonationRegistry._key = Object.freeze(['emailSecurity', 'settings', 'impersonationRegistry']); return BaseImpersonationRegistry; })(); exports.BaseImpersonationRegistry = BaseImpersonationRegistry; class ImpersonationRegistry extends BaseImpersonationRegistry { } exports.ImpersonationRegistry = ImpersonationRegistry; //# sourceMappingURL=impersonation-registry.js.map