Public/Get-GW2EmblemForegrounds.ps1
|
<#
.SYNOPSIS Retrieves emblem foreground information from the Guild Wars 2 API. .DESCRIPTION Calls the Guild Wars 2 API v2 /emblem/foregrounds endpoint. - If no parameters are provided, returns a list of all available emblem foreground IDs. - If 'Ids' is provided, returns objects containing details for the specified emblem foregrounds. - If 'All' is specified, returns all available emblem foregrounds. .PARAMETER Ids Optional. A list of emblem foreground IDs (integers) to retrieve. Example: 1, 2 .PARAMETER All Optional. If set, retrieves all emblem foregrounds. .EXAMPLE Get-GW2EmblemForegrounds Returns a list of all emblem foreground IDs. .EXAMPLE Get-GW2EmblemForegrounds -Ids 1 Returns details for the specified emblem foreground. .EXAMPLE Get-GW2EmblemForegrounds -All Returns details for all emblem foregrounds. .NOTES - Requires network access to api.guildwars2.com. - This is a public endpoint and does not require an API key. #> function Get-GW2EmblemForegrounds { param ( [Parameter(Mandatory = $false)] [int[]]$Ids, [Parameter(Mandatory = $false)] [switch]$All ) $url = "https://api.guildwars2.com/v2/emblem/foregrounds" if ($All) { $url = $url + "?ids=all" } elseif ($Ids) { # Join IDs with commas for the query parameter $idString = $Ids -join ',' $url = $url + "?ids=$idString" } $response = Invoke-RestMethod -Uri $url -Method Get return $response } |