GithubHelp home page GithubHelp logo

tptapi's Introduction

TPTAPI

This package interacts with Powder Toy 's API.

Usage:

var opts = {
    url: 'http://powdertoy.co.uk'
};
var client = require('tptapi')(opts);

Login

Most actions need a session token you can obtain from Login: client.login(user, passwd); returns a boolean.

Check Login

To verify that your session is still valid you can run checkLogin: client.checkLogin() which will return a boolean.

Vote [LOGIN NEEDED]

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.

Comment [LOGIN NEEDED]

To add a comment, you need to do client.comment(id, text). Returns a boolean.

Add Tag [LOGIN NEEDED]

To add a tag, you need to do client.addTag(id, name). Returns a boolean.

Delete Tag [LOGIN NEEDED]

To remove a tag, you need to do client.delTag(id, name). Returns a boolean.

Delete Save [LOGIN NEEDED]

To remove a save, you need to do client.delSave(id). Returns a boolean.

Unpublish Save [LOGIN NEEDED]

To unpublish a save, you need to do client.unpublishTag(id). Returns a boolean.

Publish Save [LOGIN NEEDED]

To publish a save, you need to do client.publishSave(id). Returns a boolean.

Update Profile [LOGIN NEEDED]

To update your profile, you need to do client.setProfile(data). Returns a boolean.

Browse [LOGIN ENHACES OUTPUT]

To browse, you need to do client.browse(query, count, offset). Returns results.

List Tags

To list tags, you need to do client.listTags(start, count). Returns array of tags.

Favourite a Save [LOGIN NEEDED]

To add a save to favutrites, you need to do client.fav(id). Returns a boolean.

UnFavourite a Save [LOGIN NEEDED]

To remove a save from favutrites, you need to do client.remFav(id). Returns a boolean.

Save [LOGIN NEEDED]

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.

Update Save [LOGIN NEEDED]

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.

Startup Data [LOGIN ENHACES OUTPUT]

Returns Startup.json data. client.startup()

Save's Comments

Returns a save's comments. client.comments(id, count, offset)

tptapi's People

Contributors

io4 avatar wolfy1339 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.