Public/Get-GW2Maps.ps1

<#
    .SYNOPSIS
        Retrieves information about maps.
 
    .DESCRIPTION
        This function retrieves information about maps from the Guild Wars 2 API.
        It supports retrieving specific maps by ID or all maps.
 
    .PARAMETER Ids
        The ID(s) of the maps to retrieve. Can be a single ID, an array of IDs, or "all".
 
    .PARAMETER All
        Retrieves information for all maps.
 
    .PARAMETER Lang
        The language to return localized text in. Defaults to "en".
        Valid values: "en", "es", "de", "fr", "zh".
 
    .EXAMPLE
        Get-GW2Maps -Ids 15,50
        Retrieves information for maps with IDs 15 and 50.
 
    .EXAMPLE
        Get-GW2Maps -All
        Retrieves information for all maps.
 
    .LINK
        https://wiki.guildwars2.com/wiki/API:2/maps
#>

function Get-GW2Maps {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false)]
        [object]$Ids,
        [Parameter(Mandatory = $false)]
        [switch]$All,
        [Parameter(Mandatory = $false)]
        [ValidateSet("en", "es", "de", "fr", "zh")]
        [string]$Lang = "en"
    )

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

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

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