A small JS client to handle fetching the ever-loved Party Parrots (of all varieties).
npm i fetch-the-parrot --save
yarn add fetch-the-parrot
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
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
})
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) orhd
. 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.
- callback(data)
-
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.
-