Public/Get-GW2HomeNodes.ps1
|
<#
.SYNOPSIS Retrieves information about home instance upgrades (nodes). .DESCRIPTION Calls the Guild Wars 2 API v2 /home/nodes endpoint. - If no parameters are provided, returns a list of all available node IDs. - If 'Ids' is provided, returns objects containing details for the specified nodes. .PARAMETER Ids Optional. A list of node IDs (strings) to retrieve. Example: "quartz_node", "sprocket_generator" .EXAMPLE Get-GW2HomeNodes Returns a list of all node IDs. .EXAMPLE Get-GW2HomeNodes -Ids "quartz_node" Returns details for the specified node. .NOTES - Requires network access to api.guildwars2.com. - This is a public endpoint and does not require an API key. #> function Get-GW2HomeNodes { param ( [Parameter(Mandatory = $false)] [string[]]$Ids ) $url = "https://api.guildwars2.com/v2/home/nodes" if ($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 } |