Public/Get-GW2Quaggans.ps1

<#
    .SYNOPSIS
        Retrieves quaggan image URLs.
 
    .DESCRIPTION
        This function retrieves quaggan image URLs from the Guild Wars 2 API.
        It supports retrieving specific quaggans by ID or all quaggans.
 
    .PARAMETER Ids
        The ID(s) of the quaggans to retrieve. Can be a single ID, an array of IDs, or "all".
 
    .EXAMPLE
        Get-GW2Quaggans -Ids "box","bear"
        Retrieves URLs for specific quaggan images.
 
    .EXAMPLE
        Get-GW2Quaggans -Ids "all"
        Retrieves URLs for all quaggan images.
 
    .LINK
        https://wiki.guildwars2.com/wiki/API:2/quaggans
#>

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

    $Uri = "https://api.guildwars2.com/v2/quaggans"
    $QueryParams = @{}

    if ($null -ne $Ids) {
        if ($Ids -is [array]) {
            $QueryParams["ids"] = $Ids -join ","
        }
        elseif ($Ids -eq "all") {
            $QueryParams["ids"] = "all"
        }
        else {
            $QueryParams["ids"] = $Ids
        }
    }

    try {
        Invoke-RestMethod -Uri $Uri -Method Get -Body $QueryParams
    }
    catch {
        Write-Error "Failed to retrieve quaggans: $_"
    }
}