logeater-sdk
v0.19.0
Published
Can send events to logeater
Downloads
24
Readme
logeater-sdk
How to install
yarn add logeater-sdk
Setup
import { Logeater, Config } from 'logeater-sdk';
const logeaterConfig: Config = {
Address: "https://gateway.staging.solsten.io/logeater",
Service: "dashbboard",
Jwt: companyJwt
};
const logeater = new Logeater(logeaterConfig);
Address should probably be stored in your repo config and passed as such so it's not hardcoded and since it depends on the environment. Service tells us who you are, so for now it will be either "dashboard" or "navi2.0". Jwt is either a company JWT or a dashboard JWT, Logeater will deduct information automatically based on the JWT token.
logeater.push({
type: "dashboard.edit",
params: JSON.stringify({
"id": "6075b063dfda87c6cf05f826",
"company": "5d64edd9219bf88014a62ffb",
"name": "TEST",
"status": 1,
"storage_bucket_name": "test_test"
}),
segmentID: "5d64edd9219bf88014a62ffc"
});
Now, there are 2 methods you can call, push
and flush
.
push
will let you stack an event to be send soon to the API.
The object you pass to push has 2 important parameters and 1 optional:
- type: act as a namespace (ex: "dashboard.edit", "action.delete") and help us recognize the schema of params json string.
- params: a JSON stringified object that contains parameters that will be stored for context of that event.
- segmentID: an optional parameter that let us know if you are inside the context of a segment.
event type and params
In order to know what to send as type
and params
fields, you should sync with Alex or Julien to either get the details or define together what this new event should send.
Backend already send similar events and they are defined here.