A JS wrapper for the Petfinder API, written in JavaScript/TypeScript.
- TypeScript definition
- Promises (via Axios)
- Well tested
Using npm:
npm install --save @petfinder/petfinder-js
In browser:
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://unpkg.com/@petfinder/petfinder-js/dist/petfinder.min.js"></script>
var pf = new petfinder.Client({apiKey: "my-api-key", secret: "my-api-secret"});
pf.animal.search()
.then(function (response) {
// Do something with `response.data.animals`
})
.catch(function (error) {
// Handle the error
});
var petfinder = require("@petfinder/petfinder-js");
var client = new petfinder.Client({apiKey: "my-api-key", secret: "my-api-secret"});
client.animal.search()
.then(function (response) {
// Do something with `response.data.animals`
})
.catch(function (error) {
// Handle the error
});
import { Client } from "@petfinder/petfinder-js";
const client = new Client({apiKey: "my-api-key", secret: "my-api-secret"});
client.animal.search()
.then(function (response) {
// Do something with `response.data.animals`
})
.catch(function (error) {
// Handle the error
});
See docs directory for more detailed documentation.