
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
challonge-js
Advanced tools
##Usage
###Get all tournaments on your account
const challonge = require('./node-challonge');
const client = challonge.createClient({
apiKey: '<yourApiKey>'
});
client.tournaments.index({
callback: function (error, data) {
if (error) { console.log(error); return; }
console.log(data);
}
});
###Create a tournament
const challonge = require('./node-challonge');
const client = challonge.createClient({
apiKey: '<yourApiKey>'
});
client.tournaments.create({
tournament: {
name: 'new_tournament_name',
url: 'new_tournament_url',
tournamentType: 'single elimination'
},
callback: function (error, data) {
if (error) { console.log(error); return; }
console.log(data);
}
});
##API Client
createClient takes one argument for configuration and returns an instance of the api client. The configuration object can contain the following options:
apiKey
string (required) - Your challonge API Key
subdomain
string (optional) - Setting the subdomain automatically passes tournament[subdomain] and prefixes the subdomain to tournament urls. If you don't want to pass a subdomain to the constructor, and want to use an organization (or multiple organizations), you must use client.setSubdomain('subdomain') before making api calls.
format
string (optional) - The format of the response data. Defaults to 'json'. If set to 'json', will return javascript objects. 'xml' will return the raw text string.
massageProperties
boolean (optional) - If the response object should be massaged into camelCase properties when using json format. Defaults to true.
The wrapper is organized into resource.method to match the API
For API calls that require nested params (eg: http://api.challonge.com/v1/documents/tournaments/create) properties should be specified as a nested object:
{
tournament: {
name: 'new_tournament_name',
url: 'new_tournament_url',
tournamentType: 'single elimination'
},
callback: function (error, data) {}
}
All properties can be specified camelCase instead of using under_scores Both of the following are valid:
tournament: { tournamentType: 'single elimination' }
tournament: { tournament_type: 'single elimination' }
##TODO
##Bugs in the API / docs
Some minor gatchas:
server 500s if trying to finalize() a tournament that has not yet been start()ed
http://api.challonge.com/v1/documents/participants/create shows participant_id as a required field when the server does not respect passing it, and is not required.
http://api.challonge.com/v1/documents/participants/randomize shows participant_id as a required field when the server does not respect passing it, and is not required.
The structure of this api wrapper is ripped off from https://github.com/nodejitsu/nodejitsu-api
This repository was forked from https://github.com/Tidwell/node-challonge
FAQs
Wrapper for the challonge api.
We found that challonge-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.