summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/cac.sh28
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/cac.sh b/lib/cac.sh
index d2108d360..5e3f4ec70 100644
--- a/lib/cac.sh
+++ b/lib/cac.sh
@@ -8,26 +8,22 @@ _cac_exec() {
fi
}
+_cac_curl_api_v1() {
+ _cac_exec curl -fsS "$1" "https://panel.cloudatcost.com/api/v1/$2.php" $(
+ shift 2
+ set -- "$@" login="$cac_login" key="$cac_key"
+ for arg; do
+ echo -d $(printf '%s' "$arg" | url_encode)
+ done
+ )
+}
+
_cac_get_api_v1() {
- _cac_exec curl -fsS \
- $(shift
- set -- "$@" login="$cac_login" key="$cac_key"
- for arg; do
- echo -d $(printf '%s' "$arg" | url_encode)
- done
- ) \
- -G "https://panel.cloudatcost.com/api/v1/$1.php"
+ _cac_curl_api_v1 -G "$@"
}
_cac_post_api_v1() {
- _cac_exec curl -fsS \
- $(shift
- set -- "$@" login="$cac_login" key="$cac_key"
- for arg; do
- echo -d $(printf '%s' "$arg" | url_encode)
- done
- ) \
- -X POST "https://panel.cloudatcost.com/api/v1/$1.php"
+ _cac_curl_api_v1 -XPOST "$@"
}
cac_listservers() {