Community Forum

Ask a Question
Back to All

Events General Common Structure

Good day

When working with https://docs.rootplatform.com/reference/events I know that the structure can vary depending on the event. But is there some sort of common structure we can rely on for the event?

Can I assume the below is common to all events?

{
  "event": {
    "type": "application_used",
    "created_at": "2017-10-05T18:28:30+02:00",
    "requested_by": {
      "type": "system"
    },
  // this portion can and will differ based on event.type  
  }
  // this portion can and will differ based on event.type
}

Or the TS type for this base event would be something like:

type base_event = {
    "event": string; // this is actually an enum
    "created_at": Date;
    // the rest of this differes bsaed on the type
}

type base_event_body = {
    "event": base_event;
    // the rest of this differes bsaed on the type
}