Created
September 24, 2018 08:03
-
-
Save onokatio/96570ec64e5a20e90c45bdacb64423c1 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
APIKEY=${APIKEY:-"NONE"} | |
DOMAIN=${DOMAIN:-"NONE"} | |
VERSION=${VERSION:-"v2"} | |
command_HTTP=${command_HTTP:-"curl -Ss"} | |
if [[ "${APIKEY}" == "NONE" ]];then | |
echo "\$APIKEY is empty. Please make sure to set it." | |
exit | |
fi | |
if [[ "${DOMAIN}" == "NONE" ]];then | |
echo "\$DOMAIN is empty. Please make sure to set it." | |
exit | |
fi | |
# String(JSON) getHTTP(Strings endpoint,Strings args); | |
function getHTTP(){ | |
${command_HTTP} "${DOMAIN}/api/${VERSION}/$1?apiKey=${APIKEY}&$2" | |
} | |
# Strings(JSON) getProjects(void) | |
function getProjects(){ | |
echo $( getHTTP "projects" ) | |
} | |
# Strings(JSON) getIssues(int projectID) | |
function getIssues(){ | |
echo $( getHTTP "issues" "projectId=$1" ) | |
} | |
pid=$(getProjects | jq .[0].id) | |
getIssues $pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment