/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { domainsCreate } from "../funcs/domainsCreate.js"; import { domainsDelete } from "../funcs/domainsDelete.js"; import { domainsDiagnose } from "../funcs/domainsDiagnose.js"; import { domainsList } from "../funcs/domainsList.js"; import { domainsRetrieve } from "../funcs/domainsRetrieve.js"; import { domainsUpdate } from "../funcs/domainsUpdate.js"; import { domainsVerify } from "../funcs/domainsVerify.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { AutoConfigure } from "./autoconfigure.js"; import { Routes } from "./routes.js"; export class Domains extends ClientSDK { private _autoConfigure?: AutoConfigure; get autoConfigure(): AutoConfigure { return (this._autoConfigure ??= new AutoConfigure(this._options)); } private _routes?: Routes; get routes(): Routes { return (this._routes ??= new Routes(this._options)); } /** * List domains for an environment * * @remarks * Returns a paginated list of inbound-email domains in the current environment. Supports cursor pagination and a name contains filter. */ async list( request: operations.DomainsControllerListDomainsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(domainsList( this, request, options, )); } /** * Create a domain * * @remarks * Registers a new inbound-email domain. The response includes the DNS records customers must add at their DNS provider before the domain can receive mail. */ async create( createDomainDto: components.CreateDomainDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsCreate( this, createDomainDto, idempotencyKey, options, )); } /** * Retrieve a domain by name * * @remarks * Returns the domain configuration and the DNS records that must be in place. This is a pure read; call `domains.verify` to refresh verification status from DNS. */ async retrieve( domain: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsRetrieve( this, domain, idempotencyKey, options, )); } /** * Update a domain * * @remarks * Updates optional domain fields. When `data` is provided, it replaces the entire metadata object; omit `data` to leave it unchanged. */ async update( updateDomainDto: components.UpdateDomainDto, domain: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsUpdate( this, updateDomainDto, domain, idempotencyKey, options, )); } /** * Delete a domain * * @remarks * Removes the domain and cascades the deletion to all of its routes. Inbound mail for that domain stops being processed immediately. */ async delete( domain: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsDelete( this, domain, idempotencyKey, options, )); } /** * Diagnose inbound DNS for a domain * * @remarks * Runs live DNS checks for inbound email readiness (MX correctness, apex CNAME collision, and common DNS blocklists for the Novu mail host). Returns structured issues with plain-language fixes. */ async diagnose( domain: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsDiagnose( this, domain, idempotencyKey, options, )); } /** * Verify a domain * * @remarks * Performs a live DNS lookup to refresh the MX record status of the domain and updates the verification status accordingly. Returns the latest domain configuration. */ async verify( domain: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsVerify( this, domain, idempotencyKey, options, )); } }