import { APIError } from "../generated/codes"; export interface Extractor { [key: string]: (v: T) => any; } export interface Context { [key: string]: any; } export interface RequestDetails { url: string; path: string; status?: number; uuid?: string; authToken?: string; locale?: string; sessionID?: string; deviceID?: string; } export declare type SystemErrorType = "timeout" | "no_status" | "bad_status" | "unrecognized_data_body" | "unrecognized_error_body"; export declare type ResponseError = { kind: "error"; error: APIError; details: RequestDetails; } | { kind: "system_error"; type: SystemErrorType; details: RequestDetails; } | { kind: "custom_error"; text: string; }; export declare type Response = { kind: "data"; data: T; details: RequestDetails; } | ResponseError; export declare type Method = "POST" | "GET" | "DELETE"; export interface MethodAndPath { method: Method; path: string; } export interface APIRequest { method: string; url: string; request?: any; expansions?: string[]; } export interface APIResponse { status: number; response?: any; error?: APIError; } export declare function requestErrorPrefix(details: RequestDetails): string; export declare function prettyPrintResponseError(err: ResponseError, detailed?: boolean): string; declare class RequestBuilder { private _ctx; private _method; private _path; private _params; private _status; private _extract; private _data; private _expansionsSet; constructor(ctx: Context, methodAndPath: string); private expandRecursive; expand(v: any): this; expectStatus(v: number): this; extract(v: Extractor): this; data(v: any): this; clone(): RequestBuilder; send(): Promise>; sendUnwrap(): Promise; } export declare function requestFunction(ctx: Context, methodAndPath: string): RequestBuilder; export declare function isExpanded(v: T | { id: string; } | null | undefined): v is T; export declare function assertExpanded(v: T | { id: string; } | null | undefined): T; export {};