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["Content-Type"] = cloudevent.getContenttype();
|
||||||
|
|
||||||
_headers["CE-EventType"] = cloudevent.getType();
|
_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
|
// Set the cloudevent payload
|
||||||
_config["data"] = cloudevent.format();
|
_config["data"] = cloudevent.format();
|
||||||
|
|
|
@ -47,21 +47,37 @@ Cloudevent.prototype.source = function(_source){
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloudevent.prototype.getSource = function(){
|
||||||
|
return this.spec.getSource();
|
||||||
|
};
|
||||||
|
|
||||||
Cloudevent.prototype.id = function(_id){
|
Cloudevent.prototype.id = function(_id){
|
||||||
this.spec.id(_id);
|
this.spec.id(_id);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloudevent.prototype.getId = function() {
|
||||||
|
return this.spec.getId();
|
||||||
|
};
|
||||||
|
|
||||||
Cloudevent.prototype.time = function(_time){
|
Cloudevent.prototype.time = function(_time){
|
||||||
this.spec.time(_time);
|
this.spec.time(_time);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloudevent.prototype.getTime = function() {
|
||||||
|
return this.spec.getTime();
|
||||||
|
};
|
||||||
|
|
||||||
Cloudevent.prototype.schemaurl = function(_schemaurl) {
|
Cloudevent.prototype.schemaurl = function(_schemaurl) {
|
||||||
this.spec.schemaurl(_schemaurl);
|
this.spec.schemaurl(_schemaurl);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloudevent.prototype.getSchemaurl = function() {
|
||||||
|
return this.spec.getSchemaurl();
|
||||||
|
};
|
||||||
|
|
||||||
Cloudevent.prototype.contenttype = function(_contenttype){
|
Cloudevent.prototype.contenttype = function(_contenttype){
|
||||||
this.spec.contenttype(_contenttype);
|
this.spec.contenttype(_contenttype);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -55,21 +55,37 @@ Spec01.prototype.source = function(_source){
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec01.prototype.getSource = function() {
|
||||||
|
return this.payload["source"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec01.prototype.id = function(_id){
|
Spec01.prototype.id = function(_id){
|
||||||
this.payload["eventID"] = _id;
|
this.payload["eventID"] = _id;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec01.prototype.getId = function() {
|
||||||
|
return this.payload["eventID"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec01.prototype.time = function(_time){
|
Spec01.prototype.time = function(_time){
|
||||||
this.payload["eventTime"] = _time.toISOString();
|
this.payload["eventTime"] = _time.toISOString();
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec01.prototype.getTime = function() {
|
||||||
|
return this.payload["eventTime"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec01.prototype.schemaurl = function(_schemaurl){
|
Spec01.prototype.schemaurl = function(_schemaurl){
|
||||||
this.payload["schemaURL"] = _schemaurl;
|
this.payload["schemaURL"] = _schemaurl;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec01.prototype.getSchemaurl = function() {
|
||||||
|
return this.payload["schemaURL"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec01.prototype.contenttype = function(_contenttype){
|
Spec01.prototype.contenttype = function(_contenttype){
|
||||||
this.payload["contentType"] = _contenttype;
|
this.payload["contentType"] = _contenttype;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -54,16 +54,28 @@ Spec02.prototype.id = function(_id){
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec02.prototype.getId = function() {
|
||||||
|
return this.payload["id"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec02.prototype.time = function(_time){
|
Spec02.prototype.time = function(_time){
|
||||||
this.payload["time"] = _time.toISOString();
|
this.payload["time"] = _time.toISOString();
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec02.prototype.getTime = function() {
|
||||||
|
return this.payload["time"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec02.prototype.schemaurl = function(_schemaurl){
|
Spec02.prototype.schemaurl = function(_schemaurl){
|
||||||
this.payload["schemaurl"] = _schemaurl;
|
this.payload["schemaurl"] = _schemaurl;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec02.prototype.getSchemaurl = function() {
|
||||||
|
return this.payload["schemaurl"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec02.prototype.contenttype = function(_contenttype){
|
Spec02.prototype.contenttype = function(_contenttype){
|
||||||
this.payload["contenttype"] = _contenttype;
|
this.payload["contenttype"] = _contenttype;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -6,6 +6,8 @@ const type = "com.github.pull.create";
|
||||||
const source = "urn:event:from:myapi/resourse/123";
|
const source = "urn:event:from:myapi/resourse/123";
|
||||||
const webhook = "https://cloudevents.io/webhook";
|
const webhook = "https://cloudevents.io/webhook";
|
||||||
const contentType = "application/cloudevents+json; charset=utf-8";
|
const contentType = "application/cloudevents+json; charset=utf-8";
|
||||||
|
const now = new Date();
|
||||||
|
const schemaurl = "http://cloudevents.io/schema.json"
|
||||||
|
|
||||||
const ceContentType = "application/json";
|
const ceContentType = "application/json";
|
||||||
|
|
||||||
|
@ -21,6 +23,8 @@ var cloudevent =
|
||||||
.type(type)
|
.type(type)
|
||||||
.source(source)
|
.source(source)
|
||||||
.contenttype(ceContentType)
|
.contenttype(ceContentType)
|
||||||
|
.time(now)
|
||||||
|
.schemaurl(schemaurl)
|
||||||
.data(data);
|
.data(data);
|
||||||
|
|
||||||
var httpcfg = {
|
var httpcfg = {
|
||||||
|
|
Loading…
Reference in New Issue