0.0.5 • Published 3 years ago
metdev-sdk-team10 v0.0.5
sdk-metdev-team-10
NodeJs sdk for using MetDev, published in npm.
- Marcel Canu 223586
- Ian Spektor 202748
- Alejandro Kugelmass 192472
Usage
const { MetDev } = require('metdev-sdk-team10')
// API_KEY is the api key provided by MetDev for your organization.
// TIMEOUT is the max milliseconds to wait for.
const metdevClient = new MetDev(API_KEY, TIMEOUT)
// Optionally, you could set your desired timeout between 0 and 500 ms
// const metdevClient = new MetDev(API_KEY,350)
const event = {
metric: 'total_requests',
value: 10,
timestamp: new Date(),
}
metdevClient
.createEvent(event)
.then((created) => console.log('Event created'))
.catch((err) => console.error(err))
You can also catch specific errors provided by the SDK:
UnauthorizedError
: Api key is invalid.ServiceUnavailableError
: MetDev server is unavailable.InvalidRequestError
: There is an error in the event, check the message.
const {
UnauthorizedError,
InvalidRequestError,
ServiceUnavailableError,
} = require('metdev-sdk-team10')