Doodle3D-API/src/api/update.js

35 lines
865 B
JavaScript
Raw Normal View History

2017-11-30 17:23:13 +01:00
import { parseFetch } from '../utils.js';
2015-07-15 15:06:18 +02:00
2016-04-21 15:44:20 +02:00
export default class Update {
2016-04-21 15:52:23 +02:00
constructor(api) {
this.api = api;
}
status() {
2017-11-30 17:23:13 +01:00
return fetch(`${this.api}update/status`, { method: 'GET' }).then(parseFetch);
2016-04-21 15:52:23 +02:00
}
download() {
//not tested
2017-11-30 17:23:13 +01:00
return fetch(`${this.api}update/download`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
}).then(parseFetch);
2016-04-21 15:52:23 +02:00
}
install() {
//not tested
2017-11-30 17:23:13 +01:00
return fetch(`${this.api}update/install`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
}).then(parseFetch);
2016-04-21 15:52:23 +02:00
}
clear() {
//not tested
2017-11-30 17:23:13 +01:00
return fetch(`${this.api}update/clear`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
}).then(parseFetch);
2016-04-21 15:52:23 +02:00
}
}