import { BaseConnector } from '../../base/base.connector'; import type { IChatOptions, IChatProvider, ISendMessageSuccessResponse, WithPassthrough, ChatSendResult, IChatConnector } from '../../types'; import { ChannelTypeEnum } from '../../types'; import type { MattermostConfig } from './mattermost.config'; import type { MattermostNarrowedInput } from './mattermost.types'; /** * Webhook-URL-as-auth. No Authorization header; the webhookUrl IS the * credential. * * Mattermost Incoming Webhooks return plain text `"ok"` on success (HTTP 200) * and an error string on failure — non-JSON body parsing throughout. No * message_id is returned, so `providerMessageId` is always `null`. * * Mattermost adopted Slack's legacy attachment format verbatim. The * camelCase→snake_case mapping for attachment fields lives in the private * `toWireAttachment` method below (explicit per-connector * mapping, NOT generic middleware). */ export declare class MattermostChatConnector extends BaseConnector implements IChatProvider, IChatConnector { private config; readonly id: "mattermost"; readonly channelType: ChannelTypeEnum.CHAT; constructor(config: MattermostConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IChatConnector`. * * `to` is intentionally absent from `MattermostNarrowedInput` — the webhook * URL targets the (default) channel directly. All snake_case wire * keys (`icon_url`, `icon_emoji`, and per-attachment `author_name`, * `author_link`, `author_icon`, `title_link`, `image_url`, `thumb_url`, * `footer_icon`) are written explicitly; no `Casing` * helper is invoked. */ send(input: MattermostNarrowedInput): Promise; /** * Map camelCase narrowed attachment fields to Slack-compat snake_case wire * keys. Lives on the connector (NOT a shared utility): * explicit per-connector mapping for the Slack-compat-attachment-shape * contract this connector owns. * * Same-form fields (`color`, `pretext`, `title`, `text`, `fields`, `footer`, * `timestamp`, `fallback`) pass through untouched. Unknown extension keys * are preserved verbatim via the `[k: string]: unknown` index signature. */ private toWireAttachment; /** * HTTP-layer mapping. ConnectorError carries no * `retryAfterSeconds` field — retry is consumer policy: * parsed seconds embedded in `providerMessage` text, raw header preserved on * `cause.retryAfter`. Wrapper performs no retry. * * 401/403/404 all map to `auth_failed` — invalid, revoked, or * non-existent Incoming Webhook IDs are all credential failures. */ private mapVendorError; sendMessage(options: IChatOptions, bridgeProviderData?: WithPassthrough>): Promise; }