forked from aaronmars/martian
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
32 lines (28 loc) · 934 Bytes
/
api.js
File metadata and controls
32 lines (28 loc) · 934 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
import { Plug } from 'mindtouch-http.js/plug.js';
import { Settings } from './lib/settings.js';
/**
* A class for validating HTTP requests to the MindTouch site API.
*/
export class Api {
/**
* Construct a new API object.
* @param {Settings} [settings] - The {@link Settings} information to use in construction. If not supplied, the default settings are used.
*/
constructor(settings = new Settings()) {
this._plug = new Plug(settings.host, settings.plugConfig).at('@api', 'deki');
}
/**
* Validate HTTP request
* @returns {Promise} - A Promise that, when resolved, indicates a successful HTTP request.
*/
http() {
return this._plug.at('http').get();
}
/**
* Validate HTTP request
* @returns {Promise} - A Promise that, when resolved, indicates a successful F1 HTTP request.
*/
f1() {
return this._plug.at('f1').get();
}
}