event-gateway-sdk icon indicating copy to clipboard operation
event-gateway-sdk copied to clipboard

CloudEvent object

Open alexdebrie opened this issue 7 years ago • 7 comments

Since the Event Gateway is CloudEvents friendly, it'd be nice to have an easy way to make a CloudEvent for use with the emit() functionality.

For example:

import {SDK, Event} from '@serverless/event-gateway-sdk';

const eventGateway = new SDK({
  url: 'http://myeventgateway.io',
  space: 'prod'
})

// Create your CloudEvent
let event = new Event({
  eventType: 'user.created',
  eventTypeVersion: "1.0",
  source: 'dashboard.serverless.com'
})

// Emit your event
eventGateway.emit(event)

alexdebrie avatar Jun 05 '18 20:06 alexdebrie