import Resource from './resource';
import { LinkVariables } from './link';
/**
 * Base interface for both FollowOne and FollowAll
 */
declare abstract class FollowPromise<T> implements PromiseLike<T> {
    protected prefetchEnabled: boolean;
    protected preferTranscludeEnabled: boolean;
    protected useHeadEnabled: boolean;
    constructor();
    preFetch(): this;
    preferTransclude(): this;
    /**
     * Use a HTTP HEAD request to fetch the links.
     *
     * This is useful when interacting with servers that embed links in Link
     * Headers.
     */
    useHead(): this;
    abstract then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
    abstract catch<TResult1 = T, TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
}
/**
 * The FollowPromise class is what's being returned from follow() functions.
 *
 * It's 'PromiseLike', which means you can treat it like a Promise, and it
 * can be awaited. When used as a Promise, it resolves to the Resource object
 * that was followed.
 *
 * In addition to being a Promise<Resource> stand-in, it also exposes other
 * functions, namely:
 *
 * * `follow()` to allow a user to chain several follow() functions to do
 *   several 'hops' all at once.
 * * `followAll()`, allowing a user to call `followAll()` at the end of a
 *   chain.
 */
export declare class FollowPromiseOne<T = any> extends FollowPromise<Resource<T>> {
    private resource;
    private rel;
    private variables?;
    constructor(resource: Resource | Promise<Resource>, rel: string, variables?: LinkVariables);
    /**
     * This 'then' function behaves like a Promise then() function.
     *
     * This method signature is pretty crazy, but trust that it's pretty much
     * like any then() method on a promise.
     */
    then<TResult1 = Resource<T>, TResult2 = never>(onfulfilled?: ((value: Resource<T>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: Error) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
    /**
     * This 'catch' function behaves like a Promise catch() function.
     */
    catch<TResult1 = any, TResult2 = never>(onrejected?: ((reason: Error) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
    /**
     * Implementation of a Promise.finally function
     */
    finally<TResult1 = any>(onfinally: () => TResult1 | PromiseLike<TResult1>): Promise<TResult1>;
    /**
     * Follow another link immediately after following this link.
     *
     * This allows you to follow several hops of links in one go.
     *
     * For example: resource.follow('foo').follow('bar');
     */
    follow<TNested = any>(rel: string, variables?: LinkVariables): FollowPromiseOne<TNested>;
    /**
     * Follows a set of links immediately after following this link.
     *
     * For example: resource.follow('foo').followAll('item');
     */
    followAll<TNested = any>(rel: string): FollowPromiseMany<TNested>;
    /**
     * This function does the actual fetching of the linked
     * resource.
     */
    private fetchLinkedResource;
}
/**
 */
export declare class FollowPromiseMany<T = any> extends FollowPromise<Resource<T>[]> {
    private resource;
    private rel;
    constructor(resource: Resource | Promise<Resource>, rel: string);
    /**
     * This 'then' function behaves like a Promise then() function.
     */
    then<TResult1 = Resource<T>[], TResult2 = never>(onfulfilled?: ((value: Resource<T>[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: Error) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
    /**
     * This 'catch' function behaves like a Promise catch() function.
     */
    catch<TResult1 = any, TResult2 = never>(onrejected?: ((reason: Error) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
    /**
     * Implementation of a Promise.finally function
     */
    finally<TResult1 = any>(onfinally: () => TResult1 | PromiseLike<TResult1>): Promise<TResult1>;
    /**
     * This function does the actual fetching, to obtained the url
     * of the linked resource. It returns the Resource object.
     */
    private fetchLinkedResources;
}
export {};
