-
Notifications
You must be signed in to change notification settings - Fork 2
/
match.interface.ts
94 lines (82 loc) · 2.87 KB
/
match.interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { BaseInterfaces } from './';
export namespace MatchInterfaces {
export interface matchActions {
/** Include an array of associated attachment records */
include_attachments?: 0 | 1;
}
/** Requests */
/** Parameter interface for a tournaments match index endpoint */
export interface indexMatchesRequest {
/** all (default), pending, open, complete */
state?: matchStateType
/** Only retrieve matches that include the specified participant. */
participant_id?: number
}
/** Parameter interface for getting a single match endpoint */
export interface showMatchesRequest extends matchActions {
}
/** Parameters for getting a single match endpoint */
export interface updateMatchesRequest {
match: matchUpdateRequestObject
}
export interface matchUpdateRequestObject {
/** Comma separated set/game scores with player 1 score first
* (e.g. "1-3,3-0,3-2") */
scores_csv?: string
/** The participant ID of the winner or "tie" if applicable (Round Robin and
* Swiss). NOTE: If you change the outcome of a completed match, all matches
* in the bracket that branch from the updated match will be reset. */
winner_id?: number
/** Overwrites the number of votes for player 1 */
player1_votes?: number
/** Overwrites the number of votes for player 2 */
player2_votes?: number
}
/** Responses */
/** Response expected from the index matches endpoint */
export interface indexMatchesResponse extends BaseInterfaces.baseResponse {
matches: Array<matchResponseObject>
}
/** Response expected from the show match endpoint */
export interface showMatchResponse extends BaseInterfaces.baseResponse {
match: matchResponseObject
}
/** Response expected from the update match endpoint */
export interface updateMatchResponse extends BaseInterfaces.baseResponse {
match: matchResponseObject
}
/** Response expected from the update match endpoint */
export interface reopenMatchResponse extends BaseInterfaces.baseResponse {
match: matchResponseObject
}
/** Match response object */
export interface matchResponseObject {
attachment_count: number,
created_at: Date,
group_id: number,
has_attachment: false,
id: number,
identifier: string,
location: string,
loser_id: number,
player1_id: number,
player1_is_prereq_match_loser: boolean,
player1_prereq_match_id: number,
player1_votes: number,
player2_id: number,
player2_is_prereq_match_loser: boolean,
player2_prereq_match_id: number,
player2_votes: number,
round: number,
scheduled_time: Date,
started_at: Date,
state: matchStateType,
tournament_id: number,
underway_at: Date,
updated_at: Date,
winner_id: number,
prerequisite_match_ids_csv: string,
scores_csv: string
}
export type matchStateType = 'open' | 'pending' | 'complete';
}