Tabnine Logo For Javascript
petfinder-client
Code IndexAdd Tabnine to your IDE (free)

How to use petfinder-client

Best JavaScript code snippets using petfinder-client(Showing top 5 results out of 315)

origin: maniezhilan/krabby-parcel

componentDidMount() {
    petfinder.pet
      .find({ location: "Austin, TX", output: "full" })
      .then(data => {
        let pets;
        if (data.petfinder.pets && data.petfinder.pets.pet) {
          if (Array.isArray(data.petfinder.pets.pet)) {
            pets = data.petfinder.pets.pet;
          } else {
            pets = [data.petfinder.pets.pet];
          }
        } else {
          pets = [];
        }
        this.setState({
          pets: pets
        });
      });
  }
origin: Archaeologist03/BH-intermediate-react

getBreeds() {
  if (this.state.animal) {
   petfinder.breed
    .list({ animal: this.state.animal })
    .then(data => {
     if (
      data.petfinder &&
      data.petfinder.breeds &&
      Array.isArray(data.petfinder.breeds.breed)
     ) {
      this.setState({
       breeds: data.petfinder.breeds.breed
      });
     } else {
      this.setState({ breeds: [] });
     }
    })
    .catch(console.error);
  } else {
   this.setState({
    breeds: []
   });
  }
 }
origin: Archaeologist03/BH-intermediate-react

petfinder.pet
   .find({
    location: this.props.searchParams.location,
    animal: this.props.searchParams.animal,
    breed: this.props.searchParams.breed,
    output: "full"
   })
   .then(data => {
    let pets;
    if (data.petfinder.pets && data.petfinder.pets.pet) {
     if (Array.isArray(data.petfinder.pets.pet)) {
      pets = data.petfinder.pets.pet;
     } else {
      pets = [data.petfinder.pets.pet];
     }
    } else {
     pets = [];
    }
    this.setState({
     pets: pets
    });
   });
origin: Archaeologist03/BH-intermediate-react

export default function getBreeds() {
 return function getBReedsThunk(dispatch, getState) {
  const { animal } = getState();

  if (animal) {
   petfinder.breed
    .list({ animal })
    .then(data => {
     if (
      data.petfinder &&
      data.petfinder.breeds &&
      Array.isArray(data.petfinder.breeds.breed)
     ) {
      dispatch({
       type: "SET_BREEDS",
       payload: data.petfinder.breeds.breed
      });
     } else {
      dispatch({ type: "SET_BREADS", payload: [] });
     }
    })
    .catch(console.error);
  } else {
   dispatch({ type: "SET_BREADS", payload: [] });
  }
 };
}
origin: Archaeologist03/BH-intermediate-react

componentDidMount() {
  petfinder.pet
   .get({
    output: "full",
    id: this.props.id
   })
   .then(data => {
    let breed;
    if (Array.isArray(data.petfinder.pet.breeds.breed)) {
     breed = data.petfinder.pet.breeds.breed.join(", ");
    } else {
     breed = data.petfinder.pet.breeds.breed;
    }
    this.setState({
     name: data.petfinder.pet.name,
     animal: data.petfinder.pet.animal,
     location: `${data.petfinder.pet.contact.city}, ${
      data.petfinder.pet.contact.state
     }`,
     description: data.petfinder.pet.description,
     media: data.petfinder.pet.media,
     breed,
     loading: false
    });
   })
   .catch(() => {
    navigate("/");
   });
 }
petfinder-client(npm)

Most used petfinder-client functions

  • PetFindResponse.petfinder
  • find
  • pet
  • pets
  • BreedResponse.petfinder
  • Pet.breeds,
  • Pet.contact,
  • Pet.description,
  • Pet.media,
  • Pet.name,
  • PetResponse.petfinder,
  • breed,
  • breeds,
  • city,
  • get,
  • list,
  • state

Popular in JavaScript

  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • glob
    a little globber
  • redis
    Redis client library
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • semver
    The semantic version parser used by npm.
  • express
    Fast, unopinionated, minimalist web framework
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now