/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { domainsRoutesCreate } from "../funcs/domainsRoutesCreate.js"; import { domainsRoutesDelete } from "../funcs/domainsRoutesDelete.js"; import { domainsRoutesList } from "../funcs/domainsRoutesList.js"; import { domainsRoutesRetrieve } from "../funcs/domainsRoutesRetrieve.js"; import { domainsRoutesTest } from "../funcs/domainsRoutesTest.js"; import { domainsRoutesUpdate } from "../funcs/domainsRoutesUpdate.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"; export class Routes extends ClientSDK { /** * List routes for a domain * * @remarks * Returns a paginated list of routes attached to the domain. Optionally filter by an agent identifier to find routes pointing to a specific agent. */ async list( request: operations.DomainsControllerListDomainRoutesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(domainsRoutesList( this, request, options, )); } /** * Create a route * * @remarks * Creates a route on the domain that forwards inbound mail addressed to `
@` to either a webhook or an agent. Each address on a domain may only have a single route. */ async create( domainRouteDto: components.DomainRouteDto, domain: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsRoutesCreate( this, domainRouteDto, domain, idempotencyKey, options, )); } /** * Retrieve a route by address * * @remarks * Returns the route bound to `
@`. Use `*` as the address to retrieve the wildcard route for the domain. */ async retrieve( domain: string, address: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsRoutesRetrieve( this, domain, address, idempotencyKey, options, )); } /** * Update a route * * @remarks * Updates the destination of the route bound to `
@`. The address itself is the resource identity and cannot be changed; delete and recreate the route to rename it. */ async update( updateDomainRouteDto: components.UpdateDomainRouteDto, domain: string, address: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsRoutesUpdate( this, updateDomainRouteDto, domain, address, idempotencyKey, options, )); } /** * Delete a route * * @remarks * Removes the route bound to `
@`. Inbound mail for that address will no longer be processed. */ async delete( domain: string, address: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.DomainsControllerDeleteDomainRouteResponse | undefined > { return unwrapAsync(domainsRoutesDelete( this, domain, address, idempotencyKey, options, )); } /** * Test an inbound route * * @remarks * Sends a synthetic inbound email through the same delivery path as production (outbound webhooks for webhook routes, signed HTTP to the agent for agent routes). Use `dryRun: true` to preview the payload without delivering. */ async test( testDomainRouteDto: components.TestDomainRouteDto, domain: string, address: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(domainsRoutesTest( this, testDomainRouteDto, domain, address, idempotencyKey, options, )); } }