Public/Get-GW2EmblemBackgrounds.ps1
|
<#
.SYNOPSIS Retrieves emblem background information from the Guild Wars 2 API. .DESCRIPTION Calls the Guild Wars 2 API v2 /emblem/backgrounds endpoint. - If no parameters are provided, returns a list of all available emblem background IDs. - If 'Ids' is provided, returns objects containing details for the specified emblem backgrounds. - If 'All' is specified, returns all available emblem backgrounds. .PARAMETER Ids Optional. A list of emblem background IDs (integers) to retrieve. Example: 1, 2 .PARAMETER All Optional. If set, retrieves all emblem backgrounds. .EXAMPLE Get-GW2EmblemBackgrounds Returns a list of all emblem background IDs. .EXAMPLE Get-GW2EmblemBackgrounds -Ids 1 Returns details for the specified emblem background. .EXAMPLE Get-GW2EmblemBackgrounds -All Returns details for all emblem backgrounds. .NOTES - Requires network access to api.guildwars2.com. - This is a public endpoint and does not require an API key. #> function Get-GW2EmblemBackgrounds { param ( [Parameter(Mandatory = $false)] [int[]]$Ids, [Parameter(Mandatory = $false)] [switch]$All ) $url = "https://api.guildwars2.com/v2/emblem/backgrounds" 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 } |