92 lines
1.3 KiB
Protocol Buffer
92 lines
1.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
package chat;
|
|
|
|
import "vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto";
|
|
|
|
service Chat {
|
|
rpc Stream(stream StreamRequest) returns (stream StreamResponse) {}
|
|
}
|
|
|
|
message StreamRequest {
|
|
oneof event {
|
|
Login login = 1;
|
|
Join channel_join = 2;
|
|
Part channel_part = 3;
|
|
Message message = 4;
|
|
Quit quit = 5;
|
|
}
|
|
|
|
message Login {
|
|
string session = 1;
|
|
}
|
|
|
|
message Join {
|
|
string channel = 1;
|
|
}
|
|
|
|
message Part {
|
|
string channel = 1;
|
|
}
|
|
|
|
message Message {
|
|
string to = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
message Quit {}
|
|
}
|
|
|
|
message StreamResponse {
|
|
uint64 id = 1;
|
|
google.protobuf.Timestamp timestamp = 2;
|
|
|
|
oneof event {
|
|
Error error = 3;
|
|
Login login = 4;
|
|
Join channel_join = 5;
|
|
Names channel_names = 6;
|
|
Part channel_part = 7;
|
|
Users user_names = 8;
|
|
Message message = 9;
|
|
Shutdown shutdown = 10;
|
|
}
|
|
|
|
message Error {
|
|
int32 code = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
message Login {
|
|
string status = 1;
|
|
}
|
|
|
|
message Join {
|
|
string channel = 1;
|
|
}
|
|
|
|
message Part {
|
|
string channel = 1;
|
|
}
|
|
|
|
message Names {
|
|
string channel = 1;
|
|
repeated User users = 2;
|
|
}
|
|
|
|
message Users {
|
|
repeated User users = 1;
|
|
}
|
|
|
|
message User {
|
|
uint64 id = 1;
|
|
string name = 2;
|
|
}
|
|
|
|
message Message {
|
|
string channel = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
message Shutdown {}
|
|
}
|