1.0.3 • Published 1 year ago
@umairchd/lotr-sdk v1.0.3
A simple and lightweight Javascript SDK for the One API.
Installation
npm i @umairchd/LORG-sdk
Authentication
To use ALL the features of the LORG SDK, you need to provide an accessToken
. That token is available for free on the One API website once you sign up.
For Movie
, Quote
interfaces, you will need to provide an accessToken
.
Quick Start
import LORG from '@umairchd/LORG-sdk';
const client = new LORG('<YOUR_ACCESS_TOKEN>');
client.character
.list({
limit: 10, // limit the number of responses to 10
})
.then((characters) => {
// handle data
})
.catch((err) => {
// handle error
});
That's it!
Usage
The SDK models the One API and each property from the SDK matches a section in the API documentation.
Examples
To list all movies:
import LORG from '@umairchd/LORG-sdk';
const client = new LORG(); // accessToken not needed
client.movie
.list({
limit: 10, // limit the number of responses to 10
})
.then((movies) => {
// handle data
})
.catch((err) => {
// handle error
});
1.0.3
1 year ago