1.1.2 • Published 3 years ago
dogshome v1.1.2
DogsHome Node.js SDK
Table of Contents
Overview
Dogshome is a Node.js SDK for DogsHome API.
Installation
The DogsHome API Node.js SDK is available on npm as dogshome:
$ npm install --save dogshome
To use the module in your application, require
it from any JavaScript file:
const dogshome = require('dogshome');
Usage
SDK Initialization
Require DogsHome API Node.js SDK
const dogshome = require('dogshome');
Initialize a DogsHome application with your API key:
const app = dogshome.initializeApp({
token: '<your-token>'
});
or...
const config = {
token: '<your-token>'
}
const app = dogshome.initializeApp(config);
Simplified initialization:
const app = require('dogshome').initializeApp({
token: '<your-token>'
});
SDK Methods
Get a list of all publications
app.getAllPublications().then(publications => {
//Successfully retrieved publications
//...
}).catch(error => {
//Error retrieving publications
//...
});
Get single publication by ID
app.getPublicationByID(publicationID).then(publication => {
//Successfully retrieved publication
//...
}).catch(error => {
//Error retrieving publication
//...
});