/
Get-WordlCup.ps1
27 lines (23 loc) · 1.08 KB
/
Get-WordlCup.ps1
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
$global:APIkey = "2131a26f84069c7a06521e41d73affd3"
Function Get-WorldCupPlayer ($Country) {
If ($Country) {
$TeamID = (Get-WorldCupTeam -Country $Country).id
Invoke-WebRequest -Uri ("http://worldcup.kimonolabs.com/api/players?teamId=$($TeamID)&apikey=$($ApiKey)") | ConvertFrom-Json
} Else {
Invoke-WebRequest -Uri "http://worldcup.kimonolabs.com/api/players?apikey=$($ApiKey)" | ConvertFrom-Json
}
}
Function Get-WorldCupTeam ($Country, $TeamID) {
If ($Country) {
Invoke-WebRequest -Uri ("http://worldcup.kimonolabs.com/api/teams?name=$($Country)&apikey=$($ApiKey)") | ConvertFrom-Json
}
If ($TeamID) {
Invoke-WebRequest -Uri ("http://worldcup.kimonolabs.com/api/teams?id=$($TeamID)&apikey=$($ApiKey)") | ConvertFrom-Json
}
If (!$country -and !$TeamID) {
Invoke-WebRequest -Uri "http://worldcup.kimonolabs.com/api/teams?apikey=$($ApiKey)" | ConvertFrom-Json
}
}
Function Get-WorldCupStat {
Invoke-WebRequest -Uri ("http://worldcup.kimonolabs.com/api/teams?sort=goalsFor,-1&apikey=$($ApiKey)") | ConvertFrom-Json
}