Public/Get-GW2PvPSeasons.ps1

<#
    .SYNOPSIS
        Retrieves PvP seasons from the Guild Wars 2 API.
 
    .DESCRIPTION
        The Get-GW2PvPSeasons cmdlet retrieves information about PvP League seasons.
 
    .PARAMETER Ids
        The ID(s) of the seasons to retrieve. Can be a single ID, an array of IDs, or "all".
 
    .PARAMETER Lang
        The language to return localized text in. Defaults to "en".
        Valid values: "en", "es", "de", "fr", "zh".
 
    .EXAMPLE
        Get-GW2PvPSeasons -Ids "A54849B7-7DBD-4958-91EF-72E18CD659BA"
        Retrieves information for a specific season.
 
    .EXAMPLE
        Get-GW2PvPSeasons -Ids "all"
        Retrieves information for all seasons.
 
    .NOTES
        API Endpoint: /v2/pvp/seasons
    #>

function Get-GW2PvPSeasons {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false)]
        [string[]]$Ids,

        [Parameter(Mandatory = $false)]
        [ValidateSet("en", "es", "de", "fr", "zh")]
        [string]$Lang
    )

    $Uri = "https://api.guildwars2.com/v2/pvp/seasons"

    if ($Ids) {
        $Uri += "?ids=" + ($Ids -join ",")
    }

    if ($Lang) {
        $Uri += "&lang=$Lang"
    }

    try {
        $Result = Invoke-RestMethod -Uri $Uri -Method Get
        return $Result
    }
    catch {
        Write-Error "Failed to retrieve PvP seasons: $_"
    }
}