Matches

Matches

new Matches(options)

Source:
Constructor function for the class to query Matches endpoints
    index    GET  tournaments/:tournament/matches
    show     GET  tournaments/:tournament/matches/:match_id
    update   PUT  tournaments/:tournament/matches/:match_id
  
Parameters:
Name Type Description
options object configuration options for this instance

Methods

index(obj)

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

show(obj)

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

update(obj)

Source:
Update/submit the score(s) for a match. See the Challonge API Doc for a full list of object properties.
Example
client.matches.update({
  id: 'my-tournament-url',
  matchId: '12345678',
  match: {
    scoresCsv: '3-0',
    winnerId: '678910'
  },
  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 the match in
matchId string OR obj.match_id The id of the match to update
match object The match object with updates. See challonge docs for available properties.
callback function A method to call when the API returns. Arguments are (error, data)