Participants

Participants

new Participants(options)

Source:
Constructor function for the class to query Participants endpoints
    index     GET     tournaments/:tournament/participants
    create    POST    tournaments/:tournament/participants
    show      GET     tournaments/:tournament/participants/:participant_id
    update    PUT     tournaments/:tournament/participants/:participant_id
    destroy   DELETE  tournaments/:tournament/participants/:participant_id
    randomize GET     tournaments/:tournament/participants/randomize
  
Parameters:
Name Type Description
options object configuration options for this instance

Methods

create(obj)

Source:
Add a participant to a tournament (up until it is started). See the Challonge API Doc for a full list of object properties.
Example
client.participants.create({
  id: 'my-tournament-url',
  participant: {
    name: 'Bob the Awesome'
  },
  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 create the participants in
participant object The participant 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:
If the tournament has not started, delete a participant, automatically filling in the abandoned seed number. If tournament is underway, mark a participant inactive, automatically forfeiting his/her remaining matches. See the Challonge API Doc for a full list of object properties.
Example
client.participants.destroy({
  id: 'my-tournament-url',
  participantId: '123456',
  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 a participant from
participantId string OR obj.participant_id The id of the participant to remove
callback function A method to call when the API returns. Arguments are (error, data)

index(obj)

Source:
Retrieve a tournament's participant list. See the Challonge API Doc for a full list of object properties.
Example
client.participants.index({
  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 the participants from
callback function A method to call when the API returns. Arguments are (error, data)

randomize(obj)

Source:
Randomize seeds among participants. Only applicable before a tournament has started. See the Challonge API Doc for a full list of object properties.
Example
client.participants.randomize({
  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 randomize the participant seeds in
callback function A method to call when the API returns. Arguments are (error, data)

show(obj)

Source:
Retrieve a single participant record for a tournament. See the Challonge API Doc for a full list of object properties.
Example
client.participants.show({
  id: 'my-tournament-url',
  participantId: '123456',
  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 a participant in
participantId string OR obj.participant_id The id of the participant to get
callback function A method to call when the API returns. Arguments are (error, data)

update(obj)

Source:
Update the attributes of a tournament participant. See the Challonge API Doc for a full list of object properties.
Example
client.participants.update({
  id: 'my-tournament-url',
  participantId: '123456',
  participant: {
    name: 'Bob the Super Awesome'
  },
  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 a participant in
participantId string OR obj.participant_id The id of the participant to update
participant object The participant object with updates. See challonge docs for available properties.
callback function A method to call when the API returns. Arguments are (error, data)