Public/Get-ShellPhishJamCharts.ps1
|
function Get-ShellPhishJamCharts { <# .SYNOPSIS Retrieve jam chart records from Phish.net. .DESCRIPTION Returns jam chart entries by song ID or song slug. .PARAMETER ApiKey Your Phish.net API key. Defaults to $env:PHISH_KEY. .PARAMETER SongId Numeric song ID. .PARAMETER Slug URL slug of the song (e.g. makisupa-policeman). .EXAMPLE PS C:\> Get-ShellPhishJamCharts -Slug makisupa-policeman #> [CmdletBinding(DefaultParameterSetName = 'Default')] param ( [Parameter(Position=0)] [string]$ApiKey = $env:PHISH_KEY, [Parameter()] [ValidateSet('json','xml','html')] [string]$Format = 'json', [Parameter(ParameterSetName='BySongId', Mandatory=$true)] [string]$SongId, [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) { 'BySongId' { $endpoint = "jamcharts/songid/$SongId.$Format" } 'BySlug' { $endpoint = "jamcharts/slug/$Slug.$Format" } default { $endpoint = "jamcharts.$Format" } } $qp = Get-CommonQueryParams -OrderBy $OrderBy -Direction $Direction -Limit $Limit -NoHeader:$NoHeader Invoke-ShellPhishApi -Endpoint $endpoint -QueryParams $qp -ApiKey $ApiKey } |