Public/Get-GW2AccountBuildStorage.ps1
|
<#
.SYNOPSIS Retrieves the account's build storage using a provided API key. .DESCRIPTION Calls the Guild Wars 2 API v2 /account/buildstorage endpoint and returns the deserialized object containing the account's build storage. The function issues an authenticated GET request. .PARAMETER APIKey The Guild Wars 2 API key (string) to authenticate the request. Requires 'account' and 'builds' scopes. .PARAMETER Ids The IDs of the builds to retrieve (string array). .EXAMPLE Get-GW2AccountBuildStorage -APIKey 'your_api_key_here' .NOTES - Requires network access to api.guildwars2.com. - Ensure the API key has the necessary scopes. #> function Get-GW2AccountBuildStorage { param ( [string]$APIKey, [string[]]$Ids ) $headers = @{ "Authorization" = "Bearer $APIKey" } $url = "https://api.guildwars2.com/v2/account/buildstorage" if ($Ids) { # Join IDs with commas for the query parameter $idString = $Ids -join ',' $url = $url + "?ids=$idString" } $response = Invoke-RestMethod -Uri $url -Method Get -Headers $headers return $response } |