1.0.2 • Published 2 years ago

lotr-sdk-jordan-hammond v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Lord of the Rings SDK

Installation

  1. Get your access token from here.
  2. Go into your JS application. Note: you will need to have a package.json file.
  3. npm install lotr-sdk-jordan-hammond
  4. Start using it. You can see how below.

Examples

Usage

Basic usage

const lotrSdk = require('lotr-sdk-jordan-hammond');

async function main() {
  try {
    const client = lotrSdk('YOUR_API_TOKEN');
    const movies = await client.getMovies();
    console.log(movies);
  } catch (error) {
    console.error(error);
  }
}

main();

Initialization

const lotrSdk = require('lotr-sdk-jordan-hammond');
const client = lotrSdk('YOUR_API_TOKEN');

getMovies()

Fetches an array of all the movies from the API.

Example Usage:

const movies = await client.getMovies();

Example Return:

[
  // ... Additional movie objects ...
  {
    "_id": "5cd95395de30eff6ebccde5c",
    "name": "The Fellowship of the Ring",
    "runtimeInMinutes": 178,
    "budgetInMillions": 93,
    "boxOfficeRevenueInMillions": 871.5,
    "academyAwardNominations": 13,
    "academyAwardWins": 4,
    "rottenTomatoesScore": 91
  },
  // ... Additional movie objects ...
]

getMovie(movieId)

Fetches data for a specific movie by its ID.

Example Usage:

const movie = await client.getMovie('5cd95395de30eff6ebccde5b');

Example Return:

{
  "_id": "5cd95395de30eff6ebccde5b",
  "name": "The Two Towers",
  "runtimeInMinutes": 179,
  "budgetInMillions": 94,
  "boxOfficeRevenueInMillions": 926,
  "academyAwardNominations": 6,
  "academyAwardWins": 2,
  "rottenTomatoesScore": 96
}

getMovieQuotes(movieId)

Fetches all quotes from a specific movie by its ID.

Example Usage:

const quotes = await client.getMovieQuotes('5cd95395de30eff6ebccde5b');`

Example Return:

[
  // ... Additional quote objects ...
  {
    "_id": "5cd96e05de30eff6ebcce84a",
    "dialog": "My dear Sam, you cannot always be torn in two...",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfc15"
  },
  // ... Additional quote objects ...
]

getQuotes()

Fetches an array of all the quotes from the API.

Example Usage:

const quotes = await client.getQuotes();

Example Return:

[
  // ... Additional quote objects ...
  {
    "_id": "5cd96e05de30eff6ebcce84c",
    "dialog": "I didn't think it would end this way.",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfe2e"
  },
  // ... Additional quote objects ...
]

getQuote(quoteId)

Fetches data for a specific quote by its ID.

Example Usage:

const quote = await client.getQuote('5cd96e05de30eff6ebcce84c');

Example Return:

{
  "_id": "5cd96e05de30eff6ebcce84c",
  "dialog": "I didn't think it would end this way.",
  "movie": "5cd95395de30eff6ebccde5d",
  "character": "5cd99d4bde30eff6ebccfe2e"
}
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago