Public/Get-GW2Files.ps1
|
<#
.SYNOPSIS Retrieves information about common asset files. .DESCRIPTION This function retrieves information about common asset files (logos, icons) from the Guild Wars 2 API. It supports retrieving specific files by ID or all files. .PARAMETER Ids The ID(s) of the files to retrieve. Can be a single ID, an array of IDs, or "all". .EXAMPLE Get-GW2Files -Ids "map_complete","map_dungeon" Retrieves information for specific files. .EXAMPLE Get-GW2Files -Ids "all" Retrieves information for all files. .LINK https://wiki.guildwars2.com/wiki/API:2/files #> function Get-GW2Files { [CmdletBinding()] param ( [Parameter(Mandatory = $false)] [object]$Ids ) $Uri = "https://api.guildwars2.com/v2/files" $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 files: $_" } } |