param( [Parameter(Mandatory = $true)] [string]$ServiceRoleKey, [Parameter(Mandatory = $false)] [string]$OutputPath = "${PWD}/.github/copilot/supabase-rest-openapi.json", [Parameter(Mandatory = $false)] [string]$RestUrl = "http://192.168.0.150:8080/rest/v1" ) $uri = "$RestUrl/?apikey=$ServiceRoleKey" Write-Host "Downloading Supabase OpenAPI schema from $uri" -ForegroundColor Cyan try { Invoke-WebRequest -Uri $uri -OutFile $OutputPath -UseBasicParsing Write-Host "Saved OpenAPI schema to $OutputPath" -ForegroundColor Green } catch { Write-Host "Failed to download OpenAPI schema: $($_.Exception.Message)" -ForegroundColor Red exit 1 }