Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lynnaloo/adopt-a-pet
:cat2: :dog2: Adopt-a-Pet API Client for Node.js
https://github.com/lynnaloo/adopt-a-pet
adopt-a-pet adoption animal api api-client hacktoberfest hacktoberfest2020 nodejs npm pets rescue
Last synced: 24 days ago
JSON representation
:cat2: :dog2: Adopt-a-Pet API Client for Node.js
- Host: GitHub
- URL: https://github.com/lynnaloo/adopt-a-pet
- Owner: lynnaloo
- License: mit
- Created: 2016-12-21T02:44:04.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:23:59.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T12:37:45.403Z (7 months ago)
- Topics: adopt-a-pet, adoption, animal, api, api-client, hacktoberfest, hacktoberfest2020, nodejs, npm, pets, rescue
- Language: JavaScript
- Homepage:
- Size: 285 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Adopt-a-Pet
[![Greenkeeper badge](https://badges.greenkeeper.io/lynnaloo/adopt-a-pet.svg)](https://greenkeeper.io/)
[![Build Status](https://dev.azure.com/lynnaloo/adopt-a-pet/_apis/build/status/lynnaloo.adopt-a-pet?branchName=master)](https://dev.azure.com/lynnaloo/adopt-a-pet/_build/latest?definitionId=2&branchName=master)Adopt-a-Pet API Client for Node
## Installation
* Install [Node LTS](https://nodejs.org/)
```
npm i adopt-a-pet
```## Setup
* [Get API keys](http://www.adoptapet.com/shelter/portable_pet_list_api) for your shelter
* Set API key and ShelterId to environment variables: (optional)```
export ADOPT_API_KEY=xxx
export SHELTER_ID=90641
```## Usage:
```javascript
const AdoptPet = require('adopt-a-pet')// Instantiate the adopt-a-pet API Client
// Parameters are not required if environment variables are set
const adoptPet = new AdoptPet(shelterId, apiKey)//
// Get all pets for current shelter
//
adoptPet.getPets()
.then((pets) => {
// returns an array of pet objects
return pets;
});//
// Get a random pet from the list of current shelter pets
//
adoptPet.getRandomPet()
.then((pet) => {
// return the random pet object
return pet;
})//
// Get pet details using a petId and boolean to limit details
//
adoptPet.getPetDetails(petId, true)
.then((pet) => {
// returns detailed pet object
return pet;
});
```