Skip to content

drlukeangel/Pet-Finder-API-Javascript-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Petfinder API

Petfinder API allows you to search their database for available pets ready for adoption.

Installation

NPM

npm install petfinder --save

--save adds petfinder to your package.json file

Package Manager package.json:

{
  ...
  "dependencies": {
    ...
    "petfinder": "latest"
  }
}

Usage

// Import module
var petfinder = require('petfinder')('api_key','api_secret');

// Get list of breeds
petfinder.getBreedList('cat', function(err, breeds) {
  console.log(breeds)
});

Methods

Pets

// animal = barnyard, bird, cat, dog, horse, pig, reptile, smallfurry
getBreedList( animal, callback )

getPet( petId, options, callback )
getRandomPet ( options, callback )
findPet ( location, options, callback )

Shelters

findShelter( location, options, callback )
getShelter( shelterId, options, callback )
getPetsInShelter( shelterId, options, callback )

// breed get from getBreedList
getSheltersWithBreeds ( animal, breed, options, callback )

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some awesome feature')
  4. Push to the remote branch (git push origin my-new-feature)
  5. Create a pull request

Running Tests

cp .env.example .env
npm test

to record api calls

REPLAY=record npm test

to debug recorded api calls

DEBUG=replay npm test

Npm Page

https://www.npmjs.com/package/pet-finder-api

Typings For Typescript

In the typeScriptFiles folder and at the typings site https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pet-finder-api

Thanks to @ncipollina

About

JavaScript Library For working with the Pet Finder API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages