import { type Config } from './config.js'; export declare class RustpadApiError extends Error { readonly status: number; readonly body: string; constructor(status: number, body: string, method: string, path: string); } /** Server statistics as returned by `GET /api/stats`. */ export interface RustpadStats { start_time: number; num_documents: number; database_size: number; } /** * Client for Rustpad's two HTTP endpoints (verified against ekzhang/rustpad * `rustpad-server/src/lib.rs`). Everything else — writing, language, presence — * speaks the WebSocket protocol in `session.ts`. */ export declare class RustpadApi { private readonly config; private readonly baseUrl; /** * Only set when RUSTPAD_INSECURE_TLS is enabled. Scopes the relaxed * certificate validation to requests against the configured host instead of * disabling it process-wide via NODE_TLS_REJECT_UNAUTHORIZED. */ private readonly insecureDispatcher?; constructor(config: Config); private request; /** * Current text of a document, as plain text. An empty string is ambiguous: * Rustpad answers it both for an empty pad and for one that never existed * or has expired. */ text(id: string): Promise; stats(): Promise; } /** * Guards a value that ends up in a URL path or WebSocket path. * * Rustpad accepts any string as a document id, but ids outside this shape are * almost always an attempt at path traversal — and with enough `..` the * request reaches a different endpoint entirely. */ export declare function assertDocumentId(value: string): string;