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

asoiaf-api

v1.0.1

Published

Javascript wrapper for the A song of ice and fire API

Downloads

17

Readme

A-song-of-ice-and-fire-API

Overview

A-song-of-ice-and-fire-API is a Node.js wrapper for accessing AnApiOfIceAndFire.

Installation

The current production release of A-song-of-ice-and-fire-API is available through npm:

npm install asoiaf-api

Usage

> var asoaif = require('asoiaf-api');
> asoaif.getCharacterByName("Jon Snow");


[ { url: 'http://www.anapioficeandfire.com/api/characters/583',
    name: 'Jon Snow',
    gender: 'Male',
    culture: 'Northmen',
    born: 'In 283 AC',
    died: '',
    titles: [ 'Lord Commander of the Night\'s Watch' ],
    aliases: 
     [ 'Lord Snow',
       'Ned Stark\'s Bastard',
       'The Snow of Winterfell',
       'The Crow-Come-Over',
       'The 998th Lord Commander of the Night\'s Watch',
       'The Bastard of Winterfell',
       'The Black Bastard of the Wall',
       'Lord Crow' ],
    father: '',
    mother: '',
    spouse: '',
    allegiances: [ 'http://www.anapioficeandfire.com/api/houses/362' ],
    books: [ 'http://www.anapioficeandfire.com/api/books/5' ],
    povBooks: 
     [ 'http://www.anapioficeandfire.com/api/books/1',
       'http://www.anapioficeandfire.com/api/books/2',
       'http://www.anapioficeandfire.com/api/books/3',
       'http://www.anapioficeandfire.com/api/books/8' ],
    tvSeries: [ 'Season 1', 'Season 2', 'Season 3', 'Season 4', 'Season 5' ],
    playedBy: [ 'Kit Harington' ] } ]

API

###Characters###

getCharacterByID

  • Accepts: A string or number representing a character ID.
  • Returns: An object containing the character's properties if the character exists.

getCharacterByName

  • Accepts: A string representing full name of the character.
  • Returns: An array of objects containing all the characters with given name.

getCharactersByCulture

  • Accepts: A string representing the culture of Character.
  • Returns: An array of objects containing all the characters with given culture.

getCharactersByGender

  • Accepts: A string representing the gender of Character.
  • Returns: An array of objects containing all the characters with given gender.

getAllCharacters

  • Returns: An array of objects containing all the characters.

###Houses###

getHouseByID

  • Accepts: A string or number representing a house ID.
  • Returns: An object containing the house's properties if the house exists.

getHouseByName

  • Accepts: A string representing full name of the house.
  • Returns: An array of objects containing all the houses with given name.

getHouseByRegion

  • Accepts: A string representing the region of the house.
  • Returns: An array of objects containing all the houses with given region.

getHouseByWords

  • Accepts: A string representing the words/saying of the house.
  • Returns: An array of objects containing all the houses with given words/saying.

getAllHouses

  • Returns: An array of objects containing all the houses.

###Books###

getBookByID

  • Accepts: A string or number representing a book ID.
  • Returns: An object containing the book's properties if the book exists.

getBookByName

  • Accepts: A string representing full name of the book.
  • Returns: An array of objects containing all the books with given name.

getAllBooks

  • Returns: An array of objects containing all the books.

###FUN###

getRandomCharacter

  • Returns: An object containing the properties of a random character.

getRandomHouse

  • Returns: An object containing the properties of a random house.

getRandomCharacterOfHouse

  • Accepts: A string representing full name of the house.
  • Returns: An object containing the properties of a random character from the given house
> var asoaif = require('asoiaf-api');
> asoaif.getRandomCharacterOfHouse("House Stark of Winterfell");

{ url: 'http://www.anapioficeandfire.com/api/characters/170',
  name: 'Barthogan Stark',
  gender: 'Male',
  culture: 'Northmen',
  born: '',
  died: '',
  titles: [ 'Lord of Winterfell', 'Warden of the North' ],
  aliases: [ 'Barth Blacksword' ],
  father: '',
  mother: '',
  spouse: '',
  allegiances: [ 'http://www.anapioficeandfire.com/api/houses/362' ],
  books: 
   [ 'http://www.anapioficeandfire.com/api/books/2',
     'http://www.anapioficeandfire.com/api/books/11' ],
  povBooks: [],
  tvSeries: [],
  playedBy: [] }