Created
March 8, 2021 22:21
-
-
Save htadashi/991c4c5be166c04d44daf1d3dc55c8e1 to your computer and use it in GitHub Desktop.
Exemplo de como comunicar com o bible-api.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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