-
Notifications
You must be signed in to change notification settings - Fork 1
/
Get-FplLineup.ps1
29 lines (24 loc) · 993 Bytes
/
Get-FplLineup.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
28
29
function Get-FplLineup {
<#
.SYNOPSIS
Retrieves your team lineup for the upcoming gameweek
.DESCRIPTION
Retrieves your team lineup for the upcoming gameweek
.EXAMPLE
Get-FplLineup
.LINK
https://psfpl.readthedocs.io/en/master/functions/Get-FplLineup
.LINK
https://github.com/sk82jack/PSFPL/blob/master/PSFPL/Public/Get-FplLineup.ps1
#>
[CmdletBinding()]
param()
if ((-not $Script:FplSessionData) -or (-not $Script:FplSessionData['FplSession'])) {
Write-Warning 'No existing connection found'
$Credential = Get-Credential -Message 'Please enter your FPL login details'
Connect-Fpl -Credential $Credential
}
$TeamId = $Script:FplSessionData['TeamID']
$Response = Invoke-RestMethod -Uri "https://fantasy.premierleague.com/api/my-team/$TeamId/" -WebSession $FplSessionData['FplSession'] -UseBasicParsing
ConvertTo-FplObject -InputObject $Response.Picks -Type 'FplLineup'
}