syntax = "proto3"; package game; // TODO Reorganize this file // Connection utilities to get a client_id service Connection { rpc name(Null) returns(Name); rpc connect(Name) returns(UserID); rpc joinLobbyWithCode(LobbyCode) returns(Null); rpc createLobby(LobbyConfig) returns(LobbyCode); rpc getGames(Null) returns(stream Game); rpc getPublicLobbies (Null) returns (stream LobbyCode); rpc disconnect (Null) returns (Null); } // Lobby functionality (client_id required for most of them) service Lobby { rpc getCardImage(CardID) returns(Image); rpc users (Null) returns (stream Name); rpc vote(Vote) returns(Null); rpc ready(Null) returns(Null); rpc status(Null) returns(LobbyStatus); rpc leave (Null) returns (Null); } message UserID { string id = 1; } message Name { string name = 1; } message LobbyConfig { bool public = 1; // repeated uint32 allowed_games = 2; } message Null {} 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 { uint64 id = 1; } message LobbyStatus { repeated Vote votes = 1; repeated Player ready = 2; bool isStarting = 3; } message Player { string name = 1; uint32 id = 2; }