Public/Get-ShellPhishSetlists.ps1
|
function Get-ShellPhishSetlists { <# .SYNOPSIS Retrieve setlist records from Phish.net. .DESCRIPTION Returns setlists filtered by show ID, show date, song name, or song slug. .PARAMETER ApiKey Your Phish.net API key. Defaults to $env:PHISH_KEY. .PARAMETER ShowId Numeric show ID. .PARAMETER ShowDate Show date in YYYY-MM-DD format. .PARAMETER Song Song name to search setlists for. .PARAMETER Slug URL slug of the song. .EXAMPLE PS C:\> Get-ShellPhishSetlists -ShowDate 1997-11-22 .EXAMPLE PS C:\> Get-ShellPhishSetlists -Slug tweezer #> [CmdletBinding(DefaultParameterSetName = 'Default')] param ( [Parameter(Position=0)] [string]$ApiKey = $env:PHISH_KEY, [Parameter()] [ValidateSet('json','xml','html')] [string]$Format = 'json', [Parameter(ParameterSetName='ByShowId', Mandatory=$true)] [string]$ShowId, [Parameter(ParameterSetName='ByShowDate', Mandatory=$true)] [ValidatePattern('^\d{4}-\d{2}-\d{2}$')] [string]$ShowDate, [Parameter(ParameterSetName='BySong', Mandatory=$true)] [string]$Song, [Parameter(ParameterSetName='BySlug', Mandatory=$true)] [string]$Slug, [Parameter()][string]$OrderBy, [Parameter()][ValidateSet('asc','desc')][string]$Direction, [Parameter()][int]$Limit, [Parameter()][switch]$NoHeader ) switch ($PSCmdlet.ParameterSetName) { 'ByShowId' { $endpoint = "setlists/showid/$ShowId.$Format" } 'ByShowDate' { $endpoint = "setlists/showdate/$ShowDate.$Format" } 'BySong' { $endpoint = "setlists/song/$Song.$Format" } 'BySlug' { $endpoint = "setlists/slug/$Slug.$Format" } default { $endpoint = "setlists.$Format" } } $qp = Get-CommonQueryParams -OrderBy $OrderBy -Direction $Direction -Limit $Limit -NoHeader:$NoHeader Invoke-ShellPhishApi -Endpoint $endpoint -QueryParams $qp -ApiKey $ApiKey } |