Petfinder API allows you to search their database for available pets ready for adoption.
npm install petfinder --save--save adds petfinder to your package.json file
{
...
"dependencies": {
...
"petfinder": "latest"
}
}// Import module
var petfinder = require('petfinder')('api_key','api_secret');
// Get list of breeds
petfinder.getBreedList('cat', function(err, breeds) {
console.log(breeds)
});// animal = barnyard, bird, cat, dog, horse, pig, reptile, smallfurry
getBreedList( animal, callback )
getPet( petId, options, callback )
getRandomPet ( options, callback )
findPet ( location, options, callback )findShelter( location, options, callback )
getShelter( shelterId, options, callback )
getPetsInShelter( shelterId, options, callback )
// breed get from getBreedList
getSheltersWithBreeds ( animal, breed, options, callback )- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some awesome feature') - Push to the remote branch (
git push origin my-new-feature) - Create a pull request
cp .env.example .envnpm testto record api calls
REPLAY=record npm testto debug recorded api calls
DEBUG=replay npm testhttps://www.npmjs.com/package/pet-finder-api
In the typeScriptFiles folder and at the typings site https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pet-finder-api
Thanks to @ncipollina