Private/Invoke-ShellPhishApi.ps1

function Invoke-ShellPhishApi {
    <#
    .SYNOPSIS
        Sends a request to the Phish.net API and returns the response.
    .DESCRIPTION
        Central HTTP helper used by all public cmdlets. Builds the full URL from
        an endpoint path and optional query parameters, then calls Invoke-RestMethod.
    .PARAMETER Endpoint
        The API endpoint path (e.g. "shows/showdate/2021-07-04.json").
    .PARAMETER QueryParams
        Optional hashtable of query-string parameters (order_by, direction, limit, etc.).
    .PARAMETER ApiKey
        Your Phish.net API key.
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [string]$Endpoint,

        [Parameter(Mandatory=$false)]
        [hashtable]$QueryParams = @{},

        [Parameter(Mandatory=$true)]
        [string]$ApiKey
    )

    $qs  = New-ShellPhishParameterString -QueryParams $QueryParams -ApiKey $ApiKey
    $url = "$PhishNetApiBaseUrl/$Endpoint`?$qs"
    $uri = [uri]::EscapeUriString($url)
    Write-Verbose "URI: $uri"

    Invoke-RestMethod -Method Get -Uri $uri -UserAgent "ShellPhish/2.0"
}