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