You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

80 lines
1.8 KiB

syntax = "proto3";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
package game;
// TODO Reorganize this file
// Connection utilities to get a client_id
service Connection {
rpc name(google.protobuf.Empty) returns(Name);
rpc connect(Name) returns(UserID);
rpc joinLobbyWithCode(LobbyCode) returns(google.protobuf.Empty);
rpc createLobby(LobbyConfig) returns(LobbyCode);
rpc getGames(google.protobuf.Empty) returns(stream Game);
rpc getPublicLobbies (google.protobuf.Empty) returns (stream LobbyCode);
rpc disconnect (google.protobuf.Empty) returns (google.protobuf.Empty);
}
// Lobby functionality (client_id required for most of them)
service Lobby {
rpc getCardImage(CardID) returns(Image);
rpc users (google.protobuf.Empty) returns (stream Name);
rpc vote(SingleVote) returns(google.protobuf.Empty);
rpc ready(google.protobuf.Empty) returns(google.protobuf.Empty);
rpc hasNewStatus(LastStatusTimestamp) returns(HasNewStatus);
rpc getStatus(google.protobuf.Empty) returns(LobbyStatus);
rpc leave (google.protobuf.Empty) returns (google.protobuf.Empty);
}
message UserID { string id = 1; }
message Name { string name = 1; }
message LobbyConfig {
bool public = 1;
// repeated uint32 allowed_games = 2;
}
message HasNewStatus {
bool value = 1;
}
message LastStatusTimestamp {
google.protobuf.Timestamp time = 1;
uint32 lobby = 2;
}
message CardID {
uint32 gameId = 1;
string cardId = 2;
}
message Image { bytes content = 1; }
message LobbyCode { uint32 code = 1; }
message Game {
string name = 1;
string version = 2;
repeated string authors = 3;
uint32 id = 4;
}
message Vote {
string player = 1;
uint32 game = 2;
bool ready = 3;
}
message SingleVote {
uint32 game = 2;
}
message LobbyStatus {
repeated Name names = 1;
repeated Vote votes = 2;
bool isStarting = 3;
}