Public/Get-GW2PvPHeroes.ps1
|
<#
.SYNOPSIS Retrieves PvP heroes (Mist Champions) from the Guild Wars 2 API. .DESCRIPTION The Get-GW2PvPHeroes cmdlet retrieves information about Mist Champions (PvP heroes) for Stronghold sPvP. .PARAMETER Ids The ID(s) of the heroes to retrieve. Can be a single ID, an array of IDs, or "all". .PARAMETER Page The page number to retrieve. .PARAMETER PageSize The number of results per page. .PARAMETER Lang The language to return localized text in. Defaults to "en". Valid values: "en", "es", "de", "fr", "zh". .EXAMPLE Get-GW2PvPHeroes -Ids "D16D6D9F-73E5-420E-8C9B-1B44211D50DF" Retrieves information for a specific Mist Champion. .EXAMPLE Get-GW2PvPHeroes -Ids "all" Retrieves information for all Mist Champions. .NOTES API Endpoint: /v2/pvp/heroes #> function Get-GW2PvPHeroes { [CmdletBinding()] param ( [Parameter(Mandatory = $false)] [object]$Ids, [Parameter(Mandatory = $false)] [int]$Page, [Parameter(Mandatory = $false)] [int]$PageSize, [Parameter(Mandatory = $false)] [ValidateSet("en", "es", "de", "fr", "zh")] [string]$Lang ) $Uri = "https://api.guildwars2.com/v2/pvp/heroes" if ($Ids) { $Uri += "?ids=" + ($Ids -join ",") } if ($Lang) { $Uri += "&lang=$Lang" } if ($Page) { $Uri += "&page=$Page" } if ($PageSize) { $Uri += "&page_size=$PageSize" } try { Invoke-RestMethod -Uri $Uri -Method Get } catch { Write-Error "Failed to retrieve PvP heroes: $_" } } |