@petfinder/petfinder-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Petfinder JS SDK

CircleCI npm version Coverage Status

A JS wrapper for the Petfinder API, written in JavaScript/TypeScript.

Features

  • TypeScript definition
  • Promises (via Axios)
  • Well tested

Install

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>

Usage (Browser)

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
    });

Usage (Node/CommonJS)

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
    });

Usage (TypeScript/ES6 Module)

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
    });

Documentation

See docs directory for more detailed documentation.

Readme

Keywords

Package Sidebar

Install

npm i @petfinder/petfinder-js

Weekly Downloads

163

Version

1.0.6

License

BSD-3-Clause

Unpacked Size

51.3 kB

Total Files

17

Last publish

Collaborators

  • nsdavidson
  • mloberg
  • pftjtn