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
}
}()