@ladymozzarella/lotr

1.0.0 • Public • Published

@ladymozzarella/lotr

An NPM module for obtaining Movie and Quote data from API to rule them all, the Lord of the Rings API.

Example Use Cases

Get all movies:

const movies = await lotrClient.get(lotrResourceType.MOVIE)

Get a movie:

const movie = await lotrClient.get(lotrResourceType.MOVIE, {
  movieId: '5cd95395de30eff6ebccde5c'
});

Get all quotes:

const quotes = lotrClient.get(lotrResourceType.QUOTE);

Get a quote:

const quote = lotrClient.get(lotrResourceType.QUOTE, {
  quoteId: '5cd96e05de30eff6ebcce857'
});

Get all quotes from a movie:

const quotes = await lotrClient.get(lotrResourceType.QUOTE, {
  movieId: '5cd95395de30eff6ebccde5c'
});

Setup

Obtain a Bearer Token

A bearer token is required to authorize requests for Lord of the Rings data. Request one at https://the-one-api.dev/ by creating an account. Store this token in a safe location.

Install @ladymozzarella/lotr

The library is available as an npm package. To install the package run:

npm install @ladymozzarella/lotr

Usage

Import LotrClient and lotrResourceType to create a local client to access Lord of the Rings movie and quote data. Once imported, a LotrClient instance will need to be created with the bearer token obtained previously.

import { LotrClient, lotrResourceType } from '@ladymozzarella/lotr';

const lotrClient = new LotrClient({
  bearerToken: 'ENTER_YOUR_BEARER_TOKEN_HERE'
});

// log all movies to the console
lotrClient.get(lotrResourceType.MOVIE).then(console.log);

Readme

Keywords

none

Package Sidebar

Install

npm i @ladymozzarella/lotr

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

20 kB

Total Files

11

Last publish

Collaborators

  • ladymozzarella