import { Context } from 'react'; import { AxiosInstance, AxiosRequestConfig } from 'axios'; import { APIConfig, ResponseUnwrapper, APIConfigOptions } from './types'; import { QueryParams } from '../util/query-string'; type APIBase = { baseURL: string; axiosInstance: AxiosInstance; }; type APIContextValue = APIBase & { config: APIConfig; }; type APIProviderCoreProps = APIConfigOptions & Partial & { config?: Partial; }; type APIProviderProps = APIProviderCoreProps & { context?: Context; children?: React.ReactChild; }; type APIContextType = Context; export type APIContext = APIContextType; declare function createAPIContext(defaultProps?: APIProviderCoreProps): APIContextType; declare const APIContext: APIContextType; declare const APIHelpers: (ctx: APIContextValue) => { buildURL(route?: string, params?: {}): string; processOptions(opts?: APIConfigOptions): APIConfig; }; interface APIActions { post(route: string, params: QueryParams, payload: any, opts: APIConfigOptions): Promise; post(route: string, payload: any, opts?: APIConfigOptions): Promise; get(route: string, params: QueryParams, opts: APIConfigOptions): Promise; get(route: string, opts?: APIConfigOptions): Promise; } declare const APIActions: (ctx: APIContextValue) => APIActions; declare function APIProvider(props: APIProviderProps): import('react').FunctionComponentElement>; declare const useAPIActions: (ctx?: APIContextType) => APIActions; declare const useAPIHelpers: (ctx?: APIContextType) => { buildURL(route?: string, params?: {}): string; processOptions(opts?: APIConfigOptions): APIConfig; }; type APIHookOpts = Partial; declare function useAxiosInstance(context?: APIContextType): AxiosInstance; declare function useAPIResult(route: string | null, params?: QueryParams, opts?: APIHookOpts | ResponseUnwrapper): T; export { createAPIContext, useAxiosInstance, APIContext, APIProvider, APIActions, APIHelpers, useAPIActions, useAPIResult, useAPIHelpers, };