import Resource from './resource'; import { LinkVariables } from './link'; /** * Base interface for both FollowOne and FollowAll */ declare abstract class FollowPromise implements PromiseLike { protected prefetchEnabled: boolean; protected preferPushEnabled: boolean; protected preferTranscludeEnabled: boolean; protected useHeadEnabled: boolean; constructor(); preFetch(): this; preferPush(): 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(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; abstract catch(onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; } /** * 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 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 extends FollowPromise> { private resource; private rel; private variables?; constructor(resource: Resource | Promise, 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, TResult2 = never>(onfulfilled?: ((value: Resource) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: Error) => TResult2 | PromiseLike) | null | undefined): Promise; /** * This 'catch' function behaves like a Promise catch() function. */ catch(onrejected?: ((reason: Error) => TResult2 | PromiseLike) | null | undefined): Promise; /** * Implementation of a Promise.finally function */ finally(onfinally: () => TResult1 | PromiseLike): Promise; /** * 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(rel: string, variables?: LinkVariables): FollowPromiseOne; /** * Follows a set of links immediately after following this link. * * For example: resource.follow('foo').followAll('item'); */ followAll(rel: string): FollowPromiseMany; /** * This function does the actual fetching of the linked * resource. */ private fetchLinkedResource; } /** */ export declare class FollowPromiseMany extends FollowPromise[]> { private resource; private rel; constructor(resource: Resource | Promise, rel: string); /** * This 'then' function behaves like a Promise then() function. */ then[], TResult2 = never>(onfulfilled?: ((value: Resource[]) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: Error) => TResult2 | PromiseLike) | null | undefined): Promise; /** * This 'catch' function behaves like a Promise catch() function. */ catch(onrejected?: ((reason: Error) => TResult2 | PromiseLike) | null | undefined): Promise; /** * Implementation of a Promise.finally function */ finally(onfinally: () => TResult1 | PromiseLike): Promise; /** * This function does the actual fetching, to obtained the url * of the linked resource. It returns the Resource object. */ private fetchLinkedResources; } export {};