@metis-w/api-client
Version:
Modern TypeScript HTTP API client with dynamic routes, parameterized endpoints, interceptors, and advanced features
25 lines • 684 B
TypeScript
export interface APIResponse<T = any> {
success: boolean;
error?: {
code?: number;
message?: string;
};
data?: T;
}
export interface RawResponse {
status: number;
statusText: string;
headers: Record<string, string>;
body: any;
}
export interface ClientError {
message: string;
type: "network" | "timeout" | "abort" | "parse";
originalError?: Error;
response?: RawResponse;
}
export interface ResponseInterceptor {
onResponse?: <T>(response: APIResponse<T>) => APIResponse<T> | Promise<APIResponse<T>>;
onError?: (error: ClientError) => ClientError | Promise<ClientError>;
}
//# sourceMappingURL=response.d.ts.map