@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint manager to set up, configure and monitor 3D printers. Our aim is to provide extremely optimized websocket performance and reliability.
103 lines (102 loc) • 3.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "OctoprintRoutes", {
enumerable: true,
get: function() {
return OctoprintRoutes;
}
});
class OctoprintRoutes {
octoPrintBase = "/";
apiBase = `${this.octoPrintBase}api`;
apiVersion = `${this.apiBase}/version`;
apiServer = `${this.apiBase}/server`;
apiCurrentUser = `${this.apiBase}/currentuser`;
apiSettingsPart = `${this.apiBase}/settings`;
apiFiles = `${this.apiBase}/files`;
apiFilesLocal = `${this.apiFiles}/local`;
apiConnection = `${this.apiBase}/connection`;
apiJob = `${this.apiBase}/job`;
apiPrinter = `${this.apiBase}/printer`;
apiPrinterHead = `${this.apiBase}/printer/printhead`;
apiPrinterBed = `${this.apiPrinter}/bed`;
apiPrinterCustomCommand = `${this.apiPrinter}/command`;
apiPrinterProfiles = `${this.apiBase}/printerprofiles`;
apiSystem = `${this.apiBase}/system`;
apiSystemInfo = `${this.apiSystem}/info`;
apiSystemCommands = `${this.apiSystem}/commands`;
apiServerRestartCommand = `${this.apiSystemCommands}/core/restart`;
apiUsers = `${this.apiBase}/users`;
apiLogin = `${this.apiBase}/login`;
get disconnectCommand() {
return {
command: "disconnect"
};
}
get cancelJobCommand() {
return {
command: "cancel"
};
}
get pauseJobCommand() {
return {
command: "pause",
action: "pause"
};
}
get resumeJobCommand() {
return {
command: "pause",
action: "resume"
};
}
get connectCommand() {
return {
command: "connect"
};
}
getBedTargetCommand(targetTemperature) {
return {
command: "target",
target: targetTemperature
};
}
apiPrinterCurrent = (history, limit, exclude)=>{
exclude = exclude?.filter((e)=>!!e.length);
const excludeParam = exclude?.length ? `&exclude=${exclude?.join(",")}` : "";
const limitParam = !!limit ? `&limit=${limit}` : "";
return `${this.apiPrinter}?history=${!!history}${limitParam}${excludeParam}`;
};
apiFile = (path)=>`${this.apiFilesLocal}/${path}`;
downloadFileLocal = (path)=>`${this.octoPrintBase}downloads/files/local/${path}`;
apiGetFiles = (recursive = false)=>`${this.apiFiles}/local?recursive=${recursive}`;
selectCommand(print = false) {
return {
command: "select",
print
};
}
moveFileCommand(destination) {
return {
command: "move",
destination
};
}
printerNameSetting(name) {
return {
appearance: {
name: name
}
};
}
gcodeAnalysisSetting(enabled) {
return {
gcodeAnalysis: {
runAt: enabled ? "idle" : "never"
}
};
}
}
//# sourceMappingURL=octoprint-api.routes.js.map