import { BaseConnector } from '../../base/base.connector'; import type { IChatOptions, IChatProvider, ISendMessageSuccessResponse, WithPassthrough, ChatSendResult, IChatConnector } from '../../types'; import { ChannelTypeEnum } from '../../types'; import type { DiscordConfig } from './discord.config'; import type { DiscordNarrowedInput } from './discord.types'; /** * Webhook-URL-as-auth. No Authorization header; the webhookUrl IS the credential. * * `?wait=true` is always appended so Discord returns the created message ID in * the response body (default behavior is HTTP 204 No Content with no body). * `?thread_id=` is appended when `input.threadId` is set — Discord uses a * query param, not a body field, to target an existing thread. * * Retry-After dual-path (outlier, surfaced): * Discord historically emits `Retry-After` in MILLISECONDS in the HTTP header, * but the body field `retry_after` is in seconds (float, since API v8). The * connector parses both paths and normalizes to seconds, surfacing the value * informationally — `ConnectorError` carries no `retryAfterSeconds` field; the * wrapper performs no retry. */ export declare class DiscordChatConnector extends BaseConnector implements IChatProvider, IChatConnector { private config; readonly id: "discord"; readonly channelType: ChannelTypeEnum.CHAT; constructor(config: DiscordConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IChatConnector`. * * `to` is intentionally absent from `DiscordNarrowedInput` — the webhook URL * targets the channel directly. All snake_case wire keys * (`avatar_url`, `allowed_mentions`, `thread_name`) are written explicitly * no `Casing` helper is invoked. */ send(input: DiscordNarrowedInput): Promise; /** * HTTP-layer mapping. ConnectorError carries no * `retryAfterSeconds` field — retry is consumer policy: * parsed seconds embedded in `providerMessage` text; raw header preserved on * `cause.retryAfter`; raw body float on `cause.retryAfterBody`. Wrapper * performs no retry. * * 401/403/404 all map to `auth_failed` — invalid, revoked, or * deleted webhook URLs are all credential failures. * * Discord Retry-After dual path (outlier): * - Body `retry_after` (seconds, float, canonical since API v8): prefer; ceil to seconds. * - Header `Retry-After` (legacy, historically ms): heuristic — values > 1000 → ms, else seconds. * See https://discord.com/developers/docs/topics/rate-limits. */ private mapVendorError; private appendQuery; sendMessage(options: IChatOptions, bridgeProviderData?: WithPassthrough>): Promise; }