Skip to content

Instantly share code, notes, and snippets.

@htadashi
Created March 8, 2021 22:21
Show Gist options
  • Save htadashi/991c4c5be166c04d44daf1d3dc55c8e1 to your computer and use it in GitHub Desktop.
Save htadashi/991c4c5be166c04d44daf1d3dc55c8e1 to your computer and use it in GitHub Desktop.
Exemplo de como comunicar com o bible-api.com
/**
* Obtém versículos da Bíblia
*
* @param {String} citation - Localização do versículo (em inglês). Exemplo: Jn 3:16
* @customFunction
*
* @returns {number} Verso bíblico
*/
function BIBLE_VERSE(citation){
return fetchBibleAPI_(citation);
}
function fetchBibleAPI_(citation){
var url = 'https://bible-api.com/' + citation + '?translation=almeida';
var response = UrlFetchApp.fetch(url);
var verses = JSON.parse(response.getContentText());
return verses.text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment