brackets-manager
Version:
A simple library to manage tournament brackets (round-robin, single elimination, double elimination)
60 lines • 2.37 kB
TypeScript
import { Group, Id, Match, MatchGame } from 'brackets-model';
import { BaseGetter } from './base/getter';
export declare class Find extends BaseGetter {
/**
* Gets the upper bracket (the only bracket if single elimination or the winner bracket in double elimination).
*
* @param stageId ID of the stage.
*/
upperBracket(stageId: Id): Promise<Group>;
/**
* Gets the loser bracket.
*
* @param stageId ID of the stage.
*/
loserBracket(stageId: Id): Promise<Group>;
/**
* Returns the matches leading to the given match.
*
* If a `participantId` is given, the previous match _from their point of view_ is returned.
*
* @param matchId ID of the target match.
* @param participantId Optional ID of the participant.
*/
previousMatches(matchId: Id, participantId?: number): Promise<Match[]>;
/**
* Returns the matches following the given match.
*
* If a `participantId` is given:
* - If the participant won, the next match _from their point of view_ is returned.
* - If the participant is eliminated, no match is returned.
*
* @param matchId ID of the target match.
* @param participantId Optional ID of the participant.
*/
nextMatches(matchId: Id, participantId?: number): Promise<Match[]>;
/**
* Finds a match in a given group. The match must have the given number in a round of which the number in group is given.
*
* **Example:** In group of id 1, give me the 4th match in the 3rd round.
*
* @param groupId ID of the group.
* @param roundNumber Number of the round in its parent group.
* @param matchNumber Number of the match in its parent round.
*/
match(groupId: Id, roundNumber: number, matchNumber: number): Promise<Match>;
/**
* Finds a match game based on its `id` or based on the combination of its `parent_id` and `number`.
*
* @param game Values to change in a match game.
*/
matchGame(game: Partial<MatchGame>): Promise<MatchGame>;
/**
* Returns an object with 1 match per group type. Only supports double elimination.
*
* @param matches A list of matches.
* @param fetchedGroups A map of groups which were already fetched.
*/
private getMatchesByGroupDoubleElimination;
}
//# sourceMappingURL=find.d.ts.map