Appearance
@gracious.tech/fetch-client / collection/bibles / BibleCollection
Class: BibleCollection
Defined in: client/src/collection/bibles.ts:13
Extends
Constructors
Constructor
new BibleCollection(
items,requester,languages,language2to3,languages_most_spoken,usage):BibleCollection
Defined in: client/src/collection/generic.ts:142
Parameters
items
Record<string, RuntimeManifestItem>
requester
languages
Record<string, MetaLanguage>
language2to3
Record<string, string>
languages_most_spoken
string[]
usage
Returns
BibleCollection
Inherited from
Properties
requester
requester:
RequestHandler
Defined in: client/src/collection/generic.ts:140
Inherited from
Methods
get_book_url()
get_book_url(
resource,book,format?):string
Defined in: client/src/collection/bibles.ts:16
Get the URL for a book’s content (useful for caching and manual retrieval)
Parameters
resource
string
book
string
format?
"html" | "usx" | "usfm" | "txt" | "typst"
Returns
string
fetch_book()
Call Signature
fetch_book(
resource,book,format?):Promise<BibleBookHtml>
Defined in: client/src/collection/bibles.ts:24
Make request for the text for a book of a translation (returns object for accessing it)
Parameters
resource
string
book
string
format?
"html"
Returns
Promise<BibleBookHtml>
Call Signature
fetch_book(
resource,book,format):Promise<BibleBookUsx>
Defined in: client/src/collection/bibles.ts:25
Make request for the text for a book of a translation (returns object for accessing it)
Parameters
resource
string
book
string
format
"usx"
Returns
Promise<BibleBookUsx>
Call Signature
fetch_book(
resource,book,format):Promise<BibleBookUsfm>
Defined in: client/src/collection/bibles.ts:26
Make request for the text for a book of a translation (returns object for accessing it)
Parameters
resource
string
book
string
format
"usfm"
Returns
Promise<BibleBookUsfm>
Call Signature
fetch_book(
resource,book,format):Promise<BibleBookTxt>
Defined in: client/src/collection/bibles.ts:27
Make request for the text for a book of a translation (returns object for accessing it)
Parameters
resource
string
book
string
format
"txt"
Returns
Promise<BibleBookTxt>
Call Signature
fetch_book(
resource,book,format):Promise<BibleBookTypst>
Defined in: client/src/collection/bibles.ts:28
Make request for the text for a book of a translation (returns object for accessing it)
Parameters
resource
string
book
string
format
"typst"
Returns
Promise<BibleBookTypst>
fetch_translation_extras()
fetch_translation_extras(
resource):Promise<TranslationExtra>
Defined in: client/src/collection/bibles.ts:52
Make request for extra metadata for a translation (such as book names and section headings). This will also auto-provide local book names for future calls of get_books().
Parameters
resource
string
Returns
Promise<TranslationExtra>
detect_references()
detect_references(
text,resource?,always_detect_english?):Generator<PassageReferenceMatch,null,undefined>
Defined in: client/src/collection/bibles.ts:123
Detect bible references in a block of text using book names of given translation(s). A generator is returned and can be passed updated text each time it yields a result. You must have first awaited a call to fetch_translation_extras() to be able to parse non-English references.
Parameters
text
string
resource?
string | string[]
always_detect_english?
boolean = true
Returns
Generator<PassageReferenceMatch, null, undefined>
string_to_reference()
string_to_reference(
text,resource?,always_detect_english?):PassageReference|null
Defined in: client/src/collection/bibles.ts:132
Parse a single bible reference string into a PassageReference object (validating it). Supports only single passages (for e.g. Matt 10:6,8 use detect_references). You must have first awaited a call to fetch_translation_extras() to be able to parse non-English references.
Parameters
text
string
resource?
string | string[]
always_detect_english?
boolean = true
Returns
PassageReference | null
reference_to_string()
reference_to_string(
reference,resource?,abbreviate?):string
Defined in: client/src/collection/bibles.ts:140
Render a PassageReference object as a string using the given translation’s book names. You must have first awaited a call to fetch_translation_extras() for the translation, or English will be used by default.
Parameters
reference
resource?
string
abbreviate?
boolean
Returns
string
has_language()
has_language(
language):boolean
Defined in: client/src/collection/generic.ts:181
Check if a language exists (must be 3 character id)
Parameters
language
string
Returns
boolean
Inherited from
GenericCollection.has_language
has_resource()
has_resource(
resource):boolean
Defined in: client/src/collection/generic.ts:186
Check if a resource exists
Parameters
resource
string
Returns
boolean
Inherited from
GenericCollection.has_resource
has_book()
has_book(
resource,book):boolean
Defined in: client/src/collection/generic.ts:191
Check if a book exists within a resource
Parameters
resource
string
book
string
Returns
boolean
Inherited from
get_language()
get_language(
code):GetLanguagesItem|undefined
Defined in: client/src/collection/generic.ts:199
Get a language’s metadata
Parameters
code
string
Returns
GetLanguagesItem | undefined
Inherited from
GenericCollection.get_language
get_languages()
Call Signature
get_languages(
options):Record<string,GetLanguagesItem>
Defined in: client/src/collection/generic.ts:215
Get available languages as either a list or an object
Parameters
options
ObjT<GetLanguagesOptions>
Returns
Record<string, GetLanguagesItem>
Inherited from
GenericCollection.get_languages
Call Signature
get_languages(
options?):GetLanguagesItem[]
Defined in: client/src/collection/generic.ts:216
Get available languages as either a list or an object
Parameters
options?
ObjF<GetLanguagesOptions>
Returns
Inherited from
GenericCollection.get_languages
get_preferred_language()
get_preferred_language(
preferences?):GetLanguagesItem
Defined in: client/src/collection/generic.ts:271
Get the user’s preferred available language (no arg required when used in browser)
Parameters
preferences?
string[] = []
Returns
Inherited from
GenericCollection.get_preferred_language
get_resource()
get_resource(
id):GetResourcesItem|undefined
Defined in: client/src/collection/generic.ts:303
Get a resource’s metadata
Parameters
id
string
Returns
GetResourcesItem | undefined
Inherited from
GenericCollection.get_resource
get_resources()
Call Signature
get_resources(
options):Record<string,GetResourcesItem>
Defined in: client/src/collection/generic.ts:350
Get available resources as either a list or an object
Parameters
options
ObjT<GetResourcesOptions>
Returns
Record<string, GetResourcesItem>
Inherited from
GenericCollection.get_resources
Call Signature
get_resources(
options?):GetResourcesItem[]
Defined in: client/src/collection/generic.ts:351
Get available resources as either a list or an object
Parameters
options?
ObjF<GetResourcesOptions>
Returns
Inherited from
GenericCollection.get_resources
get_preferred_resource()
get_preferred_resource(
languages?):GetResourcesItem
Defined in: client/src/collection/generic.ts:407
Get user’s preferred available resource (provide language preferences if not in browser)
Parameters
languages?
string[] = []
Returns
Inherited from
GenericCollection.get_preferred_resource
get_books()
Call Signature
get_books(
resource,options):Record<string,GetBooksItem>
Defined in: client/src/collection/generic.ts:455
Get which books are available for a resource. If no resource is given, all books will be listed but marked as unavailable. If fetch_translation_extras() has already been called for a translation then local name data will also be available (otherwise only English book names will be available).
Parameters
resource
string | undefined
options
ObjT<GetBooksOptions>
Returns
Record<string, GetBooksItem>
Inherited from
Call Signature
get_books(
resource?,options?):GetBooksItem[]
Defined in: client/src/collection/generic.ts:457
Get which books are available for a resource. If no resource is given, all books will be listed but marked as unavailable. If fetch_translation_extras() has already been called for a translation then local name data will also be available (otherwise only English book names will be available).
Parameters
resource?
string
options?
ObjF<GetBooksOptions>
Returns
Inherited from
get_completion()
get_completion(
resource):GetCompletionReturn
Defined in: client/src/collection/generic.ts:525
Get book ids that are available/missing for a resource for each testament
Parameters
resource
string