Constructor
new CloudEvent(options)
Creates a new CloudEvent instance
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
CloudEvent properties as a simple object Properties
|
Members
data :*
Gets or sets the data for this event
- Source:
- See:
dataContentEncoding :string
Gets or sets the event's data content encoding
- Source:
- See:
dataContentType :string
Gets or sets the content type of the data value for this event
- Source:
- See:
dataSchema :string
Gets or sets the event's data schema
- Source:
- See:
id :string
Gets or sets the event id. Source + id must be unique for each distinct event.
schemaURL :string
DEPRECATED: Gets or sets the schema URL for this event. Throws {TypeError} if this is a version 1.0 event.
- Source:
- See:
source :string
Gets or sets the origination source of this event as a URI.
- Source:
- See:
specversion :string
Gets the CloudEvent specification version
- Source:
- See:
subject :string
Gets or sets the event subject
time :string
Gets or sets the timestamp for this event as an ISO formatted date string
type :string
Gets or sets the event type
Methods
addExtension(key, value) → {void}
Adds an extension attribute to this CloudEvent
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
the name of the extension attribute |
value |
* |
the value of the extension attribute |
- Source:
- See:
format() → {JSON}
Formats the CloudEvent as JSON. Validates the event according to the CloudEvent specification and throws an exception if it's invalid.
- Source:
Throws:
-
if this event cannot be validated against the specification
- Type
- ValidationError
getExtensions() → {Object}
Gets the extension attributes, if any, associated with this event
- Source:
- See:
toString() → {string}
Formats the CloudEvent as JSON. No specification validation is performed.
- Source: