UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

109 lines • 5.13 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 BaseSendingDomainRestrictions = /* @__PURE__ */ (() => { class BaseSendingDomainRestrictions extends APIResource { /** * Creates a new sending domain restriction to enforce TLS requirements for a * domain. Emails without TLS from this domain will be dropped unless the subdomain * is in the exclude list. * * @example * ```ts * const sendingDomainRestriction = * await client.emailSecurity.settings.sendingDomainRestrictions.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * domain: 'example.com', * exclude: ['subdomain.example.com'], * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/email-security/settings/sending_domain_restrictions`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Returns a paginated list of sending domain restrictions. These restrictions * enforce TLS requirements for emails from specific domains. Mail without TLS from * restricted domains will be dropped unless the subdomain is in the exclude list. * Supports sorting and searching. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const sendingDomainRestrictionListResponse of client.emailSecurity.settings.sendingDomainRestrictions.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/email-security/settings/sending_domain_restrictions`, (V4PagePaginationArray), { query, ...options }); } /** * Removes a sending domain restriction. After deletion, TLS will no longer be * enforced for emails from this domain. * * @example * ```ts * const sendingDomainRestriction = * await client.emailSecurity.settings.sendingDomainRestrictions.delete( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(sendingDomainRestrictionID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/email-security/settings/sending_domain_restrictions/${sendingDomainRestrictionID}`, options)._thenUnwrap((obj) => obj.result); } /** * Updates an existing sending domain restriction. Only provided fields will be * modified. Changes affect which domains require TLS and which subdomains are * excluded. * * @example * ```ts * const response = * await client.emailSecurity.settings.sendingDomainRestrictions.edit( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ edit(sendingDomainRestrictionID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/email-security/settings/sending_domain_restrictions/${sendingDomainRestrictionID}`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves details for a specific sending domain restriction including the domain * requiring TLS and any excluded subdomains exempt from the TLS requirement. * * @example * ```ts * const sendingDomainRestriction = * await client.emailSecurity.settings.sendingDomainRestrictions.get( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(sendingDomainRestrictionID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/email-security/settings/sending_domain_restrictions/${sendingDomainRestrictionID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSendingDomainRestrictions._key = Object.freeze(['emailSecurity', 'settings', 'sendingDomainRestrictions']); return BaseSendingDomainRestrictions; })(); export class SendingDomainRestrictions extends BaseSendingDomainRestrictions { } //# sourceMappingURL=sending-domain-restrictions.mjs.map