@motdde/liblab-lotr
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Liblab Lord of the Rings SDK

Installation

npm i @motdde/liblab-lotr

Authentication

This SDK currently supports the Movie and Quotes endpoints. Signup to get the API access key from One API website.

Quickstart

import { LOTR } from '@motdde/liblab-lotr';

const client = new LOTR('<YOUR_ACCESS_TOKEN>');

client.movie
  .list({
    limit: 5, // Limit data response to 5
    sort: {
      budgetInMillions: 'desc', // Sort by budgetInMillions in descending order
    },
  })
  .then((movies) => {
    // handle data
  })
  .catch((err) => {
    // handle error
  });

The methods returs a promise thereby support the async await syntax within a try catch block or your preffered async error catcher.

import { LOTR } from '@motdde/liblab-lotr';

const client = new LOTR('<YOUR_ACCESS_TOKEN>');

async function(){
  try{
    const movies = await client.movies.list({
      limit: 5,
      // Limit data response to 5
      sort: {
        budgetInMillions: 'desc',
        // Sort by budgetInMillions in descending order
      },
    })
    // use movies data
  }catch(err){
    // handle error
  }
}()

Readme

Keywords

none

Package Sidebar

Install

npm i @motdde/liblab-lotr

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

14 kB

Total Files

35

Last publish

Collaborators

  • motdde