import { Resource, State as ResourceState } from 'ketting';
import { ResourceLike } from '../util';
/**
 * The result of a useResource hook.
 */
export declare type UseResourceResponse<T> = {
    loading: boolean;
    error: Error | null;
    resourceState: ResourceState<T>;
    setResourceState: (newState: ResourceState<T>) => void;
    submit: (state?: ResourceState<T>) => Promise<void>;
    data: T;
    setData: (newData: T) => void;
    resource: Resource<T>;
};
export declare type UseResourceOptions<T> = {
    initialState?: T | ResourceState<T>;
    refreshOnStale?: boolean;
};
/**
 * The useResource hook allows you to GET and PUT the state of
 * a resource.
 *
 * Example call:
 *
 * <pre>
 *   const {
 *     loading,
 *     error,
 *     resourceState,
 *     setResourceState,
 *     submit
 *  } = useResource(resource);
 * </pre>
 *
 * Returned properties:
 *
 * * loading - will be true as long as the result is still being fetched from
 *             the server.
 * * error - Will be null or an error object.
 * * resourceState - A state object. The `.data` property of this object will
 *                   contain the parsed JSON from the server.
 * * setResourceState - Update the local cache of the resource.
 * * submit - Send a PUT request to the server.
 *
 * If you don't need the full resourceState, you can also use the `data` and
 * `setData` properties instead of `resourceState` or `useResourceState`.
 */
export declare function useResource<T = any>(resourceLike: ResourceLike<any>, options?: UseResourceOptions<T>): UseResourceResponse<T>;
