john-lord-sdk v1.0.1
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.0Installation
BEFORE YOU INSTALL: please read the prerequisites
Start with installing and set up the library, run:
$ npm install john-lord-sdkOr if you prefer using Yarn:
$ yarn add --dev john-lord-sdkUsage
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}
| Key | Type | Default value | Enum value | Optional |
|---|---|---|---|---|
| skip | number | 0 | Yes | |
| take | number | 10 | Yes | |
| sort | Enum | '' | 'name:asc' or 'name:desc' | Yes |
Result
BookDto
| Key | Type |
|---|---|
| _id | string |
| name | string |
PagenationDto<T>
| Key | Type |
|---|---|
| docs | Array |
| total | number |
| limit | number |
| offset | number |
| page | number |
getBookById
getBookById(id: string): BookDto;Supported parmas and result fields for the getBookById function are listed below.
Params
id
| Key | Type | Default value | Enum value | Optional |
|---|---|---|---|---|
| id | string | No |
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}
| Key | Type | Default value | Enum value | Optional |
|---|---|---|---|---|
| skip | number | 0 | Yes | |
| take | number | 10 | Yes | |
| sort | Enum | '' | 'chapterName:asc' or 'chapterName:desc' | Yes |
Result
ChapterDto
| Key | Type |
|---|---|
| _id | string |
| chapterName | string |
Authors
- John Leelike
3 years ago