-
-
Notifications
You must be signed in to change notification settings - Fork 0
BibleService
You may want multiple services if you plan on using different versions of the api, or fetching text and audio.
const {BibleService} = require('berea');
const service = new BibleService('someLongToken');
As the API itself is version controlled, the library is too. This is an optional second parameter:
const {BibleService} = require('berea');
const service = new BibleService('someLongToken', 1);
The Bible API itself offers text and audio. As you may want one over the other, this is an optional third parameter. The options are text or audio.
const {BibleService} = require('berea');
const service = new BibleService('someLongToken', 1, 'audio');
Kind: global class
-
BibleService
- new BibleService(apikey, [version], [medium], [dependencies])
-
instance
-
.version :
string -
.dependencies :
object -
.apikey :
string -
.axios :
object -
.BibleTypes :
enum -
.RequestParameters :
enum -
.getBibles([request]) ⇒
Promise.<Array.<BibleResponse>> -
.getBible(id) ⇒
Promise.<BibleResponse> -
.getBooks(request) ⇒
Promise.<Array.<BookResponse>> -
.getBook(request, [bookIdStr]) ⇒
Promise.<BookResponse> -
.getChaptersFromBook(request, [bookIdStr]) ⇒
Promise.<Array.<ChapterSummaryResponse>> -
.getChapter(request, chapterIdStr) ⇒
Promise.<ChapterResponse> -
.getPassage(request, passageIdStr) ⇒
Promise.<PassageResponse> -
.getVersesFromChapter(request, [chapterIdStr]) ⇒
Promise.<Array.<ChapterResponse>> -
.getVerse(request, [verseIdStr]) ⇒
Promise.<Array.<VerseResponse>>
-
.version :
- static
| Param | Type | Default | Description |
|---|---|---|---|
| apikey | string |
api key needed | |
| [version] |
number | string
|
1 |
version of api |
| [medium] | BibleTypes |
'text' |
audio or text bible |
| [dependencies] | object |
{Axios} |
axios library |
Kind: instance property of BibleService
Access: public
Kind: instance property of BibleService
Access: public
Kind: instance property of BibleService
Access: public
Kind: instance property of BibleService
Access: public
enum for kinds of media for the bible (text or audio)
Kind: instance enum of BibleService
Read only: true
enum for all the parameters that can be submitted through any of the service methods
Kind: instance enum of BibleService
Read only: true
Kind: instance method of BibleService
Returns: Promise.<Array.<BibleResponse>> - An array of bibles
| Param | Type | Description |
|---|---|---|
| [request] | BiblesRequestParam |
options to send |
bibleService.getBible(id) ⇒ Promise.<BibleResponse>
Kind: instance method of BibleService
Returns: Promise.<BibleResponse> - Bible data
| Param | Type | Description |
|---|---|---|
| id | string |
Gets Bible by Id |
Kind: instance method of BibleService
Returns: Promise.<Array.<BookResponse>> - an array of bookdata
| Param | Type | Description |
|---|---|---|
| request |
BooksRequestParam | string
|
id of the bible or object containing id and parameters |
bibleService.getBook(request, [bookIdStr]) ⇒ Promise.<BookResponse>
Kind: instance method of BibleService
Returns: Promise.<BookResponse> - book data
| Param | Type | Description |
|---|---|---|
| request |
string | BookRequestParam
|
id of the bible or object containing id, bookId, and parameters |
| [bookIdStr] | string |
id of the book to fetch. Not required if the request is an object. |
Gets chapters from a single book
Kind: instance method of BibleService
Returns: Promise.<Array.<ChapterSummaryResponse>> - Chapterdata
| Param | Type | Default | Description |
|---|---|---|---|
| request |
ChaptersRequestParam | string
|
id of the bible or object containing id, bookId, and parameters | |
| [bookIdStr] | string |
"''" |
id for the book. Not needed if request is an object and has bookId |
bibleService.getChapter(request, chapterIdStr) ⇒ Promise.<ChapterResponse>
Kind: instance method of BibleService
Returns: Promise.<ChapterResponse> - The chapter
| Param | Type | Description |
|---|---|---|
| request |
ChapterRequestParam | string
|
options object |
| chapterIdStr | string |
chapter id. not needed if request has chapterId |
bibleService.getPassage(request, passageIdStr) ⇒ Promise.<PassageResponse>
Kind: instance method of BibleService
Returns: Promise.<PassageResponse> - passageData
| Param | Type | Description |
|---|---|---|
| request |
PassageRequestParam | string
|
options or string with bible id |
| passageIdStr | string |
id of passage (e.g. GEN.1.1-GEN.2.2) |
Gets verses from a single chapter
Kind: instance method of BibleService
Returns: Promise.<Array.<ChapterResponse>> - chapterdata
| Param | Type | Description |
|---|---|---|
| request |
ChaptersRequestParam | string
|
id of the bible or object containing id, bookId, and parameters |
| [chapterIdStr] | string |
chapterId (e.g. GEN.1) |
Get a verse
Kind: instance method of BibleService
Returns: Promise.<Array.<VerseResponse>> - versedata
| Param | Type | Description |
|---|---|---|
| request |
VerseRequestParam | string
|
id of the bible or object containing id, bookId, and parameters |
| [verseIdStr] | string |
verseId (e.g. GEN.1.1) not needed if the request parameter has verseId |
Kind: static method of BibleService
Returns: object - Axios instance
| Param | Type | Description |
|---|---|---|
| dependencies | object |
the dependencies object passed it, containing an Axios |
| apiKey | string |
apikey needed for.. the api |
| version | number |
version of the api |