1.2.0 • Published 6 years ago
gen-eversince-client v1.2.0
gen-eversince-client
This package has been develop to give easy access to ever-since api.
Usage Examples
To add this library just add the dependency to your project.
$ npm install gen-eversince-client
Here is an example of code that uses this library.
const eversince = require('gen-eversince-client');
// Function to add an event to eversince.
const registerEvent = async () => {
let eventInstance = {};
eventInstance.actor_id = 1;
eventInstance.actor_type = 'Actor_Type';
eventInstance.meta = {};
eventInstance.meta.country_id = 11;
eventInstance.meta.location_id = 1;
eventInstance.meta.program_id = 121;
eventInstance.name = 'Name';
eventInstance.subject_id = 0;
eventInstance.subject_type = '1';
let result = await eversince.registerEvent(eventInstance);
}
// Function that query all the events and filtered by actor_id
const readEvents = async () => {
let result =await eversince.getEvents({ 'actor_id': 5 });
}
// Set the URL for eversince-api
eversince.setUrl('localhost:3000');
// Set Authentication key.
//request.setAuthKey('ThisIsMySecretKey');
registerEvent();
readEvents();