/** * The http library agnostic response. */ export interface ApiResponse< T = any[] | Record | string | null > extends Pick { /** * The parsed response content. * (in the case of libraries like axios) */ data?: T; /** * The request that got this response. */ request?: Record & (RequestInit | XMLHttpRequest); /** * The url the request was sent to. */ url?: string; /** * Additional information. */ [key: string]: any; /** * The fetch json method resolving to the given type. */ json?: () => Promise>; } /** * Interface prescribes what's expected to be implemented * by an object that is used for handling the requests. */ export default interface HandlesApiResponse { /** * Handle the promised response. * * @param promise * * @return {Promise} */ handle: (promise: Promise) => Promise; }