Public/Get-ShellPhishArtists.ps1

function Get-ShellPhishArtists {
    <#
    .SYNOPSIS
        Retrieve artist records from Phish.net.
    .DESCRIPTION
        Returns all artists, or a single artist by ID or slug.
    .PARAMETER ApiKey
        Your Phish.net API key. Defaults to $env:PHISH_KEY.
    .PARAMETER Format
        Response format: json, xml, html. Default is json.
    .PARAMETER Id
        Numeric ID of the artist to fetch.
    .PARAMETER Slug
        URL slug of the artist to fetch.
    .EXAMPLE
        PS C:\> Get-ShellPhishArtists
    .EXAMPLE
        PS C:\> Get-ShellPhishArtists -Id 1
    .EXAMPLE
        PS C:\> Get-ShellPhishArtists -Slug phish -OrderBy artist -Direction asc -Limit 10
    #>

    [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 = "artists/$Id.$Format" }
        'BySlug' { $endpoint = "artists/slug/$Slug.$Format" }
        default  { $endpoint = "artists.$Format" }
    }

    $qp = Get-CommonQueryParams -OrderBy $OrderBy -Direction $Direction -Limit $Limit -NoHeader:$NoHeader
    Invoke-ShellPhishApi -Endpoint $endpoint -QueryParams $qp -ApiKey $ApiKey
}