Lord of the Rings SDK
Installation
To use the Lord of the Rings SDK in your project, you can install it via npm:
npm install @ozairfarahi/lotrsdk
Usage
To use the Lord of the Rings SDK in your code, you need to import it and create a new instance by providing your API key and the base URL of the Lord of the Rings API:
const { LotrSDK } = require('@ozairfarahi/lotrsdk');
const lotrSDK = new LotrSDK({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://the-one-api.dev/v2',
});
// Retrieve all movies
lotrSDK
.getAllMovies(2, 1)
.then((movies) => {
console.log(movies);
})
.catch((error) => {
console.error(error);
});
Make sure to replace 'YOUR_API_KEY' with your actual API key to authenticate with the Lord of the Rings API.
Testing
To run the tests for the Lord of the Rings SDK, first make sure to set apiKey in lotrSDK.test.ts in the root folder and then you can use the following command:
npm test