This package interacts with Powder Toy 's API.
var opts = {
url: 'http://powdertoy.co.uk'
};
var client = require('tptapi')(opts);
Most actions need a session token you can obtain from Login: client.login(user, passwd);
returns a boolean.
To verify that your session is still valid you can run checkLogin: client.checkLogin()
which will return a boolean.
To cast a vote, you need to do client.vote(id, type)
where type is a negative or positive number that defines if its a upvote or downvote. Returns a boolean.
To add a comment, you need to do client.comment(id, text)
. Returns a boolean.
To add a tag, you need to do client.addTag(id, name)
. Returns a boolean.
To remove a tag, you need to do client.delTag(id, name)
. Returns a boolean.
To remove a save, you need to do client.delSave(id)
. Returns a boolean.
To unpublish a save, you need to do client.unpublishTag(id)
. Returns a boolean.
To publish a save, you need to do client.publishSave(id)
. Returns a boolean.
To update your profile, you need to do client.setProfile(data)
. Returns a boolean.
To browse, you need to do client.browse(query, count, offset)
. Returns results.
To list tags, you need to do client.listTags(start, count)
.
Returns array of tags.
To add a save to favutrites, you need to do client.fav(id)
. Returns a boolean.
To remove a save from favutrites, you need to do client.remFav(id)
. Returns a boolean.
Saves a CPS file. Data has to be OPS1-encoded save.
var data = fs.readFileSync("save.cps").toString();
client.save(name, description, data)
Returns save id.
Updates a save with new description and content. Data has to be OPS1-encoded save.
var data = fs.readFileSync("save.cps").toString();
client.updateSave(name, description, data)
Returns a boolean.
Returns Startup.json data. client.startup()
Returns a save's comments. client.comments(id, count, offset)