@metis-w/api-client
Version:
Modern TypeScript HTTP API client with dynamic routes, parameterized endpoints, interceptors, and advanced features
22 lines • 843 B
TypeScript
import { APIResponse, ClientError } from "../../types";
/**
* Utilities for parsing HTTP responses and creating standardized error objects
*/
export declare class ResponseParser {
/**
* Parses the response from the fetch call, handling both success and error cases.
* It returns a standardized APIResponse object.
*
* @param response - The Response object from the fetch call
* @returns A Promise that resolves to an APIResponse object
*/
static parseResponse<T>(response: Response): Promise<APIResponse<T>>;
/**
* Creates a standardized ClientError object from any caught error.
*
* @param error - The error to convert
* @returns A standardized ClientError object
*/
static createClientError(error: unknown): ClientError;
}
//# sourceMappingURL=response-parser.d.ts.map