#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=../lib/common.sh
source "${ROOT}/lib/common.sh"

require_env TOKEN
NEW_EMAIL="${NEW_EMAIL:-newemail@example.com}"

curl_post_bearer_json "/change-email" "${TOKEN}" \
  "$(printf '%s' "{\"newEmail\":\"${NEW_EMAIL}\"}")" | pretty
