1.0.1 • Published 1 year ago

john-lord-sdk v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

The Lord of the Rings API

This is the simple typescript sdk for the Lord of the Rings API. This SDK cover only the books endpoints.

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.4.1
v8.16.0

Installation

BEFORE YOU INSTALL: please read the prerequisites

Start with installing and set up the library, run:

$ npm install john-lord-sdk

Or if you prefer using Yarn:

$ yarn add --dev john-lord-sdk

Usage

import bookApi from 'john-lord-sdk'

Or

const bookApi = require('john-lord-sdk');

API

getBooks

getBooks(pagenationParam: GetBookDto): PagenationDto<BookDto>;

Supported parmas and result fields for the getBooks function are listed below.

Params

GetBookDto = {skip, take, sort}

KeyTypeDefault valueEnum valueOptional
skipnumber0Yes
takenumber10Yes
sortEnum'''name:asc' or 'name:desc'Yes

Result

BookDto

KeyType
_idstring
namestring

PagenationDto<T>

KeyType
docsArray
totalnumber
limitnumber
offsetnumber
pagenumber

getBookById

getBookById(id: string): BookDto;

Supported parmas and result fields for the getBookById function are listed below.

Params

id

KeyTypeDefault valueEnum valueOptional
idstringNo

Result

BookDto

getBookChaptersById

getBookChaptersById(id: number, pagenationParam: GetChapterDto): PagenationDto<ChapterDto>;

Supported parmas and result fields for the getBookChaptersById function are listed below.

Params

id | Key | Type | Default value | Enum value | Optional | | --- | ------ | ------------- | ---------- | -------- | | id | string | | | No |

GetChapterDto = {skip, take, sort}

KeyTypeDefault valueEnum valueOptional
skipnumber0Yes
takenumber10Yes
sortEnum'''chapterName:asc' or 'chapterName:desc'Yes

Result

ChapterDto

KeyType
_idstring
chapterNamestring

Authors

  • John Leelike