# Date: 2021-12-03 12:08:21 +0000 (Fri, 03 Dec 2021)
#
# https://github.com/harisekhon/bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
set -euo pipefail
[ -n "${DEBUG:-}"]&&set -x
srcdir="$(dirname "${BASH_SOURCE[0]}")"
# shellcheck disable=SC1090
. "$srcdir/lib/utils.sh"
# shellcheck disable=SC1090
. "$srcdir/lib/git.sh"
# shellcheck disable=SC2034,SC2154
usage_description="
Queries the CircleCI API
Requires \$CIRCLECI_TOKEN in the environment
Can specify \$CURL_OPTS for options to pass to curl or provide them as arguments
Set up a personal access token here - may need to click 'Enable SSO' next to each token to access corporation organizations with SSO (eg. Azure AAD SSO):
The CircleCI API isn't very mature, so sometimes you need to go back and use the v1.1 API instead of the default v2 API, so if the path starts with /v1.1 it'll use that API instead