A challonge api for js
npm install simple-challonge-api``bash`
$ npm install simple-challonge-api
`js
const Challonge = require('simple-challonge-api');
const client = new Challonge({
"username" : "Your challonge username",
"apiKey" : "Your API key", // https://challonge.com/settings/developer
"tournamentID" : "The tournament id of the tournament you are using the API with" // https://challonge.com/
})
`
Everything documented in the challonge API docs except the "Attatchment" section are available in this API
The commands for the API are sorted based on branches on the API docs. For example the match index command is called with client.matches.index() whereas the participants index command is client.participants.index()
To use the functions of the API with post data (i. e. the tournament show api call has the arguments include_participants and include_matches) just call the methods with arguments in order as they show on the challonge api documentation page or check the documentation for the api (in progress). Example:`jsinclude_participants
client.tournements.show(0, 1) // Where 0 is the parameter and 1 is the include_matches parameter as indicated by https://api.challonge.com/v1/documents/tournaments/show`
When using the create_bulk, create, and update functions of client.participants use the format used in client.participants.participant. On a similar note, when using the update and create methods of client.tournaments use the format used in client.tournaments.tournament
Everything here returns promises synchronously you can than acces with .then. Example:`js`
client.matches.index().then(h => console.log(h)
`bash`
$ git clone https://github.com/NicoNekoru/challonge.js
$ cd challonge.js
$ npm install
`bash`
$ npm test
Issues are tracked on github: https://github.com/NicoNekoru/challonge.js/issues
master is the active development branch
live` is the latest published build on npm