-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stats.psm1
61 lines (60 loc) · 1.86 KB
/
Stats.psm1
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
Function Get-RankedStats
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true,
ParameterSetName='ID')]
[string[]]$ID,
[Parameter(Mandatory=$true,
ParameterSetName='Name')]
[string[]]$Name,
[ValidateSet('br', 'eune', 'euw', 'kr', 'lan', 'las', 'na', 'oce', 'ru', 'tr')]
[string]$Region = 'na'
)
If($PSCmdlet.ParameterSetName -eq 'Name')
{
$summoner = Get-Summoner -Name $Name -Region $Region
}
ElseIf($PSCmdlet.ParameterSetName -eq 'ID')
{
$summoner = Get-Summoner -ID $ID -Region $Region
}
$results = @()
Foreach($summonerID in $summoner)
{
$result = Invoke-RiotRestMethod -BaseUri "https://$Region.api.pvp.net/api/lol/$Region/v1.3/stats/by-summoner/" -Parameter $summonerID.id -Method '/ranked'
$result | Add-Member -MemberType NoteProperty -Name Name -Value $summonerID.Name
$result
}
}
Function Get-Stats
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true,
ParameterSetName='ID')]
[string[]]$ID,
[Parameter(Mandatory=$true,
ParameterSetName='Name')]
[string[]]$Name,
[ValidateSet('br', 'eune', 'euw', 'kr', 'lan', 'las', 'na', 'oce', 'ru', 'tr')]
[string]$Region = 'na'
)
If($PSCmdlet.ParameterSetName -eq 'Name')
{
$summoner = Get-Summoner -Name $Name -Region $Region
}
ElseIf($PSCmdlet.ParameterSetName -eq 'ID')
{
$summoner = Get-Summoner -ID $ID -Region $Region
}
$results = @()
Foreach($summonerID in $summoner)
{
$result = Invoke-RiotRestMethod -BaseUri "https://$Region.api.pvp.net/api/lol/$Region/v1.3/stats/by-summoner/" -Parameter $summonerID.id -Method '/summary'
$result | Add-Member -MemberType NoteProperty -Name Name -Value $summonerID.Name
$result
}
}