1.0.0 • Published 3 years ago

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

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

The Lord Of the Rings SDK

Installation

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

Using yarn:

$ yarn add lord-of-the-rings-sdk

Initialization

You need to provide your API key, which you can get on https://the-one-api.dev/

import LordOfRingsSDK from 'lord-of-the-rings-sdk';

const sdk = new LordOfRingsSDK({ apiKey: 'Your API key goes here' });

Usage

Get all books

const books = await sdk.getBooks();

Get top 3 longest movies

const movies = await sdk.getMovies({
  sortingOptions: {
    runtimeInMinutes: 'desc',
  },
  paginationOptions: {
    limit: 3,
  }
});

Get all characters whose name start with "A" (usage with RegExp)

const characters = await sdk.getCharacters({
  filterOptions: {
    name: {
      isIn: ['/^A/']
    }
  }
});

Available Methods

sdk.getBooks(options?: BookGettingOptions)

sdk.getMovies(options?: MovieGettingOptions)

sdk.getCharacters(options?: CharacterGettingOptions)

sdk.getQuotes(options?: QuoteGettingOptions)

sdk.getChapters(options?: ChapterGettingOptions)

Tests

If you want to run tests, clone the repository https://github.com/AndreyKarapetyan/Andrey_Karapetyan-SDK.git and run npm i and then npm test. Make sure you have API_KEY environment variable in .env file.