-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marcel Kocisek
committed
Jan 31, 2022
1 parent
96fcd1b
commit e0986e9
Showing
6 changed files
with
193 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.tabSize": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Ziskanie dostupnych zoznamov z APi | ||
./iz.sh -al | jq | ||
|
||
# Ziskanie detailu o zozname ds_dph_oud | ||
./iz.sh -l ds_dph_oud | jq | ||
|
||
# Ziskanie vsetkych platitelov DPH na strane 1 (defaultna hodnota) | ||
./iz.sh -d ds_dphs | jq | ||
|
||
# Ziskanie stranu 2 z platitelov DPH | ||
./iz.sh -d ds_dphs -p 2 | jq | ||
|
||
# Najdeme v zozname platitelov DPH vsetkych podla ic_dph SK2020317068 | ||
./iz.sh -ds ds_dphs -s SK2020317068 -c ic_dph | jq | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
print_help(){ | ||
./generator/generated/iz/client.sh --about | ||
echo -e "-al/--available-lists - All lists in API" | ||
echo -e "-l/--list [slug] - Detail of list based on string slug" | ||
echo -e "-d/--data [slug] - Get data based on slug" | ||
echo -e "-ds/--data-search [slug] - Searching in list based on slug" | ||
echo -e "-p/--page [page] - Page in large data (default is 1)" | ||
echo -e "-c/--column [column] - Searchable column" | ||
echo -e "-s/--search [term] - Searching term in selected -c/--column" | ||
} | ||
|
||
. ./config.sh | ||
|
||
get_slug=false | ||
get_page=false | ||
get_column=false | ||
get_search=false | ||
|
||
for param in "$@"; do | ||
|
||
case $OPERATION in | ||
"listsSlugGet") | ||
SLUG=$param | ||
continue | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
if [[ "$get_slug" = true ]]; then | ||
SLUG=$param | ||
get_slug=false | ||
continue | ||
fi | ||
|
||
if [[ "$get_page" = true ]]; then | ||
PAGE=$param | ||
get_page=false | ||
continue | ||
fi | ||
|
||
if [[ "$get_search" = true ]]; then | ||
SEARCH=$param | ||
get_search=false | ||
continue | ||
fi | ||
|
||
if [[ "$get_column" = true ]]; then | ||
COLUMN=$param | ||
get_column=false | ||
continue | ||
fi | ||
|
||
case $param in | ||
-al|--available-lists) | ||
OPERATION="listsGet" | ||
break | ||
;; | ||
-l|--list) | ||
OPERATION="listsSlugGet" | ||
;; | ||
-d|--data) | ||
OPERATION="dataSlugGet" | ||
get_slug=true | ||
;; | ||
-ds|--data-search) | ||
OPERATION="dataSlugSearchGet" | ||
get_slug=true | ||
;; | ||
-s|--search) | ||
get_search=true | ||
;; | ||
-c|--column) | ||
get_column=true | ||
;; | ||
-p|--page) | ||
get_page=true | ||
;; | ||
-h|--help) | ||
print_help | ||
exit 0 | ||
;; | ||
-*|--*) | ||
echo "ERROR: Unknown param $param" | ||
exit 1 | ||
;; | ||
*) | ||
;; | ||
esac | ||
done | ||
|
||
# Check if user provided host name | ||
if [[ -z "$OPERATION" ]]; then | ||
echo "ERROR: Operation not supported, not enough arguments" | ||
exit 1 | ||
fi | ||
|
||
PARAMS="" | ||
|
||
case $OPERATION in | ||
"listsSlugGet") | ||
if [[ -z "$SLUG" ]]; then | ||
echo "ERROR: Missing parameter" | ||
exit 1 | ||
fi | ||
PARAMS="${PARAMS} slug=${SLUG}" | ||
;; | ||
"dataSlugGet") | ||
if [[ -z "$SLUG" ]]; then | ||
echo "ERROR: Missing parameter" | ||
exit 1 | ||
fi | ||
PARAMS="${PARAMS} slug=${SLUG} page=${PAGE:-1}" | ||
;; | ||
"dataSlugSearchGet") | ||
if [[ -z "$SLUG" ]]; then | ||
echo "ERROR: Missing parameter" | ||
exit 1 | ||
fi | ||
if [[ -z "$COLUMN" ]]; then | ||
echo "ERROR: Missing parameter column" | ||
exit 1 | ||
fi | ||
PARAMS="${PARAMS} slug=${SLUG} page=${PAGE:-1} column=${COLUMN} search=${SEARCH}" | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
./generator/generated/iz/client.sh \ | ||
--host https://iz.opendata.financnasprava.sk/api/data \ | ||
${OPERATION} \ | ||
'key:${OAFS_KEY}' \ | ||
$PARAMS | ||
|