npm i harold-lord-of-the-rings-sdk
import SDK from 'harold-lord-of-the-rings-sdk';
const sdk = new SDK({ token: 'your-api-key' });
const response = await sdk.book.get();
console.log(response);
-
List of all "The Lord of the Rings" books
await sdk.book.get();
-
Request one specific book
await sdk.book.getOne(id);
-
Request all chapters of one specific book
await sdk.book.chapters(bookId);
-
List of all movies, including the "The Lord of the Rings" and the "The Hobbit" trilogies
await sdk.movie.get();
-
Request one specific movie
await sdk.movie.getOne(id);
-
Request all movie quotes for one specific movie (only working for the LotR trilogy)
await sdk.movie.quote(movieId);
-
List of characters including metadata like name, gender, realm, race and more
await sdk.character.get();
-
Request one specific character
await sdk.character.getOne(id);
-
Request all movie quotes of one specific character
await sdk.character.quote(characterId);
-
List of characters including metadata like name, gender, realm, race and more
await sdk.quote.get();
-
Request one specific character
await sdk.quote.getOne(id);
-
List of all book chapters
await sdk.chapter.get();
-
Request one specific book chapter
await sdk.chapter.getOne(id);
You can use this for all entities:
book.get({
sort: {name: 'asc'}
});
book.get({
pagination: {limit: 20, offset: 10}
});
book.get({
pagination: {limit: 20, page: 2}
});
book.get({
filter: {
match: [{name: 'Gandalf'}],
notMatch: [{name: 'Gandalf'}],
include: [{name: ['Gandalf', 'Frodo']}],
exclude: [{name: ['Gandalf', 'Frodo']}],
exist: ['name'],
notExist: ['name'],
regex: [{name: 'Gandalf'}],
notRegex: [{name: 'Gandalf'}],
numberComparison: {
gt: [{academyAwardWins: 100}],
gte: [{academyAwardWins: 100}],
lt: [{academyAwardWins: 100}],
lte: [{academyAwardWins: 100}],
}
}
});
Api available here: https://the-one-api.dev/documentation