-
Notifications
You must be signed in to change notification settings - Fork 11
/
generateAll.sh
executable file
·38 lines (31 loc) · 1.5 KB
/
generateAll.sh
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
#!/bin/sh
# Sets working tools
if [[ $OSTYPE == 'darwin'* ]]; then
echo "MacOS detected. Alias sed to gsed."
alias sed=gsed
fi
DATE=$(date +"%Y-%m-%d")
# We allow only non classic, non webhook APIs
ALLOW_LIST="BalanceControlService|BalancePlatformService|BinLookupService|CheckoutService|DataProtectionService|DisputeService|GrantService|LegalEntityService|ManagementService|PayoutService|RecurringService|StoredValueService|TestCardService|TfmAPIService|TransferService"
for entry in "adyen-openapi/yaml"/*
do
echo "Processing $entry"
if echo "$entry" | grep -q -E "$ALLOW_LIST"; then
echo "$entry is part of the allow list. Generating"
FILENAME=$entry
BASE=$(echo "$(basename "${FILENAME%.*}")")
NAME=$(echo $FILENAME | sed 's/-.*//' | sed 's/.*\///')
REAL_NAME=$(sed '/title:/!d;q' $FILENAME | sed 's/.*://')
VERSION=$(echo $FILENAME | sed 's/.*-v//' | sed 's/\..*//')
# echo "Generating $FILENAME $BASE $NAME $REAL_NAME $VERSION $DATE"
sed -i.bak2 "0,/title:.*/{s//title: $REAL_NAME\ (v$VERSION)/}" $FILENAME # Set unique name of API for Postman
/script.sh generate \
--additional-properties postmanVariables=YOUR_MERCHANT_ACCOUNT-YOUR_COMPANY_ACCOUNT-YOUR_BALANCE_PLATFORM,generatedVariables=YOUR_REFERENCE_NUMBER-YOUR_REFERENCE-YOUR_ORDER_NUMBER-YOUR_ORDER_NUMBER\
-i $FILENAME \
-o postman/$BASE
mv postman/$BASE/postman.json postman/$BASE.json
rm -rf postman/$BASE
else
echo "$entry is NOT part of the allow list. Skipping"
fi
done