(passages)
- getHtml - Get Bible passage HTML
- search - Search Bible passages
- getAudio - Get Bible passage audio
- getText - Get Bible passage text
Returns Bible passage text with HTML formatting
Esv.org API Docs for /v3/passages/html
https://api.esv.org/docs/passage-html/
import { Esv } from "esv-sdk";
const esv = new Esv({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const result = await esv.passages.getHtml({
query: "John 1:1",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { EsvCore } from "esv-sdk/core.js";
import { passagesGetHtml } from "esv-sdk/funcs/passagesGetHtml.js";
// Use `EsvCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const esv = new EsvCore({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const res = await passagesGetHtml(esv, {
query: "John 1:1",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetPassageHtmlRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.PassageResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 400, 401 | application/json |
errors.APIError | 4XX, 5XX | */* |
Returns search results for Bible passages based on the provided query
Esv.org API Docs for /v3/passage/search
https://api.esv.org/docs/passage-search/
import { Esv } from "esv-sdk";
const esv = new Esv({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const result = await esv.passages.search({
query: "<value>",
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { EsvCore } from "esv-sdk/core.js";
import { passagesSearch } from "esv-sdk/funcs/passagesSearch.js";
// Use `EsvCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const esv = new EsvCore({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const res = await passagesSearch(esv, {
query: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SearchPassagesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SearchPassagesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 400, 401 | application/json |
errors.APIError | 4XX, 5XX | */* |
Returns audio file for Bible passages based on the provided query
Esv.org API Docs for /v3/passage/audio
https://api.esv.org/docs/passage-audio/
import { Esv } from "esv-sdk";
const esv = new Esv({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const result = await esv.passages.getAudio({
query: "John 1:1",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { EsvCore } from "esv-sdk/core.js";
import { passagesGetAudio } from "esv-sdk/funcs/passagesGetAudio.js";
// Use `EsvCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const esv = new EsvCore({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const res = await passagesGetAudio(esv, {
query: "John 1:1",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetPassageAudioRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<ReadableStream>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 400, 401 | application/json |
errors.APIError | 4XX, 5XX | */* |
Returns Bible passage text based on the provided query parameters
Esv.org API Docs for /v3/passages/text
https://api.esv.org/docs/passage-text/
import { Esv } from "esv-sdk";
const esv = new Esv({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const result = await esv.passages.getText({
query: "John 1:1",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { EsvCore } from "esv-sdk/core.js";
import { passagesGetText } from "esv-sdk/funcs/passagesGetText.js";
// Use `EsvCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const esv = new EsvCore({
apiKey: process.env["ESV_API_KEY"] ?? "",
});
async function run() {
const res = await passagesGetText(esv, {
query: "John 1:1",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetPassageTextRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.PassageResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 400, 401 | application/json |
errors.APIError | 4XX, 5XX | */* |