import { HttpError, type HandlerEnv, type HandlerFs, type HttpErrorRequest, type HttpErrorResponse } from "../../toolcraft/dist/index.js";
import type { TokenSource } from "./auth/types.js";
export { HttpError };
export type { HttpErrorRequest, HttpErrorResponse };
type QueryScalar = string | number | boolean | null | undefined;
type QueryObject = {
    readonly [key: string]: QueryValue;
};
type HeaderScalar = string | number | boolean | undefined;
export type QueryValue = QueryScalar | QueryValue[] | QueryObject;
export interface HttpRequestOptions {
    baseUrl: string;
    path: string;
    method: string;
    tokenSource: TokenSource;
    auth: "required" | "none";
    fetch?: typeof globalThis.fetch;
    pathParams?: Record<string, string | number | boolean>;
    query?: Record<string, QueryValue>;
    headers?: Record<string, HeaderScalar>;
    body?: unknown;
    bodyMode?: "json" | "form" | "raw" | "base64" | "multipart";
    contentType?: string;
    multipartBinaryFields?: readonly string[];
    responseMode?: "json" | "text" | "binary";
    accept?: string;
    dryRun?: boolean;
    verbose?: boolean;
    signal?: AbortSignal;
    rawResponse?: boolean;
    retries?: {
        max: number;
        backoff: "exponential";
        retryOn: number[];
        sleep?: (ms: number) => Promise<void>;
        random?: () => number;
    };
    idempotency?: {
        header: string;
        enabled: boolean;
        key?: string;
        createKey?: () => string;
    };
    writeStdout?: (chunk: string) => void;
    writeStderr?: (chunk: string) => void;
}
export interface BinaryHttpResponse {
    contentType: string;
    encoding: "base64";
    byteLength: number;
    data: string;
}
type RuntimeFileSystem = Pick<HandlerFs, "exists" | "readFile" | "writeFile">;
type RuntimeEnvironment = Pick<HandlerEnv, "get">;
type RequestShape = Partial<Pick<HttpRequestOptions, "pathParams" | "query" | "headers" | "body">>;
export declare function requestJson<TResult = unknown>(options: HttpRequestOptions): Promise<TResult | undefined>;
export declare function prepareMultipartFileInputs(requestShape: RequestShape, options: {
    bodyMode?: HttpRequestOptions["bodyMode"];
    multipartBinaryFields?: readonly string[];
    fs?: RuntimeFileSystem;
    env?: RuntimeEnvironment;
}): Promise<RequestShape>;
export declare function writeBinaryResponseOutput(result: unknown, outputPath: unknown, runtime: {
    fs?: RuntimeFileSystem;
    env?: RuntimeEnvironment;
}): Promise<unknown>;
