Nurturing Palpable Magnificence
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

doggo-api-wrapper

1.0.1 • Public • Published

npm version npm Dependency Status

What is doggo-api-wrapper ?

doggo-api-wrapper is a simple API Wrapper for DogAPI


How to use it ?

First install the npm package npm i doggo-api-wrapper or yarn add doggo-api-wrapper

Here is a basic exemple with getARandomDog()

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getARandomDog()
  .then(data => console.log(data))
  .catch(err => console.error(err))

Each methods of the doggo-api-wrapper returns a promise.


List of all methods

getAllDogsByBreed(breed) returns an array of all the images from a breed

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getAllDogsByBreed('hound')
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getAllSubBreedImages(breed, subBreed) returns an array of all the images from the sub-breed

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getAllSubBreedImages('hound', 'afgan')
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getARandomDog() displays single random image from all dogs collection

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getARandomDog()
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getARandomDogFromBreed(breed) returns a random dog image from a breed

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getARandomDogFromBreed('hound')
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getARandomSubBreedImage(breed, subBreed) returnss a random image from a sub breed collection

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getARandomSubBreedImage('hound', 'afgan')
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getListOfAllBreeds() list all breeds available

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getListOfAllBreeds()
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getMultipleRandomDogs(amount) displays multiple random images from all dogs collection

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getMultipleRandomDogs(5)
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

getSubBreedFromBreed(breed) returns an array of all the sub-breeds from a breed

const DogApi = require('doggo-api-wrapper');
const myDog = new DogApi();
 
myDog.getSubBreedFromBreed('hound')
  .then(data => console.log(data))
  .catch(err => console.error(err)) // Don't forget the catch it's important

Install

npm i doggo-api-wrapper

DownloadsWeekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

143 kB

Total Files

7

Last publish

Collaborators

  • avatar