Skip to content
On this page

@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

NameType
languagestring

Returns

boolean


has_translation

has_translation(translation): boolean

Check if a translation exists

Parameters

NameType
translationstring

Returns

boolean


has_book

has_book(translation, book): boolean

Check if a book exists within a translation

Parameters

NameType
translationstring
bookstring

Returns

boolean


get_languages

get_languages(options): Record<string, GetLanguagesItem>

Get available languages as either a list or an object

Parameters

NameType
optionsObjT<GetLanguagesOptions>

Returns

Record<string, GetLanguagesItem>

get_languages(options?): GetLanguagesItem[]

Parameters

NameType
options?ObjF<GetLanguagesOptions>

Returns

GetLanguagesItem[]


get_preferred_language

get_preferred_language(preferences?): string

Get the user's preferred available language (no arg required when used in browser)

Parameters

NameTypeDefault value
preferencesstring[][]

Returns

string


get_translations

get_translations(options): Record<string, GetTranslationsItem>

Get available translations as either a list or an object

Parameters

NameType
optionsObjT<GetTranslationsOptions>

Returns

Record<string, GetTranslationsItem>

get_translations(options?): GetTranslationsItem[]

Parameters

NameType
options?ObjF<GetTranslationsOptions>

Returns

GetTranslationsItem[]


get_preferred_translation

get_preferred_translation(languages?): string

Get user's preferred available translation (provide language preferences if not in browser)

Parameters

NameTypeDefault value
languagesstring[][]

Returns

string


get_books

get_books(translation, options): Record<string, GetBooksItem>

Get which books are available for a translation

Parameters

NameType
translationstring
optionsObjT<GetBooksOptions>

Returns

Record<string, GetBooksItem>

get_books(translation, options?): GetBooksItem[]

Parameters

NameType
translationstring
options?ObjF<GetBooksOptions>

Returns

GetBooksItem[]


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

NameTypeDefault value
translationstringundefined
bookstringundefined
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

NameType
translationstring

Returns

GetCompletionReturn


get_chapters

get_chapters(translation, book): number[]

Get chapter numbers for a book

Parameters

NameType
translationstring
bookstring

Returns

number[]


get_verses

get_verses(translation, book, chapter): number[]

Get verse numbers for a chapter

Parameters

NameType
translationstring
bookstring
chapternumber

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

NameType
translationstring
bookstring
format?"html"

Returns

Promise<BibleBookHtml>

fetch_book(translation, book, format): Promise<BibleBookUsx>

Parameters

NameType
translationstring
bookstring
format"usx"

Returns

Promise<BibleBookUsx>