npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

petfinder-angular-service

v1.0.3

Published

Angular Service to be used with petfinder api

Readme

petfinder-angular-service

Setup

In order to make the service work you need to add an HttpModule to your @NgModule imports.

For NativeScript use NativeScriptHttpClientModule

import { NativeScriptHttpClientModule } from 'nativescript-angular/http-client';
@NgModule({
  ...
  imports: [
    ...
    NativeScriptHttpClientModule
  ],

For Web use HttpClientModule

import { HttpClientModule } from '@angular/common/http';
@NgModule({
  ...
  imports: [
    ...
    HttpClientModule
  ],

API KEY

You will also need to get a petfinder api key from here.

When you get your key, you need to provide it to the @NgModule providers using the API_KEY_TOKEN InjectionToken from petfinder-angular-service.

import { PetFinderService, API_KEY_TOKEN } from 'petfinder-angular-service';

@NgModule({
  ...
  providers: [
    ...
    { provide: API_KEY_TOKEN, useValue: 'your-key-here' },
    PetFinderService
  ],

Examples of usage

To use the service, just import what you need:

import { PetFinderService } from "petfinder-angular-service";
import { Pet } from "petfinder-angular-service/models";

Then inject the service in the constructor:

constructor(private petFinderService: PetFinderService) { }

Then to get a list of pets call:

this.petFinderService.findPets('Boston, MA')
.then((pets: Pet[]) => {
  // Deal with the pets here
  console.log(JSON.stringify(pets));
})

or with search options:

this.petFinderService.findPets(
  'Boston, MA', 
  { age: 'Baby', size: 'M' })
.then((pets: Pet[]) => {
  // Deal with the pets here
  console.log(JSON.stringify(pets));
})

API

breedList(animal: string): Promise<string[]>

  • Returns a list of breeds for a particular animal.
  • @param animal type of animal (barnyard, bird, cat, dog, horse, pig, reptile, smallfurry): for a safe list values use Options.animal

getPet(id: string | number): Promise<Pet>

  • Returns a record for a single pet.
  • @param id

getRandomPetId(options: RandomSearchOptions = {}): Promise<number>

  • Returns an id for a randomly selected pet. You can choose the characteristics of the pet you want returned using the various arguments to this method.
  • @param options a set of Random Search Options, which include: animal, breed, location, sex, shelterId, size

getRandomPet(options: RandomSearchOptions = {}, provideDescription: boolean = true): Promise<Pet>

  • Returns a record for a randomly selected pet. You can choose the characteristics of the pet you want returned using the various arguments to this method.
  • @param options a set of Search Options, which include: animal, breed, location, sex, shelterId, size
  • @param provideDescription determines whether the pet description should be provided

findPets(location: string, options: PetSearchOptions = {}): Promise<Pet[]>

  • Searches for pets according to the criteria you provde and returns a collection of pet records matching your search.

  • The results will contain at most count records per query, and a lastOffset tag.

  • To retrieve the next result set, use the lastOffset value as the offset to the next pet.find call.

  • @param location the ZIP/postal code or city and state the animal should be located (NOTE: the closest possible animal will be selected)

  • @param options a set of Search Options, which include: age, animal, breed, count, offset, output, sex, shelterId, size

findShelterPets(id: string | number, options: ShelterPetSearchOptions = {}): Promise<Pet[]>

  • Returns a list of pet records for an individual shelter.
  • @param id shelter ID (e.g. NJ94)
  • @param options a set of Search Options, which include: count, offset, output, status

findShelters(location: string, options: ShelterSearchOptions = {}): Promise<Shelter[]>

  • Returns a collection of shelter records matching your search criteria.
  • @param location the ZIP/postal code or city and state where the search should begin
  • @param options a set of Search Options, which include: count, name, offset

getShelter(id: string | number): Promise<Shelter>

  • Returns a record for a single shelter.
  • @param id shelter ID (e.g. NJ94)

findSheltersByBreed(animal:string, breed: string, options: ShelterSearchByBreedOptions = {}): Promise<Shelter[]>

  • Returns a list of shelters, listing animals of a particular breed.
  • WARNING: Shelter name is not returned!
  • @param animal type of animal, valid values: barnyard, bird, cat, dog, horse, pig, reptile, smallfurry. For a safe list of values use Options.animal
  • @param breed breed of animal, use breedList() for a list of valid breeds
  • @param options a set of Search Options, which include: count, offset