0.0.1 • Published 1 year ago

ahmad-lotr-sdk v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Ahmad-Abdulaziz-SDK

Introduction

Repository for Lotr API SDK implementation

Available features include:

  • Listing all movies.
  • Listing all quotes for one specific movie.
  • Get specific movie
  • Listing all quote.
  • Get specific quote

Basic endpoints

This only covers below endpoints

  • Movies
  • Quotes

Requirements

Installation

To install the library, run this comman in your Node terminal:

npm install ahmad-lotr-sdk

Initialization

const LOTR = require('ahmad-lotr-sdk');
const lotr = new LOTR(process.env.ACCESS_KEY);

Movies

Get all Movies

This describes how to get all movies

const LOTR = require('ahmad-lotr-sdk');
const lotr = new LOTR(process.env.ACCESS_KEY);

const getMovie = async () => {
  try {
    const rep = await lotr.Movie.getAllMovie();
    return rep;
  } catch (error) {
    console.log(error);
  }
};
getMovie();

Fetch Single Movie quote

This describes how to get single movie.

const LOTR = require('ahmad-lotr-sdk');
const lotr = new LOTR(process.env.ACCESS_KEY);

const getAMovie = async () => {
  const movieId = '5cd95395de30eff6ebccde5d';
  try {
    const rep = await lotr.Movie.getSingleMovie(movieId);
    return rep;
  } catch (error) {
    console.log(error);
  }
};
getAMovie();

Get Quote from a Movie

This describes how to get just three quote from a movie

const LOTR = require('ahmad-lotr-sdk');
const lotr = new LOTR(process.env.ACCESS_KEY);

const getMovieQuote = async () => {
  const movieId = '5cd95395de30eff6ebccde5d';
  const query = '?limit=3'
  try {
    const rep = await lotr.Movie.getMovieQuotes(movieId, query);
    return rep;
  } catch (error) {
    console.log(error);
  }
};
getMovieQuote();

You can also check the sample folder for more example

Testing

All of the libraries tests are run on Mocha. They can be run by running the test command in your terminal.

npm run test

License

By contributing to this library, you agree that your contributions will be licensed under its MIT license.

0.0.1

1 year ago