39 lines
1.6 KiB
PowerShell
39 lines
1.6 KiB
PowerShell
$baseUrl = "http://192.168.99.242:8081"
|
|
$specs = @(
|
|
@{ name="attribute"; url="/attribute/v3/api-docs" },
|
|
@{ name="batch-scheduler"; url="/batch-scheduler/v3/api-docs" },
|
|
@{ name="catalogue"; url="/catalogue/v3/api-docs" },
|
|
@{ name="customer"; url="/customer/v3/api-docs" },
|
|
@{ name="identity"; url="/identity/v3/api-docs" },
|
|
@{ name="marketing"; url="/marketing/v3/api-docs" },
|
|
@{ name="master"; url="/master/v3/api-docs" },
|
|
@{ name="notification"; url="/notification/v3/api-docs" },
|
|
@{ name="reward"; url="/reward/v3/api-docs" },
|
|
@{ name="transaction"; url="/transaction/v3/api-docs" }
|
|
)
|
|
|
|
$targetDir = "src/main/resources/specs"
|
|
if (-not (Test-Path $targetDir)) {
|
|
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
|
|
}
|
|
|
|
foreach ($spec in $specs) {
|
|
$fullUrl = $baseUrl + $spec.url
|
|
$outputPath = Join-Path $targetDir ($spec.name + ".json")
|
|
Write-Host "Downloading $($spec.name) from $fullUrl ..."
|
|
try {
|
|
Invoke-WebRequest -Uri $fullUrl -OutFile $outputPath -UseBasicParsing
|
|
Write-Host "[OK] $($spec.name) saved to $outputPath"
|
|
} catch {
|
|
Write-Host "[WARNING] Failed to download from $fullUrl, trying alternative path..."
|
|
$altUrl = $baseUrl + "/v3/api-docs/" + $spec.name
|
|
try {
|
|
Invoke-WebRequest -Uri $altUrl -OutFile $outputPath -UseBasicParsing
|
|
Write-Host "[OK] $($spec.name) saved to $outputPath (alternative path)"
|
|
} catch {
|
|
Write-Host "[ERROR] Failed to download $($spec.name)"
|
|
}
|
|
}
|
|
}
|
|
Write-Host "Done downloading specs."
|