-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.psm1
30 lines (30 loc) · 952 Bytes
/
Game.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
Function Get-RecentGames
{
[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/game/by-summoner/" -Parameter $summonerID.id -Method '/recent'
$result | Add-Member -MemberType NoteProperty -Name Name -Value $summonerID.Name
$result
}
}