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
    process_check_ins    POST    tournaments/:tournament/process_check_ins
    abort_check_in    POST    tournaments/:tournament/abort_check_in
  
Parameters:
Name Type Description
options object configuration options for this instance

Methods

abortCheckIn(obj)

Source:
When your tournament is in a 'checking_in' or 'checked_in' state, there's no way to edit the tournament's start time (start_at) or check-in duration (check_in_duration). You must first abort check-in, then you may edit those attributes.
        Makes all participants active and clears their checked_in_at times.
        Transitions the tournament state from 'checking_in' or 'checked_in' to 'pending'
     
See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.abortCheckIn({
  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 abortCheckIn
callback function A method to call when the API returns. Arguments are (error, data)

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

processCheckIns(obj)

Source:
This should be invoked after a tournament's check-in window closes before the tournament is started.
        Marks participants who have not checked in as inactive.
        Moves inactive participants to bottom seeds (ordered by original seed).
        Transitions the tournament state from 'checking_in' to 'checked_in'
        NOTE: Checked in participants on the waiting list will be promoted if slots become available.
	  
See the Challonge API Doc for a full list of object properties.
Example
client.tournaments.processCheckIns({
  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 processCheckIns
callback function A method to call when the API returns. Arguments are (error, data)

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.