///
import { ClientResponse } from './client';
export declare type PublicRequestState = Readonly<{
data: R | null;
loading: boolean;
isCalled: boolean;
isCanceled?: boolean;
error?: Error;
}>;
export declare type RequestState = PublicRequestState & Readonly<{
prevHeaders?: Record;
prevVariables?: Record;
prevParams?: Record;
}>;
export declare type RequestAction = {
type: 'call';
headers: Record;
variables: Record;
params?: Record;
} | {
type: 'success';
response: ClientResponse;
} | {
type: 'failure';
response: ClientResponse;
} | {
type: 'cancel';
};
export declare type RequestReducer = React.Reducer, RequestAction>;
export declare function requestReducer(state: RequestState, action: RequestAction): {
loading: boolean;
data: R;
isCalled: boolean;
isCanceled?: boolean | undefined;
error?: Error | undefined;
prevHeaders?: Record | undefined;
prevVariables?: Record | undefined;
prevParams?: Record | undefined;
} | {
loading: boolean;
data: null;
error: Error | undefined;
isCanceled: boolean | undefined;
isCalled: boolean;
prevHeaders?: Record | undefined;
prevVariables?: Record | undefined;
prevParams?: Record | undefined;
} | {
isCanceled: boolean;
error: undefined;
data: R | null;
loading: boolean;
isCalled: boolean;
prevHeaders?: Record | undefined;
prevVariables?: Record | undefined;
prevParams?: Record | undefined;
};