Files
services/stream/proto/stream.proto

65 lines
1.3 KiB
Protocol Buffer

syntax = "proto3";
package stream;
option go_package = "./proto;stream";
service Stream {
rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) {}
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) {}
rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) {}
}
message Message {
// id of the message
string id = 1;
// text of the message
string text = 2;
// time of message creation
string timestamp = 3;
// the channel name
string channel = 4;
// the associated metadata
map<string,string> metadata = 5;
}
message Channel {
// name of the channel
string name = 1;
// last activity time
string last_active = 2;
}
// SendMessage a message to the stream.
message SendMessageRequest {
// The channel to send to
string channel = 1;
// The message text to send
string text = 2;
}
message SendMessageResponse {}
// List all the active channels
message ListChannelsRequest {
}
message ListChannelsResponse {
repeated Channel channels = 1;
}
// List messages for a given channel
message ListMessagesRequest {
// The channel to subscribe to
string channel = 1;
// number of message to return
int32 limit = 2;
}
message ListMessagesResponse {
// The channel subscribed to
string channel = 1;
// Messages are chronological order
repeated Message messages = 2;
}