-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·54 lines (43 loc) · 1.72 KB
/
Copy pathsync.sh
File metadata and controls
executable file
·54 lines (43 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
set -euo pipefail
# Resolve paths relative to the repository root, so the script can be run from
# any working directory.
cd "$(dirname "${BASH_SOURCE[0]}")"
defaultBaseUrl="https://fingerprintjs.github.io/openapi"
schemaUrl="${1:-$defaultBaseUrl/schemas/fingerprint-server-api-v4.yaml}"
examplesBaseUrl="${2:-$defaultBaseUrl/examples}"
CURL_OPTS=(-fSL --retry 3 --proto-redir '=https' --connect-timeout 10 --max-time 300)
if [[ "${TRACE:-}" != "true" && "${ACTIONS_STEP_DEBUG:-}" != "true" ]]; then
CURL_OPTS+=(-s)
fi
schemaDestination="./res/fingerprint-server-api.yaml"
exampleBaseDestination="./test/mocks"
mkdir -p "$(dirname "$schemaDestination")"
echo "Downloading $schemaUrl to $schemaDestination"
curl "${CURL_OPTS[@]}" -o "$schemaDestination" "$schemaUrl"
examples=(
'events/search/get_event_search_200.json'
'events/get_event_200.json'
'events/get_event_ruleset_200.json'
'events/update_event_multiple_fields_request.json'
'events/update_event_one_field_request.json'
'errors/400_event_id_invalid.json'
'errors/400_request_body_invalid.json'
'errors/400_visitor_id_required.json'
'errors/400_visitor_id_invalid.json'
'errors/403_feature_not_enabled.json'
'errors/403_secret_api_key_required.json'
'errors/404_event_not_found.json'
'errors/404_visitor_not_found.json'
'errors/409_state_not_ready.json'
'errors/429_too_many_requests.json'
)
for example in "${examples[@]}"; do
destinationPath="$exampleBaseDestination/$example"
mkdir -p "$(dirname "$destinationPath")"
exampleUrl="$examplesBaseUrl/$example"
echo "Downloading $exampleUrl to $destinationPath"
curl "${CURL_OPTS[@]}" -o "$destinationPath" "$exampleUrl"
done
echo "All OpenAPI schema downloads complete."
./generate.sh