UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

118 lines • 4.53 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as DNSAPI from "./dns.mjs"; import { BaseDNS, DNS } from "./dns.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseSubdomains = /* @__PURE__ */ (() => { class BaseSubdomains extends APIResource { /** * Creates a new sending subdomain or re-enables sending on an existing subdomain * that had it disabled. If zone-level Email Sending has not been enabled yet, the * zone flag is automatically set when the entitlement is present. A leftmost * wildcard such as `*.example.com` is accepted only for accounts with wildcard * Email Sending enabled. Wildcard senders share the base domain's DKIM signing * identity and `cf-bounce.<base>` return path. * * @example * ```ts * const subdomain = * await client.emailSending.subdomains.create({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * name: 'sub.example.com', * }); * ``` */ create(params, options) { const { zone_id, ...body } = params; return this._client.post(path `/zones/${zone_id}/email/sending/subdomains`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all sending-enabled subdomains for the zone. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const subdomainListResponse of client.emailSending.subdomains.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { zone_id } = params; return this._client.getAPIList(path `/zones/${zone_id}/email/sending/subdomains`, (SinglePage), options); } /** * Disables sending on a subdomain and removes its DNS records. If routing is still * active on the subdomain, only sending is disabled. * * @example * ```ts * const subdomain = * await client.emailSending.subdomains.delete( * 'aabbccdd11223344aabbccdd11223344', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(subdomainID, params, options) { const { zone_id } = params; return this._client.delete(path `/zones/${zone_id}/email/sending/subdomains/${subdomainID}`, options); } /** * Updates the activity-log preview preference for a sending subdomain. * * @example * ```ts * const response = await client.emailSending.subdomains.edit( * 'aabbccdd11223344aabbccdd11223344', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ edit(subdomainID, params, options) { const { zone_id, ...body } = params; return this._client.patch(path `/zones/${zone_id}/email/sending/subdomains/${subdomainID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Gets information for a specific sending subdomain. * * @example * ```ts * const subdomain = await client.emailSending.subdomains.get( * 'aabbccdd11223344aabbccdd11223344', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(subdomainID, params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/email/sending/subdomains/${subdomainID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSubdomains._key = Object.freeze([ 'emailSending', 'subdomains', ]); return BaseSubdomains; })(); export var Subdomains = /* @__PURE__ */ (() => { class Subdomains extends BaseSubdomains { constructor() { super(...arguments); this.dns = new DNSAPI.DNS(this._client); } } Subdomains.DNS = DNS; Subdomains.BaseDNS = BaseDNS; return Subdomains; })(); //# sourceMappingURL=subdomains.mjs.map