Public/Get-GW2CommercePrices.ps1

<#
    .SYNOPSIS
        Retrieves current aggregated price information from the trading post.
 
    .DESCRIPTION
        The Get-GW2CommercePrices cmdlet retrieves the highest buy order and lowest sell offer price for items.
 
    .PARAMETER Ids
        The ID(s) of the items to retrieve prices for. Can be a single ID, an array of IDs, or "all".
 
    .EXAMPLE
        Get-GW2CommercePrices -Ids 19684
        Retrieves price information for item ID 19684.
 
    .EXAMPLE
        Get-GW2CommercePrices -Ids "all"
        Retrieves price information for all items (paginated).
 
    .NOTES
        API Endpoint: /v2/commerce/prices
    #>

function Get-GW2CommercePrices {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false)]
        [string[]]$Ids
    )

    $Uri = "https://api.guildwars2.com/v2/commerce/prices"

    if ($Ids) {
        $Uri += "?ids=$($Ids -join ',')"
    }

    try {
        Invoke-RestMethod -Uri $Uri -Method Get
    }
    catch {
        Write-Error "Failed to retrieve commerce prices: $_"
    }
}