1.1.0 • Published 1 year ago

@nikeshp/nikeshpadakanti-sdk v1.1.0

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

the-one-api.dev Movies SDK

https://the-one-api.dev/ is a API for The Lord of the Rings Triology. There are lot of end points available see docs here. How ever this repo has sdk implementation for only Movies end point. And also written in a way this can be extended to other apis also.

Requirements

  • Node.js v >= 19
  • Create an account at here and get the bearer token.

Installation

For installing use below command

npm install @nikeshp/nikeshpadakanti-sdk

Build

  • For Production build run below command
npm run build
  • For Dev build which also watching on the source files
npm run dev

Usage

Initialization

import Lotr from "nikeshpadakanti-sdk";

const client = new Lotr({
  bearerToken: "G3xGE1Q1Vrm2e1aRc2B_",
});

Example 1

client.getMovies().then((response) => {
  console.log(response);
});

Example 1 pagination

client
  .getMovies()
  .limit(3)
  .page(1)
  .call()
  .then((response) => {
    console.log(response);
  });

Example 1 filtering

client
  .getMovies()
  .matching("name", "The Two Towers")
  .call()
  .then((response) => {
    console.log(response);
  });

Filtering Methods Supported

  • matching
        // usage
        matching(key:string , value:string)
  • notMatching
        // usage
        notMatching(key:string , value:string)
  • including
        // usage
        including(key:string , value:string[])
  • excluding
        // usage
        excluding(key:string , value:string[])
  • filterByRegex
        // usage
        filterByRegex(key:string , value:string)
  • filterByMeasures
        // usage
        filterByMeasures(key:string , operator: ">" | "<" | ">=" | "<=" | "=", value:number)
1.1.0

1 year ago

1.0.0

1 year ago