import { ZodType } from 'zod'; type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'TRACE' | 'CONNECT'; type ContentType = 'application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data'; type QueryValue = string | string[] | number | number[]; /** * Fluent fetch-api wrapper * * Example usage: * ```ts * const httpClient = new HttpClient("http://127.0.0.1:8080"); * * const { data, error } = await httpClient * .path('/v1/auth') * .basicAuth('user', 'pass') * .prevalidate(loginRequestSchema) // prevalidate with zod before execute request * .data({ * domain: 'grave-brief', * email: 'adela17@gmail.com', * password: 'MyPassword2025!', * }) * .post<{ refreshToken: string }>(); * console.log('login result:', data); * * const refresh = await httpClient.path('/v1/auth').bearer(res.refreshToken).patch(); * * console.log('refresh result:', refresh); * ``` */ export declare class HttpClient { #private; constructor(baseUrl?: string); url(url: string): this; path(path: string): this; /** * Set the request to send FormData */ form(): this; rawBody(body: string, type: string): void; queryParams(params: Record): this; query(key: string, value: QueryValue): this; setContentType(type: ContentType): void; data(data: Record, type?: ContentType): this; bearer(token: string): this; basicAuth(username: string, password: string): this; private toStringValue; headers(headers: Record): this; header(name: string, value: string | any[] | number): this; credentials(opt: RequestCredentials): this; method(method: HttpMethod): this; get(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; post(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; put(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; patch(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; delete(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; options(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; head(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; trace(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; connect(): Promise<{ data: null; error: import("../exception").ExceptionType; } | { data: T; error: null; }>; private toFormData; private getBody; /** * Set the schema to validate data (of body) before sending the request at 'do' */ prevalidate(schema: ZodType): this; private reset; private execute; /** * Execute request and return data/error monade */ private do; } export {};