import { BaseConnector } from '../../base/base.connector.js'; import type { ISmsOptions, ISmsProvider, ISendMessageSuccessResponse, WithPassthrough, SmsSendResult, ISmsConnector } from '../../types/index.js'; import { ChannelTypeEnum } from '../../types/index.js'; import type { TwilioConfig } from './twilio.config.js'; import type { TwilioNarrowedInput, TwilioRegion, TwilioEdge } from './twilio.types.js'; /** * Default edge per non-US processing region. Twilio: "The edge location name * (dublin, sydney) is a required part of the hostname for non-US regions", and * the legacy-regions table pairs ie1 with dublin and au1 with sydney. No Twilio * SDK ships such a map (they require the caller to pass both), so this is the * library's documented default. */ export declare const TWILIO_DEFAULT_EDGES: Readonly, TwilioEdge>>; /** * Resolve the Messages API host for a region/edge pair, following Twilio's * documented `PRODUCT.EDGE.REGION.twilio.com` shape. Both values are * interpolated into the hostname the Basic credentials are sent to, so each * must come from the closed lists above; anything else is rejected before a * request is built. */ export declare function twilioApiHost(region: string | undefined, edge: string | undefined): string; export declare class TwilioSmsConnector extends BaseConnector implements ISmsProvider, ISmsConnector { private config; readonly id = "twilio"; readonly channelType: ChannelTypeEnum.SMS; constructor(config: TwilioConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `ISmsConnector`. * Builds an `application/x-www-form-urlencoded` body in PascalCase wire * shape, authenticates with HTTP Basic (`accountSid:authToken`), and POSTs * to the Twilio Messages endpoint for `config.region` / `config.edge` * (see {@link twilioApiHost}). * * the connector explicitly invokes * `transformKeys(_passthrough.body, CasingEnum.PASCAL_CASE)` so consumer- * supplied camelCase keys (e.g., `messagingServiceSid`) land as PascalCase * (`MessagingServiceSid`) in the form body alongside the connector-built * fields. * * `mediaUrl` (string[]) is encoded as multiple `MediaUrl=` form fields per * Twilio's documented multi-attachment shape — never comma-joined. */ send(input: TwilioNarrowedInput): Promise; private messagesUrl; /** * Map Twilio error responses to canonical `ConnectorError` with the 6-value * `ProviderCode` union. Parses `Retry-After`: * parsed seconds embedded in `providerMessage` text; raw header * value on `cause.retryAfter`. No structured `retryAfterSeconds` field per * Retry is consumer policy (no retryAfterSeconds field). */ private mapVendorError; sendMessage(options: ISmsOptions, bridgeProviderData?: WithPassthrough>): Promise; }