Skip to content

Commit 796aa9f

Browse files
committed
Harden generate script fetches
1 parent 8cc73e5 commit 796aa9f

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/libs/Ideogram/generate.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# OpenAPI spec: https://api.ideogram.ai/openapi.json
4+
install_autosdk_cli() {
5+
dotnet tool update --global autosdk.cli --prerelease >/dev/null 2>&1 || \
6+
dotnet tool install --global autosdk.cli --prerelease
7+
}
8+
9+
fetch_spec() {
10+
curl "$@" \
11+
--fail --silent --show-error --location \
12+
--retry 5 --retry-delay 10 --retry-all-errors \
13+
--connect-timeout 30 --max-time 300
14+
}
515

6-
dotnet tool install --global autosdk.cli --prerelease
16+
# OpenAPI spec: https://api.ideogram.ai/openapi.json
17+
install_autosdk_cli
718
rm -rf Generated
8-
curl --fail --silent --show-error -L https://api.ideogram.ai/openapi.json | jq . > openapi.json
19+
fetch_spec --fail --silent --show-error -L https://api.ideogram.ai/openapi.json | jq . > openapi.json
920
autosdk generate openapi.json \
1021
--namespace Ideogram \
1122
--clientClassName IdeogramClient \

0 commit comments

Comments
 (0)