1.0.3 • Published 3 years ago
@11-met-dev/event-creator v1.0.3
11-met-dev-events-sdk
This repository contains the source code for 11-Met-Dev npm package for events creation.
Installation and usage
Installing with npm:
$ npm install @11-met-dev/event-creator
Usage:
const eventCreator = require("@11-met-dev/event-creator");
Example
This package as of now has only one asynchronous function to create and register events of an organization's metric.
First of all you need to set te base url of the api with the setUrl function. (See full example above)
In order to create an event of a metric, one has to provide the createEvent function with the following arguments:
- a valid API key for the organization
- metric's name
- event's value
From within your application code, you can use this function as follows:
try {
eventCreator.setUrl("http://yoururl.here.com");
await eventCreator.createEvent("01cc781b-bc7b-4d8d-ac0e-bcaf643471fb", "covid_total_cases", 1);
} catch (err) {
console.log(err);
}