1.0.0 • Published 8 months ago

shrajhi-api-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

wakatime E2E Node.js CI GitHub License GitHub Release codecov Size typescript npm npm GitHub issues GitHub stars

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);
    }
})();
1.0.0

8 months ago