@jamesgopsill/repetier-server-client
Version:
A Typescript client for Repetier Server
375 lines (374 loc) • 14.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setLogLevel = exports.removeLog = exports.listLogs = exports.getFirmwareData = exports.getFirmwareSettings = exports.startUpdateFirmwareSettings = exports.listFirmwareNames = exports.testPushMessage = exports.ignoreUpdate = exports.updateAvailable = exports.listPorts = exports.deleteUser = exports.updateUser = exports.createUser = exports.userlist = exports.updateUserSettings = exports.updateSettings = exports.getSettings = exports.removeConfiguration = exports.createConfiguration = exports.runExternalCommand = exports.listExternalCommands = exports.setEeprom = exports.getEeprom = exports.communicationData = exports.deactivate = exports.activate = exports.setScript = exports.getScript = exports.setPrinterConfig = exports.getPrinterConfig = exports.removeJob = exports.continueJob = exports.stopJob = exports.startJob = exports.jobInfo = exports.modelInfo = exports.listJobs = exports.copyModel = exports.listModels = exports.removeModel = exports.removeMessage = exports.messages = exports.move = exports.fetchLog = exports.stateList = exports.sendGcode = exports.extendPing = exports.ping = exports.listPrinter = void 0;
exports.sendQuickCommand = exports.babystep = exports.preheat = exports.cooldown = exports.canUploadGCodeWithSize = exports.importUrl = exports.browseFolder = exports.setFolders = exports.getFolders = exports.listFilesystemFolders = exports.moveModelFileToGroup = exports.deleteModelGroup = exports.addModelGroup = exports.listModelGroups = exports.getPrinterSettings = exports.setPrinterSetting = exports.getPrinterSetting = exports.version = exports.emergencyStop = exports.setChamberTemperature = exports.setBedTemperature = exports.setExtruderTemperature = exports.setFanSpeed = exports.setFlowMultiplier = exports.setSpeedMultiplier = exports.hideMoves = exports.sendMoves = void 0;
const index_js_1 = require("../index.js");
async function listPrinter() {
return this._sendAndListen(index_js_1.Actions.LIST_PRINTER);
}
exports.listPrinter = listPrinter;
async function ping() {
return this._sendAndListen(index_js_1.Actions.PING);
}
exports.ping = ping;
async function extendPing(timeout) {
const data = {
timeout,
};
return this._sendAndListen(index_js_1.Actions.EXTEND_PING, data);
}
exports.extendPing = extendPing;
async function sendGcode(printer, cmd) {
const data = {
cmd,
printer,
};
return this._sendAndListen(index_js_1.Actions.SEND, data);
}
exports.sendGcode = sendGcode;
async function stateList() {
return this._sendAndListen(index_js_1.Actions.STATE_LIST);
}
exports.stateList = stateList;
async function fetchLog(start = 0, filter = 10) {
const data = {
start,
filter,
};
return this._sendAndListen(index_js_1.Actions.RESPONSE, data);
}
exports.fetchLog = fetchLog;
async function move(x, y, z, e, speed, relative = true) {
const data = {
x,
y,
z,
e,
speed,
relative,
};
return this._sendAndListen(index_js_1.Actions.MOVE, data);
}
exports.move = move;
async function messages() {
return this._sendAndListen(index_js_1.Actions.MESSAGES);
}
exports.messages = messages;
async function removeMessage(id) {
return this._sendAndListen(index_js_1.Actions.REMOVE_MESSAGE, { id, a: "" });
}
exports.removeMessage = removeMessage;
async function removeModel(id) {
return this._sendAndListen(index_js_1.Actions.REMOVE_MODEL, { id });
}
exports.removeModel = removeModel;
async function listModels(group = "*") {
return this._sendAndListen(index_js_1.Actions.LIST_MODELS, { group });
}
exports.listModels = listModels;
async function copyModel(id, autostart = false) {
const data = { id, autostart };
return this._sendAndListen(index_js_1.Actions.COPY_MODEL, data);
}
exports.copyModel = copyModel;
async function listJobs() {
return this._sendAndListen(index_js_1.Actions.LIST_JOBS);
}
exports.listJobs = listJobs;
async function modelInfo(id) {
return this._sendAndListen(index_js_1.Actions.MODEL_INFO, { id });
}
exports.modelInfo = modelInfo;
async function jobInfo(id) {
return this._sendAndListen(index_js_1.Actions.JOB_INFO, { id });
}
exports.jobInfo = jobInfo;
async function startJob(id) {
return this._sendAndListen(index_js_1.Actions.START_JOB, { id });
}
exports.startJob = startJob;
async function stopJob() {
return this._sendAndListen(index_js_1.Actions.START_JOB);
}
exports.stopJob = stopJob;
async function continueJob() {
return this._sendAndListen(index_js_1.Actions.CONTINUE_JOB);
}
exports.continueJob = continueJob;
async function removeJob() {
return this._sendAndListen(index_js_1.Actions.REMOVE_JOB);
}
exports.removeJob = removeJob;
async function getPrinterConfig(printer = "") {
return this._sendAndListen(index_js_1.Actions.GET_PRINTER_CONFIG, { printer });
}
exports.getPrinterConfig = getPrinterConfig;
async function setPrinterConfig(config) {
return this._sendAndListen(index_js_1.Actions.SET_PRINTER_CONFIG, config);
}
exports.setPrinterConfig = setPrinterConfig;
async function getScript(name) {
return this._sendAndListen(index_js_1.Actions.GET_SCRIPT, { name });
}
exports.getScript = getScript;
async function setScript(name, script) {
return this._sendAndListen(index_js_1.Actions.SET_SCRIPT, { name, script });
}
exports.setScript = setScript;
async function activate(printer) {
return this._sendAndListen(index_js_1.Actions.ACTIVATE, { printer });
}
exports.activate = activate;
async function deactivate(printer) {
return this._sendAndListen(index_js_1.Actions.DEACTIVATE, { printer });
}
exports.deactivate = deactivate;
async function communicationData() {
return this._sendAndListen(index_js_1.Actions.COMMUNICATION_DATA, {});
}
exports.communicationData = communicationData;
async function getEeprom() {
return this._sendAndListen(index_js_1.Actions.GET_EEPROM);
}
exports.getEeprom = getEeprom;
async function setEeprom(eeprom) {
return this._sendAndListen(index_js_1.Actions.SET_EEPROM, { eeprom });
}
exports.setEeprom = setEeprom;
async function listExternalCommands() {
return this._sendAndListen(index_js_1.Actions.LIST_EXTERNAL_COMMANDS);
}
exports.listExternalCommands = listExternalCommands;
async function runExternalCommand(id) {
return this._sendAndListen(index_js_1.Actions.LIST_EXTERNAL_COMMANDS, { id });
}
exports.runExternalCommand = runExternalCommand;
async function createConfiguration(printerName, printer) {
const data = {
name: printerName,
slug: printer,
};
return this._sendAndListen(index_js_1.Actions.LIST_EXTERNAL_COMMANDS, data);
}
exports.createConfiguration = createConfiguration;
async function removeConfiguration(printer) {
return this._sendAndListen(index_js_1.Actions.REMOVE_CONFIGURATION, { slug: printer });
}
exports.removeConfiguration = removeConfiguration;
async function getSettings() {
return this._sendAndListen(index_js_1.Actions.GET_SETTINGS);
}
exports.getSettings = getSettings;
async function updateSettings(settings) {
return this._sendAndListen(index_js_1.Actions.UPDATE_SETTINGS, settings);
}
exports.updateSettings = updateSettings;
async function updateUserSettings(settings) {
return this._sendAndListen(index_js_1.Actions.UPDATE_USER_SETTINGS, settings);
}
exports.updateUserSettings = updateUserSettings;
async function userlist() {
return this._sendAndListen(index_js_1.Actions.USER_LIST);
}
exports.userlist = userlist;
async function createUser(login, password, permissions) {
return this._sendAndListen(index_js_1.Actions.CREATE_USER, {
login,
password,
permissions,
});
}
exports.createUser = createUser;
async function updateUser(login, permissions, password) {
return this._sendAndListen(index_js_1.Actions.UPDATE_USER, {
login,
password,
permissions,
});
}
exports.updateUser = updateUser;
async function deleteUser(login) {
return this._sendAndListen(index_js_1.Actions.DELETE_USER, { login });
}
exports.deleteUser = deleteUser;
async function listPorts() {
return this._sendAndListen(index_js_1.Actions.LIST_PORTS);
}
exports.listPorts = listPorts;
async function updateAvailable() {
return this._sendAndListen(index_js_1.Actions.UPDATE_AVAILABLE);
}
exports.updateAvailable = updateAvailable;
async function ignoreUpdate() {
return this._sendAndListen(index_js_1.Actions.IGNORE_UPDATE);
}
exports.ignoreUpdate = ignoreUpdate;
async function testPushMessage() {
return this._sendAndListen(index_js_1.Actions.TEST_PUSH_MESSAGE);
}
exports.testPushMessage = testPushMessage;
async function listFirmwareNames() {
return this._sendAndListen(index_js_1.Actions.LIST_FIRMWARE_NAMES);
}
exports.listFirmwareNames = listFirmwareNames;
async function startUpdateFirmwareSettings() {
return this._sendAndListen(index_js_1.Actions.START_UPDATE_FIRMWARE_SETTINGS);
}
exports.startUpdateFirmwareSettings = startUpdateFirmwareSettings;
async function getFirmwareSettings() {
return this._sendAndListen(index_js_1.Actions.GET_FIRMWARE_SETTINGS);
}
exports.getFirmwareSettings = getFirmwareSettings;
async function getFirmwareData() {
return this._sendAndListen(index_js_1.Actions.GET_FIRMWARE_DATA);
}
exports.getFirmwareData = getFirmwareData;
async function listLogs() {
return this._sendAndListen(index_js_1.Actions.LIST_LOGS);
}
exports.listLogs = listLogs;
async function removeLog(log) {
return this._sendAndListen(index_js_1.Actions.REMOVE_LOG, { log });
}
exports.removeLog = removeLog;
async function setLogLevel(level) {
return this._sendAndListen(index_js_1.Actions.REMOVE_LOG, { level });
}
exports.setLogLevel = setLogLevel;
async function sendMoves() {
return this._sendAndListen(index_js_1.Actions.SEND_MOVES);
}
exports.sendMoves = sendMoves;
async function hideMoves() {
return this._sendAndListen(index_js_1.Actions.HIDE_MOVES);
}
exports.hideMoves = hideMoves;
async function setSpeedMultiplier(speed) {
return this._sendAndListen(index_js_1.Actions.SET_SPEED_MULTIPLY, { speed });
}
exports.setSpeedMultiplier = setSpeedMultiplier;
async function setFlowMultiplier(speed) {
return this._sendAndListen(index_js_1.Actions.SET_FLOW_MULTIPLY, { speed });
}
exports.setFlowMultiplier = setFlowMultiplier;
async function setFanSpeed(speed, fan = 0) {
return this._sendAndListen(index_js_1.Actions.SET_FAN_SPEEED, { speed, fanId: fan });
}
exports.setFanSpeed = setFanSpeed;
async function setExtruderTemperature(temperature, extruder = 0) {
return this._sendAndListen(index_js_1.Actions.SET_FAN_SPEEED, { temperature, extruder });
}
exports.setExtruderTemperature = setExtruderTemperature;
async function setBedTemperature(temperature, bed = 0) {
return this._sendAndListen(index_js_1.Actions.SET_BED_TEMPERATURE, {
temperature,
bedId: bed,
});
}
exports.setBedTemperature = setBedTemperature;
async function setChamberTemperature(temperature, chamber = 0) {
return this._sendAndListen(index_js_1.Actions.SET_CHAMBER_TEMPERATURE, {
temperature,
chamberId: chamber,
});
}
exports.setChamberTemperature = setChamberTemperature;
async function emergencyStop() {
return this._sendAndListen(index_js_1.Actions.EMERGENCY_STOP);
}
exports.emergencyStop = emergencyStop;
async function version() {
return this._sendAndListen(index_js_1.Actions.VERSION);
}
exports.version = version;
async function getPrinterSetting(key) {
return this._sendAndListen(index_js_1.Actions.GET_PRINTER_SETTING, { key });
}
exports.getPrinterSetting = getPrinterSetting;
async function setPrinterSetting(key, value) {
let data = {};
data[key] = value;
return this._sendAndListen(index_js_1.Actions.SET_PRINTER_SETTING, data);
}
exports.setPrinterSetting = setPrinterSetting;
async function getPrinterSettings() {
return this._sendAndListen(index_js_1.Actions.GET_PRINTER_SETTINGS);
}
exports.getPrinterSettings = getPrinterSettings;
async function listModelGroups() {
return this._sendAndListen(index_js_1.Actions.LIST_MODEL_GROUPS);
}
exports.listModelGroups = listModelGroups;
async function addModelGroup(groupName) {
return this._sendAndListen(index_js_1.Actions.ADD_MODEL_GROUP, { groupName });
}
exports.addModelGroup = addModelGroup;
async function deleteModelGroup(groupName, delFiles) {
return this._sendAndListen(index_js_1.Actions.DELETE_MODEL_GROUP, {
groupName,
delFiles,
});
}
exports.deleteModelGroup = deleteModelGroup;
async function moveModelFileToGroup(groupName, fileId) {
return this._sendAndListen(index_js_1.Actions.MOVE_MODEL_FILE_TO_GROUP, {
groupName,
fileId,
});
}
exports.moveModelFileToGroup = moveModelFileToGroup;
async function listFilesystemFolders() {
return this._sendAndListen(index_js_1.Actions.LIST_FILESYSTEM_FOLDERS);
}
exports.listFilesystemFolders = listFilesystemFolders;
async function getFolders() {
return this._sendAndListen(index_js_1.Actions.GET_FOLDERS);
}
exports.getFolders = getFolders;
async function setFolders(folders) {
return this._sendAndListen(index_js_1.Actions.SET_FOLDERS, folders);
}
exports.setFolders = setFolders;
async function browseFolder(folder, root, next) {
return this._sendAndListen(index_js_1.Actions.BROWSE_FOLDERS, {
folder,
root,
next,
});
}
exports.browseFolder = browseFolder;
async function importUrl(folder, files) {
return this._sendAndListen(index_js_1.Actions.IMPORT_URL, {
folder,
files,
});
}
exports.importUrl = importUrl;
async function canUploadGCodeWithSize(size) {
return this._sendAndListen(index_js_1.Actions.CAN_UPLOAD_GCODE_WITH_SIZE, { size });
}
exports.canUploadGCodeWithSize = canUploadGCodeWithSize;
async function cooldown(extruder, bed, chamber) {
return this._sendAndListen(index_js_1.Actions.COOLDOWN, {
extruder,
bed,
chamber,
});
}
exports.cooldown = cooldown;
async function preheat(extruder, bed, chamber) {
return this._sendAndListen(index_js_1.Actions.PREHEAT, {
extruder,
bed,
chamber,
});
}
exports.preheat = preheat;
async function babystep(z) {
return this._sendAndListen(index_js_1.Actions.PREHEAT, { z });
}
exports.babystep = babystep;
async function sendQuickCommand(name) {
return this._sendAndListen(index_js_1.Actions.SEND_QUICK_COMMAND, { name });
}
exports.sendQuickCommand = sendQuickCommand;