Skip to content
master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

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

About

🐦🎊 Javascript library for PARTY PARROTS

Topics

Resources

Packages

No packages published
You can’t perform that action at this time.