mirror of
https://github.com/rwxrob/dot
synced 2024-11-18 15:25:52 +00:00
19 lines
439 B
Plaintext
19 lines
439 B
Plaintext
|
|
# curl a graphql query (change /tmp/gitstoken)
|
|
|
|
curlgl () {
|
|
declare uri="$1"
|
|
shift
|
|
declare q=$(argsorin "$@")
|
|
q=${q//\"/\\\"} # escape all the double quotes
|
|
q=${q//$'\n'/ } # force single line
|
|
q=${q//$'\t'/ } # remove random tabs
|
|
declare query='{"query": "'$q'"}'
|
|
curl -s -X POST \
|
|
-H "Authorization: Bearer $(</tmp/gitstoken)" \
|
|
-H 'Content-Type: application/json' \
|
|
-d "$query" "$uri" && echo
|
|
return $?
|
|
}
|
|
|