Tournaments

Tournaments

new Tournaments(options)

Source:
Constructor function for the class to query Tournaments endpoints
    index    GET    tournaments
    create   POST   tournaments
    show     GET    tournaments/:tournament
    update   PUT    tournaments/:tournament
    destroy  DELETE tournaments/:tournament
    start    POST   tournaments/:tournament/start
    finalize POST   tournaments/:tournament/finalize
    reset    POST   tournaments/:tournament/reset
  
Parameters:
Name Type Description
options object configuration options for this instance

Methods

create(obj)

Source:
Create a new tournament. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.create({
  tournament: {
    name: 'My Tournament',
    url: 'my-tournament-url',
    tournamentType: 'single elimination',
  },
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
tournament object The tournament to create. See challonge docs for available properties.
callback function A method to call when the API returns. Arguments are (error, data)

destroy(obj)

Source:
Deletes a tournament along with all its associated records. There is no undo, so use with care! See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.destroy({
  id: 'my-tournament-url',
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
id string The url of the tournament to remove
callback function A method to call when the API returns. Arguments are (error, data)

finalize(obj)

Source:
Finalize a tournament that has had all match scores submitted, rendering its results permanent. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.finalize({
  id: 'my-tournament-url',
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
id string The url of the tournament to finalize
callback function A method to call when the API returns. Arguments are (error, data)

index(obj)

Source:
Retrieve a set of tournaments created with your account. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.index({
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request

reset(obj)

Source:
Reset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.reset({
  id: 'my-tournament-url',
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
id string The url of the tournament to reset
callback function A method to call when the API returns. Arguments are (error, data)

show(obj)

Source:
Retrieve a single tournament record created with your account. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.show({
  id: 'my-tournament-url',
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
id string The url of the tournament to get
callback function A method to call when the API returns. Arguments are (error, data)

start(obj)

Source:
Start a tournament, opening up first round matches for score reporting. The tournament must have at least 2 participants. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.start({
  id: 'my-tournament-url',
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
id string The url of the tournament to start
callback function A method to call when the API returns. Arguments are (error, data)

update(obj)

Source:
Update a tournament's attributes. See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.update({
  id: 'my-tournament-url',
  tournament: {
    name: 'The New Tournament Name'
  },
  callback: (err, data) => {
    console.log(err, data);
  }
});
Parameters:
Name Type Description
obj object params to pass to the api request
Properties
Name Type Description
id string The url of the tournament to update
callback function A method to call when the API returns. Arguments are (error, data)
tournament object The tournament object with updates. See challonge docs for available properties.