Public/Get-GW2DailyCrafting.ps1
|
<#
.SYNOPSIS Retrieves daily crafting information from the Guild Wars 2 API. .DESCRIPTION Calls the Guild Wars 2 API v2 /dailycrafting endpoint. - If no parameters are provided, returns a list of all available time-gated recipe IDs. - If 'Ids' is provided, returns objects containing details for the specified recipes. .PARAMETER Ids Optional. A list of recipe IDs (strings) to retrieve. Example: "charged_quartz_crystal", "glob_of_elder_spirit_residue" .EXAMPLE Get-GW2DailyCrafting Returns a list of all recipe IDs. .EXAMPLE Get-GW2DailyCrafting -Ids "charged_quartz_crystal" Returns details for the specified recipe. .NOTES - Requires network access to api.guildwars2.com. - This is a public endpoint and does not require an API key. #> function Get-GW2DailyCrafting { param ( [Parameter(Mandatory = $false)] [string[]]$Ids ) $url = "https://api.guildwars2.com/v2/dailycrafting" if ($Ids) { # Join IDs with commas for the query parameter $idString = $Ids -join ',' $url = $url + "?ids=$idString" } $response = Invoke-RestMethod -Uri $url -Method Get return $response } |