2016-04-21 15:32:11 +02:00
|
|
|
import * as rest from '../rest.js';
|
2015-07-15 15:06:18 +02:00
|
|
|
|
2016-04-21 15:44:20 +02:00
|
|
|
export default class Printer {
|
2016-04-21 15:52:23 +02:00
|
|
|
constructor(api) {
|
|
|
|
this.api = api;
|
|
|
|
}
|
|
|
|
temperature() {
|
|
|
|
return rest.get(`${ this.api }printer/temperature`);
|
|
|
|
}
|
|
|
|
progress() {
|
|
|
|
return rest.get(`${ this.api }printer/progress`);
|
|
|
|
}
|
|
|
|
state() {
|
|
|
|
return rest.get(`${ this.api }printer/state`);
|
|
|
|
}
|
|
|
|
listAll() {
|
|
|
|
return rest.get(`${ this.api }printer/listall`);
|
|
|
|
}
|
|
|
|
heatup() {
|
|
|
|
return rest.post(`${ this.api }printer/heatup`, {});
|
|
|
|
}
|
|
|
|
print(gcode = '', first = false, start = false, last) {
|
2016-07-20 10:16:53 +02:00
|
|
|
return rest.post(`${ this.api }printer/print`, { gcode, first, start, last });
|
2016-04-21 15:52:23 +02:00
|
|
|
}
|
|
|
|
stop(gcode = '') {
|
2016-07-20 10:16:53 +02:00
|
|
|
return rest.post(`${ this.api }printer/stop`, { gcode });
|
2016-04-21 15:52:23 +02:00
|
|
|
}
|
2015-10-12 12:33:33 +02:00
|
|
|
}
|