Public/Get-ShellPhishReviews.ps1

function Get-ShellPhishReviews {
    <#
    .SYNOPSIS
        Retrieve show review records from Phish.net.
    .DESCRIPTION
        This is a special method — a filter is REQUIRED. The API will reject
        bare calls to /reviews without a column/value filter.
    .PARAMETER ApiKey
        Your Phish.net API key. Defaults to $env:PHISH_KEY.
    .PARAMETER Uid
        Numeric user ID.
    .PARAMETER ShowId
        Numeric show ID.
    .PARAMETER Username
        Phish.net username.
    .PARAMETER ShowDate
        Show date in YYYY-MM-DD format.
    .EXAMPLE
        PS C:\> Get-ShellPhishReviews -ShowId 1252683361
    #>

    [CmdletBinding()]
    param (
        [Parameter(Position=0)]
        [string]$ApiKey = $env:PHISH_KEY,

        [Parameter()]
        [ValidateSet('json','xml','html')]
        [string]$Format = 'json',

        [Parameter(ParameterSetName='ByUid', Mandatory=$true)]
        [string]$Uid,

        [Parameter(ParameterSetName='ByShowId', Mandatory=$true)]
        [string]$ShowId,

        [Parameter(ParameterSetName='ByUsername', Mandatory=$true)]
        [string]$Username,

        [Parameter(ParameterSetName='ByShowDate', Mandatory=$true)]
        [ValidatePattern('^\d{4}-\d{2}-\d{2}$')]
        [string]$ShowDate,

        [Parameter()][string]$OrderBy,
        [Parameter()][ValidateSet('asc','desc')][string]$Direction,
        [Parameter()][int]$Limit,
        [Parameter()][switch]$NoHeader
    )

    switch ($PSCmdlet.ParameterSetName) {
        'ByUid'      { $endpoint = "reviews/uid/$Uid.$Format" }
        'ByShowId'   { $endpoint = "reviews/showid/$ShowId.$Format" }
        'ByUsername'  { $endpoint = "reviews/username/$Username.$Format" }
        'ByShowDate' { $endpoint = "reviews/showdate/$ShowDate.$Format" }
    }

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