1.0.1 • Published 1 year ago

the-lord-of-the-rings-sdk v1.0.1

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

the-lord-of-the-rings-sdk

A SDK for https://the-one-api.dev/v2 API

Getting Started

Installing

NodeJS v10.0.0+ is required.

npm install -S the-lord-of-the-rings-sdk

Basic Usage

const SDK = require('the-lord-of-the-rings-sdk').default;
// import SDK from 'the-lord-of-the-rings-sdk'; equivalent in TS

const sdk = new SDK();
const book = sdk.getBookInstance();

book.getBooks()
.then(res => {
  console.log(res);
});

sample output:

[
  {
    _id: '5cf5805fb53e011a64671582',
    name: 'The Fellowship Of The Ring'
  },
  ...
]

With Authorization header

  • In order to ease the usage of library it needs to set Autherization header only on instance creation
const sdk = new SDK("Brear-token");

Endpoints

InstanceEndpointsdescriptionRequires Authorization
BookgetBooksList of all "The Lord of the Rings" booksN
BookgetBookByIdRequest one specific bookN
BookgetChapterByIdRequest all chapters of one specific bookN
ChaptersgetChaptersList of all chaptersY
ChaptersgetChapterByIdRequest one specific book chapter.Y
CharactergetCharactersList of characters including metadata like name, gender, realm, race and moreY
CharactergetCharacterByIdRequest one specific characterY
CharactergetQoutesByCharacterIdRequest all movie quotes of one specific characterY
MoviegetMoviesList of all movies, including the "The Lord of the Rings" and the "The Hobbit" trilogiesY
MoviegetMovieByIdRequest one specific movieY
MoviegetQoutesByMovieIdRequest all movie quotes of one specific Movie(only working for the LotR trilogy)Y
QuotegetQuoteList of all movie quotesY
QuotegetQuoteByIdRequest one specific movie quoteY