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

stefan-stefanovic-sdk

v1.1.3

Published

A powerful SDK for accessing information about the Lord of the Rings trilogy through the Lord of the Rings API.

Downloads

10

Readme

Lord of the Rings SDK 🧙‍♂️

This SDK makes it easy for developers to consume information about the trilogy from an existing Lord of the Rings API.

Follow this link to learn more about the API that is used in the SDK and how to create your own API key.

Table of Content:

Installation

The Lord of the Rings SDK can be installed using your favorite package manager. Run the following command:

npm install stefan-stefanovic-sdk

Getting Started

To get started with the Lord of the Rings SDK, follow these steps:

  1. Import the SDK in your project:
import {
  getMovies,
  getMovieById,
  getMovieQuotes,
  getQuotes,
  getQuoteById,
} from "stefan-stefanovic-sdk";
  1. Use the SDK functions to interact with the Lord of the Rings API:

    Fetch a list of movies

    const movies = await getMovies();

    Fetch a specific movie by ID

    const movie = await getMovieById('movie-id');

    Fetch quotes for a specific movie

    const quotes = await getMovieQuotes('movie-id');

    Fetch a list of all quotes

    const allQuotes = await getQuotes();

    Fetch a specific quote by ID

    const quote = await getQuoteById('quote-id');

  2. Handle the responses and errors according to your application's requirements.

Filtering, sorting and pagination

Filtering

To filter the data based on specific criteria, you can include the filters parameter when calling the SDK functions. The filters parameter accepts an object with various filtering options. Here's an example:

const filters = {
  match: {
    name: "The Lord of the Rings",
    academyAwardWins: "4",
  },
  lessThan: {
    budgetInMillions: 100,
  },
};
const movies = await getMovies({ filters });

Sorting

To sort the data in a specific order, you can include the sort parameter when calling the SDK functions. The sort parameter accepts a string that specifies the field to sort by and the sorting order. Here's an example:

const sort = "name:asc";
const movies = await getMovies({ sort });

Pagination

To paginate through the data, you can include the page, limit, and offset parameters when calling the SDK functions. The page parameter specifies the page number, the limit parameter sets the number of items per page, and the offset parameter sets the number of items to skip. Here's an example:

const page = 2;
const limit = 10;
const offset = 1;
const movies = await getMovies({ page, limit, offset });

Rate limit

The Lord of the Rings API imposes a rate limit of 100 requests per 10 minutes for the SDK. This means that you should avoid exceeding this limit to ensure smooth and uninterrupted access to the API.

If you make more than 100 requests within a 10-minute window, you may receive an error response indicating that you have exceeded the rate limit. To avoid this, it's recommended to manage your requests responsibly and consider implementing appropriate measures such as caching or throttling mechanisms.

Please note that the rate limit is subject to change, and it's important to check the official API documentation for any updates or modifications to the rate limit policy.

Environment Variables

The Lord of the Rings SDK can utilize the following environment variables:

  • LOTR_API_BASE_URL: The base URL of the Lord of the Rings API.
  • LOTR_API_KEY: Your API key for accessing the Lord of the Rings API.

You can set these environment variables in your development environment or use a library like dotenv to load them from a .env file.

SDK Design

For detailed information about the design and implementation of the Lord of the Rings SDK, please refer to the design.md file in the root directory of this project.

Testing

The Lord of the Rings SDK provides a comprehensive set of tests to ensure its functionality. To run the tests, use the following command:

npm run test

Contributing

Contributions are welcome! If you find any issues or want to add new features to the SDK, feel free to open a pull request.

License

This project is licensed under the MIT License.

Author