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

talesmgodois-ringsdk

v0.1.2

Published

The `RingsSdk` class is like the Fellowship of the Ring - a team of brave companions on a quest to deliver a powerful and valuable service to the world of developers. It provides methods for interacting with the Rings API and retrieving movie and quote da

Downloads

1

Readme

RingsSdk

The RingsSdk class is like the Fellowship of the Ring - a team of brave companions on a quest to deliver a powerful and valuable service to the world of developers. It provides methods for interacting with the Rings API and retrieving movie and quote data.

Instalation

The talesmgodois-ringsdk is a Node.js SDK for interacting with the Ring's API. This SDK provides a simple way to get information about movies and quotes

Installation

To install the SDK, simply run the following command:

npm install talesmgodois-ringsdk

Usage

To use the SDK, first import it into your project:

const { RingsSdk } = require('talesmgodois-ringsdk');

Or in TypeScript:

import { RingsSdk } from 'talesmgodois-ringsdk';

Then, create a new instance of the SDK by passing your API credentials:

const ringsSdk = new RingsSdk({
    token,
});

Methods

The constructor of the RingsSdk class takes a SdkOptions object as a parameter, just as the Fellowship was formed to help Frodo on his journey to destroy the One Ring. This object contains the following properties:

  • token: A string representing the API token to use when making requests to the Ring's API, much like the One Ring had to be protected and kept secret from those who sought to use its power for their own gain.
  • ttl: An optional number representing the TTL (time to live) in milliseconds for cached responses. Default is 10 minutes - just enough time for the Fellowship to rest and prepare for their next challenge.

getMovie(id: string): Promise<Movie>

This method takes a string parameter representing the ID of the movie to retrieve and returns a Promise that resolves to a Movie object, much like the Fellowship relied on Aragorn's leadership to navigate through the dangers of Middle Earth. The Movie object contains information about the movie, such as its title, runtime, and release date - vital information needed to complete the journey.

getMovies(): Promise<HttpResult<Movie[]>>

This method returns a Promise that resolves to an HttpResult object containing an array of Movie objects, much like the Fellowship needed the support of its members to overcome the challenges they faced. The HttpResult object contains additional information about the request, such as the total number of movies returned and the number of pages - useful information to keep track of progress.

getMovieQuotes(id: string): Promise<HttpResult<Quote[]>>

This method takes a string parameter representing the ID of the movie to retrieve quotes for and returns a Promise that resolves to an HttpResult object containing an array of Quote objects, much like the Fellowship had to rely on the skills and expertise of each member to overcome obstacles. The Quote objects contain information about the quote, such as the character who said it and the text of the quote.

getQuotes(params?: QueryParams): Promise<HttpResult<Quote[]>>

This method takes an optional QueryParams object as a parameter and returns a Promise that resolves to an HttpResult object containing an array of Quote objects, much like the Fellowship needed to work together and communicate effectively to complete their journey. The QueryParams object can be used to filter and paginate the quotes returned - useful tools for developers who want to narrow down their search.

getAllQuotes(): Promise<Quote[]>

This method returns a Promise that resolves to an array of all Quote objects available on the Ring's platform, much like the Fellowship had to travel through many lands and face many challenges to reach their destination.

getAllQuotesAsStream(chunkLimit = 100): Readable

This method returns a Readable stream that emits chunks of Quote objects, much like the Fellowship had to adapt and change tactics to overcome different challenges. The chunkLimit parameter specifies the number of quotes to retrieve in each chunk.

I asked ChatGPT for help in crafting this documentation with a Lord of the Rings theme. Although it didn't turn out quite as amazing as I had hoped, it's definitely better than anything I could have come up with on my own.