-
Notifications
You must be signed in to change notification settings - Fork 6
/
comp.js
109 lines (87 loc) · 2.76 KB
/
comp.js
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
This file contains a wrapper around the srcomp-http api.
*/
// Makes a GET request to the API
// Define an
var comp = function (){}
comp._api = function(address, callback, parameter){
if(parameter === undefined){
var url = apiURI + address;
}else{
var url = apiURI + address + "/" + parameter;
}
return $.getJSON(url,callback);
}
// Get an object containing the URLs for the various parts of the competition interface.
comp.index = function(callback){
return comp._api('',callback);
}
// Get an object containing all arenas.
comp.arenas = function(callback){
return comp._api('arenas',callback);
}
// Get information about an arena.
comp.arena = function(name, callback){
return comp._api('arenas',callback,name);
}
// Get an object containing all teams.
comp.teams = function(callback){
return comp._api('teams',callback);
}
// Get information about a team.
comp.team = function(tla, callback){
return comp._api('teams',callback,tla);
}
// Get the team image.
comp.teamImage = function(tla, callback){
// TODO: Remove hack
return comp._api('teams/' + tla,callback,"image");
}
// Get an object containing all corners.
comp.corners = function(callback){
return comp._api('corners',callback);
}
// Get information about a corner.
comp.corner = function(number, callback){
return comp._api('corners',callback,number);
}
// Get information about parts of the competition state which change with the current time.
comp.current = function(callback){
return comp._api('current',callback);
}
// Get the latest commit that the competition is working with.
comp.state = function(callback){
return comp._api('state',callback);
}
// Get general information about the configuration of the competition and the host.
comp.config = function(callback){
return comp._api('state',callback);
}
// Get information about the locations within the venue.
comp.locations = function(callback){
return comp._api('locations',callback);
}
// Get information about the locations within the venue.
comp.location = function(name,callback){
return comp._api('locations',callback,name);
}
// Get information about matches
comp.matches = function(callback){
return comp._api('matches', callback);
}
//last_scored contains the highest match number which has a score assigned, but may be null if no scores have yet been entered.
comp.matchesLastScored = function(callback){
return comp._api('matches/last_scores', callback);
}
// Get a list of match periods.
comp.periods = function(callback){
return comp._api('periods',callback,name);
}
// Get a list of rounds which make up the knockouts.
comp.knockouts = function(callback){
return comp._api('knockouts',callback);
}
// Get the tiebreaker match
comp.tiebreaker = function(callback){
return comp._api('tiebreaker',callback);
}