@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint, Klipper, PrusaLink and BambuLab manager to set up, configure and monitor 3D printers. Our aim is to provide neat overview over your farm.
79 lines (78 loc) • 2.39 kB
JavaScript
//#region src/services/octoprint/octoprint-api.routes.ts
var OctoprintRoutes = class {
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, path = "") => `${this.apiFiles}/local${path ? `/${path}` : ""}?recursive=${recursive}`;
selectCommand(print = false) {
return {
command: "select",
print
};
}
moveFileCommand(destination) {
return {
command: "move",
destination
};
}
printerNameSetting(name) {
return { appearance: { name } };
}
};
//#endregion
export { OctoprintRoutes };
//# sourceMappingURL=octoprint-api.routes.js.map