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

one-sdk-to-rule-them-all

v0.1.12

Published

- [Installation](#installaton) - [Examples](#examples) - [Usage](#usage) - [Initialization](#initialization) - [getBooks()](#getbooks) - [getBook(bookId)](#getbook) - [getBookChapters(bookId)](#getbookchapters) - [getMovies()](#getmovies) - [g

Downloads

9

Readme

Lord of the Rings SDK

Installation

Get an access token from The One Api. Then npm install one-sdk-to-rule-them-all

Examples

Examples may be found in /examples/example.js

Usage

const OneSdkToRuleThemAll = require('one-sdk-to-rule-them-all');
const client = new OneSdkToRuleThemAll('API-TOKEN-HERE');

(async () =>  {
  try {
    const books = await client.getBooks();
    console.log(books);
  } catch (error) {
    console.error(error);
  }
})()

Initialization

const OneSdkToRuleThemAll = require('one-sdk-to-rule-them-all');
const client = new OneSdkToRuleThemAll('API-TOKEN-HERE');

getBooks()

Fetches a list of all books from the the-one-api API without any requestConfigs set.

Example Usage:

const books = await client.getBooks();

Example Return:

"docs": [
    {"_id": "5cf5805fb53e011a64671582", "name": "The Fellowship Of The Ring"},
    {"_id": "5cf58080b53e011a64671584", "name": "The Return Of The King"},
    {"_id": "5cf58077b53e011a64671583", "name": "The Two Towers"}
],
"total": 3,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getBooks(requestConfigs)

Fetches a list of all books from the the-one-api API with requestConfigs set.

Example Usage:

const books = await client.getBooks({
    filtering: {
        exclude: {
            excludeKey: 'name',
            excludeValue: 'The Two Towers'
        }
    }
});

Example Return:

"docs": [
    {"_id": "5cf5805fb53e011a64671582", "name": "The Fellowship Of The Ring"},
    {"_id": "5cf58080b53e011a64671584", "name": "The Return Of The King"},
],
"total": 2,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getBook(bookId)

Fetches a specific book from the the-one-api API without any requestConfigs set.

Example Usage:

const books = await client.getBook('5cf5805fb53e011a64671582');

Example Return:

"docs": [
    {"_id": "5cf5805fb53e011a64671582", "name": "The Fellowship Of The Ring"},
],
"total": 1,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getBookChapters(bookId)

Fetches all chapters of a specific book from the the-one-api API without any requestConfigs set.

Example Usage:

const books = await client.getBookChapters('5cf5805fb53e011a64671582');

Example Return:

"docs": [
    // ... Additional chapter objects ...
    {"_id": "6091b6d6d58360f988133ba0", "chapterName": "The Breaking of the Fellowship"},
],
"total": 22,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getBookChapters(bookId, requestConfigs)

Fetches all chapters of a specific book from the the-one-api API with requestConfigs set.

Example Usage:

const books = await client.getBookChapters('5cf5805fb53e011a64671582', {
    filtering: {
        exclude: {
            excludeKey: 'chapterName',
            excludeValue: 'The Mirror of Galadriel',
        }
    }
});

Example Return:

"docs": [
    {"_id": "6091b6d6d58360f988133b9e", "chapterName": "Farewell to Lórien"},
    {"_id": "6091b6d6d58360f988133b9f", "chapterName": "The Great River"},
    {"_id": "6091b6d6d58360f988133ba0", "chapterName": "The Breaking of the Fellowship"}
],
"total": 3,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getMovies()

Fetches all movies without any requestConfig set.

Example Usage:

const quotes = await client.getMovies();`

Example Return:

"docs": [
    // ... Additional quote objects ...
    {
      "_id": "5cd95395de30eff6ebccde5d",
      "name": "The Return of the King",
      "runtimeInMinutes": 201,
      "budgetInMillions": 94,
      "boxOfficeRevenueInMillions": 1120,
      "academyAwardNominations": 11,
      "academyAwardWins": 11,
      "rottenTomatoesScore": 95
    }
  ],
  "total": 8,
  "limit": 1000,
  "offset": 0,
  "page": 1,
  "pages": 1

getMovies(requestConfig)

Fetches all movies with requestConfig set.

Example Usage:

const quotes = await client.getMovies({
    sorting: {
        sortingKey: 'name',
        sortingDirection: 'desc',
    }
});`

Example Return:

"docs": [
    // ... Additional quote objects ...
    {
      "_id": "5cd95395de30eff6ebccde5a",
      "name": "The Battle of the Five Armies",
      "runtimeInMinutes": 144,
      "budgetInMillions": 250,
      "boxOfficeRevenueInMillions": 956,
      "academyAwardNominations": 1,
      "academyAwardWins": 0,
      "rottenTomatoesScore": 60
    }
  ],
  "total": 8,
  "limit": 1000,
  "offset": 0,
  "page": 1,
  "pages": 1

getMovie(movieId)

Fetches a specific movie by its ID without requestConfig set.

Example Usage:

const quotes = await client.getMovie('5cd95395de30eff6ebccde5b');`

Example Return:

"docs": [
    {
      "_id": "5cd95395de30eff6ebccde5b",
      "name": "The Two Towers",
      "runtimeInMinutes": 179,
      "budgetInMillions": 94,
      "boxOfficeRevenueInMillions": 926,
      "academyAwardNominations": 6,
      "academyAwardWins": 2,
      "rottenTomatoesScore": 96
    }
  ],
  "total": 1,
  "limit": 1000,
  "offset": 0,
  "page": 1,
  "pages": 1

getMovieQuotes(movieId)

Fetches all quotes from a specific movie by its ID without any requestConfigs set.

Example Usage:

const quotes = await client.getMovieQuotes('5cd95395de30eff6ebccde5b');`

Example Return:

"docs": [
  // ... Additional quote objects ...
  {
    "_id": "5cd96e05de30eff6ebcce84a",
    "dialog": "My dear Sam, you cannot always be torn in two...",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfc15"
  },
  // ... Additional quote objects ...  
],
"total": 100,
"limit": 100,
"offset": 0,
"page": 1,
"pages": 1

getMovieQuotes(movieId, requestConfig)

Fetches all quotes from a specific movie by its ID with requestConfig set.

Example Usage:

const quotes = await client.getMovieQuotes('5cd95395de30eff6ebccde5b', {
    filtering: {
        regexInclude: {
            regexIncludeKey: '_id',
            regexIncludeValue: /5cd96e05de30eff6ebcce84a/i,
        },
    }
});`

Example Return:

"docs": [
  {
    "_id": "5cd96e05de30eff6ebcce84a",
    "dialog": "My dear Sam, you cannot always be torn in two...",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfc15"
  }
],
"total": 1,
"limit": 100,
"offset": 0,
"page": 1,
"pages": 1

getCharacters()

Fetches all characters without any requestConfigs set.

Example Usage:

const quotes = await client.getCharacters();`

Example Return:

"docs": [
  {
    "_id": "5cd99d4bde30eff6ebccfc1f",
    "height": "1.76m / 5'9 (film)",
    "race": "Human",
    "gender": "Male",
    "birth": "TA 2925",
    "spouse": "Unnamed wife",
    "death": "TA 3007",
    "realm": "Dale",
    "hair": "Brown (film)",
    "name": "Bain",
    "wikiUrl": "http://lotr.wikia.com//wiki/Bain"
  },
  {
    "_id": "5cd99d4bde30eff6ebccfc20",
    "height": "",
    "race": "Human",
    "gender": "",
    "birth": "",
    "spouse": "",
    "death": "",
    "realm": "",
    "hair": "",
    "name": "Baranor (Gondor)",
    "wikiUrl": "http://lotr.wikia.com//wiki/Baranor_(Gondor)"
  },
  // ... Additional quote objects ...  
],
"total": 100,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getCharacters()

Fetches all characters with requestConfigs set.

Example Usage:

const quotes = await client.getCharacters({
    filtering: {
        include: {
            includeKey: 'name',
            includeValue: 'Bain'
        },
    }
});`

Example Return:

"docs": [
  {
    "_id": "5cd99d4bde30eff6ebccfc1f",
    "height": "1.76m / 5'9 (film)",
    "race": "Human",
    "gender": "Male",
    "birth": "TA 2925",
    "spouse": "Unnamed wife",
    "death": "TA 3007",
    "realm": "Dale",
    "hair": "Brown (film)",
    "name": "Bain",
    "wikiUrl": "http://lotr.wikia.com//wiki/Bain"
  },
],
"total": 1,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getCharacter(characterId)

Fetches a specific character without any requestConfigs set.

Example Usage:

const quotes = await client.getCharacters('5cd99d4bde30eff6ebccfc1f');`

Example Return:

"docs": [
  {
    "_id": "5cd99d4bde30eff6ebccfc1f",
    "height": "1.76m / 5'9 (film)",
    "race": "Human",
    "gender": "Male",
    "birth": "TA 2925",
    "spouse": "Unnamed wife",
    "death": "TA 3007",
    "realm": "Dale",
    "hair": "Brown (film)",
    "name": "Bain",
    "wikiUrl": "http://lotr.wikia.com//wiki/Bain"
  },
],
"total": 1,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getCharacterQuotes(characterId)

Fetches all quotes for a specific characters without any requestConfigs set.

Example Usage:

const quotes = await client.getCharacterQuotes('5cd99d4bde30eff6ebccfc15');`

Example Return:

"docs": [
  {
    "_id": "5cd96e05de30eff6ebcce84a",
    "dialog": "My dear Sam, you cannot always be torn in two. You will have to be one and whole for many years. You have so much to enjoy and to be and to do. Your part in the story will go on.",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfc15",
    "id": "5cd96e05de30eff6ebcce84a"
  },
  // ... Additional quote objects ...  
],
"total": 67,
"limit": 1000,
"offset": 0,
"page": 1,
"pages": 1

getQuotes()

Fetches a list of all the quotes from the API.

Example Usage:

const quotes = await client.getQuotes();

Example Return:

"docs": [
  // ... Additional quote objects ...
  {
    "_id": "5cd96e05de30eff6ebcce84c",
    "dialog": "I didn't think it would end this way.",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfe2e"
  },
  // ... Additional quote objects ...
]
"total": 100,
"limit": 100,
"offset": 0,
"page": 1,
"pages": 1

getQuote(quoteId)

Fetches data for a specific quote by its ID.

Example Usage:

const quote = await client.getQuote('5cd96e05de30eff6ebcce84c');

Example Return:

"docs": [
    {
    "_id": "5cd96e05de30eff6ebcce84c",
    "dialog": "I didn't think it would end this way.",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfe2e"
    }
],
"total": 1,
"limit": 100,
"offset": 0,
"page": 1,
"pages": 1

getChapters()

Fetches a list of all the chapters from every book in the API.

Example Usage:

const quotes = await client.getChapters();

Example Return:

"docs": [
  // ... Additional chapter objects ...
  {
    "_id": "5cd96e05de30eff6ebcce84c",
    "dialog": "I didn't think it would end this way.",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfe2e"
  },
  // ... Additional chapter objects ...
]
"total": 100,
"limit": 100,
"offset": 0,
"page": 1,
"pages": 1

getChapter(chapterId)

Fetches data for a specific quote by its ID.

Example Usage:

const quote = await client.getChapter('5cd96e05de30eff6ebcce84c');

Example Return:

"docs": [
    {
    "_id": "5cd96e05de30eff6ebcce84c",
    "dialog": "I didn't think it would end this way.",
    "movie": "5cd95395de30eff6ebccde5d",
    "character": "5cd99d4bde30eff6ebccfe2e"
    }
],
"total": 1,
"limit": 100,
"offset": 0,
"page": 1,
"pages": 1