@meisens1/lotr-sdk
Version:
Lord of the Rings SDK for the one API v2
57 lines (53 loc) • 1.66 kB
JavaScript
const LOTR = require('../190aaa3fcf904265a8d0f2f805afc8e0/src/client/client');
const accessToken = 'I8gnOCMUmPF9vDzwgZT-';
const client = new LOTR(accessToken);
//get the first page of 2 movies
client.listMovies({ page: 1, limit: 4 })
.then((movies) => {
console.log('Movies:', movies);
// Handle the movie data here
})
.catch((error) => {
console.error('Error:', error);
// Handle the error here
});
//get the first page of 4 quotes
client.listQuotes({ page: 1, limit: 4 })
.then((quotes) => {
console.log('Quotes:', quotes);
// Handle the movie data here
})
.catch((error) => {
console.error('Error:', error);
// Handle the error here
});
//get movie by id
client.getMovieById('5cd95395de30eff6ebccde5d')
.then((movie) => {
console.log('Movie:', movie);
// Handle the movie data here
})
.catch((error) => {
console.error('Error:', error);
// Handle the error here
});
//get quote by quote id
client.getQuoteById('5cd96e05de30eff6ebcce7f2')
.then((quotes) => {
console.log('Quotes:', quotes);
// Handle the movie data here
})
.catch((error) => {
console.error('Error:', error);
// Handle the error here
});
//get quotes by movie id
client.getQuotesByMovieId('5cd95395de30eff6ebccde5d', 1, 100)
.then((quotes) => {
console.log('Quotes:', quotes);
// Handle the movie data here
})
.catch((error) => {
console.error('Error:', error);
// Handle the error here
});