shrajhi-api-sdk
v1.0.0
Published
JavaScript SDK for accessing shrajhi.com.sa content
Downloads
20
Readme
shrajhi-api-sdk
SDK to access shrajhi.com.sa
APIs.
Installation
To install shrajhi-api-sdk, use npm or yarn:
npm install shrajhi-api-sdk
# or
yarn add shrajhi-api-sdk
# or
pnpm i shrajhi-api-sdk
Usage
Importing the SDK
import { getLessons } from 'shrajhi-api-sdk';
Get Book Information
Retrieve metadata about a specific book.
(async () => {
try {
const bookInfo = await getBookInfo(123);
console.log(bookInfo);
} catch (error) {
console.error(error.message);
}
})();
Get Book Contents
Fetch the contents of a book, including chapters and sections.
(async () => {
try {
const bookContents = await getBookContents(123);
console.log(bookContents);
} catch (error) {
console.error(error.message);
}
})();
Download Book
Download a book's data to a local file.
(async () => {
try {
const outputFilePath = await downloadBook(123, './book.json');
console.log(`Book downloaded to ${outputFilePath}`);
} catch (error) {
console.error(error.message);
}
})();