mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-23 15:51:24 +00:00
update stream to be about social ephemeral messaging (#255)
This commit is contained in:
@@ -3,33 +3,62 @@ syntax = "proto3";
|
||||
package stream;
|
||||
|
||||
option go_package = "./proto;stream";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
service Stream {
|
||||
rpc Publish(PublishRequest) returns (PublishResponse) {}
|
||||
rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) {}
|
||||
rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) {}
|
||||
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) {}
|
||||
rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) {}
|
||||
}
|
||||
|
||||
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
|
||||
message PublishRequest {
|
||||
// The topic to publish to
|
||||
string topic = 1;
|
||||
// The json message to publish
|
||||
google.protobuf.Struct message = 2;
|
||||
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 PublishResponse {}
|
||||
|
||||
// Subscribe to messages for a given topic.
|
||||
message SubscribeRequest {
|
||||
// The topic to subscribe to
|
||||
string topic = 1;
|
||||
message Channel {
|
||||
// name of the channel
|
||||
string name = 1;
|
||||
// last activity time
|
||||
string last_active = 2;
|
||||
}
|
||||
|
||||
// A blocking stream will be returned in response.
|
||||
message SubscribeResponse {
|
||||
// The topic subscribed to
|
||||
string topic = 1;
|
||||
// The next json message on the topic
|
||||
google.protobuf.Struct message = 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user