1.0.2 • Published 1 year ago

harold-lord-of-the-rings-sdk v1.0.2

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

Install

npm i harold-lord-of-the-rings-sdk

Usage

import SDK from 'harold-lord-of-the-rings-sdk';

const sdk = new SDK({ token: 'your-api-key' });

const response = await sdk.book.get();
console.log(response);

Entities

Book

  • List of all "The Lord of the Rings" books

      await sdk.book.get();
  • Request one specific book

      await sdk.book.getOne(id);
  • Request all chapters of one specific book

      await sdk.book.chapters(bookId);

Movie

  • List of all movies, including the "The Lord of the Rings" and the "The Hobbit" trilogies

      await sdk.movie.get();
  • Request one specific movie

      await sdk.movie.getOne(id);
  • Request all movie quotes for one specific movie (only working for the LotR trilogy)

      await sdk.movie.quote(movieId);

Character

  • List of characters including metadata like name, gender, realm, race and more

      await sdk.character.get();
  • Request one specific character

      await sdk.character.getOne(id);
  • Request all movie quotes of one specific character

      await sdk.character.quote(characterId);

Quote

  • List of characters including metadata like name, gender, realm, race and more

      await sdk.quote.get();
  • Request one specific character

      await sdk.quote.getOne(id);

Chapter

  • List of all book chapters

      await sdk.chapter.get();
  • Request one specific book chapter

      await sdk.chapter.getOne(id);

Extra Args

You can use this for all entities:

Sort

  book.get({
      sort: {name: 'asc'}
  });

Pagination (offset)

  book.get({
      pagination: {limit: 20, offset: 10}
  });

Pagination (page)

  book.get({
      pagination: {limit: 20, page: 2}
  });

Filter

  book.get({
    filter: {
      match: [{name: 'Gandalf'}],
      notMatch: [{name: 'Gandalf'}],

      include: [{name: ['Gandalf', 'Frodo']}],
      exclude: [{name: ['Gandalf', 'Frodo']}],

      exist: ['name'],
      notExist: ['name'],

      regex: [{name: 'Gandalf'}],
      notRegex: [{name: 'Gandalf'}],

      numberComparison: {
        gt: [{academyAwardWins: 100}],
        gte: [{academyAwardWins: 100}],
        lt: [{academyAwardWins: 100}],
        lte: [{academyAwardWins: 100}],
      }
    }
  });

API

Api available here: https://the-one-api.dev/documentation