Public/Get-ShellPhishSongData.ps1
|
function Get-ShellPhishSongData { <# .SYNOPSIS Retrieve extended song information (history, background) from Phish.net. .DESCRIPTION Returns song data by ID or slug. The songdata endpoint provides richer detail than the songs endpoint (lyrics, history, etc.). .PARAMETER ApiKey Your Phish.net API key. Defaults to $env:PHISH_KEY. .PARAMETER Id Numeric song ID. .PARAMETER Slug URL slug of the song. .EXAMPLE PS C:\> Get-ShellPhishSongData -Slug tweezer #> [CmdletBinding(DefaultParameterSetName = 'Default')] param ( [Parameter(Position=0)] [string]$ApiKey = $env:PHISH_KEY, [Parameter()] [ValidateSet('json','xml','html')] [string]$Format = 'json', [Parameter(ParameterSetName='ById', Mandatory=$true)] [string]$Id, [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) { 'ById' { $endpoint = "songdata/$Id.$Format" } 'BySlug' { $endpoint = "songdata/slug/$Slug.$Format" } default { $endpoint = "songdata.$Format" } } $qp = Get-CommonQueryParams -OrderBy $OrderBy -Direction $Direction -Limit $Limit -NoHeader:$NoHeader Invoke-ShellPhishApi -Endpoint $endpoint -QueryParams $qp -ApiKey $ApiKey } |