Appearance
@gracious.tech/fetch-client / collection / BibleCollection
Class: BibleCollection
collection.BibleCollection
Access to a collection's meta data, including languages and translations available
Methods
has_language
▸ has_language(language
): boolean
Check if a language exists (must be 3 character id)
Parameters
Name | Type |
---|---|
language | string |
Returns
boolean
has_translation
▸ has_translation(translation
): boolean
Check if a translation exists
Parameters
Name | Type |
---|---|
translation | string |
Returns
boolean
has_book
▸ has_book(translation
, book
): boolean
Check if a book exists within a translation
Parameters
Name | Type |
---|---|
translation | string |
book | string |
Returns
boolean
get_languages
▸ get_languages(options
): Record
<string
, GetLanguagesItem
>
Get available languages as either a list or an object
Parameters
Name | Type |
---|---|
options | ObjT <GetLanguagesOptions > |
Returns
Record
<string
, GetLanguagesItem
>
▸ get_languages(options?
): GetLanguagesItem
[]
Parameters
Name | Type |
---|---|
options? | ObjF <GetLanguagesOptions > |
Returns
get_preferred_language
▸ get_preferred_language(preferences?
): string
Get the user's preferred available language (no arg required when used in browser)
Parameters
Name | Type | Default value |
---|---|---|
preferences | string [] | [] |
Returns
string
get_translations
▸ get_translations(options
): Record
<string
, GetTranslationsItem
>
Get available translations as either a list or an object
Parameters
Name | Type |
---|---|
options | ObjT <GetTranslationsOptions > |
Returns
Record
<string
, GetTranslationsItem
>
▸ get_translations(options?
): GetTranslationsItem
[]
Parameters
Name | Type |
---|---|
options? | ObjF <GetTranslationsOptions > |
Returns
get_preferred_translation
▸ get_preferred_translation(languages?
): string
Get user's preferred available translation (provide language preferences if not in browser)
Parameters
Name | Type | Default value |
---|---|---|
languages | string [] | [] |
Returns
string
get_books
▸ get_books(translation
, options
): Record
<string
, GetBooksItem
>
Get which books are available for a translation
Parameters
Name | Type |
---|---|
translation | string |
options | ObjT <GetBooksOptions > |
Returns
Record
<string
, GetBooksItem
>
▸ get_books(translation
, options?
): GetBooksItem
[]
Parameters
Name | Type |
---|---|
translation | string |
options? | ObjF <GetBooksOptions > |
Returns
get_book_url
▸ get_book_url(translation
, book
, format?
): string
Get the URL for a book's content (useful for caching and manual retrieval)
Parameters
Name | Type | Default value |
---|---|---|
translation | string | undefined |
book | string | undefined |
format | "html" | "usx" | 'html' |
Returns
string
get_completion
▸ get_completion(translation
): GetCompletionReturn
Get book ids that are available/missing for a translation for each testament
Parameters
Name | Type |
---|---|
translation | string |
Returns
get_chapters
▸ get_chapters(translation
, book
): number
[]
Get chapter numbers for a book
Parameters
Name | Type |
---|---|
translation | string |
book | string |
Returns
number
[]
get_verses
▸ get_verses(translation
, book
, chapter
): number
[]
Get verse numbers for a chapter
Parameters
Name | Type |
---|---|
translation | string |
book | string |
chapter | number |
Returns
number
[]
fetch_book
▸ fetch_book(translation
, book
, format?
): Promise
<BibleBookHtml
>
Make request for the HTML text for a book of a translation (returns object for accessing it)
Parameters
Name | Type |
---|---|
translation | string |
book | string |
format? | "html" |
Returns
Promise
<BibleBookHtml
>
▸ fetch_book(translation
, book
, format
): Promise
<BibleBookUsx
>
Parameters
Name | Type |
---|---|
translation | string |
book | string |
format | "usx" |
Returns
Promise
<BibleBookUsx
>