🐦🎊 Javascript library for PARTY PARROTS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist Remove default export Aug 12, 2017
src Remove default export Aug 12, 2017
.gitignore Update .gitignore Aug 12, 2017
.travis.yml Travis + readme updates Aug 12, 2017
README.md Fix README Sep 26, 2017
package-lock.json 2.0.0 Jun 18, 2018
package.json 2.0.0 Jun 18, 2018

README.md

fetch-the-parrot

npm version Build Status

A small JS client to handle fetching the ever-loved Party Parrots (of all varieties).

Mega parrot!

Installation

NPM

npm i fetch-the-parrot --save

Yarn

yarn add fetch-the-parrot

Basic examples

ES5
var getParrotGif = require('fetch-the-parrot').getParrotGif;

var parrot = getParrotGif({
  'name': 'Parrot',
  'res': 'hd',
  'path': 'http://my-parrot-website.com/parrots/'
})

console.log(parrot)

/* Result */
http://my-parrot-website.com/parrots/parrots/hd/parrot.gif
ES6
import { getParrotGif } from 'fetch-the-parrot'

getParrotGif({
  'name': 'Fiesta Parrot',
  'path': 'http://my-parrot-website.com/parrots/'
}, gif => {
  console.log(gif)

  /* Result */
  http://my-parrot-website.com/parrots/parrots/fiestaparrot.gif
})

Usage

This library exposes 3 methods in total.

So far we've seen getParrotGif in the above snippets, but getParrotsJSON & searchParrotsByName are also available. Let's run over all 3 methods in more detail:

  • getParrotGif(options, callback): This is the method used to return a partyparrot's .gif URL.

    • options object

      • name string: Party parrot's name, case insensitive (use names as labelled here).

      • res string: The resolution for our gif, sd (default) or hd. Note, not all party parrots have HD support, in the case of a hd request on an "sd-only" parrot, the SD version will be returned.

      • path string: Optional string to set the path of where the party parrot images are located.

    • callback(gif) function: Returns the gif URL if successful.

  • getParrotsJSON(callback): Returns the main json object of all parrots.

    • callback(data) function: Returns json object if successful.
  • searchParrotsByName(name, callback): Returns the single object for a parrot.

    • name string: Name, case insensitive, of the parrot we're searching for (use names as labelled here).

    • callback(data) function: Returns json object for queried parrot if successful.

Also worth checking out