-
Notifications
You must be signed in to change notification settings - Fork 0
/
tbaAPI.php
46 lines (38 loc) · 1.11 KB
/
tbaAPI.php
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
<?php
require_once('tbaHandler.php');
require_once('databaseLibrary.php');
require('databaseName.php');
global $tbaTable;
global $tbaKey;
$eventCode = "2022cabl";
if (isset($_GET["eventCode"])){
$eventCode = $_GET["eventCode"];
}
$tba = new tbaHandler($tbaKey, $tbaTable, connectToDB());
if (isset($_GET["query"])){
// Generic TBA query, passes value of query to TBA
echo(json_encode($tba->makeDBCachedCall($_GET["query"])));
}
else if (isset($_GET["getTeamList"])){
echo(json_encode($tba->getSimpleTeamList($eventCode)));
}
else if (isset($_GET["getMatchList"])){
echo(json_encode($tba->getMatches($eventCode)));
}
else if (isset($_GET["getCOPRs"])){
echo(json_encode($tba->getComponentOPRS($eventCode)));
}
else if (isset($_GET["lastEventOPRS"])){
$teamList = $tba->getSimpleTeamList($eventCode);
$oprs = $tba->getLastEventOPRS($teamList);
// print_r($oprs);
echo(json_encode($oprs));
}
else if (isset($_GET["createTable"])){
createTBATable($tbaTable);
}
function getTBAHandler(){
global $tba;
return $tba;
}
?>