import type { Result } from "../types.mjs"; /** Thin wrapper around `fetch` used by every HTTP-based driver (Resend, * Postmark, SendGrid, Mailgun, Mailtrap, Brevo, MailerSend, Loops, Zeptomail, * MailChannels, HTTP). Handles JSON encoding, response parsing, and * mapping HTTP status codes to our `EmailErrorCode` taxonomy. * * Drivers pass a tiny `classifyError()` callback when the provider * returns richer error codes than plain HTTP (Postmark's `ErrorCode 10`, * SendGrid's `errors[].field`, etc.). */ export interface HttpRequestInit { fetch: typeof fetch; driver: string; url: string; method?: string; headers?: Record; body?: unknown; /** Return a custom EmailErrorCode classification from the parsed body. */ classifyError?: (status: number, body: unknown) => { code: "AUTH" | "RATE_LIMIT" | "NETWORK" | "PROVIDER"; retryable?: boolean; message?: string; } | null; } /** Issue a JSON HTTP request and return a `Result` where the * data is the parsed response (or null for empty bodies). */ export declare function httpJson(init: HttpRequestInit): Promise>;