1.0.1 • Published 6 years ago

doggo-api-wrapper v1.0.1

Weekly downloads
13
License
MIT
Repository
github
Last release
6 years ago

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
1.0.1

6 years ago

1.0.0

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago