http binary wip
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
63d25f5b04
commit
4d79e11284
|
@ -18,6 +18,12 @@ HTTPBinary.prototype.emit = function(cloudevent){
|
|||
_headers["Content-Type"] = cloudevent.getContenttype();
|
||||
|
||||
_headers["CE-EventType"] = cloudevent.getType();
|
||||
_headers["CE-CloudEventsVersion"] = cloudevent.getSpecversion();
|
||||
|
||||
_headers["CE-Source"] = cloudevent.getSource();
|
||||
_headers["CE-EventID"] = cloudevent.getId();
|
||||
_headers["CE-EventTime"] = cloudevent.getTime();
|
||||
_headers["CE-SchemaURL"] = cloudevent.getSchemaurl();
|
||||
|
||||
// Set the cloudevent payload
|
||||
_config["data"] = cloudevent.format();
|
||||
|
|
|
@ -47,21 +47,37 @@ Cloudevent.prototype.source = function(_source){
|
|||
return this;
|
||||
};
|
||||
|
||||
Cloudevent.prototype.getSource = function(){
|
||||
return this.spec.getSource();
|
||||
};
|
||||
|
||||
Cloudevent.prototype.id = function(_id){
|
||||
this.spec.id(_id);
|
||||
return this;
|
||||
};
|
||||
|
||||
Cloudevent.prototype.getId = function() {
|
||||
return this.spec.getId();
|
||||
};
|
||||
|
||||
Cloudevent.prototype.time = function(_time){
|
||||
this.spec.time(_time);
|
||||
return this;
|
||||
};
|
||||
|
||||
Cloudevent.prototype.getTime = function() {
|
||||
return this.spec.getTime();
|
||||
};
|
||||
|
||||
Cloudevent.prototype.schemaurl = function(_schemaurl) {
|
||||
this.spec.schemaurl(_schemaurl);
|
||||
return this;
|
||||
};
|
||||
|
||||
Cloudevent.prototype.getSchemaurl = function() {
|
||||
return this.spec.getSchemaurl();
|
||||
};
|
||||
|
||||
Cloudevent.prototype.contenttype = function(_contenttype){
|
||||
this.spec.contenttype(_contenttype);
|
||||
return this;
|
||||
|
|
|
@ -55,21 +55,37 @@ Spec01.prototype.source = function(_source){
|
|||
return this;
|
||||
};
|
||||
|
||||
Spec01.prototype.getSource = function() {
|
||||
return this.payload["source"];
|
||||
};
|
||||
|
||||
Spec01.prototype.id = function(_id){
|
||||
this.payload["eventID"] = _id;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec01.prototype.getId = function() {
|
||||
return this.payload["eventID"];
|
||||
};
|
||||
|
||||
Spec01.prototype.time = function(_time){
|
||||
this.payload["eventTime"] = _time.toISOString();
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec01.prototype.getTime = function() {
|
||||
return this.payload["eventTime"];
|
||||
};
|
||||
|
||||
Spec01.prototype.schemaurl = function(_schemaurl){
|
||||
this.payload["schemaURL"] = _schemaurl;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec01.prototype.getSchemaurl = function() {
|
||||
return this.payload["schemaURL"];
|
||||
};
|
||||
|
||||
Spec01.prototype.contenttype = function(_contenttype){
|
||||
this.payload["contentType"] = _contenttype;
|
||||
return this;
|
||||
|
|
|
@ -54,16 +54,28 @@ Spec02.prototype.id = function(_id){
|
|||
return this;
|
||||
};
|
||||
|
||||
Spec02.prototype.getId = function() {
|
||||
return this.payload["id"];
|
||||
};
|
||||
|
||||
Spec02.prototype.time = function(_time){
|
||||
this.payload["time"] = _time.toISOString();
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec02.prototype.getTime = function() {
|
||||
return this.payload["time"];
|
||||
};
|
||||
|
||||
Spec02.prototype.schemaurl = function(_schemaurl){
|
||||
this.payload["schemaurl"] = _schemaurl;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec02.prototype.getSchemaurl = function() {
|
||||
return this.payload["schemaurl"];
|
||||
};
|
||||
|
||||
Spec02.prototype.contenttype = function(_contenttype){
|
||||
this.payload["contenttype"] = _contenttype;
|
||||
return this;
|
||||
|
|
|
@ -6,6 +6,8 @@ const type = "com.github.pull.create";
|
|||
const source = "urn:event:from:myapi/resourse/123";
|
||||
const webhook = "https://cloudevents.io/webhook";
|
||||
const contentType = "application/cloudevents+json; charset=utf-8";
|
||||
const now = new Date();
|
||||
const schemaurl = "http://cloudevents.io/schema.json"
|
||||
|
||||
const ceContentType = "application/json";
|
||||
|
||||
|
@ -21,6 +23,8 @@ var cloudevent =
|
|||
.type(type)
|
||||
.source(source)
|
||||
.contenttype(ceContentType)
|
||||
.time(now)
|
||||
.schemaurl(schemaurl)
|
||||
.data(data);
|
||||
|
||||
var httpcfg = {
|
||||
|
|
Loading…
Reference in New Issue