import type { SessionOrToken } from '../auth'; /** * Superset of a normal RequestInit, with some shorthand properties to * automatically add authentication and data serialization. */ type RequestOptions = RequestInit & { auth: SessionOrToken; path: string; /** * contains values that are encoded into the query parameter and appended * to the `path` */ params?: Record; } & (GetRequest | PostRequest); /** * Various payload formats. At most one of these properties * should be specified. */ type Payloads = { /** * Serializes into an encoded form. Sets the Content-Type header to * 'application/x-www-form-urlencoded' if not already specified */ fields?: Record; /** * Serializes into a JSON string. Sets the Content-Type header to * 'application/json' if not already specified */ json?: any; /** * Any supported request body type. Has no special handling. */ body?: RequestInit['body']; }; /** Get requests (default method) do no support payloads */ type GetRequest = { method?: 'GET'; } & AllowOnly; type PostRequest = { method: 'POST'; } & OneOf; /** * Makes a network request, following most `fetch` semantics. Has a few * additional convenience properties to deal with headers and serialization */ export declare function makeRequest(opts: RequestOptions): Promise; export declare class ErrorResponseBody extends Error { detail: string; constructor(message: string, detail: string); } export declare function parseResponseBody(response: Response): Promise; export {};