0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-06-01 21:44:31 +02:00
Doodle3D-API/src/api/network.js
casperlamboo 2e3b174d3b clean up
code is in single line
2016-07-20 10:16:53 +02:00

43 lines
956 B
JavaScript

import * as rest from '../rest.js';
export default class Network {
constructor(api) {
this.api = api;
}
scan() {
return rest.get(`${ this.api }network/scan`);
}
known() {
return rest.get(`${ this.api }network/known`);
}
status() {
return rest.get(`${ this.api }network/status`);
}
assosiate(ssid, phrase, recreate = false) {
return rest.post(`${ this.api }network/associate`, { ssid, phrase, recreate });
}
disassociate() {
//not tested
return rest.post(`${ this.api }network/disassociate`, {});
}
openAccesPoint() {
//not tested
return rest.post(`${ this.api }network/openap`, {});
}
remove(ssid) {
return rest.post(`${ this.api }network/remove`, { ssid });
}
signin() {
return rest.get(`${ this.api }network/signin`);
}
async alive() {
try {
await rest.get(`${ this.api }network/alive`);
return true;
} catch(error) {
return false;
}
}
}