Chat add support for CLI

This commit is contained in:
Ben Toogood
2020-10-16 10:28:40 +01:00
parent f2fcf3d3fb
commit b3a93ce52a
5 changed files with 270 additions and 41 deletions

View File

@@ -10,6 +10,8 @@ service Chat {
rpc New(NewRequest) returns (NewResponse);
// History returns the historical messages in a chat
rpc History(HistoryRequest) returns (HistoryResponse);
// Send a single message to the chat
rpc Send(SendRequest) returns (SendResponse);
// Connect to a chat using a bidirectional stream enabling the client to send and recieve messages
// over a single RPC. When a message is sent on the stream, it will be added to the chat history
// and sent to the other connected users. When opening the connection, the client should provide
@@ -39,6 +41,23 @@ message HistoryResponse {
repeated Message messages = 1;
}
// SendRequest contains a single message to send to a chat
message SendRequest {
// a client side id, should be validated by the server to make the request retry safe
string client_id = 1;
// id of the chat the message is being sent to / from
string chat_id = 2;
// id of the user who sent the message
string user_id = 3;
// subject of the message
string subject = 4;
// text of the message
string text = 5;
}
// SendResponse is a blank message returned when a message is successfully created
message SendResponse {}
// Message sent to a chat
message Message {
// id of the message, allocated by the server