UNPKG

harrogateclient

Version:

A simple node.js client for Kipr Harrogate on their Wallaby's.

151 lines (141 loc) 4.69 kB
const HarrogateClient = require('../index'); console.log('Create Client\n'); var client = new HarrogateClient('localhost:8888') /* WORKS client.checkConnection().then(console.log) */ /* WORKS client.loadFile('Default User', 'test', 'src', 'main.c').then(console.log).catch(console.log) */ /* WORKS client.getUsers().then(function (users) { users[0].addProject('testproj').then(function (proj) { proj.getInformation().then(function (info) { info.source[0].load().then(function (content) { content = content.replace('kipr/botball.h', 'stdio.h') info.source[0].save(content).then(function () { proj.compile().then(function (res) { console.log(res) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) users[0].deleteProject('testproj') }) }).catch(function (err) { console.error(err) })*/ /* WORKS client.getUsers().then(function (users) { users[0].getProjects().then(function (projects) { projects[0].getInformation().then(function (info) { info.addFile('src', 'testfile').then(function (file) { file.save('asdfg').catch(function (err) { console.log(err) }).catch(function (err) { console.error(err) }) setTimeout(function () { file.delete().catch(function (err) { console.error(err) }) }, 10000) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) })*/ /* WORKS client.getUsers().then(function (users) { console.log('Users: ' + users) users[0].addProject('InstantDelete').then(function (prj) { console.log('Project created') setTimeout(function () { prj.delete().then(function () { console.log('Project deleted') }).catch(function (err) { console.error(err) }) }, 5000) }).catch(function (err) { console.error(err) setTimeout(function () { users[0].deleteProject('InstantDelete').then(function () { console.log('Project deleted') }).catch(function (err) { console.error(err) }) }, 5000) }) }).catch(function (err) { console.error('Users error: ' + err.message) }) */ /* WORKS client.getUsers().then(function (users) { users[0].getProjects().then(function (projects) { projects[0].getInformation().then(function (info) { info.source[0].load().then(function (file) { console.log(file) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error(err) }) */ /* WORKS client.addUser('test').then(function (user) { console.log('User created') user.delete().then(function () { console.log('User deleted') }).catch(function (err) { console.error(err.message) }) }).catch(function (err) { console.error(err) client.deleteUser('test').then(function () { console.log('User deleted') }).catch(function (err) { console.error(err) }) }) */ /* WORKS client.getProjects('Default User').then(function (projects) { console.log('List "Default User\'s" Projects: ' + projects) projects[0].getInformation().then(function (info) { console.log("Project info: " + JSON.stringify(info)) }).catch(function (err) { console.error(err) }) }).catch(function (err) { console.error('Cant list Projects: ' + err.message) }) */ /* WORKS client.allProjects(function (err, res) { }).then(function (result) { console.log(result) }).catch(function (err) { console.error(err) })*/