UNPKG

1.78 kBTypeScriptView Raw
1import { IClient, ITokenContext } from './definitions';
2/**
3 * `Client` is for making HTTP requests to the API.
4 *
5 * Under the hood, it uses
6 * [superagent](http://visionmedia.github.io/superagent/). When a method is
7 * called, you can call any number of superagent functions on it and then call
8 * `end()` to complete and send the request.
9 *
10 * @featured
11 */
12export declare class Client implements IClient {
13 /**
14 * @hidden
15 */
16 tokenContext: ITokenContext;
17 /**
18 * @hidden
19 */
20 baseUrl: string;
21 /**
22 * @private
23 */
24 private req;
25 constructor(
26 /**
27 * @hidden
28 */
29 tokenContext: ITokenContext,
30 /**
31 * @hidden
32 */
33 baseUrl: string, req?: any);
34 /**
35 * GET request for retrieving a resource from the API.
36 *
37 * @param endpoint - The path of the API endpoint.
38 */
39 get(endpoint: string): any;
40 /**
41 * POST request for sending a new resource to the API.
42 *
43 * @param endpoint - The path of the API endpoint.
44 */
45 post(endpoint: string): any;
46 /**
47 * PUT request for replacing a resource in the API.
48 *
49 * @param endpoint - The path of the API endpoint.
50 */
51 put(endpoint: string): any;
52 /**
53 * PATCH request for performing partial updates to a resource in the API.
54 *
55 * @param endpoint - The path of the API endpoint.
56 */
57 patch(endpoint: string): any;
58 /**
59 * DELETE request for deleting a resource from the API.
60 *
61 * @param endpoint - The path of the API endpoint.
62 */
63 delete(endpoint: string): any;
64 /**
65 * @hidden
66 */
67 request(method: string, endpoint: string): any;
68 /**
69 * @private
70 */
71 private supplement(fn, endpoint);
72}