1 | import FollowablePromise from './followable-promise';
|
2 | import Representor from './representor/base';
|
3 | import Resource from './resource';
|
4 | import { ContentType, KettingInit } from './types';
|
5 | import './utils/fetch-polyfill';
|
6 |
|
7 |
|
8 |
|
9 | export default class Ketting {
|
10 | |
11 |
|
12 |
|
13 | bookMark: string;
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 | resourceCache: {
|
20 | [url: string]: Resource;
|
21 | };
|
22 | |
23 |
|
24 |
|
25 |
|
26 |
|
27 | contentTypes: ContentType[];
|
28 | |
29 |
|
30 |
|
31 | private fetchHelper;
|
32 | constructor(bookMark: string, options?: KettingInit);
|
33 | /**
|
34 | * This function is a shortcut for getResource().follow(x);
|
35 | */
|
36 | follow(rel: string, variables?: object): FollowablePromise;
|
37 | /**
|
38 | * Returns a resource by its uri.
|
39 | *
|
40 | * This function doesn't do any HTTP requests. The uri is optional. If it's
|
41 | * not specified, it will return the bookmark resource.
|
42 | *
|
43 | * If a relative uri is passed, it will be resolved based on the bookmark
|
44 | * uri.
|
45 | */
|
46 | go(uri?: string): Resource;
|
47 | /**
|
48 | * Returns a resource by its uri.
|
49 | *
|
50 | * This function doesn't do any HTTP requests. The uri is optional. If it's
|
51 | * not specified, it will return the bookmark resource.
|
52 | */
|
53 | getResource(uri?: string): Resource;
|
54 | /**
|
55 | * This function does an arbitrary request using the fetch API.
|
56 | *
|
57 | * @see {@link https:
|
58 | */
|
59 | fetch(input: string | Request, init?: RequestInit): Promise<Response>;
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | getRepresentor(contentType: string): typeof Representor;
|
67 | |
68 |
|
69 |
|
70 | getAcceptHeader(): string;
|
71 | beforeRequest(request: Request): void;
|
72 | }
|