The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
805 B

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. if [[ -z "${BUBBLE_SMTP_PASS}" ]] ; then
  6. echo "BUBBLE_SMTP_PASS not defined in environment"
  7. exit 1
  8. fi
  9. API_BASE=https://api.sendgrid.com/v3/
  10. URI="${1:?no uri}"
  11. POST_FILE="${2}"
  12. HTTP_METHOD=${3}
  13. if [[ -n "${POST_FILE}" ]] ; then
  14. if [[ -z "${HTTP_METHOD}" ]] ; then
  15. curl -d @${POST_FILE} -s -H 'Content-Type: application/json' -H "Authorization: Bearer ${BUBBLE_SMTP_PASS}" ${API_BASE}${URI}
  16. else
  17. curl -d @${POST_FILE} -X ${HTTP_METHOD} -s -H 'Content-Type: application/json' -H "Authorization: Bearer ${BUBBLE_SMTP_PASS}" ${API_BASE}${URI}
  18. fi
  19. else
  20. curl -s -H "Authorization: Bearer ${BUBBLE_SMTP_PASS}" ${API_BASE}${URI}
  21. fi