cloudflare
Version:
The official TypeScript library for the Cloudflare API
114 lines • 5.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SendingDomainRestrictions = exports.BaseSendingDomainRestrictions = 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 BaseSendingDomainRestrictions = /* @__PURE__ */ (() => {
class BaseSendingDomainRestrictions extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/email-security/settings/sending_domain_restrictions`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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;
})();
exports.BaseSendingDomainRestrictions = BaseSendingDomainRestrictions;
class SendingDomainRestrictions extends BaseSendingDomainRestrictions {
}
exports.SendingDomainRestrictions = SendingDomainRestrictions;
//# sourceMappingURL=sending-domain-restrictions.js.map