ketab-online-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

ketab-online-sdk

SDK to access ketabonline.com APIs.

Installation

To install ketab-online-sdk, use npm or yarn:

npm install ketab-online-sdk
# or
yarn add ketab-online-sdk
# or
pnpm i ketab-online-sdk

Usage

Importing the SDK

import { getBookInfo, getBookContents, downloadBook } from 'ketab-online-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 Author Information

Fetch information about an author.

(async () => {
    try {
        const authorInfo = await getAuthorInfo(123);
        console.log(authorInfo);
    } catch (error) {
        console.error(error.message);
    }
})();

Get Category Information

Fetch information about a category.

(async () => {
    try {
        const categoryInfo = await getCategoryInfo(123);
        console.log(categoryInfo);
    } 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);
    }
})();

Package Sidebar

Install

npm i ketab-online-sdk

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

37.6 kB

Total Files

6

Last publish

Collaborators

  • ragaeeb