-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathApi.js
More file actions
34 lines (29 loc) · 686 Bytes
/
Api.js
File metadata and controls
34 lines (29 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// @flow
import Resource from "./Resource";
type ApiOptions = {
title?: string,
resources?: Map<string, Resource>
};
/**
* @property {string} entrypoint - The URL of the API's entrypoint
*/
export default class Api {
entrypoint: string;
title: string;
resources: Array<Resource>;
/**
* @param {string} entrypoint
* @param {?ApiOptions} options
*/
constructor(entrypoint: string, options: ApiOptions = {}) {
this.entrypoint = entrypoint;
Object.keys(options).forEach(key => {
Object.defineProperty(this, key, {
readable: true,
writable: true,
enumerable: true,
value: options[key]
});
});
}
}