Skip to content

Commit

Permalink
Update documentation for v0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyimpervious committed Aug 17, 2021
1 parent cfdd4ad commit a1959e5
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 125 deletions.
2 changes: 1 addition & 1 deletion docs/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Represents a message send to a far end node

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| msg | string | | the raw message itself to be sent to the far end node |
| msg | bytes | | the raw message itself to be sent to the far end node |
| pubkey | string | | The public key of the far end lightning node running IMP |
| amount | int64 | | Optional satoshi amount to send along with the message, defaults to 1 sat. |
| reply_to_id | string | | Optional ID of the message that this message is replying to. |
Expand Down
2 changes: 1 addition & 1 deletion docs/websocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Represents a response back from the websocket containing event information
| id | string | | The ID of the message |
| reply_to_id | string | | Optional ID of the message the sender is replying to |
| from_pubkey | string | | The node that sent the message |
| data | string | | The data the node is sending over |
| data | bytes | | The data the node is sending over |
| service_type | string | | The type of service the message is meant for |
| amount | int64 | | The amount sent as part of the message |

Expand Down
8 changes: 4 additions & 4 deletions go/proto/imp/api/messaging/messaging.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions go/proto/imp/api/websocket/websocket.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 33 additions & 9 deletions js/sendmessagerequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ proto.messaging.SendMessageRequest.prototype.toObject = function(opt_includeInst
*/
proto.messaging.SendMessageRequest.toObject = function(includeInstance, msg) {
var f, obj = {
msg: jspb.Message.getFieldWithDefault(msg, 1, ""),
msg: msg.getMsg_asB64(),
pubkey: jspb.Message.getFieldWithDefault(msg, 2, ""),
amount: jspb.Message.getFieldWithDefault(msg, 3, 0),
replyToId: jspb.Message.getFieldWithDefault(msg, 4, "")
Expand Down Expand Up @@ -111,7 +111,7 @@ proto.messaging.SendMessageRequest.deserializeBinaryFromReader = function(msg, r
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setMsg(value);
break;
case 2:
Expand Down Expand Up @@ -155,9 +155,9 @@ proto.messaging.SendMessageRequest.prototype.serializeBinary = function() {
*/
proto.messaging.SendMessageRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getMsg();
f = message.getMsg_asU8();
if (f.length > 0) {
writer.writeString(
writer.writeBytes(
1,
f
);
Expand Down Expand Up @@ -187,20 +187,44 @@ proto.messaging.SendMessageRequest.serializeBinaryToWriter = function(message, w


/**
* optional string msg = 1;
* @return {string}
* optional bytes msg = 1;
* @return {!(string|Uint8Array)}
*/
proto.messaging.SendMessageRequest.prototype.getMsg = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};


/**
* @param {string} value
* optional bytes msg = 1;
* This is a type-conversion wrapper around `getMsg()`
* @return {string}
*/
proto.messaging.SendMessageRequest.prototype.getMsg_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getMsg()));
};


/**
* optional bytes msg = 1;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getMsg()`
* @return {!Uint8Array}
*/
proto.messaging.SendMessageRequest.prototype.getMsg_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getMsg()));
};


/**
* @param {!(string|Uint8Array)} value
* @return {!proto.messaging.SendMessageRequest} returns this
*/
proto.messaging.SendMessageRequest.prototype.setMsg = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
return jspb.Message.setProto3BytesField(this, 1, value);
};


Expand Down
44 changes: 33 additions & 11 deletions js/subscriberesponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ proto.websocket.SubscribeResponse.toObject = function(includeInstance, msg) {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
replyToId: jspb.Message.getFieldWithDefault(msg, 2, ""),
fromPubkey: jspb.Message.getFieldWithDefault(msg, 3, ""),
data: jspb.Message.getFieldWithDefault(msg, 4, ""),
data: msg.getData_asB64(),
serviceType: jspb.Message.getFieldWithDefault(msg, 5, ""),
amount: jspb.Message.getFieldWithDefault(msg, 6, 0)
};
Expand Down Expand Up @@ -125,7 +125,7 @@ proto.websocket.SubscribeResponse.deserializeBinaryFromReader = function(msg, re
msg.setFromPubkey(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
case 5:
Expand Down Expand Up @@ -186,9 +186,9 @@ proto.websocket.SubscribeResponse.serializeBinaryToWriter = function(message, wr
f
);
}
f = message.getData();
f = message.getData_asU8();
if (f.length > 0) {
writer.writeString(
writer.writeBytes(
4,
f
);
Expand Down Expand Up @@ -265,20 +265,44 @@ proto.websocket.SubscribeResponse.prototype.setFromPubkey = function(value) {


/**
* optional string data = 4;
* @return {string}
* optional bytes data = 4;
* @return {!(string|Uint8Array)}
*/
proto.websocket.SubscribeResponse.prototype.getData = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};


/**
* @param {string} value
* optional bytes data = 4;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.websocket.SubscribeResponse.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};


/**
* optional bytes data = 4;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.websocket.SubscribeResponse.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};


/**
* @param {!(string|Uint8Array)} value
* @return {!proto.websocket.SubscribeResponse} returns this
*/
proto.websocket.SubscribeResponse.prototype.setData = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
return jspb.Message.setProto3BytesField(this, 4, value);
};


Expand Down Expand Up @@ -316,5 +340,3 @@ proto.websocket.SubscribeResponse.prototype.getAmount = function() {
proto.websocket.SubscribeResponse.prototype.setAmount = function(value) {
return jspb.Message.setProto3IntField(this, 6, value);
};


3 changes: 2 additions & 1 deletion openapiv2/proto/imp/api/messaging/messaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ var SwaggerJSON = `
"type": "object",
"properties": {
"msg": {
"type": "string"
"type": "string",
"format": "byte"
},
"pubkey": {
"type": "string"
Expand Down
3 changes: 2 additions & 1 deletion openapiv2/proto/imp/api/messaging/messaging.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"type": "object",
"properties": {
"msg": {
"type": "string"
"type": "string",
"format": "byte"
},
"pubkey": {
"type": "string"
Expand Down
3 changes: 2 additions & 1 deletion openapiv2/proto/imp/api/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ var SwaggerJSON = `
"type": "string"
},
"data": {
"type": "string"
"type": "string",
"format": "byte"
},
"serviceType": {
"type": "string"
Expand Down
3 changes: 2 additions & 1 deletion openapiv2/proto/imp/api/websocket/websocket.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"type": "string"
},
"data": {
"type": "string"
"type": "string",
"format": "byte"
},
"serviceType": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion proto/messaging.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ service Messaging {
* Represents a message send to a far end node
*/
message SendMessageRequest {
string msg = 1; // the raw message itself to be sent to the far end node
bytes msg = 1; // the raw message itself to be sent to the far end node
string pubkey = 2; // The public key of the far end lightning node running IMP
int64 amount = 3; // Optional satoshi amount to send along with the message, defaults to 1 sat.
string reply_to_id = 4; // Optional ID of the message that this message is replying to.
Expand Down
2 changes: 1 addition & 1 deletion proto/websocket.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ message SubscribeResponse {
string id = 1; // The ID of the message
string reply_to_id = 2; // Optional ID of the message the sender is replying to
string from_pubkey = 3; // The node that sent the message
string data = 4; // The data the node is sending over
bytes data = 4; // The data the node is sending over
string service_type = 5; // The type of service the message is meant for
int64 amount = 6; // The amount sent as part of the message
}
Loading

0 comments on commit a1959e5

Please sign in to comment.