npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lunaticsatoshi/lor-sdk-test

v1.0.5

Published

A sdk for the lord of the rings api

Downloads

5

Readme

npm version

Installation

npm install @lunaticsatoshi/lor-sdk-test

Usage

Use One API's Getting Started Guide to get set up to use LOR API.

Import and initialize a client using an integration token or an OAuth access token.

const { Client } = require("@lunaticsatoshi/lor-sdk-test")
// Modern js
import { Client } from "@lunaticsatoshi/lor-sdk-test"

// Initializing a client
const client = new Client({
  apiKey: process.env.API_TOKEN,
  baseUrl: process.env.BASE_URL
})

Make a request to All Movies.

See the complete list of endpoints in the API reference.

(async () => {
  const client = new Client({
    apiKey: 'YOUR_API_KEY',
    baseUrl: 'BASE_URL',
  });

  const response = await client.movies.getMovies();

  console.log(JSON.parse(JSON.stringify(response, null, 4)));
})();

Each method returns a Promise which resolves the response.

{
    "docs": [
        {
            "_id": "5cd95395de30eff6ebccde56",
            "name": "The Lord of the Rings Series",
            "runtimeInMinutes": 558,
            "budgetInMillions": 281,
            "boxOfficeRevenueInMillions": 2917,
            "academyAwardNominations": 30,
            "academyAwardWins": 17,
            "rottenTomatoesScore": 94
        },
        {
            "_id": "5cd95395de30eff6ebccde57",
            "name": "The Hobbit Series",
            "runtimeInMinutes": 462,
            "budgetInMillions": 675,
            "boxOfficeRevenueInMillions": 2932,
            "academyAwardNominations": 7,
            "academyAwardWins": 1,
            "rottenTomatoesScore": 66.33333333
        },
    ],
    "total": 8,
    "limit": 1000,
    "offset": 0,
    "page": 1,
    "pages": 1
}

Get a single movie.

(async () => {
  const client = new Client({
    apiKey: 'YOUR_API_KEY',
    baseUrl: 'BASE_URL',
  });

  const response = await client.movies.getMovieById("5cd95395de30eff6ebccde5b");

  console.log(JSON.parse(JSON.stringify(response, null, 4)));
})();

Get Quote from a single movie.

(async () => {
  const client = new Client({
    apiKey: 'YOUR_API_KEY',
    baseUrl: 'BASE_URL',
  });

  const response = await client.movies.getMovieQuote("5cd95395de30eff6ebccde5b");

  console.log(JSON.parse(JSON.stringify(response, null, 4)));
})();

Contributing

Note this is only for developers who want to contribute code to the SDK

Clone the Repository

git clone https://github.com/Lunaticsatoshi/lor-sdk-test

Building

yarn build

Testing

Add your api key to client in the client.test.ts file before running test

yarn test

Requirements

This package supports the following minimum versions:

  • Runtime: node >= 12
  • Type definitions (optional): typescript >= 4.5

Earlier versions may still work, but we encourage people building new applications to upgrade to the current stable.

🔐 License

This project is licensed under the MIT License - see the LICENSE.md file for details

Suggestions and Bug Reports

Since this is an open source project all suggestions, requests and bug reports are always welcomed. If you have any don't forget to leave them in the issues section. But we recommend creating an issue or replying in a comment to let us know what you are working on first that way we don't overwrite each other.

Don't forget to checkout the CONTRIBUTING.md for more info on how to contribute to this project.