evening_detective/api/main.proto

159 lines
2.6 KiB
Protocol Buffer

syntax = "proto3";
package crabs.evening_detective;
import "google/api/annotations.proto";
option go_package = "pkg/proto";
service EveningDetective {
rpc Ping(PingReq) returns (PingRsp) {
option (google.api.http) = {
get: "/ping"
};
}
rpc AddTeams(AddTeamsReq) returns (AddTeamsRsp) {
option (google.api.http) = {
post: "/teams",
body: "*"
};
}
rpc GetTeams(GetTeamsReq) returns (GetTeamsRsp) {
option (google.api.http) = {
get: "/teams"
};
}
rpc GetTeamsCSV(GetTeamsCSVReq) returns (GetTeamsCSVRsp) {
option (google.api.http) = {
get: "/csv"
};
}
rpc GetTeam(GetTeamReq) returns (GetTeamRsp) {
option (google.api.http) = {
get: "/teams/{id}"
};
}
rpc DeleteTeams(DeleteTeamsReq) returns (DeleteTeamsRsp) {
option (google.api.http) = {
delete: "/teams"
};
}
rpc AddAction(AddActionReq) returns (AddActionRsp) {
option (google.api.http) = {
post: "/actions"
};
}
rpc GameStart(GameStartReq) returns (GameStartRsp) {
option (google.api.http) = {
post: "/game/start",
body: "*"
};
}
rpc GameStop(GameStopReq) returns (GameStopRsp) {
option (google.api.http) = {
post: "/game/stop",
body: "*"
};
}
rpc GiveApplications(GiveApplicationsReq) returns (GiveApplicationsRsp) {
option (google.api.http) = {
post: "/teams/{teamId}/applications",
body: "*"
};
}
}
message PingReq {}
message PingRsp {}
message AddTeamsReq {
repeated Team teams = 1;
}
message Team {
string name = 1;
}
message AddTeamsRsp {
repeated TeamFull teams = 1;
}
message TeamFull {
int64 id = 1;
string name = 2;
string password = 3;
}
message GetTeamsReq {}
message GetTeamsRsp {
repeated TeamAdvanced teams = 1;
}
message GetTeamsCSVReq {}
message GetTeamsCSVRsp {
string data = 1;
}
message TeamAdvanced {
int64 id = 1;
string name = 2;
int64 spendTime = 3;
repeated Application applications = 4;
}
message Application {
string name = 1;
}
message GetTeamReq {
int64 id = 1;
}
message GetTeamRsp {
repeated AddActionRsp actions = 1;
}
message DeleteTeamsReq {}
message DeleteTeamsRsp {}
message AddActionReq {
string to = 1;
}
message AddActionRsp {
int64 id = 1;
string to = 2;
string text = 3;
repeated Application applications = 4;
}
message GameStartReq {}
message GameStartRsp {}
message GameStopReq {
int64 timeSeconds = 1;
}
message GameStopRsp {}
message GiveApplicationsReq {
int64 teamId = 1;
repeated Application applications = 2;
}
message GiveApplicationsRsp {}