Constructor
+ + + + + + ++ new CloudEvent(UserSpecopt, UserFormatteropt) +
+ + + + + + +Creates a new CloudEvent instance
+Parameters:
+ + +Name | + + +Type | + + +Attributes | + + + + +Description | +
---|---|---|---|
UserSpec |
+
+
+ + + + + Spec + + + + + + + | + + +
+
+ <optional> + + + + + + |
+
+
+
+
+
+ A CloudEvent version specification + + |
+
UserFormatter |
+
+
+ + + + + Formatter + + + + + + + | + + +
+
+ <optional> + + + + + + |
+
+
+
+
+
+ Converts the event into a readable string + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 13 + +
+
+
+
+
+
+
+
+
Methods
+ + + + + + + + + + + ++ addExtension(key, value) → {CloudEvent} +
+ + + + + + +Adds an extension attribute to this CloudEvent
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
key |
+
+
+ + + + + * + + + + + + + | + + + + + +
+ the name of the exteneion attribute + + |
+
value |
+
+
+ + + + + * + + + + + + + | + + + + + +
+ the value of the extension attribute + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 214 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ data(data) → {CloudEvent} +
+ + + + + + +Sets the data for this event
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
data |
+
+
+ + + + + * + + + + + + + | + + + + + +
+ any data associated with this event + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 193 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ dataContenttype(contenttype) → {CloudEvent} +
+ + + + + + +Sets the content type of the data value for this event
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
contenttype |
+
+
+ + + + + string + + + + + + + | + + + + + +
+ per https://tools.ietf.org/html/rfc2046 + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 173 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ format() → {JSON} +
+ + + + + + +Format the CloudEvent as JSON. Validates the event according +to the CloudEvent specification and throws an exception if +it's invalid.
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 35 + +
+
+
+
+
+
+
+
+
+ getData() → {*} +
+ + + + + + +Gets any data that has been set for this event
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 203 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ getDataContenttype() → {string} +
+ + + + + + +Gets the content type of the data value for this event
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 183 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ getExtensions() → {Object} +
+ + + + + + +Gets the extension attributes, if any, associated with this event
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 229 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ getFormats() → {Object} +
+ + + + + + +Get the formatters available to this CloudEvent
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 25 + +
+
+
+
+
+
+
+
+
+ getId() → {string} +
+ + + + + + +Gets the event id.
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 128 + +
+
+
+
+
+
+
+
+
+ getSource() → {string} +
+ + + + + + +Gets the origination source of this event.
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 109 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ getSpecversion() → {string} +
+ + + + + + +Gets the CloudEvent specification version
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 89 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ getTime() → {Date} +
+ + + + + + +Gets the timestamp for this event
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 150 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ getType() → {String} +
+ + + + + + +Gets the event type
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 71 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ id(id) → {CloudEvent} +
+ + + + + + +Sets the event id. Source + id must be unique for each distinct event.
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
id |
+
+
+ + + + + string + + + + + + + | + + + + + +
+ source+id must be unique for each distinct event + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 119 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ source(source) → {CloudEvent} +
+ + + + + + +Sets the origination source of this event.
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
source |
+
+
+ + + + + URI + + + + + + + | + + + + + +
+ the context in which the event happened + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 99 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ time(time) → {CloudEvent} +
+ + + + + + +Sets the timestamp for this event
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
time |
+
+
+ + + + + Date + + + + + + + | + + + + + +
+ timestamp when the event occurred + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 138 + +
+
+
+
+
+
+ - See: +
- + + + + + +
+ toString() → {JSON} +
+ + + + + + +Formats the CLoudEvent as JSON. No specification validation +is performed.
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 51 + +
+
+
+
+
+
+
+
+
+ type(type) → {CloudEvent} +
+ + + + + + +Sets the event type
+Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
type |
+
+
+ + + + + string + + + + + + + | + + + + + +
+ the type of event related to the originating source + + |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
-
+
-
+
- + cloudevent.js, line 61 + +
+
+
+
+
+
+ - See: +
- + + + + + +