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

cristos-lotr-sdk

v1.0.3

Published

A simple SDK that helps developers consume lord of the rings API

Downloads

7

Readme

Lord Of The Rings SDK

This SDK has been created for a purpose of making it easy for developers to consume information about the trilogy Lord Of The Rings API.

With this SDK you are able to have a complete access to API and even more. Simple to install and easy to use.

Requirements

Installation

SDK Initialization

Before use

SDK Methods

Development


Requirements

For being able to use all the functionality except for [Books], that SDK provides, you will need to register at the API WebSite. After success registration you will receive an API key. It has to be used in an imported function call. The complete installation instructions is right below.

Installation

All you need to make an SDK installed is just run the following script in your command line:

yarn i cristos-lotr-sdk

SDK Initialization

As was mentioned before at this step you will need to have API key retrieved from API (How to retrieve an API key).

You have to import SDK to your application and provide following arguments to it:

  • apiKey (key that was retrieved from API)

CommonJS

Common JS SDK initialization example with setting cache reset to 10 seconds and enabling logger:

const SDK = require('cristos-lotr-sdk')

const sdk = new SDK({ apiKey: 'api key' })

ES Modules

ES Modules SDK initialization example without enabling it features:

import SDK from 'cristos-lotr-sdk'

const sdk = new SDK({ apiKey: 'api key' })

Before use

Note: Lord of the Rings API has a limitation for requests. So you are able to send only 100 requests each 10 minutes.

In subsequent version we instead to add Caching so as to give you the flexibility to call the API as you like.

SDK methods

SDK is created to make developers life easier. However it is just a layer between developers and API.

Our development team is working to cover as much usage cases as possible. But at the same moment we have left you some freedom in actions.

Please, discover the methods, that SDK provides, to understand how it can be useful for you.

Methods

Initialized SDK includes five blocks of functions to operate with specific entities.

  • GetABook;
  • GetAllBook;
  • GetABookCharacter;
  • GetAChapter;
  • ListCharacters;
  • GetACharacterQuote
  • GetACharacter
  • ListMovies
  • GetAMovieQuote
  • GetAMovie
  • GetAQuote

Note: query is always an optional parameter, you don't need to provide the values.

const filter = { name: '=Gandalf' }
const query = { limit: 20, page: 2, filter }
sdk.GetAllBook(query).then((result) => console.log(result))

Query object

query is an optional item and might consist following properties:

  • limit?: number;
  • offset?: number;
  • page?: number;
  • filter?: Record

Filtering example:

const filter = { name: '=Gandalf' }
const query = { filter }
sdk.ListMovies(query).then((result) => console.log(result))

Error handling

For making a usage of current SDK we are throwing Error so as to help you figure out what you are not doing correctly.

Development

Testing

Testing is available for development purpose, you may discover test cases in our [GitHub Repository]

It's developed with a help of Jest testing framework on a unit

For this you will need to install development dependencies first:

yarn i

Unit tests To run unit tests, execute following script:

yarn test