free-use-bible-api 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +253 -139
- package/dist/cjs/FreeUseBibleApi.cjs +499 -0
- package/dist/cjs/FreeUseBibleApi.cjs.map +7 -0
- package/dist/cjs/index.cjs +4 -6
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/{apis/index.cjs → types.gen.cjs} +3 -11
- package/dist/cjs/types.gen.cjs.map +7 -0
- package/dist/esm/FreeUseBibleApi.js +473 -0
- package/dist/esm/FreeUseBibleApi.js.map +7 -0
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/types.gen.js +2 -0
- package/dist/esm/types.gen.js.map +7 -0
- package/dist/types/FreeUseBibleApi.d.ts +408 -0
- package/dist/types/index.d.ts +2 -3
- package/dist/types/types.gen.d.ts +2022 -0
- package/package.json +34 -33
- package/dist/cjs/apis/DefaultApi.cjs +0 -432
- package/dist/cjs/apis/DefaultApi.cjs.map +0 -7
- package/dist/cjs/apis/FreeUseBibleApi.cjs +0 -97
- package/dist/cjs/apis/FreeUseBibleApi.cjs.map +0 -7
- package/dist/cjs/apis/index.cjs.map +0 -7
- package/dist/cjs/models/ApiAvailableCommentaries.cjs +0 -63
- package/dist/cjs/models/ApiAvailableCommentaries.cjs.map +0 -7
- package/dist/cjs/models/ApiAvailableDatasets.cjs +0 -63
- package/dist/cjs/models/ApiAvailableDatasets.cjs.map +0 -7
- package/dist/cjs/models/ApiAvailableTranslations.cjs +0 -63
- package/dist/cjs/models/ApiAvailableTranslations.cjs.map +0 -7
- package/dist/cjs/models/ApiCommentary.cjs +0 -119
- package/dist/cjs/models/ApiCommentary.cjs.map +0 -7
- package/dist/cjs/models/ApiCommentaryBook.cjs +0 -94
- package/dist/cjs/models/ApiCommentaryBook.cjs.map +0 -7
- package/dist/cjs/models/ApiCommentaryBookChapter.cjs +0 -83
- package/dist/cjs/models/ApiCommentaryBookChapter.cjs.map +0 -7
- package/dist/cjs/models/ApiCommentaryBookChapterChapter.cjs +0 -68
- package/dist/cjs/models/ApiCommentaryBookChapterChapter.cjs.map +0 -7
- package/dist/cjs/models/ApiCommentaryBooks.cjs +0 -67
- package/dist/cjs/models/ApiCommentaryBooks.cjs.map +0 -7
- package/dist/cjs/models/ApiDataset.cjs +0 -115
- package/dist/cjs/models/ApiDataset.cjs.map +0 -7
- package/dist/cjs/models/ApiDatasetBook.cjs +0 -87
- package/dist/cjs/models/ApiDatasetBook.cjs.map +0 -7
- package/dist/cjs/models/ApiDatasetBookChapter.cjs +0 -86
- package/dist/cjs/models/ApiDatasetBookChapter.cjs.map +0 -7
- package/dist/cjs/models/ApiDatasetBooks.cjs +0 -67
- package/dist/cjs/models/ApiDatasetBooks.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslation.cjs +0 -125
- package/dist/cjs/models/ApiTranslation.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslationBook.cjs +0 -95
- package/dist/cjs/models/ApiTranslationBook.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslationBookChapter.cjs +0 -92
- package/dist/cjs/models/ApiTranslationBookChapter.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslationBookChapterChapter.cjs +0 -70
- package/dist/cjs/models/ApiTranslationBookChapterChapter.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslationBooks.cjs +0 -67
- package/dist/cjs/models/ApiTranslationBooks.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslationComplete.cjs +0 -67
- package/dist/cjs/models/ApiTranslationComplete.cjs.map +0 -7
- package/dist/cjs/models/ApiTranslationCompleteBook.cjs +0 -87
- package/dist/cjs/models/ApiTranslationCompleteBook.cjs.map +0 -7
- package/dist/cjs/models/BookId.cjs +0 -163
- package/dist/cjs/models/BookId.cjs.map +0 -7
- package/dist/cjs/models/ChapterContent.cjs +0 -78
- package/dist/cjs/models/ChapterContent.cjs.map +0 -7
- package/dist/cjs/models/ChapterFootnote.cjs +0 -72
- package/dist/cjs/models/ChapterFootnote.cjs.map +0 -7
- package/dist/cjs/models/ChapterFootnoteCaller.cjs +0 -51
- package/dist/cjs/models/ChapterFootnoteCaller.cjs.map +0 -7
- package/dist/cjs/models/ChapterFootnoteReference.cjs +0 -65
- package/dist/cjs/models/ChapterFootnoteReference.cjs.map +0 -7
- package/dist/cjs/models/ChapterHeading.cjs +0 -70
- package/dist/cjs/models/ChapterHeading.cjs.map +0 -7
- package/dist/cjs/models/ChapterHebrewSubtitle.cjs +0 -71
- package/dist/cjs/models/ChapterHebrewSubtitle.cjs.map +0 -7
- package/dist/cjs/models/ChapterHebrewSubtitleContentInner.cjs +0 -69
- package/dist/cjs/models/ChapterHebrewSubtitleContentInner.cjs.map +0 -7
- package/dist/cjs/models/ChapterLineBreak.cjs +0 -67
- package/dist/cjs/models/ChapterLineBreak.cjs.map +0 -7
- package/dist/cjs/models/ChapterVerse.cjs +0 -74
- package/dist/cjs/models/ChapterVerse.cjs.map +0 -7
- package/dist/cjs/models/ChapterVerseContentInner.cjs +0 -80
- package/dist/cjs/models/ChapterVerseContentInner.cjs.map +0 -7
- package/dist/cjs/models/DatasetChapterData.cjs +0 -66
- package/dist/cjs/models/DatasetChapterData.cjs.map +0 -7
- package/dist/cjs/models/DatasetChapterVerseContent.cjs +0 -66
- package/dist/cjs/models/DatasetChapterVerseContent.cjs.map +0 -7
- package/dist/cjs/models/FormattedText.cjs +0 -66
- package/dist/cjs/models/FormattedText.cjs.map +0 -7
- package/dist/cjs/models/InlineHeading.cjs +0 -62
- package/dist/cjs/models/InlineHeading.cjs.map +0 -7
- package/dist/cjs/models/InlineLineBreak.cjs +0 -67
- package/dist/cjs/models/InlineLineBreak.cjs.map +0 -7
- package/dist/cjs/models/ScoredVerseRef.cjs +0 -78
- package/dist/cjs/models/ScoredVerseRef.cjs.map +0 -7
- package/dist/cjs/models/TranslationBookChapter.cjs +0 -66
- package/dist/cjs/models/TranslationBookChapter.cjs.map +0 -7
- package/dist/cjs/models/VerseFootnoteReference.cjs +0 -62
- package/dist/cjs/models/VerseFootnoteReference.cjs.map +0 -7
- package/dist/cjs/models/index.cjs +0 -97
- package/dist/cjs/models/index.cjs.map +0 -7
- package/dist/cjs/runtime.cjs +0 -360
- package/dist/cjs/runtime.cjs.map +0 -7
- package/dist/esm/apis/DefaultApi.js +0 -416
- package/dist/esm/apis/DefaultApi.js.map +0 -7
- package/dist/esm/apis/FreeUseBibleApi.js +0 -61
- package/dist/esm/apis/FreeUseBibleApi.js.map +0 -7
- package/dist/esm/apis/index.js +0 -4
- package/dist/esm/apis/index.js.map +0 -7
- package/dist/esm/models/ApiAvailableCommentaries.js +0 -32
- package/dist/esm/models/ApiAvailableCommentaries.js.map +0 -7
- package/dist/esm/models/ApiAvailableDatasets.js +0 -32
- package/dist/esm/models/ApiAvailableDatasets.js.map +0 -7
- package/dist/esm/models/ApiAvailableTranslations.js +0 -32
- package/dist/esm/models/ApiAvailableTranslations.js.map +0 -7
- package/dist/esm/models/ApiCommentary.js +0 -81
- package/dist/esm/models/ApiCommentary.js.map +0 -7
- package/dist/esm/models/ApiCommentaryBook.js +0 -63
- package/dist/esm/models/ApiCommentaryBook.js.map +0 -7
- package/dist/esm/models/ApiCommentaryBookChapter.js +0 -58
- package/dist/esm/models/ApiCommentaryBookChapter.js.map +0 -7
- package/dist/esm/models/ApiCommentaryBookChapterChapter.js +0 -37
- package/dist/esm/models/ApiCommentaryBookChapterChapter.js.map +0 -7
- package/dist/esm/models/ApiCommentaryBooks.js +0 -39
- package/dist/esm/models/ApiCommentaryBooks.js.map +0 -7
- package/dist/esm/models/ApiDataset.js +0 -77
- package/dist/esm/models/ApiDataset.js.map +0 -7
- package/dist/esm/models/ApiDatasetBook.js +0 -56
- package/dist/esm/models/ApiDatasetBook.js.map +0 -7
- package/dist/esm/models/ApiDatasetBookChapter.js +0 -61
- package/dist/esm/models/ApiDatasetBookChapter.js.map +0 -7
- package/dist/esm/models/ApiDatasetBooks.js +0 -39
- package/dist/esm/models/ApiDatasetBooks.js.map +0 -7
- package/dist/esm/models/ApiTranslation.js +0 -87
- package/dist/esm/models/ApiTranslation.js.map +0 -7
- package/dist/esm/models/ApiTranslationBook.js +0 -64
- package/dist/esm/models/ApiTranslationBook.js.map +0 -7
- package/dist/esm/models/ApiTranslationBookChapter.js +0 -67
- package/dist/esm/models/ApiTranslationBookChapter.js.map +0 -7
- package/dist/esm/models/ApiTranslationBookChapterChapter.js +0 -42
- package/dist/esm/models/ApiTranslationBookChapterChapter.js.map +0 -7
- package/dist/esm/models/ApiTranslationBooks.js +0 -39
- package/dist/esm/models/ApiTranslationBooks.js.map +0 -7
- package/dist/esm/models/ApiTranslationComplete.js +0 -39
- package/dist/esm/models/ApiTranslationComplete.js.map +0 -7
- package/dist/esm/models/ApiTranslationCompleteBook.js +0 -59
- package/dist/esm/models/ApiTranslationCompleteBook.js.map +0 -7
- package/dist/esm/models/BookId.js +0 -127
- package/dist/esm/models/BookId.js.map +0 -7
- package/dist/esm/models/ChapterContent.js +0 -58
- package/dist/esm/models/ChapterContent.js.map +0 -7
- package/dist/esm/models/ChapterFootnote.js +0 -44
- package/dist/esm/models/ChapterFootnote.js.map +0 -7
- package/dist/esm/models/ChapterFootnoteCaller.js +0 -17
- package/dist/esm/models/ChapterFootnoteCaller.js.map +0 -7
- package/dist/esm/models/ChapterFootnoteReference.js +0 -31
- package/dist/esm/models/ChapterFootnoteReference.js.map +0 -7
- package/dist/esm/models/ChapterHeading.js +0 -34
- package/dist/esm/models/ChapterHeading.js.map +0 -7
- package/dist/esm/models/ChapterHebrewSubtitle.js +0 -38
- package/dist/esm/models/ChapterHebrewSubtitle.js.map +0 -7
- package/dist/esm/models/ChapterHebrewSubtitleContentInner.js +0 -35
- package/dist/esm/models/ChapterHebrewSubtitleContentInner.js.map +0 -7
- package/dist/esm/models/ChapterLineBreak.js +0 -31
- package/dist/esm/models/ChapterLineBreak.js.map +0 -7
- package/dist/esm/models/ChapterVerse.js +0 -41
- package/dist/esm/models/ChapterVerse.js.map +0 -7
- package/dist/esm/models/ChapterVerseContentInner.js +0 -44
- package/dist/esm/models/ChapterVerseContentInner.js.map +0 -7
- package/dist/esm/models/DatasetChapterData.js +0 -35
- package/dist/esm/models/DatasetChapterData.js.map +0 -7
- package/dist/esm/models/DatasetChapterVerseContent.js +0 -35
- package/dist/esm/models/DatasetChapterVerseContent.js.map +0 -7
- package/dist/esm/models/FormattedText.js +0 -32
- package/dist/esm/models/FormattedText.js.map +0 -7
- package/dist/esm/models/InlineHeading.js +0 -28
- package/dist/esm/models/InlineHeading.js.map +0 -7
- package/dist/esm/models/InlineLineBreak.js +0 -31
- package/dist/esm/models/InlineLineBreak.js.map +0 -7
- package/dist/esm/models/ScoredVerseRef.js +0 -47
- package/dist/esm/models/ScoredVerseRef.js.map +0 -7
- package/dist/esm/models/TranslationBookChapter.js +0 -35
- package/dist/esm/models/TranslationBookChapter.js.map +0 -7
- package/dist/esm/models/VerseFootnoteReference.js +0 -28
- package/dist/esm/models/VerseFootnoteReference.js.map +0 -7
- package/dist/esm/models/index.js +0 -40
- package/dist/esm/models/index.js.map +0 -7
- package/dist/esm/runtime.js +0 -304
- package/dist/esm/runtime.js.map +0 -7
- package/dist/types/apis/DefaultApi.d.ts +0 -176
- package/dist/types/apis/FreeUseBibleApi.d.ts +0 -34
- package/dist/types/apis/index.d.ts +0 -3
- package/dist/types/models/ApiAvailableCommentaries.d.ts +0 -34
- package/dist/types/models/ApiAvailableDatasets.d.ts +0 -34
- package/dist/types/models/ApiAvailableTranslations.d.ts +0 -34
- package/dist/types/models/ApiCommentary.d.ts +0 -145
- package/dist/types/models/ApiCommentaryBook.d.ts +0 -100
- package/dist/types/models/ApiCommentaryBookChapter.d.ts +0 -72
- package/dist/types/models/ApiCommentaryBookChapterChapter.d.ts +0 -46
- package/dist/types/models/ApiCommentaryBooks.d.ts +0 -41
- package/dist/types/models/ApiDataset.d.ts +0 -138
- package/dist/types/models/ApiDatasetBook.d.ts +0 -82
- package/dist/types/models/ApiDatasetBookChapter.d.ts +0 -78
- package/dist/types/models/ApiDatasetBooks.d.ts +0 -41
- package/dist/types/models/ApiTranslation.d.ts +0 -169
- package/dist/types/models/ApiTranslationBook.d.ts +0 -100
- package/dist/types/models/ApiTranslationBookChapter.d.ts +0 -96
- package/dist/types/models/ApiTranslationBookChapterChapter.d.ts +0 -47
- package/dist/types/models/ApiTranslationBooks.d.ts +0 -41
- package/dist/types/models/ApiTranslationComplete.d.ts +0 -41
- package/dist/types/models/ApiTranslationCompleteBook.d.ts +0 -83
- package/dist/types/models/BookId.d.ts +0 -125
- package/dist/types/models/ChapterContent.d.ts +0 -34
- package/dist/types/models/ChapterFootnote.d.ts +0 -53
- package/dist/types/models/ChapterFootnoteCaller.d.ts +0 -27
- package/dist/types/models/ChapterFootnoteReference.d.ts +0 -39
- package/dist/types/models/ChapterHeading.d.ts +0 -46
- package/dist/types/models/ChapterHebrewSubtitle.d.ts +0 -47
- package/dist/types/models/ChapterHebrewSubtitleContentInner.d.ts +0 -51
- package/dist/types/models/ChapterLineBreak.d.ts +0 -40
- package/dist/types/models/ChapterVerse.d.ts +0 -53
- package/dist/types/models/ChapterVerseContentInner.d.ts +0 -70
- package/dist/types/models/DatasetChapterData.d.ts +0 -40
- package/dist/types/models/DatasetChapterVerseContent.d.ts +0 -40
- package/dist/types/models/FormattedText.d.ts +0 -45
- package/dist/types/models/InlineHeading.d.ts +0 -33
- package/dist/types/models/InlineLineBreak.d.ts +0 -40
- package/dist/types/models/ScoredVerseRef.d.ts +0 -70
- package/dist/types/models/TranslationBookChapter.d.ts +0 -42
- package/dist/types/models/VerseFootnoteReference.d.ts +0 -33
- package/dist/types/models/index.d.ts +0 -39
- package/dist/types/runtime.d.ts +0 -185
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 AO Lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,139 +1,253 @@
|
|
|
1
|
-
# Free Use Bible API
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
###
|
|
95
|
-
|
|
96
|
-
Some
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
1
|
+
# Free Use Bible API
|
|
2
|
+
|
|
3
|
+
TypeScript and JavaScript client for the public Free Use Bible API:
|
|
4
|
+
|
|
5
|
+
- `https://bible.helloao.org`
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install free-use-bible-api
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add free-use-bible-api
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add free-use-bible-api
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { FreeUseBibleApi } from 'free-use-bible-api';
|
|
25
|
+
|
|
26
|
+
const api = new FreeUseBibleApi();
|
|
27
|
+
|
|
28
|
+
const available = await api.getAvailableTranslations();
|
|
29
|
+
console.log('Total translations:', available.translations.length);
|
|
30
|
+
|
|
31
|
+
const books = await api.getTranslationBooks('BSB');
|
|
32
|
+
console.log('Books in BSB:', books.books.length);
|
|
33
|
+
|
|
34
|
+
const chapter = await api.getTranslationBookChapter('BSB', 'GEN', 1);
|
|
35
|
+
console.log('Verses in Genesis 1:', chapter.numberOfVerses);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Client Options
|
|
39
|
+
|
|
40
|
+
You can customize the client with `FreeUseBibleApiOptions`:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { FreeUseBibleApi } from 'free-use-bible-api';
|
|
44
|
+
|
|
45
|
+
const api = new FreeUseBibleApi({
|
|
46
|
+
endpoint: 'https://bible.helloao.org/',
|
|
47
|
+
useCache: true,
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- `endpoint`: Base API endpoint.
|
|
52
|
+
- `useCache`: Enables in-memory response caching (default: `true`).
|
|
53
|
+
|
|
54
|
+
## API Methods
|
|
55
|
+
|
|
56
|
+
### Translations
|
|
57
|
+
|
|
58
|
+
- `getAvailableTranslations(endpoint?)`
|
|
59
|
+
- `getTranslationBooks(translation, endpoint?)`
|
|
60
|
+
- `getTranslationBookChapter(translation, book, chapter, endpoint?)`
|
|
61
|
+
- `getTranslationBookChapterWords(translation, book, chapter, endpoint?)`
|
|
62
|
+
- `getCompleteTranslation(translation, endpoint?)`
|
|
63
|
+
- `getSimpleTranslationBookChapter(translation, book, chapter, endpoint?)`
|
|
64
|
+
- `getSimpleTranslationBookChapterWords(translation, book, chapter, endpoint?)`
|
|
65
|
+
- `getSimpleCompleteTranslation(translation, endpoint?)`
|
|
66
|
+
|
|
67
|
+
`getCompleteTranslation()` and `getSimpleCompleteTranslation()` disable per-request cache internally because payloads are typically large.
|
|
68
|
+
|
|
69
|
+
### Commentaries
|
|
70
|
+
|
|
71
|
+
- `getAvailableCommentaries(endpoint?)`
|
|
72
|
+
- `getCommentaryBooks(commentary, endpoint?)`
|
|
73
|
+
- `getCommentaryBookChapter(commentary, book, chapter, endpoint?)`
|
|
74
|
+
- `getSimpleCommentaryBookChapter(commentary, book, chapter, endpoint?)`
|
|
75
|
+
|
|
76
|
+
### Datasets
|
|
77
|
+
|
|
78
|
+
- `getAvailableDatasets(endpoint?)`
|
|
79
|
+
- `getDatasetBooks(dataset, endpoint?)`
|
|
80
|
+
- `getDatasetBookChapter(dataset, book, chapter, endpoint?)`
|
|
81
|
+
|
|
82
|
+
### Chapter Navigation Helpers
|
|
83
|
+
|
|
84
|
+
- `getNextChapter(chapter, endpoint?)`
|
|
85
|
+
- `getPreviousChapter(chapter, endpoint?)`
|
|
86
|
+
|
|
87
|
+
### Chapter & Verse Helpers
|
|
88
|
+
|
|
89
|
+
- `getVerseText(verse)`
|
|
90
|
+
- `getChapterVerseText(chapter)`
|
|
91
|
+
|
|
92
|
+
These helpers work with translation, commentary, and dataset chapter responses, as well as simplified translation and commentary chapter responses.
|
|
93
|
+
|
|
94
|
+
### Word Annotations
|
|
95
|
+
|
|
96
|
+
Some translations include word-level annotations (Strong's numbers and related source data) for their chapters.
|
|
97
|
+
|
|
98
|
+
- `getChapterWords(chapter, endpoint?)` - gets the annotations for a chapter you already loaded, or `null` if it doesn't have any.
|
|
99
|
+
- `getWordText(verse, word)` - gets the text that a single annotation applies to.
|
|
100
|
+
- `getVerseWords(verse, words)` - gets the annotations for a verse, each paired with the text it applies to.
|
|
101
|
+
|
|
102
|
+
Each annotation is anchored to a range of characters in a single item of a verse's `content` array: `contentIndex` is the index of the item, and `start`/`end` are character offsets into that item's text (`end` is exclusive). Anchoring per content item keeps the offsets correct for verses whose content is split into multiple items, such as poem lines and the words of Jesus.
|
|
103
|
+
|
|
104
|
+
`getWordText()` and `getVerseWords()` resolve those offsets for you, so you don't have to walk the content array yourself.
|
|
105
|
+
|
|
106
|
+
### Simplified Chapters
|
|
107
|
+
|
|
108
|
+
Every translation and commentary chapter can also be fetched in a simplified format, where each verse's content is a single string instead of a list of formatted content. Footnotes, inline headings, the Words of Jesus, and poetry are represented as offset ranges into that string instead of being split across multiple content items.
|
|
109
|
+
|
|
110
|
+
- `getSimpleTranslationBookChapter(translation, book, chapter, endpoint?)`
|
|
111
|
+
- `getSimpleCommentaryBookChapter(commentary, book, chapter, endpoint?)`
|
|
112
|
+
- `getSimpleCompleteTranslation(translation, endpoint?)`
|
|
113
|
+
- `getSimpleChapter(chapter, endpoint?)` - follows a chapter's `simpleChapterApiLink`, or `null` if simplified chapters aren't available for it.
|
|
114
|
+
- `getSimpleTranslationBookChapterWords(translation, book, chapter, endpoint?)` / `getSimpleChapterWords(chapter, endpoint?)` - the same as the regular word annotations, but with offsets into the simplified verse text instead of a verse's content array.
|
|
115
|
+
- `getSimpleWordText(verse, word)` / `getSimpleVerseWords(verse, words)` - the same as `getWordText()`/`getVerseWords()`, but for simplified verses and annotations.
|
|
116
|
+
- `getSimpleChapterVerseText(chapter, options?)` - the same as `getChapterVerseText()`, but for a simplified chapter.
|
|
117
|
+
|
|
118
|
+
`getNextChapter()` and `getPreviousChapter()` also accept simplified chapters, returning the next/previous simplified chapter.
|
|
119
|
+
|
|
120
|
+
Datasets don't have a simplified format.
|
|
121
|
+
|
|
122
|
+
## Examples
|
|
123
|
+
|
|
124
|
+
### Get a complete translation
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
const complete = await api.getCompleteTranslation('BSB');
|
|
128
|
+
console.log(complete.translation.id);
|
|
129
|
+
console.log(complete.books.length);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Read a commentary chapter
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const comm = await api.getCommentaryBookChapter('matthew_henry', 'GEN', 1);
|
|
136
|
+
console.log(comm.book.name);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Read a dataset chapter
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
const dataChapter = await api.getDatasetBookChapter(
|
|
143
|
+
'cross_references',
|
|
144
|
+
'JHN',
|
|
145
|
+
3
|
|
146
|
+
);
|
|
147
|
+
console.log(dataChapter.book.name);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Navigate to next/previous chapter
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const current = await api.getTranslationBookChapter('BSB', 'GEN', 1);
|
|
154
|
+
|
|
155
|
+
const next = await api.getNextChapter(current);
|
|
156
|
+
const previous = await api.getPreviousChapter(current);
|
|
157
|
+
|
|
158
|
+
console.log(next?.chapter.number);
|
|
159
|
+
console.log(previous?.chapter.number);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Read the Strong's numbers for a chapter
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
const chapter = await api.getTranslationBookChapter('engwebp', 'JHN', 1);
|
|
166
|
+
const words = await api.getChapterWords(chapter);
|
|
167
|
+
|
|
168
|
+
if (!words) {
|
|
169
|
+
// This translation has no word-level annotations for the chapter.
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
for (const content of chapter.chapter.content) {
|
|
174
|
+
if (content.type !== 'verse') {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (const word of api.getVerseWords(content, words)) {
|
|
179
|
+
console.log(word.text, word.strongs);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// In [ 'G1722' ]
|
|
184
|
+
// the [ 'G1722' ]
|
|
185
|
+
// beginning [ 'G0746' ]
|
|
186
|
+
// ...
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Read a simplified chapter
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
const chapter = await api.getSimpleTranslationBookChapter('BSB', 'JHN', 1);
|
|
193
|
+
|
|
194
|
+
for (const content of chapter.chapter.content) {
|
|
195
|
+
if (content.type !== 'verse') {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
console.log(content.number, content.text);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Direct HTTP Endpoints
|
|
203
|
+
|
|
204
|
+
### Translation endpoints
|
|
205
|
+
|
|
206
|
+
- `GET /api/available_translations.json`
|
|
207
|
+
- `GET /api/{translation}/books.json`
|
|
208
|
+
- `GET /api/{translation}/{book}/{chapter}.json`
|
|
209
|
+
- `GET /api/{translation}/{book}/{chapter}.words.json`
|
|
210
|
+
- `GET /api/{translation}/complete.json`
|
|
211
|
+
- `GET /api/{translation}/{book}/{chapter}.simple.json`
|
|
212
|
+
- `GET /api/{translation}/{book}/{chapter}.words.simple.json`
|
|
213
|
+
- `GET /api/{translation}/complete.simple.json`
|
|
214
|
+
|
|
215
|
+
### Commentary endpoints
|
|
216
|
+
|
|
217
|
+
- `GET /api/available_commentaries.json`
|
|
218
|
+
- `GET /api/c/{commentary}/books.json`
|
|
219
|
+
- `GET /api/c/{commentary}/{book}/{chapter}.json`
|
|
220
|
+
- `GET /api/c/{commentary}/{book}/{chapter}.simple.json`
|
|
221
|
+
|
|
222
|
+
### Dataset endpoints
|
|
223
|
+
|
|
224
|
+
- `GET /api/available_datasets.json`
|
|
225
|
+
- `GET /api/d/{dataset}/books.json`
|
|
226
|
+
- `GET /api/d/{dataset}/{book}/{chapter}.json`
|
|
227
|
+
|
|
228
|
+
Example requests:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
curl https://bible.helloao.org/api/available_translations.json
|
|
232
|
+
curl https://bible.helloao.org/api/BSB/books.json
|
|
233
|
+
curl https://bible.helloao.org/api/BSB/GEN/1.json
|
|
234
|
+
curl https://bible.helloao.org/api/available_commentaries.json
|
|
235
|
+
curl https://bible.helloao.org/api/available_datasets.json
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Error Handling
|
|
239
|
+
|
|
240
|
+
Methods throw on non-2xx responses.
|
|
241
|
+
|
|
242
|
+
A 404 response usually means one of the path values is invalid, for example:
|
|
243
|
+
|
|
244
|
+
- translation
|
|
245
|
+
- commentary
|
|
246
|
+
- dataset
|
|
247
|
+
- book
|
|
248
|
+
- chapter
|
|
249
|
+
|
|
250
|
+
## Notes
|
|
251
|
+
|
|
252
|
+
- Uses the global `fetch` API.
|
|
253
|
+
- For Node.js, use a runtime that provides `fetch` (Node 18+ recommended) or polyfill it.
|