free-use-bible-api 0.1.2 → 0.2.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.
Files changed (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +101 -70
  3. package/dist/cjs/FreeUseBibleApi.cjs +296 -0
  4. package/dist/cjs/FreeUseBibleApi.cjs.map +7 -0
  5. package/dist/cjs/index.cjs +25 -0
  6. package/dist/cjs/index.cjs.map +7 -0
  7. package/dist/cjs/types.gen.cjs +17 -0
  8. package/dist/cjs/types.gen.cjs.map +7 -0
  9. package/dist/esm/FreeUseBibleApi.js +270 -0
  10. package/dist/esm/FreeUseBibleApi.js.map +7 -0
  11. package/dist/esm/index.js +2 -3
  12. package/dist/esm/index.js.map +2 -2
  13. package/dist/esm/types.gen.js +2 -0
  14. package/dist/esm/types.gen.js.map +7 -0
  15. package/dist/types/FreeUseBibleApi.d.ts +247 -0
  16. package/dist/types/index.d.ts +2 -3
  17. package/dist/types/types.gen.d.ts +1147 -0
  18. package/package.json +33 -31
  19. package/dist/esm/apis/DefaultApi.js +0 -416
  20. package/dist/esm/apis/DefaultApi.js.map +0 -7
  21. package/dist/esm/apis/FreeUseBibleApi.js +0 -61
  22. package/dist/esm/apis/FreeUseBibleApi.js.map +0 -7
  23. package/dist/esm/apis/index.js +0 -4
  24. package/dist/esm/apis/index.js.map +0 -7
  25. package/dist/esm/models/ApiAvailableCommentaries.js +0 -32
  26. package/dist/esm/models/ApiAvailableCommentaries.js.map +0 -7
  27. package/dist/esm/models/ApiAvailableDatasets.js +0 -32
  28. package/dist/esm/models/ApiAvailableDatasets.js.map +0 -7
  29. package/dist/esm/models/ApiAvailableTranslations.js +0 -32
  30. package/dist/esm/models/ApiAvailableTranslations.js.map +0 -7
  31. package/dist/esm/models/ApiCommentary.js +0 -81
  32. package/dist/esm/models/ApiCommentary.js.map +0 -7
  33. package/dist/esm/models/ApiCommentaryBook.js +0 -63
  34. package/dist/esm/models/ApiCommentaryBook.js.map +0 -7
  35. package/dist/esm/models/ApiCommentaryBookChapter.js +0 -58
  36. package/dist/esm/models/ApiCommentaryBookChapter.js.map +0 -7
  37. package/dist/esm/models/ApiCommentaryBookChapterChapter.js +0 -37
  38. package/dist/esm/models/ApiCommentaryBookChapterChapter.js.map +0 -7
  39. package/dist/esm/models/ApiCommentaryBooks.js +0 -39
  40. package/dist/esm/models/ApiCommentaryBooks.js.map +0 -7
  41. package/dist/esm/models/ApiDataset.js +0 -77
  42. package/dist/esm/models/ApiDataset.js.map +0 -7
  43. package/dist/esm/models/ApiDatasetBook.js +0 -56
  44. package/dist/esm/models/ApiDatasetBook.js.map +0 -7
  45. package/dist/esm/models/ApiDatasetBookChapter.js +0 -61
  46. package/dist/esm/models/ApiDatasetBookChapter.js.map +0 -7
  47. package/dist/esm/models/ApiDatasetBooks.js +0 -39
  48. package/dist/esm/models/ApiDatasetBooks.js.map +0 -7
  49. package/dist/esm/models/ApiTranslation.js +0 -87
  50. package/dist/esm/models/ApiTranslation.js.map +0 -7
  51. package/dist/esm/models/ApiTranslationBook.js +0 -64
  52. package/dist/esm/models/ApiTranslationBook.js.map +0 -7
  53. package/dist/esm/models/ApiTranslationBookChapter.js +0 -67
  54. package/dist/esm/models/ApiTranslationBookChapter.js.map +0 -7
  55. package/dist/esm/models/ApiTranslationBookChapterChapter.js +0 -42
  56. package/dist/esm/models/ApiTranslationBookChapterChapter.js.map +0 -7
  57. package/dist/esm/models/ApiTranslationBooks.js +0 -39
  58. package/dist/esm/models/ApiTranslationBooks.js.map +0 -7
  59. package/dist/esm/models/ApiTranslationComplete.js +0 -39
  60. package/dist/esm/models/ApiTranslationComplete.js.map +0 -7
  61. package/dist/esm/models/ApiTranslationCompleteBook.js +0 -59
  62. package/dist/esm/models/ApiTranslationCompleteBook.js.map +0 -7
  63. package/dist/esm/models/BookId.js +0 -127
  64. package/dist/esm/models/BookId.js.map +0 -7
  65. package/dist/esm/models/ChapterContent.js +0 -58
  66. package/dist/esm/models/ChapterContent.js.map +0 -7
  67. package/dist/esm/models/ChapterFootnote.js +0 -44
  68. package/dist/esm/models/ChapterFootnote.js.map +0 -7
  69. package/dist/esm/models/ChapterFootnoteCaller.js +0 -17
  70. package/dist/esm/models/ChapterFootnoteCaller.js.map +0 -7
  71. package/dist/esm/models/ChapterFootnoteReference.js +0 -31
  72. package/dist/esm/models/ChapterFootnoteReference.js.map +0 -7
  73. package/dist/esm/models/ChapterHeading.js +0 -34
  74. package/dist/esm/models/ChapterHeading.js.map +0 -7
  75. package/dist/esm/models/ChapterHebrewSubtitle.js +0 -38
  76. package/dist/esm/models/ChapterHebrewSubtitle.js.map +0 -7
  77. package/dist/esm/models/ChapterHebrewSubtitleContentInner.js +0 -35
  78. package/dist/esm/models/ChapterHebrewSubtitleContentInner.js.map +0 -7
  79. package/dist/esm/models/ChapterLineBreak.js +0 -31
  80. package/dist/esm/models/ChapterLineBreak.js.map +0 -7
  81. package/dist/esm/models/ChapterVerse.js +0 -41
  82. package/dist/esm/models/ChapterVerse.js.map +0 -7
  83. package/dist/esm/models/ChapterVerseContentInner.js +0 -44
  84. package/dist/esm/models/ChapterVerseContentInner.js.map +0 -7
  85. package/dist/esm/models/DatasetChapterData.js +0 -35
  86. package/dist/esm/models/DatasetChapterData.js.map +0 -7
  87. package/dist/esm/models/DatasetChapterVerseContent.js +0 -35
  88. package/dist/esm/models/DatasetChapterVerseContent.js.map +0 -7
  89. package/dist/esm/models/FormattedText.js +0 -32
  90. package/dist/esm/models/FormattedText.js.map +0 -7
  91. package/dist/esm/models/InlineHeading.js +0 -28
  92. package/dist/esm/models/InlineHeading.js.map +0 -7
  93. package/dist/esm/models/InlineLineBreak.js +0 -31
  94. package/dist/esm/models/InlineLineBreak.js.map +0 -7
  95. package/dist/esm/models/ScoredVerseRef.js +0 -47
  96. package/dist/esm/models/ScoredVerseRef.js.map +0 -7
  97. package/dist/esm/models/TranslationBookChapter.js +0 -35
  98. package/dist/esm/models/TranslationBookChapter.js.map +0 -7
  99. package/dist/esm/models/VerseFootnoteReference.js +0 -28
  100. package/dist/esm/models/VerseFootnoteReference.js.map +0 -7
  101. package/dist/esm/models/index.js +0 -40
  102. package/dist/esm/models/index.js.map +0 -7
  103. package/dist/esm/runtime.js +0 -304
  104. package/dist/esm/runtime.js.map +0 -7
  105. package/dist/types/apis/DefaultApi.d.ts +0 -176
  106. package/dist/types/apis/FreeUseBibleApi.d.ts +0 -34
  107. package/dist/types/apis/index.d.ts +0 -3
  108. package/dist/types/models/ApiAvailableCommentaries.d.ts +0 -34
  109. package/dist/types/models/ApiAvailableDatasets.d.ts +0 -34
  110. package/dist/types/models/ApiAvailableTranslations.d.ts +0 -34
  111. package/dist/types/models/ApiCommentary.d.ts +0 -145
  112. package/dist/types/models/ApiCommentaryBook.d.ts +0 -100
  113. package/dist/types/models/ApiCommentaryBookChapter.d.ts +0 -72
  114. package/dist/types/models/ApiCommentaryBookChapterChapter.d.ts +0 -46
  115. package/dist/types/models/ApiCommentaryBooks.d.ts +0 -41
  116. package/dist/types/models/ApiDataset.d.ts +0 -138
  117. package/dist/types/models/ApiDatasetBook.d.ts +0 -82
  118. package/dist/types/models/ApiDatasetBookChapter.d.ts +0 -78
  119. package/dist/types/models/ApiDatasetBooks.d.ts +0 -41
  120. package/dist/types/models/ApiTranslation.d.ts +0 -169
  121. package/dist/types/models/ApiTranslationBook.d.ts +0 -100
  122. package/dist/types/models/ApiTranslationBookChapter.d.ts +0 -96
  123. package/dist/types/models/ApiTranslationBookChapterChapter.d.ts +0 -47
  124. package/dist/types/models/ApiTranslationBooks.d.ts +0 -41
  125. package/dist/types/models/ApiTranslationComplete.d.ts +0 -41
  126. package/dist/types/models/ApiTranslationCompleteBook.d.ts +0 -83
  127. package/dist/types/models/BookId.d.ts +0 -125
  128. package/dist/types/models/ChapterContent.d.ts +0 -34
  129. package/dist/types/models/ChapterFootnote.d.ts +0 -53
  130. package/dist/types/models/ChapterFootnoteCaller.d.ts +0 -27
  131. package/dist/types/models/ChapterFootnoteReference.d.ts +0 -39
  132. package/dist/types/models/ChapterHeading.d.ts +0 -46
  133. package/dist/types/models/ChapterHebrewSubtitle.d.ts +0 -47
  134. package/dist/types/models/ChapterHebrewSubtitleContentInner.d.ts +0 -51
  135. package/dist/types/models/ChapterLineBreak.d.ts +0 -40
  136. package/dist/types/models/ChapterVerse.d.ts +0 -53
  137. package/dist/types/models/ChapterVerseContentInner.d.ts +0 -70
  138. package/dist/types/models/DatasetChapterData.d.ts +0 -40
  139. package/dist/types/models/DatasetChapterVerseContent.d.ts +0 -40
  140. package/dist/types/models/FormattedText.d.ts +0 -45
  141. package/dist/types/models/InlineHeading.d.ts +0 -33
  142. package/dist/types/models/InlineLineBreak.d.ts +0 -40
  143. package/dist/types/models/ScoredVerseRef.d.ts +0 -70
  144. package/dist/types/models/TranslationBookChapter.d.ts +0 -42
  145. package/dist/types/models/VerseFootnoteReference.d.ts +0 -33
  146. package/dist/types/models/index.d.ts +0 -39
  147. package/dist/types/runtime.d.ts +0 -185
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_gen_exports = {};
16
+ module.exports = __toCommonJS(types_gen_exports);
17
+ //# sourceMappingURL=types.gen.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../types.gen.ts"],
4
+ "sourcesContent": ["// This file is auto-generated by @hey-api/openapi-ts\r\n\r\nexport type ClientOptions = {\r\n baseUrl: 'https://bible.helloao.org' | (string & {});\r\n};\r\n\r\n/**\r\n * IDs for books. Follows the USFM standard (https://ubsicap.github.io/usfm/identification/books.html)\r\n */\r\nexport type BookId =\r\n | 'GEN'\r\n | 'EXO'\r\n | 'LEV'\r\n | 'NUM'\r\n | 'DEU'\r\n | 'JOS'\r\n | 'JDG'\r\n | 'RUT'\r\n | '1SA'\r\n | '2SA'\r\n | '1KI'\r\n | '2KI'\r\n | '1CH'\r\n | '2CH'\r\n | 'EZR'\r\n | 'NEH'\r\n | 'EST'\r\n | 'JOB'\r\n | 'PSA'\r\n | 'PRO'\r\n | 'ECC'\r\n | 'SNG'\r\n | 'ISA'\r\n | 'JER'\r\n | 'LAM'\r\n | 'EZK'\r\n | 'DAN'\r\n | 'HOS'\r\n | 'JOL'\r\n | 'AMO'\r\n | 'OBA'\r\n | 'JON'\r\n | 'MIC'\r\n | 'NAM'\r\n | 'HAB'\r\n | 'ZEP'\r\n | 'HAG'\r\n | 'ZEC'\r\n | 'MAL'\r\n | 'MAT'\r\n | 'MRK'\r\n | 'LUK'\r\n | 'JHN'\r\n | 'ACT'\r\n | 'ROM'\r\n | '1CO'\r\n | '2CO'\r\n | 'GAL'\r\n | 'EPH'\r\n | 'PHP'\r\n | 'COL'\r\n | '1TH'\r\n | '2TH'\r\n | '1TI'\r\n | '2TI'\r\n | 'TIT'\r\n | 'PHM'\r\n | 'HEB'\r\n | 'JAS'\r\n | '1PE'\r\n | '2PE'\r\n | '1JN'\r\n | '2JN'\r\n | '3JN'\r\n | 'JUD'\r\n | 'REV'\r\n | 'TOB'\r\n | 'JDT'\r\n | 'ESG'\r\n | 'WIS'\r\n | 'SIR'\r\n | 'BAR'\r\n | 'LJE'\r\n | 'S3Y'\r\n | 'SUS'\r\n | 'BEL'\r\n | '1MA'\r\n | '2MA'\r\n | '3MA'\r\n | '4MA'\r\n | '1ES'\r\n | '2ES'\r\n | 'MAN'\r\n | 'PS2'\r\n | 'ODA'\r\n | 'PSS'\r\n | 'EZA'\r\n | '5EZ'\r\n | '6EZ'\r\n | 'DAG'\r\n | 'PS3'\r\n | '2BA'\r\n | 'LBA'\r\n | 'JUB'\r\n | 'ENO'\r\n | '1MQ'\r\n | '2MQ'\r\n | '3MQ'\r\n | 'REP'\r\n | '4BA'\r\n | 'LAO';\r\n\r\n/**\r\n * The list of available translations. Maps to the /api/available-translations.json endpoint.\r\n */\r\nexport type ApiAvailableTranslations = {\r\n /**\r\n * The list of translations that are available in the API.\r\n */\r\n translations: Array<ApiTranslation>;\r\n};\r\n\r\n/**\r\n * Defines a translation that is used in the API.\r\n */\r\nexport type ApiTranslation = {\r\n /**\r\n * The ID of the translation.\r\n */\r\n id: string;\r\n /**\r\n * The name of the translation.\r\n */\r\n name: string;\r\n /**\r\n * The website for the translation.\r\n */\r\n website: string;\r\n /**\r\n * The URL that the license for the translation can be found.\r\n */\r\n licenseUrl: string;\r\n /**\r\n * The API-added notes for the license.\r\n */\r\n licenseNotes?: string | null;\r\n /**\r\n * The notice that should be displayed when displaying content from the translation.\r\n */\r\n licenseNotice?: string | null;\r\n /**\r\n * The short name for the translation.\r\n */\r\n shortName?: string;\r\n /**\r\n * The English name for the translation.\r\n */\r\n englishName: string;\r\n /**\r\n * The ISO 639 3-letter language tag that the translation is primarily in.\r\n */\r\n language: string;\r\n /**\r\n * The direction that the language is written in. `ltr` indicates that the text is written from the left side of the page to the right. `rtl` indicates that the text is written from the right side of the page to the left.\r\n */\r\n textDirection: 'ltr' | 'rtl';\r\n /**\r\n * The API link for the list of books for this translation. Relative to the API origin.\r\n */\r\n listOfBooksApiLink: string;\r\n availableFormats: Array<'json' | 'usfm'>;\r\n /**\r\n * The number of books that are contained in this translation. Complete translations should have the same number of books as the Bible (66).\r\n */\r\n numberOfBooks: number;\r\n /**\r\n * The total number of chapters that are contained in this translation. Complete translations should have the same number of chapters as the Bible (1,189).\r\n */\r\n totalNumberOfChapters: number;\r\n /**\r\n * The total number of verses that are contained in this translation. Complete translations should have the same number of verses as the Bible (around 31,102 - some translations exclude verses based on the aparent likelyhood of existing in the original source texts).\r\n */\r\n totalNumberOfVerses: number;\r\n /**\r\n * The total number of apocryphal books that are contained in this translation.\r\n */\r\n numberOfApocryphalBooks?: number;\r\n /**\r\n * The total number of apocryphal chapters that are contained in this translation.\r\n */\r\n totalNumberOfApocryphalChapters?: number;\r\n /**\r\n * The total number of apocryphal verses that are contained in this translation.\r\n */\r\n totalNumberOfApocryphalVerses?: number;\r\n /**\r\n * Gets the name of the language that the translation is in. Null or undefined if the name of the language is not known.\r\n */\r\n languageName?: string;\r\n /**\r\n * Gets the name of the language in English. Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName?: string;\r\n /**\r\n * The API link for downloading the complete translation as a single JSON file. Relative to the API origin. Undefined if complete translation files are not available.\r\n */\r\n completeTranslationApiLink?: string;\r\n};\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a translation.\r\n */\r\nexport type ApiTranslationBooks = {\r\n /**\r\n * The translation information for the books.\r\n */\r\n translation: ApiTranslation;\r\n /**\r\n * The list of books that are available for the translation.\r\n */\r\n books: Array<ApiTranslationBook>;\r\n};\r\n\r\n/**\r\n * Defines a schema that contains information about a translation book.\r\n */\r\nexport type ApiTranslationBook = {\r\n id: BookId;\r\n /**\r\n * The name that the translation provided for the book.\r\n */\r\n name: string;\r\n /**\r\n * The common name for the book.\r\n */\r\n commonName: string;\r\n /**\r\n * The title of the book. This is usually a more descriptive version of the book name. If not available, then one was not provided by the translation.\r\n */\r\n title: string | null;\r\n /**\r\n * The numerical order of the book in the translation.\r\n */\r\n order: number;\r\n /**\r\n * Whether the book is an apocryphal book.\r\n */\r\n isApocryphal?: boolean;\r\n /**\r\n * The number of the first chapter in the book.\r\n */\r\n firstChapterNumber: number;\r\n /**\r\n * The link to the first chapter of the book.\r\n */\r\n firstChapterApiLink: string;\r\n firstChapterReference: TranslationChapterReference;\r\n /**\r\n * The number of the last chapter in the book.\r\n */\r\n lastChapterNumber: number;\r\n /**\r\n * The link to the last chapter of the book.\r\n */\r\n lastChapterApiLink: string;\r\n lastChapterReference: TranslationChapterReference;\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: number;\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: number;\r\n};\r\n\r\n/**\r\n * Defines a reference to a chapter in a translation.\r\n */\r\nexport type TranslationChapterReference = {\r\n /**\r\n * The ID of the translation that the chapter reference is for.\r\n */\r\n translationId: string;\r\n book: BookId;\r\n /**\r\n * The chapter number of the chapter reference.\r\n */\r\n chapter: number;\r\n};\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter in a translation.\r\n */\r\nexport type ApiTranslationBookChapter = {\r\n /**\r\n * The information for the chapter.\r\n */\r\n chapter: {\r\n /**\r\n * The number of the chapter.\r\n */\r\n number: number;\r\n /**\r\n * The content of the chapter.\r\n */\r\n content: Array<ChapterContent>;\r\n /**\r\n * The list of footnotes for the chapter.\r\n */\r\n footnotes: Array<ChapterFootnote>;\r\n };\r\n /**\r\n * The links to different audio versions for the chapter.\r\n */\r\n thisChapterAudioLinks: TranslationBookChapterAudioLinks;\r\n /**\r\n * The translation information for the book chapter.\r\n */\r\n translation: ApiTranslation;\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: ApiTranslationBook;\r\n /**\r\n * The API link for this chapter. Relative to the API origin.\r\n */\r\n thisChapterLink: string;\r\n thisChapterReference: TranslationChapterReference;\r\n /**\r\n * The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: string | null;\r\n /**\r\n * The reference for the next chapter. Null if this is the last chapter in the translation.\r\n */\r\n nextChapterReference: TranslationChapterReference | null;\r\n /**\r\n * The links to the audio versions for the next chapter. Relative to the API origin. Null if this is the last chapter in the translation.\r\n */\r\n nextChapterAudioLinks: {\r\n [key: string]: string;\r\n } | null;\r\n /**\r\n * The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: string | null;\r\n /**\r\n * The reference for the previous chapter. Null if this is the first chapter in the translation.\r\n */\r\n previousChapterReference: TranslationChapterReference | null;\r\n /**\r\n * The links to the audio versions for the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation.\r\n */\r\n previousChapterAudioLinks: {\r\n [key: string]: string;\r\n } | null;\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: number;\r\n};\r\n\r\n/**\r\n * Defines a union type that represents a single piece of chapter content. A piece of chapter content can be one of the following things: A heading, a line break, a verse, or a Hebrew Subtitle.\r\n */\r\nexport type ChapterContent =\r\n | ({\r\n type: 'heading';\r\n } & ChapterHeading)\r\n | ({\r\n type: 'line_break';\r\n } & ChapterLineBreak)\r\n | ({\r\n type: 'verse';\r\n } & ChapterVerse)\r\n | ({\r\n type: 'hebrew_subtitle';\r\n } & ChapterHebrewSubtitle);\r\n\r\n/**\r\n * Defines the schema for a heading in a chapter.\r\n */\r\nexport type ChapterHeading = {\r\n type: 'heading';\r\n /**\r\n * The content for the heading. If multiple strings are included in the array, they should be concatenated with a space.\r\n */\r\n content: Array<string>;\r\n};\r\n\r\n/**\r\n * Defines the schema for a line break in a chapter.\r\n */\r\nexport type ChapterLineBreak = {\r\n type: 'line_break';\r\n};\r\n\r\n/**\r\n * Defines the schema for a verse in a chapter.\r\n */\r\nexport type ChapterVerse = {\r\n type: 'verse';\r\n /**\r\n * The number of the verse.\r\n */\r\n number: number;\r\n /**\r\n * The list of content for the verse. Each element in the list could be a string, formatted text, or a footnote reference.\r\n */\r\n content: Array<\r\n | string\r\n | FormattedText\r\n | InlineHeading\r\n | InlineLineBreak\r\n | VerseFootnoteReference\r\n >;\r\n};\r\n\r\n/**\r\n * Defines the schema for formatted text. That is, text that is formatted in a particular manner.\r\n */\r\nexport type FormattedText = {\r\n /**\r\n * The text that is formatted.\r\n */\r\n text: string;\r\n /**\r\n * Whether the text represents a poem. The number indicates the level of indent. Common in Psalms.\r\n */\r\n poem?: number;\r\n /**\r\n * Whether the text represents the Words of Jesus.\r\n */\r\n wordsOfJesus?: boolean;\r\n};\r\n\r\n/**\r\n * Defines the schema for a heading that is embedded in a verse.\r\n */\r\nexport type InlineHeading = {\r\n /**\r\n * The text of the heading.\r\n */\r\n heading: string;\r\n};\r\n\r\n/**\r\n * Defines the schema for a line break that is embedded in a verse.\r\n */\r\nexport type InlineLineBreak = {\r\n lineBreak: true;\r\n};\r\n\r\n/**\r\n * Defines the schema for a footnote reference in a verse or a Hebrew Subtitle.\r\n */\r\nexport type VerseFootnoteReference = {\r\n /**\r\n * The ID of the note.\r\n */\r\n noteId: number;\r\n};\r\n\r\n/**\r\n * Defines the schema for a Hebrew Subtitle in a chapter.\r\n */\r\nexport type ChapterHebrewSubtitle = {\r\n type: 'hebrew_subtitle';\r\n /**\r\n * The content that is contained in the subtitle. Each element in the list could be a string, formatted text, or a footnote reference.\r\n */\r\n content: Array<string | FormattedText | VerseFootnoteReference>;\r\n};\r\n\r\n/**\r\n * Defines the schema for information about a footnote.\r\n */\r\nexport type ChapterFootnote = {\r\n /**\r\n * The ID of the note that is referenced.\r\n */\r\n noteId: number;\r\n /**\r\n * The text of the footnote.\r\n */\r\n text: string;\r\n /**\r\n * The verse reference for the footnote. Undefined if the footnote isn't associated with a specific verse.\r\n */\r\n reference?: {\r\n chapter: number;\r\n verse: number;\r\n };\r\n /**\r\n * The caller that should be used for the footnote. For footnotes, a \"caller\" is the character that is used in the text to reference to footnote. For example, in the text: Hello (a) World ---- (a) This is a footnote. The \"(a)\" is the caller. If \"+\", then the caller should be autogenerated. If null, then the caller should be empty. If a string, then the caller should be that string.\r\n */\r\n caller: '+' | string | null;\r\n};\r\n\r\n/**\r\n * Defines the schema for the audio links for a book chapter.\r\n */\r\nexport type TranslationBookChapterAudioLinks = {\r\n [key: string]: string;\r\n};\r\n\r\n/**\r\n * Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint.\r\n */\r\nexport type ApiTranslationComplete = {\r\n /**\r\n * The translation metadata.\r\n */\r\n translation: ApiTranslation;\r\n /**\r\n * The complete list of books with all their chapters.\r\n */\r\n books: Array<ApiTranslationCompleteBook>;\r\n};\r\n\r\n/**\r\n * A book in the complete translation download.\r\n */\r\nexport type ApiTranslationCompleteBook = {\r\n id: BookId;\r\n /**\r\n * The name that the translation provided for the book.\r\n */\r\n name: string;\r\n /**\r\n * The common name for the book.\r\n */\r\n commonName: string;\r\n /**\r\n * The title of the book. This is usually a more descriptive version of the book name. If not available, then one was not provided by the translation.\r\n */\r\n title: string | null;\r\n /**\r\n * The numerical order of the book in the translation.\r\n */\r\n order: number;\r\n /**\r\n * Whether the book is an apocryphal book.\r\n */\r\n isApocryphal?: boolean;\r\n /**\r\n * The number of chapters in the book.\r\n */\r\n numberOfChapters: number;\r\n /**\r\n * The total number of verses in the book.\r\n */\r\n totalNumberOfVerses: number;\r\n /**\r\n * The complete list of chapters with all content.\r\n */\r\n chapters: Array<TranslationBookChapter>;\r\n};\r\n\r\n/**\r\n * Defines the schema for information about a book chapter.\r\n */\r\nexport type TranslationBookChapter = {\r\n /**\r\n * The information for the chapter.\r\n */\r\n chapter: {\r\n /**\r\n * The number of the chapter.\r\n */\r\n number: number;\r\n /**\r\n * The content of the chapter.\r\n */\r\n content: Array<ChapterContent>;\r\n /**\r\n * The list of footnotes for the chapter.\r\n */\r\n footnotes: Array<ChapterFootnote>;\r\n };\r\n /**\r\n * The links to different audio versions for the chapter.\r\n */\r\n thisChapterAudioLinks: TranslationBookChapterAudioLinks;\r\n};\r\n\r\n/**\r\n * The list of available commentaries. Maps to the /api/available-commentaries.json endpoint.\r\n */\r\nexport type ApiAvailableCommentaries = {\r\n /**\r\n * The list of commentaries that are available in the API.\r\n */\r\n commentaries: Array<ApiCommentary>;\r\n};\r\n\r\n/**\r\n * Defines a commentary that is used in the API.\r\n */\r\nexport type ApiCommentary = {\r\n /**\r\n * The ID of the commentary.\r\n */\r\n id: string;\r\n /**\r\n * The name of the commentary.\r\n */\r\n name: string;\r\n /**\r\n * The website for the commentary.\r\n */\r\n website: string;\r\n /**\r\n * The URL that the license for the commentary can be found.\r\n */\r\n licenseUrl: string;\r\n /**\r\n * The API-added notes for the license.\r\n */\r\n licenseNotes?: string | null;\r\n /**\r\n * The English name for the commentary.\r\n */\r\n englishName: string;\r\n /**\r\n * The ISO 639 3-letter language tag that the translation is primarily in.\r\n */\r\n language: string;\r\n /**\r\n * The direction that the language is written in. `ltr` indicates that the text is written from the left side of the page to the right. `rtl` indicates that the text is written from the right side of the page to the left.\r\n */\r\n textDirection: 'ltr' | 'rtl';\r\n /**\r\n * The API link for the list of books for this commentary. Relative to the API origin.\r\n */\r\n listOfBooksApiLink: string;\r\n /**\r\n * The API link for the list of profiles for this commentary. Relative to the API origin.\r\n */\r\n listOfProfilesApiLink: string;\r\n availableFormats: Array<'json' | 'usfm'>;\r\n /**\r\n * The number of books that are contained in this commentary. Complete commentaries should have the same number of books as the Bible (66).\r\n */\r\n numberOfBooks: number;\r\n /**\r\n * The total number of chapters that are contained in this commentary. Complete commentaries should have the same number of chapters as the Bible (1,189).\r\n */\r\n totalNumberOfChapters: number;\r\n /**\r\n * The total number of verses that are contained in this commentary. Complete commentaries should have the same number of verses as the Bible (around 31,102 - some commentaries exclude verses based on the aparent likelyhood of existing in the original source texts).\r\n */\r\n totalNumberOfVerses: number;\r\n /**\r\n * The total number of profiles that are contained in this commentary. Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.\r\n */\r\n totalNumberOfProfiles: number;\r\n /**\r\n * Gets the name of the language that the commentary is in. Null or undefined if the name of the language is not known.\r\n */\r\n languageName?: string;\r\n /**\r\n * Gets the name of the language in English. Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName?: string;\r\n};\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a commentary.\r\n */\r\nexport type ApiCommentaryBooks = {\r\n /**\r\n * The commentary information for the books.\r\n */\r\n commentary: ApiCommentary;\r\n /**\r\n * The list of books that are available for the commentary.\r\n */\r\n books: Array<ApiCommentaryBook>;\r\n};\r\n\r\n/**\r\n * Defines a schema that contains information about a commentary book.\r\n */\r\nexport type ApiCommentaryBook = {\r\n id: BookId;\r\n /**\r\n * The name that the commentary provided for the book.\r\n */\r\n name: string;\r\n /**\r\n * The common name for the book.\r\n */\r\n commonName: string;\r\n /**\r\n * The commentary's introduction for the book. Undefined if the commentary didn't provide an introduction for the book.\r\n */\r\n introduction?: string;\r\n /**\r\n * The summary of the commentary's introduction for the book. Undefined if the commentary didn't provide a summary for the book.\r\n */\r\n introductionSummary?: string;\r\n /**\r\n * The order of the book in the Bible.\r\n */\r\n order: number;\r\n /**\r\n * The number of the first chapter in the book. Null if the comentary book has no chapters.\r\n */\r\n firstChapterNumber: number | null;\r\n /**\r\n * The link to the first chapter of the book. Null if the comentary book has no chapters.\r\n */\r\n firstChapterApiLink: string | null;\r\n /**\r\n * The reference for the first chapter in the book. Null if the comentary book has no chapters.\r\n */\r\n firstChapterReference: CommentaryChapterReference | null;\r\n /**\r\n * The number of the last chapter in the book. Null if the comentary book has no chapters.\r\n */\r\n lastChapterNumber: number | null;\r\n /**\r\n * The link to the last chapter of the book. Null if the comentary book has no chapters.\r\n */\r\n lastChapterApiLink: string | null;\r\n /**\r\n * The reference for the last chapter in the book. Null if the comentary book has no chapters.\r\n */\r\n lastChapterReference: CommentaryChapterReference | null;\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: number;\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: number;\r\n};\r\n\r\n/**\r\n * Defines a reference to a chapter in a commentary.\r\n */\r\nexport type CommentaryChapterReference = {\r\n /**\r\n * The ID of the commentary that the chapter reference is for.\r\n */\r\n commentaryId: string;\r\n book: BookId;\r\n /**\r\n * The chapter number of the chapter reference.\r\n */\r\n chapter: number;\r\n};\r\n\r\n/**\r\n * Defines a schema that contains information about a book chapter in a commentary.\r\n */\r\nexport type ApiCommentaryBookChapter = {\r\n /**\r\n * The information for the chapter.\r\n */\r\n chapter: {\r\n /**\r\n * The number of the chapter.\r\n */\r\n number: number;\r\n /**\r\n * The introduction that the commentary provided to the chapter. Not all commentaries provide an introduction to a chapter.\r\n */\r\n introduction?: string;\r\n /**\r\n * The content of the chapter.\r\n */\r\n content: Array<ChapterVerse>;\r\n };\r\n /**\r\n * The commentary information for the book chapter.\r\n */\r\n commentary: ApiCommentary;\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: ApiCommentaryBook;\r\n /**\r\n * The API link for this chapter. Relative to the API origin.\r\n */\r\n thisChapterLink: string;\r\n thisChapterReference: CommentaryChapterReference;\r\n /**\r\n * The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the commentary.\r\n */\r\n nextChapterApiLink: string | null;\r\n /**\r\n * The reference for the next chapter. Null if this is the last chapter in the commentary.\r\n */\r\n nextChapterReference: CommentaryChapterReference | null;\r\n /**\r\n * The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the commentary.\r\n */\r\n previousChapterApiLink: string | null;\r\n /**\r\n * The reference for the previous chapter. Null if this is the first chapter in the commentary.\r\n */\r\n previousChapterReference: CommentaryChapterReference | null;\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: number;\r\n};\r\n\r\n/**\r\n * The list of available datasets. Maps to the /api/available-datasets.json endpoint.\r\n */\r\nexport type ApiAvailableDatasets = {\r\n /**\r\n * The list of datasets that are available in the API.\r\n */\r\n datasets: Array<ApiDataset>;\r\n};\r\n\r\n/**\r\n * Defines a dataset that is used in the API.\r\n */\r\nexport type ApiDataset = {\r\n /**\r\n * The ID of the dataset.\r\n */\r\n id: string;\r\n /**\r\n * The name of the dataset.\r\n */\r\n name: string;\r\n /**\r\n * The website for the dataset.\r\n */\r\n website: string;\r\n /**\r\n * The URL that the license for the dataset can be found.\r\n */\r\n licenseUrl: string;\r\n /**\r\n * The API-added notes for the license.\r\n */\r\n licenseNotes?: string | null;\r\n /**\r\n * The English name for the dataset.\r\n */\r\n englishName: string;\r\n /**\r\n * The ISO 639 3-letter language tag that the dataset is primarily in.\r\n */\r\n language: string;\r\n /**\r\n * The direction that the language is written in.\r\n */\r\n textDirection: 'ltr' | 'rtl';\r\n /**\r\n * The API link for the list of books for this dataset. Relative to the API origin.\r\n */\r\n listOfBooksApiLink: string;\r\n availableFormats: Array<'json'>;\r\n /**\r\n * The number of books that are contained in this dataset.\r\n */\r\n numberOfBooks: number;\r\n /**\r\n * The total number of chapters that are contained in this dataset.\r\n */\r\n totalNumberOfChapters: number;\r\n /**\r\n * The total number of verses that are contained in this dataset.\r\n */\r\n totalNumberOfVerses: number;\r\n /**\r\n * The total number of references that are contained in this dataset.\r\n */\r\n totalNumberOfReferences: number;\r\n /**\r\n * Gets the name of the language that the dataset is in. Null or undefined if the name of the language is not known.\r\n */\r\n languageName?: string;\r\n /**\r\n * Gets the name of the language in English. Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName?: string;\r\n};\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a dataset.\r\n */\r\nexport type ApiDatasetBooks = {\r\n /**\r\n * The dataset information for the books.\r\n */\r\n dataset: ApiDataset;\r\n /**\r\n * The list of books that are available for the dataset.\r\n */\r\n books: Array<ApiDatasetBook>;\r\n};\r\n\r\n/**\r\n * Defines a schema that contains information about a book in a dataset.\r\n */\r\nexport type ApiDatasetBook = {\r\n id: BookId;\r\n /**\r\n * The order of the book in the Bible.\r\n */\r\n order: number;\r\n /**\r\n * The number of the first chapter in the book.\r\n */\r\n firstChapterNumber: number;\r\n /**\r\n * The link to the first chapter of the book.\r\n */\r\n firstChapterApiLink: string;\r\n firstChapterReference: DatasetChapterReference;\r\n /**\r\n * The number of the last chapter in the book.\r\n */\r\n lastChapterNumber: number;\r\n /**\r\n * The link to the last chapter of the book.\r\n */\r\n lastChapterApiLink: string;\r\n lastChapterReference: DatasetChapterReference;\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: number;\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: number;\r\n /**\r\n * The number of references that the book contains.\r\n */\r\n totalNumberOfReferences: number;\r\n};\r\n\r\n/**\r\n * Defines a reference to a chapter in a dataset.\r\n */\r\nexport type DatasetChapterReference = {\r\n /**\r\n * The ID of the dataset that the chapter reference is for.\r\n */\r\n datasetId: string;\r\n book: BookId;\r\n /**\r\n * The chapter number of the chapter reference.\r\n */\r\n chapter: number;\r\n};\r\n\r\n/**\r\n * Defines a schema that contains information about a book chapter in a dataset.\r\n */\r\nexport type ApiDatasetBookChapter = {\r\n /**\r\n * The data for the chapter.\r\n */\r\n chapter: DatasetChapterData;\r\n /**\r\n * The dataset information for the book chapter.\r\n */\r\n dataset: ApiDataset;\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: ApiDatasetBook;\r\n /**\r\n * The API link for this chapter. Relative to the API origin.\r\n */\r\n thisChapterLink: string;\r\n thisChapterReference: DatasetChapterReference;\r\n /**\r\n * The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset.\r\n */\r\n nextChapterApiLink: string | null;\r\n /**\r\n * The reference for the next chapter. Null if this is the last chapter in the dataset.\r\n */\r\n nextChapterReference: DatasetChapterReference | null;\r\n /**\r\n * The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset.\r\n */\r\n previousChapterApiLink: string | null;\r\n /**\r\n * The reference for the previous chapter. Null if this is the first chapter in the dataset.\r\n */\r\n previousChapterReference: DatasetChapterReference | null;\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: number;\r\n /**\r\n * The number of references that the chapter contains.\r\n */\r\n numberOfReferences: number;\r\n};\r\n\r\n/**\r\n * Defines the schema for information about a chapter in a dataset.\r\n */\r\nexport type DatasetChapterData = {\r\n /**\r\n * The number of the chapter.\r\n */\r\n number: number;\r\n /**\r\n * The content of the chapter.\r\n */\r\n content: Array<DatasetChapterVerseContent>;\r\n};\r\n\r\n/**\r\n * Defines the schema for information about a verse in a dataset chapter.\r\n */\r\nexport type DatasetChapterVerseContent = {\r\n /**\r\n * The number of the verse.\r\n */\r\n verse: number;\r\n /**\r\n * The list of references for the verse.\r\n */\r\n references: Array<ScoredVerseRef>;\r\n};\r\n\r\n/**\r\n * Defines the schema for information about a verse reference that has an arbitrary score attached to it.\r\n */\r\nexport type ScoredVerseRef = {\r\n book: BookId;\r\n /**\r\n * The chapter number that the reference starts at.\r\n */\r\n chapter: number;\r\n /**\r\n * The verse number that the reference starts at.\r\n */\r\n verse: number;\r\n /**\r\n * The rest of the content of the verse reference. This is the part of the string that comes after the verse reference. For example, in \"GEN 1:1 In the beginning, God created the Heavens and the Earth.\", the content would be \"In the beginning, God created the Heavens and the Earth.\"\r\n */\r\n content?: string;\r\n /**\r\n * The chapter that the verse reference ends at. This is used for references that span multiple chapters, such as \"GEN 1:1-2:3\". In this case, the endChapter would be 2.\r\n */\r\n endChapter?: number;\r\n /**\r\n * The verse that the verse reference ends at. This is used for references that span multiple verses, such as \"GEN 1:1-1:3\". In this case, the endVerse would be 3.\r\n */\r\n endVerse?: number;\r\n /**\r\n * The score for the verse reference. The meaning of the score is arbitrary and is determined by the dataset.\r\n */\r\n score: number;\r\n};\r\n\r\nexport type GetAvailableTranslationsData = {\r\n body?: never;\r\n path?: never;\r\n query?: never;\r\n url: '/api/available_translations.json';\r\n};\r\n\r\nexport type GetAvailableTranslationsResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiAvailableTranslations;\r\n};\r\n\r\nexport type GetAvailableTranslationsResponse =\r\n GetAvailableTranslationsResponses[keyof GetAvailableTranslationsResponses];\r\n\r\nexport type GetTranslationBooksData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The translation ID of the Bible translation to get the books for. For example, \"eng_kjv\" for the King James Version.\r\n */\r\n translation: string;\r\n };\r\n query?: never;\r\n url: '/api/{translation}/books.json';\r\n};\r\n\r\nexport type GetTranslationBooksErrors = {\r\n /**\r\n * 404 Not Found - The specified translation was not found.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetTranslationBooksResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiTranslationBooks;\r\n};\r\n\r\nexport type GetTranslationBooksResponse =\r\n GetTranslationBooksResponses[keyof GetTranslationBooksResponses];\r\n\r\nexport type GetTranslationBookChapterData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The translation ID of the Bible translation to get the books for. For example, \"eng_kjv\" for the King James Version.\r\n */\r\n translation: string;\r\n /**\r\n * IDs for books. Follows the USFM standard (https://ubsicap.github.io/usfm/identification/books.html)\r\n */\r\n book: BookId;\r\n /**\r\n * The chapter number to get the content for. This should be a positive integer.\r\n */\r\n chapter: number;\r\n };\r\n query?: never;\r\n url: '/api/{translation}/{book}/{chapter}.json';\r\n};\r\n\r\nexport type GetTranslationBookChapterErrors = {\r\n /**\r\n * 404 Not Found - The specified translation, book, or chapter was not found.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetTranslationBookChapterResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiTranslationBookChapter;\r\n};\r\n\r\nexport type GetTranslationBookChapterResponse =\r\n GetTranslationBookChapterResponses[keyof GetTranslationBookChapterResponses];\r\n\r\nexport type GetTranslationCompleteData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The translation ID of the Bible translation to get the books for. For example, \"eng_kjv\" for the King James Version.\r\n */\r\n translation: string;\r\n };\r\n query?: never;\r\n url: '/api/{translation}/complete.json';\r\n};\r\n\r\nexport type GetTranslationCompleteErrors = {\r\n /**\r\n * 404 Not Found - The specified translation was not found, or complete translations are not available.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetTranslationCompleteResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiTranslationComplete;\r\n};\r\n\r\nexport type GetTranslationCompleteResponse =\r\n GetTranslationCompleteResponses[keyof GetTranslationCompleteResponses];\r\n\r\nexport type GetAvailableCommentariesData = {\r\n body?: never;\r\n path?: never;\r\n query?: never;\r\n url: '/api/available_commentaries.json';\r\n};\r\n\r\nexport type GetAvailableCommentariesResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiAvailableCommentaries;\r\n};\r\n\r\nexport type GetAvailableCommentariesResponse =\r\n GetAvailableCommentariesResponses[keyof GetAvailableCommentariesResponses];\r\n\r\nexport type GetCommentaryBooksData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The commentary ID of the commentary to get the books or chapter content for.\r\n */\r\n commentary: string;\r\n };\r\n query?: never;\r\n url: '/api/c/{commentary}/books.json';\r\n};\r\n\r\nexport type GetCommentaryBooksErrors = {\r\n /**\r\n * 404 Not Found - The specified commentary was not found.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetCommentaryBooksResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiCommentaryBooks;\r\n};\r\n\r\nexport type GetCommentaryBooksResponse =\r\n GetCommentaryBooksResponses[keyof GetCommentaryBooksResponses];\r\n\r\nexport type GetCommentaryBookChapterData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The commentary ID of the commentary to get the books or chapter content for.\r\n */\r\n commentary: string;\r\n /**\r\n * IDs for books. Follows the USFM standard (https://ubsicap.github.io/usfm/identification/books.html)\r\n */\r\n book: BookId;\r\n /**\r\n * The chapter number to get the content for. This should be a positive integer.\r\n */\r\n chapter: number;\r\n };\r\n query?: never;\r\n url: '/api/c/{commentary}/{book}/{chapter}.json';\r\n};\r\n\r\nexport type GetCommentaryBookChapterErrors = {\r\n /**\r\n * 404 Not Found - The specified commentary, book, or chapter was not found.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetCommentaryBookChapterResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiCommentaryBookChapter;\r\n};\r\n\r\nexport type GetCommentaryBookChapterResponse =\r\n GetCommentaryBookChapterResponses[keyof GetCommentaryBookChapterResponses];\r\n\r\nexport type GetAvailableDatasetsData = {\r\n body?: never;\r\n path?: never;\r\n query?: never;\r\n url: '/api/available_datasets.json';\r\n};\r\n\r\nexport type GetAvailableDatasetsResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiAvailableDatasets;\r\n};\r\n\r\nexport type GetAvailableDatasetsResponse =\r\n GetAvailableDatasetsResponses[keyof GetAvailableDatasetsResponses];\r\n\r\nexport type GetDatasetBooksData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The dataset ID of the dataset to get the books or chapter content for.\r\n */\r\n dataset: string;\r\n };\r\n query?: never;\r\n url: '/api/d/{dataset}/books.json';\r\n};\r\n\r\nexport type GetDatasetBooksErrors = {\r\n /**\r\n * 404 Not Found - The specified dataset was not found.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetDatasetBooksResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiDatasetBooks;\r\n};\r\n\r\nexport type GetDatasetBooksResponse =\r\n GetDatasetBooksResponses[keyof GetDatasetBooksResponses];\r\n\r\nexport type GetDatasetBookChapterData = {\r\n body?: never;\r\n path: {\r\n /**\r\n * The dataset ID of the dataset to get the books or chapter content for.\r\n */\r\n dataset: string;\r\n /**\r\n * IDs for books. Follows the USFM standard (https://ubsicap.github.io/usfm/identification/books.html)\r\n */\r\n book: BookId;\r\n /**\r\n * The chapter number to get the content for. This should be a positive integer.\r\n */\r\n chapter: number;\r\n };\r\n query?: never;\r\n url: '/api/d/{dataset}/{book}/{chapter}.json';\r\n};\r\n\r\nexport type GetDatasetBookChapterErrors = {\r\n /**\r\n * 404 Not Found - The specified dataset, book, or chapter was not found.\r\n */\r\n 404: unknown;\r\n};\r\n\r\nexport type GetDatasetBookChapterResponses = {\r\n /**\r\n * 200 OK\r\n */\r\n 200: ApiDatasetBookChapter;\r\n};\r\n\r\nexport type GetDatasetBookChapterResponse =\r\n GetDatasetBookChapterResponses[keyof GetDatasetBookChapterResponses];\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ export class FreeUseBibleApi {
3
+ endpoint = "https://bible.helloao.org/";
4
+ _responseCache = /* @__PURE__ */ new Map();
5
+ _useCache = true;
6
+ constructor(options) {
7
+ this.endpoint = options?.endpoint ?? this.endpoint;
8
+ this._useCache = options?.useCache ?? this._useCache;
9
+ }
10
+ /**
11
+ * Gets the list of available Bible translations from the API.
12
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
13
+ */
14
+ async getAvailableTranslations(endpoint) {
15
+ return this._getJson(
16
+ "api/available_translations.json",
17
+ endpoint
18
+ );
19
+ }
20
+ /**
21
+ * Gets the complete content of a specific Bible translation.
22
+ *
23
+ * The results of this endpoint are very large, so the response is not cached.
24
+ * @param translation The ID of the translation to get the complete content for.
25
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
26
+ */
27
+ async getCompleteTranslation(translation, endpoint) {
28
+ const encodedTranslation = encodeURIComponent(translation);
29
+ return this._getJson(
30
+ `api/${encodedTranslation}/complete.json`,
31
+ endpoint,
32
+ false
33
+ );
34
+ }
35
+ /**
36
+ * Gets the list of available Bible commentaries from the API.
37
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
38
+ */
39
+ async getAvailableCommentaries(endpoint) {
40
+ return this._getJson(
41
+ "api/available_commentaries.json",
42
+ endpoint
43
+ );
44
+ }
45
+ /**
46
+ * Gets the list of available datasets from the API.
47
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
48
+ */
49
+ async getAvailableDatasets(endpoint) {
50
+ return this._getJson(
51
+ "api/available_datasets.json",
52
+ endpoint
53
+ );
54
+ }
55
+ /**
56
+ * Gets the list of books for a given Bible translation.
57
+ * @param translation The ID of the translation to get the books for.
58
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
59
+ */
60
+ async getTranslationBooks(translation, endpoint) {
61
+ const encodedTranslation = encodeURIComponent(translation);
62
+ return this._getJson(
63
+ `api/${encodedTranslation}/books.json`,
64
+ endpoint
65
+ );
66
+ }
67
+ /**
68
+ * Gets the list of books for a given Bible commentary.
69
+ * @param commentary The ID of the commentary to get the books for.
70
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
71
+ */
72
+ async getCommentaryBooks(commentary, endpoint) {
73
+ const encodedCommentary = encodeURIComponent(commentary);
74
+ return this._getJson(
75
+ `api/${encodedCommentary}/books.json`,
76
+ endpoint
77
+ );
78
+ }
79
+ /**
80
+ * Gets the list of books for a given dataset.
81
+ * @param dataset The ID of the dataset to get the books for.
82
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
83
+ */
84
+ async getDatasetBooks(dataset, endpoint) {
85
+ const encodedDataset = encodeURIComponent(dataset);
86
+ return this._getJson(
87
+ `api/d/${encodedDataset}/books.json`,
88
+ endpoint
89
+ );
90
+ }
91
+ /**
92
+ * Gets the content of a specific chapter of a specific book for a specific Bible translation.
93
+ * @param translation The ID of the translation to get the chapter for.
94
+ * @param book The ID of the book to get the chapter for.
95
+ * @param chapter The chapter number to get.
96
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
97
+ */
98
+ async getTranslationBookChapter(translation, book, chapter, endpoint) {
99
+ const encodedTranslation = encodeURIComponent(translation);
100
+ const encodedBook = encodeURIComponent(book);
101
+ const encodedChapter = encodeURIComponent(String(chapter));
102
+ return this._getJson(
103
+ `api/${encodedTranslation}/${encodedBook}/${encodedChapter}.json`,
104
+ endpoint
105
+ );
106
+ }
107
+ /**
108
+ * Gets the content of a specific chapter of a specific book for a specific Bible commentary.
109
+ * @param commentary The ID of the commentary to get the chapter for.
110
+ * @param book The ID of the book to get the chapter for.
111
+ * @param chapter The chapter number to get.
112
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
113
+ */
114
+ async getCommentaryBookChapter(commentary, book, chapter, endpoint) {
115
+ const encodedCommentary = encodeURIComponent(commentary);
116
+ const encodedBook = encodeURIComponent(book);
117
+ const encodedChapter = encodeURIComponent(String(chapter));
118
+ return this._getJson(
119
+ `api/${encodedCommentary}/${encodedBook}/${encodedChapter}.json`,
120
+ endpoint
121
+ );
122
+ }
123
+ /**
124
+ * Gets the content of a specific chapter of a specific book for a specific dataset.
125
+ * @param dataset The ID of the dataset to get the chapter for.
126
+ * @param book The ID of the book to get the chapter for.
127
+ * @param chapter The chapter number to get.
128
+ * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.
129
+ */
130
+ async getDatasetBookChapter(dataset, book, chapter, endpoint) {
131
+ const encodedDataset = encodeURIComponent(dataset);
132
+ const encodedBook = encodeURIComponent(book);
133
+ const encodedChapter = encodeURIComponent(String(chapter));
134
+ return this._getJson(
135
+ `api/d/${encodedDataset}/${encodedBook}/${encodedChapter}.json`,
136
+ endpoint
137
+ );
138
+ }
139
+ async getNextChapter(chapter, endpoint) {
140
+ if (!chapter.nextChapterApiLink) {
141
+ return null;
142
+ }
143
+ return this._getJson(chapter.nextChapterApiLink, endpoint);
144
+ }
145
+ async getPreviousChapter(chapter, endpoint) {
146
+ if (!chapter.previousChapterApiLink) {
147
+ return null;
148
+ }
149
+ return this._getJson(chapter.previousChapterApiLink, endpoint);
150
+ }
151
+ async getFirstChapter(book, endpoint) {
152
+ if (!book.firstChapterApiLink) {
153
+ return null;
154
+ }
155
+ return this._getJson(book.firstChapterApiLink, endpoint);
156
+ }
157
+ async getLastChapter(book, endpoint) {
158
+ if (!book.lastChapterApiLink) {
159
+ return null;
160
+ }
161
+ return this._getJson(book.lastChapterApiLink, endpoint);
162
+ }
163
+ /**
164
+ * Formats a verse reference as a human-readable string.
165
+ *
166
+ * e.g. Genesis 1:1-2, John 3:16, Exodus 20-22, etc.
167
+ *
168
+ * @param book The book that the reference is for.
169
+ * @param reference The reference to format.
170
+ */
171
+ formatReference(book, reference) {
172
+ const bookName = book.name;
173
+ const chapter = reference.chapter;
174
+ const verse = reference.verse;
175
+ const endChapter = reference.endChapter;
176
+ const endVerse = reference.endVerse;
177
+ let referenceStr = `${bookName} ${chapter}`;
178
+ if (endChapter) {
179
+ referenceStr += `-${endChapter}`;
180
+ } else if (verse) {
181
+ referenceStr += `:${verse}`;
182
+ if (endVerse) {
183
+ referenceStr += `-${endVerse}`;
184
+ }
185
+ }
186
+ return referenceStr;
187
+ }
188
+ /**
189
+ * Gets the text for a verse.
190
+ * @param verse The verse to get the text for.
191
+ * @param options Options for getting the verse text.
192
+ */
193
+ getVerseText(verse) {
194
+ let content = "";
195
+ for (let part of verse.content) {
196
+ if (typeof part === "string") {
197
+ content += part;
198
+ } else if (typeof part === "object" && "text" in part) {
199
+ if (part.poem) {
200
+ content += "\n";
201
+ for (let i = 0; i < part.poem; i++) {
202
+ content += " ";
203
+ }
204
+ }
205
+ content += part.text;
206
+ } else if (typeof part === "object" && "lineBreak" in part) {
207
+ content += "\n";
208
+ } else if (typeof part === "object") {
209
+ content += " ";
210
+ }
211
+ }
212
+ return content.trim();
213
+ }
214
+ /**
215
+ * Gets the verse text for the given chapter.
216
+ * By default, the returned text includes markers for verse numbers and a reference to the chapter, but these can be omitted by passing options to the `options` parameter.
217
+ * @param chapter The chapter to get the text for.
218
+ * @param options Options for getting the chapter text.
219
+ */
220
+ getChapterVerseText(chapter, options = {}) {
221
+ let content = "";
222
+ for (let chapterContent of chapter.chapter.content) {
223
+ if (chapterContent.type === "verse") {
224
+ if (!options.omitVerseNumbers) {
225
+ content += `[${chapterContent.number}] `;
226
+ }
227
+ content += this.getVerseText(chapterContent) + " ";
228
+ } else if (chapterContent.type === "line_break") {
229
+ content = content.trim() + "\n";
230
+ }
231
+ }
232
+ if (!options.omitReference) {
233
+ content = `${this.formatReference(chapter.book, {
234
+ chapter: chapter.chapter.number
235
+ })}
236
+ ${content.trim()}`;
237
+ }
238
+ return content.trim();
239
+ }
240
+ _getJson(path, endpoint, useCache = true) {
241
+ const url = this._buildUrl(path, endpoint);
242
+ const existing = this._responseCache.get(url);
243
+ if (existing) {
244
+ return existing;
245
+ }
246
+ const request = fetch(url).then(async (response) => {
247
+ if (response.status < 200 || response.status >= 300) {
248
+ throw new Error(
249
+ `Failed request to ${url}. Status: ${response.status} ${response.statusText}`
250
+ );
251
+ }
252
+ return await response.json();
253
+ }).catch((error) => {
254
+ this._responseCache.delete(url);
255
+ throw error;
256
+ });
257
+ if (this._useCache && useCache) {
258
+ this._responseCache.set(url, request);
259
+ }
260
+ return request;
261
+ }
262
+ _buildUrl(path, endpoint) {
263
+ if (/^https?:\/\//i.test(path)) {
264
+ return path;
265
+ }
266
+ const baseEndpoint = endpoint ?? this.endpoint;
267
+ return new URL(path, baseEndpoint).href;
268
+ }
269
+ }
270
+ //# sourceMappingURL=FreeUseBibleApi.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../FreeUseBibleApi.ts"],
4
+ "sourcesContent": ["import type {\r\n ApiAvailableDatasets,\r\n ApiAvailableTranslations,\r\n ApiCommentaryBook,\r\n ApiCommentaryBookChapter,\r\n ApiDatasetBook,\r\n ApiDatasetBookChapter,\r\n ApiDatasetBooks,\r\n ApiTranslationBook,\r\n ApiTranslationBookChapter,\r\n ApiTranslationBooks,\r\n ApiTranslationComplete,\r\n ChapterVerse,\r\n TranslationChapterReference,\r\n} from './types.gen.js';\r\n\r\n/**\r\n * Options for the FreeUseBibleApi class.\r\n */\r\nexport interface FreeUseBibleApiOptions {\r\n /**\r\n * The API endpoint to use for the requests. If not provided, the default endpoint will be used.\r\n */\r\n endpoint?: string;\r\n\r\n /**\r\n * Whether to cache responses in memory.\r\n *\r\n * Defaults to `true`.\r\n */\r\n useCache?: boolean;\r\n}\r\n\r\n/**\r\n * Options for the `getChapterText` method.\r\n */\r\nexport interface GetChapterTextOptions {\r\n /**\r\n * Whether to omit verse numbers from the returned text.\r\n * Defaults to `false`.\r\n */\r\n omitVerseNumbers?: boolean;\r\n\r\n /**\r\n * Whether to omit the chapter reference from the returned text.\r\n */\r\n omitReference?: boolean;\r\n}\r\n\r\n/**\r\n * Options for the `getVerseText` method.\r\n */\r\nexport interface GetVerseTextOptions {\r\n /**\r\n * Whether to omit the chapter reference from the returned text.\r\n */\r\n omitReference?: boolean;\r\n}\r\n\r\n/**\r\n * A reference to a specific verse in a Bible translation, commentary, or dataset.\r\n */\r\nexport interface VerseReference {\r\n /**\r\n * The chapter number of the reference. This should be a positive integer.\r\n */\r\n chapter: number;\r\n\r\n /**\r\n * The verse number of the reference.\r\n *\r\n * If omitted, then the reference refers to the entire chapter rather than a specific verse.\r\n */\r\n verse?: number;\r\n\r\n /**\r\n * The ending verse number of the reference, for references that span multiple verses. This should be greater than or equal to the `verse` property if it is provided.\r\n */\r\n endVerse?: number;\r\n\r\n /**\r\n * The ending chapter number of the reference, for references that span multiple chapters. This should be greater than or equal to the `chapter` property if it is provided.\r\n */\r\n endChapter?: number;\r\n}\r\n\r\n/**\r\n * A client for interacting with the [Free Use Bible API](https://bible.helloao.org/).\r\n *\r\n * This API provides access to a large collection of Bible translations, commentaries, and datasets that are free to use.\r\n */\r\nexport class FreeUseBibleApi {\r\n endpoint: string = 'https://bible.helloao.org/';\r\n private _responseCache = new Map<string, Promise<unknown>>();\r\n private _useCache: boolean = true;\r\n\r\n constructor(options?: FreeUseBibleApiOptions) {\r\n this.endpoint = options?.endpoint ?? this.endpoint;\r\n this._useCache = options?.useCache ?? this._useCache;\r\n }\r\n\r\n /**\r\n * Gets the list of available Bible translations from the API.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getAvailableTranslations(\r\n endpoint?: string\r\n ): Promise<ApiAvailableTranslations> {\r\n return this._getJson<ApiAvailableTranslations>(\r\n 'api/available_translations.json',\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the complete content of a specific Bible translation.\r\n *\r\n * The results of this endpoint are very large, so the response is not cached.\r\n * @param translation The ID of the translation to get the complete content for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getCompleteTranslation(\r\n translation: string,\r\n endpoint?: string\r\n ): Promise<ApiTranslationComplete> {\r\n const encodedTranslation = encodeURIComponent(translation);\r\n return this._getJson<ApiTranslationComplete>(\r\n `api/${encodedTranslation}/complete.json`,\r\n endpoint,\r\n false\r\n );\r\n }\r\n\r\n /**\r\n * Gets the list of available Bible commentaries from the API.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getAvailableCommentaries(\r\n endpoint?: string\r\n ): Promise<ApiAvailableTranslations> {\r\n return this._getJson<ApiAvailableTranslations>(\r\n 'api/available_commentaries.json',\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the list of available datasets from the API.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getAvailableDatasets(\r\n endpoint?: string\r\n ): Promise<ApiAvailableDatasets> {\r\n return this._getJson<ApiAvailableDatasets>(\r\n 'api/available_datasets.json',\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the list of books for a given Bible translation.\r\n * @param translation The ID of the translation to get the books for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getTranslationBooks(\r\n translation: string,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBooks> {\r\n const encodedTranslation = encodeURIComponent(translation);\r\n return this._getJson<ApiTranslationBooks>(\r\n `api/${encodedTranslation}/books.json`,\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the list of books for a given Bible commentary.\r\n * @param commentary The ID of the commentary to get the books for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getCommentaryBooks(\r\n commentary: string,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBooks> {\r\n const encodedCommentary = encodeURIComponent(commentary);\r\n return this._getJson<ApiTranslationBooks>(\r\n `api/${encodedCommentary}/books.json`,\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the list of books for a given dataset.\r\n * @param dataset The ID of the dataset to get the books for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getDatasetBooks(\r\n dataset: string,\r\n endpoint?: string\r\n ): Promise<ApiDatasetBooks> {\r\n const encodedDataset = encodeURIComponent(dataset);\r\n return this._getJson<ApiDatasetBooks>(\r\n `api/d/${encodedDataset}/books.json`,\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the content of a specific chapter of a specific book for a specific Bible translation.\r\n * @param translation The ID of the translation to get the chapter for.\r\n * @param book The ID of the book to get the chapter for.\r\n * @param chapter The chapter number to get.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getTranslationBookChapter(\r\n translation: string,\r\n book: string,\r\n chapter: number | string,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBookChapter> {\r\n const encodedTranslation = encodeURIComponent(translation);\r\n const encodedBook = encodeURIComponent(book);\r\n const encodedChapter = encodeURIComponent(String(chapter));\r\n return this._getJson<ApiTranslationBookChapter>(\r\n `api/${encodedTranslation}/${encodedBook}/${encodedChapter}.json`,\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the content of a specific chapter of a specific book for a specific Bible commentary.\r\n * @param commentary The ID of the commentary to get the chapter for.\r\n * @param book The ID of the book to get the chapter for.\r\n * @param chapter The chapter number to get.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getCommentaryBookChapter(\r\n commentary: string,\r\n book: string,\r\n chapter: number | string,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBookChapter> {\r\n const encodedCommentary = encodeURIComponent(commentary);\r\n const encodedBook = encodeURIComponent(book);\r\n const encodedChapter = encodeURIComponent(String(chapter));\r\n return this._getJson<ApiTranslationBookChapter>(\r\n `api/${encodedCommentary}/${encodedBook}/${encodedChapter}.json`,\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the content of a specific chapter of a specific book for a specific dataset.\r\n * @param dataset The ID of the dataset to get the chapter for.\r\n * @param book The ID of the book to get the chapter for.\r\n * @param chapter The chapter number to get.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n */\r\n async getDatasetBookChapter(\r\n dataset: string,\r\n book: string,\r\n chapter: number | string,\r\n endpoint?: string\r\n ): Promise<ApiDatasetBookChapter> {\r\n const encodedDataset = encodeURIComponent(dataset);\r\n const encodedBook = encodeURIComponent(book);\r\n const encodedChapter = encodeURIComponent(String(chapter));\r\n return this._getJson<ApiDatasetBookChapter>(\r\n `api/d/${encodedDataset}/${encodedBook}/${encodedChapter}.json`,\r\n endpoint\r\n );\r\n }\r\n\r\n /**\r\n * Gets the next chapter for a given chapter, if available.\r\n * @param chapter The chapter to get the next chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The next chapter, or null if there is no next chapter.\r\n */\r\n getNextChapter(\r\n chapter: ApiCommentaryBookChapter,\r\n endpoint?: string\r\n ): Promise<ApiCommentaryBookChapter | null>;\r\n /**\r\n * Gets the next chapter for a given chapter, if available.\r\n * @param chapter The chapter to get the next chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The next chapter, or null if there is no next chapter.\r\n */\r\n getNextChapter(\r\n chapter: ApiTranslationBookChapter,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBookChapter | null>;\r\n /**\r\n * Gets the next chapter for a given chapter, if available.\r\n * @param chapter The chapter to get the next chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The next chapter, or null if there is no next chapter.\r\n */\r\n getNextChapter(\r\n chapter: ApiDatasetBookChapter,\r\n endpoint?: string\r\n ): Promise<ApiDatasetBookChapter | null>;\r\n async getNextChapter(\r\n chapter:\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter,\r\n endpoint?: string\r\n ): Promise<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n | null\r\n > {\r\n if (!chapter.nextChapterApiLink) {\r\n return null;\r\n }\r\n return this._getJson<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n >(chapter.nextChapterApiLink, endpoint);\r\n }\r\n\r\n /**\r\n * Gets the previous chapter for a given chapter, if available.\r\n * @param chapter The chapter to get the previous chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The previous chapter, or null if there is no previous chapter.\r\n */\r\n getPreviousChapter(\r\n chapter: ApiCommentaryBookChapter,\r\n endpoint?: string\r\n ): Promise<ApiCommentaryBookChapter | null>;\r\n /**\r\n * Gets the previous chapter for a given chapter, if available.\r\n * @param chapter The chapter to get the previous chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The previous chapter, or null if there is no previous chapter.\r\n */\r\n getPreviousChapter(\r\n chapter: ApiTranslationBookChapter,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBookChapter | null>;\r\n /**\r\n * Gets the previous chapter for a given chapter, if available.\r\n * @param chapter The chapter to get the previous chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The previous chapter, or null if there is no previous chapter.\r\n */\r\n getPreviousChapter(\r\n chapter: ApiDatasetBookChapter,\r\n endpoint?: string\r\n ): Promise<ApiDatasetBookChapter | null>;\r\n async getPreviousChapter(\r\n chapter:\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter,\r\n endpoint?: string\r\n ): Promise<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n | null\r\n > {\r\n if (!chapter.previousChapterApiLink) {\r\n return null;\r\n }\r\n return this._getJson<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n >(chapter.previousChapterApiLink, endpoint);\r\n }\r\n\r\n /**\r\n * Gets the first chapter for a given book, if available.\r\n * @param book The book to get the first chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The first chapter, or null if there is no first chapter.\r\n */\r\n getFirstChapter(\r\n book: ApiCommentaryBook,\r\n endpoint?: string\r\n ): Promise<ApiCommentaryBookChapter | null>;\r\n /**\r\n * Gets the first chapter for a given book, if available.\r\n * @param book The book to get the first chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The first chapter, or null if there is no first chapter.\r\n */\r\n getFirstChapter(\r\n book: ApiTranslationBook,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBookChapter>;\r\n /**\r\n * Gets the first chapter for a given book, if available.\r\n * @param book The book to get the first chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The first chapter, or null if there is no first chapter.\r\n */\r\n getFirstChapter(\r\n book: ApiDatasetBook,\r\n endpoint?: string\r\n ): Promise<ApiDatasetBookChapter>;\r\n async getFirstChapter(\r\n book: ApiTranslationBook | ApiCommentaryBook | ApiDatasetBook,\r\n endpoint?: string\r\n ): Promise<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n | null\r\n > {\r\n if (!book.firstChapterApiLink) {\r\n return null;\r\n }\r\n return this._getJson<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n >(book.firstChapterApiLink, endpoint);\r\n }\r\n\r\n /**\r\n * Gets the last chapter for a given book, if available.\r\n * @param book The book to get the last chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The last chapter, or null if there is no last chapter.\r\n */\r\n getLastChapter(\r\n book: ApiCommentaryBook,\r\n endpoint?: string\r\n ): Promise<ApiCommentaryBookChapter | null>;\r\n /**\r\n * Gets the last chapter for a given book, if available.\r\n * @param book The book to get the last chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The last chapter, or null if there is no last chapter.\r\n */\r\n getLastChapter(\r\n book: ApiTranslationBook,\r\n endpoint?: string\r\n ): Promise<ApiTranslationBookChapter>;\r\n /**\r\n * Gets the last chapter for a given book, if available.\r\n * @param book The book to get the last chapter for.\r\n * @param endpoint The API endpoint to use for the request. If not provided, the default endpoint will be used.\r\n * @returns The last chapter, or null if there is no last chapter.\r\n */\r\n getLastChapter(\r\n book: ApiDatasetBook,\r\n endpoint?: string\r\n ): Promise<ApiDatasetBookChapter>;\r\n async getLastChapter(\r\n book: ApiTranslationBook | ApiCommentaryBook | ApiDatasetBook,\r\n endpoint?: string\r\n ): Promise<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n | null\r\n > {\r\n if (!book.lastChapterApiLink) {\r\n return null;\r\n }\r\n return this._getJson<\r\n | ApiTranslationBookChapter\r\n | ApiCommentaryBookChapter\r\n | ApiDatasetBookChapter\r\n >(book.lastChapterApiLink, endpoint);\r\n }\r\n\r\n /**\r\n * Formats a verse reference as a human-readable string.\r\n *\r\n * e.g. Genesis 1:1-2, John 3:16, Exodus 20-22, etc.\r\n *\r\n * @param book The book that the reference is for.\r\n * @param reference The reference to format.\r\n */\r\n formatReference(\r\n book: ApiTranslationBook,\r\n reference: VerseReference\r\n ): string {\r\n const bookName = book.name;\r\n const chapter = reference.chapter;\r\n const verse = reference.verse;\r\n const endChapter = reference.endChapter;\r\n const endVerse = reference.endVerse;\r\n\r\n let referenceStr = `${bookName} ${chapter}`;\r\n if (endChapter) {\r\n referenceStr += `-${endChapter}`;\r\n } else if (verse) {\r\n referenceStr += `:${verse}`;\r\n if (endVerse) {\r\n referenceStr += `-${endVerse}`;\r\n }\r\n }\r\n return referenceStr;\r\n }\r\n\r\n /**\r\n * Gets the text for a verse.\r\n * @param verse The verse to get the text for.\r\n * @param options Options for getting the verse text.\r\n */\r\n getVerseText(verse: ChapterVerse): string {\r\n let content = '';\r\n for (let part of verse.content) {\r\n if (typeof part === 'string') {\r\n content += part;\r\n } else if (typeof part === 'object' && 'text' in part) {\r\n if (part.poem) {\r\n content += '\\n';\r\n for (let i = 0; i < part.poem; i++) {\r\n content += '\\t';\r\n }\r\n }\r\n content += part.text;\r\n } else if (typeof part === 'object' && 'lineBreak' in part) {\r\n content += '\\n';\r\n } else if (typeof part === 'object') {\r\n content += ' ';\r\n }\r\n }\r\n return content.trim();\r\n }\r\n\r\n /**\r\n * Gets the verse text for the given chapter.\r\n * By default, the returned text includes markers for verse numbers and a reference to the chapter, but these can be omitted by passing options to the `options` parameter.\r\n * @param chapter The chapter to get the text for.\r\n * @param options Options for getting the chapter text.\r\n */\r\n getChapterVerseText(\r\n chapter: ApiTranslationBookChapter,\r\n options: GetChapterTextOptions = {}\r\n ): string {\r\n let content = '';\r\n for (let chapterContent of chapter.chapter.content) {\r\n if (chapterContent.type === 'verse') {\r\n if (!options.omitVerseNumbers) {\r\n content += `[${chapterContent.number}] `;\r\n }\r\n content += this.getVerseText(chapterContent) + ' ';\r\n } else if (chapterContent.type === 'line_break') {\r\n content = content.trim() + '\\n';\r\n }\r\n }\r\n\r\n if (!options.omitReference) {\r\n content = `${this.formatReference(chapter.book, {\r\n chapter: chapter.chapter.number,\r\n })}\\n${content.trim()}`;\r\n }\r\n\r\n return content.trim();\r\n }\r\n\r\n private _getJson<T>(\r\n path: string,\r\n endpoint: string | undefined,\r\n useCache: boolean = true\r\n ): Promise<T> {\r\n const url = this._buildUrl(path, endpoint);\r\n const existing = this._responseCache.get(url) as Promise<T> | undefined;\r\n if (existing) {\r\n return existing;\r\n }\r\n\r\n const request: Promise<T> = fetch(url)\r\n .then(async (response) => {\r\n if (response.status < 200 || response.status >= 300) {\r\n throw new Error(\r\n `Failed request to ${url}. Status: ${response.status} ${response.statusText}`\r\n );\r\n }\r\n return await response.json();\r\n })\r\n .catch((error) => {\r\n this._responseCache.delete(url);\r\n throw error;\r\n });\r\n\r\n if (this._useCache && useCache) {\r\n this._responseCache.set(url, request);\r\n }\r\n return request;\r\n }\r\n\r\n private _buildUrl(path: string, endpoint?: string): string {\r\n if (/^https?:\\/\\//i.test(path)) {\r\n return path;\r\n }\r\n\r\n const baseEndpoint = endpoint ?? this.endpoint;\r\n return new URL(path, baseEndpoint).href;\r\n }\r\n}\r\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- export * from "./runtime";
3
- export * from "./apis/index";
4
- export * from "./models/index";
2
+ export * from "./FreeUseBibleApi.js";
3
+ export * from "./types.gen.js";
5
4
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../index.ts"],
4
- "sourcesContent": ["/* tslint:disable */\r\n/* eslint-disable */\r\nexport * from './runtime';\r\nexport * from './apis/index';\r\nexport * from './models/index';\r\n"],
5
- "mappings": ";AAEA,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["export * from './FreeUseBibleApi.js';\r\nexport * from './types.gen.js';\r\n"],
5
+ "mappings": ";AAAA,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.gen.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }