doggo-api-wrapper
v1.0.1
Published
A simple API wrapper for Dog API
Downloads
12
Maintainers
Readme
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