add new methods

This commit is contained in:
2026-07-28 23:01:17 +07:00
parent 5d3044abb9
commit c04ae2868c
2 changed files with 640 additions and 1 deletions
+263 -1
View File
@@ -323,6 +323,138 @@ service EveningDetectiveServer {
summary: "Удалить точку сценария";
};
}
rpc AddGame(AddGameReq) returns (AddGameRsp) {
option (google.api.http) = {
post: "/api/games"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Игры";
summary: "Создать игру";
};
}
rpc GetGames(GetGamesReq) returns (GetGamesRsp) {
option (google.api.http) = {
get: "/api/games"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Игры";
summary: "Получить игры";
};
}
rpc GetGame(GetGameReq) returns (GetGameRsp) {
option (google.api.http) = {
get: "/api/games/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Игры";
summary: "Получить игру";
};
}
rpc UpdateGame(UpdateGameReq) returns (UpdateGameRsp) {
option (google.api.http) = {
put : "/api/games/{id}"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Игры";
summary: "Обновить игру";
};
}
rpc DeleteGame(DeleteGameReq) returns (DeleteGameRsp) {
option (google.api.http) = {
delete: "/api/games/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Игры";
summary: "Удалить игру";
};
}
rpc AddTeam(AddTeamReq) returns (AddTeamRsp) {
option (google.api.http) = {
post: "/api/teams",
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Команда";
summary: "Создать команду";
};
}
rpc UpdateTeam(UpdateTeamReq) returns (UpdateTeamRsp) {
option (google.api.http) = {
put : "/api/teams/{id}",
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Команда";
summary: "Обновить команду";
};
}
rpc DeleteTeam(DeleteTeamReq) returns (DeleteTeamRsp) {
option (google.api.http) = {
delete: "/api/teams/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Команда";
summary: "Удалить команду";
};
}
rpc GiveTeamApplications(GiveTeamApplicationsReq) returns (GiveTeamApplicationsRsp) {
option (google.api.http) = {
post: "/api/teams/{id}/applications",
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Команда";
summary: "Выдать улику";
};
}
rpc GetTeamStory(GetTeamStoryReq) returns (GetTeamStoryRsp) {
option (google.api.http) = {
get: "/api/teams/{id}/story"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
tags : "Ходы";
summary: "Получить ходы";
};
}
rpc AddTeamAction(AddTeamActionReq) returns (AddTeamActionRsp) {
option (google.api.http) = {
post: "/api/teams/{id}/actions",
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
tags : "Ходы";
summary: "Сделать ход";
};
}
rpc DeleteLastTeamAction(DeleteLastTeamActionReq) returns (DeleteLastTeamActionRsp) {
option (google.api.http) = {
delete: "/api/teams/{id}/last-actions"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Ходы";
summary: "Удалить последний ход";
};
}
}
message PingReq {}
@@ -582,4 +714,134 @@ message DeleteScenarioPlaceReq {
message DeleteScenarioPlaceRsp {
string error = 1;
}
}
message AddGameReq {
string name = 1;
string description = 2;
google.protobuf.Timestamp start_at = 3;
int32 scenario_id = 4;
}
message AddGameRsp {
string error = 1;
int32 id = 2;
}
message GetGamesReq {}
message GetGamesRsp {
string error = 1;
repeated Game games = 2;
}
message Game {
int32 id = 1;
string name = 2;
string description = 3;
google.protobuf.Timestamp start_at = 4;
string status = 5;
Scenario scenario = 6;
repeated Team teams = 7;
}
message Team {
int32 id = 1;
string name = 2;
string status = 3;
string password = 4;
int32 actions_count = 5;
repeated Application applications = 6;
}
message GetGameReq {
int32 id = 1;
}
message GetGameRsp {
string error = 1;
Game game = 2;
}
message UpdateGameReq {
int32 id = 1;
string name = 2;
string description = 3;
google.protobuf.Timestamp start_at = 4;
int32 scenario_id = 5;
}
message UpdateGameRsp {
string error = 1;
}
message DeleteGameReq {
int32 id = 1;
}
message DeleteGameRsp {
string error = 1;
}
message AddTeamReq {
int32 game_id = 1;
string name = 2;
}
message AddTeamRsp {
string error = 1;
}
message UpdateTeamReq {
int32 id = 1;
string name = 2;
}
message UpdateTeamRsp {
string error = 1;
}
message DeleteTeamReq {
int64 id = 1;
}
message DeleteTeamRsp {
string error = 1;
}
message GiveTeamApplicationsReq {
int64 id = 1;
string name = 2;
}
message GiveTeamApplicationsRsp {
string error = 1;
}
message GetTeamStoryReq {
int64 id = 1;
string password = 2;
}
message GetTeamStoryRsp {
string error = 1;
Story story = 2;
}
message AddTeamActionReq {
int64 id = 1;
string password = 2;
string code = 3;
}
message AddTeamActionRsp {
string error = 1;
}
message DeleteLastTeamActionReq {
int64 id = 1;
}
message DeleteLastTeamActionRsp {
string error = 1;
}
@@ -273,6 +273,137 @@ export type DeleteScenarioPlaceRsp = {
error: string | undefined;
};
export type AddGameReq = {
name: string | undefined;
description: string | undefined;
startAt: wellKnownTimestamp | undefined;
scenarioId: number | undefined;
};
export type AddGameRsp = {
error: string | undefined;
id: number | undefined;
};
export type GetGamesReq = {
};
export type GetGamesRsp = {
error: string | undefined;
games: Game[] | undefined;
};
export type Game = {
id: number | undefined;
name: string | undefined;
description: string | undefined;
startAt: wellKnownTimestamp | undefined;
status: string | undefined;
scenario: Scenario | undefined;
teams: Team[] | undefined;
};
export type Team = {
id: number | undefined;
name: string | undefined;
status: string | undefined;
password: string | undefined;
actionsCount: number | undefined;
applications: Application[] | undefined;
};
export type GetGameReq = {
id: number | undefined;
};
export type GetGameRsp = {
error: string | undefined;
game: Game | undefined;
};
export type UpdateGameReq = {
id: number | undefined;
name: string | undefined;
description: string | undefined;
startAt: wellKnownTimestamp | undefined;
scenarioId: number | undefined;
};
export type UpdateGameRsp = {
error: string | undefined;
};
export type DeleteGameReq = {
id: number | undefined;
};
export type DeleteGameRsp = {
error: string | undefined;
};
export type AddTeamReq = {
gameId: number | undefined;
name: string | undefined;
};
export type AddTeamRsp = {
error: string | undefined;
};
export type UpdateTeamReq = {
id: number | undefined;
name: string | undefined;
};
export type UpdateTeamRsp = {
error: string | undefined;
};
export type DeleteTeamReq = {
id: number | undefined;
};
export type DeleteTeamRsp = {
error: string | undefined;
};
export type GiveTeamApplicationsReq = {
id: number | undefined;
name: string | undefined;
};
export type GiveTeamApplicationsRsp = {
error: string | undefined;
};
export type GetTeamStoryReq = {
id: number | undefined;
password: string | undefined;
};
export type GetTeamStoryRsp = {
error: string | undefined;
story: Story | undefined;
};
export type AddTeamActionReq = {
id: number | undefined;
password: string | undefined;
code: string | undefined;
};
export type AddTeamActionRsp = {
error: string | undefined;
};
export type DeleteLastTeamActionReq = {
id: number | undefined;
};
export type DeleteLastTeamActionRsp = {
error: string | undefined;
};
export interface EveningDetectiveServer {
Ping(request: PingReq): Promise<PingRsp>;
Echo(request: EchoReq): Promise<EchoRsp>;
@@ -300,6 +431,18 @@ export interface EveningDetectiveServer {
AddScenarioPlace(request: AddScenarioPlaceReq): Promise<AddScenarioPlaceRsp>;
UpdateScenarioPlace(request: UpdateScenarioPlaceReq): Promise<UpdateScenarioPlaceRsp>;
DeleteScenarioPlace(request: DeleteScenarioPlaceReq): Promise<DeleteScenarioPlaceRsp>;
AddGame(request: AddGameReq): Promise<AddGameRsp>;
GetGames(request: GetGamesReq): Promise<GetGamesRsp>;
GetGame(request: GetGameReq): Promise<GetGameRsp>;
UpdateGame(request: UpdateGameReq): Promise<UpdateGameRsp>;
DeleteGame(request: DeleteGameReq): Promise<DeleteGameRsp>;
AddTeam(request: AddTeamReq): Promise<AddTeamRsp>;
UpdateTeam(request: UpdateTeamReq): Promise<UpdateTeamRsp>;
DeleteTeam(request: DeleteTeamReq): Promise<DeleteTeamRsp>;
GiveTeamApplications(request: GiveTeamApplicationsReq): Promise<GiveTeamApplicationsRsp>;
GetTeamStory(request: GetTeamStoryReq): Promise<GetTeamStoryRsp>;
AddTeamAction(request: AddTeamActionReq): Promise<AddTeamActionRsp>;
DeleteLastTeamAction(request: DeleteLastTeamActionReq): Promise<DeleteLastTeamActionRsp>;
}
type RequestType = {
@@ -804,6 +947,240 @@ export function createEveningDetectiveServerClient(
method: "DeleteScenarioPlace",
}) as Promise<DeleteScenarioPlaceRsp>;
},
AddGame(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
const path = `api/games`; // eslint-disable-line quotes
const body = JSON.stringify(request);
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "POST",
body,
}, {
service: "EveningDetectiveServer",
method: "AddGame",
}) as Promise<AddGameRsp>;
},
GetGames(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
const path = `api/games`; // eslint-disable-line quotes
const body = null;
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "GET",
body,
}, {
service: "EveningDetectiveServer",
method: "GetGames",
}) as Promise<GetGamesRsp>;
},
GetGame(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/games/${request.id}`; // eslint-disable-line quotes
const body = null;
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "GET",
body,
}, {
service: "EveningDetectiveServer",
method: "GetGame",
}) as Promise<GetGameRsp>;
},
UpdateGame(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/games/${request.id}`; // eslint-disable-line quotes
const body = JSON.stringify(request);
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "PUT",
body,
}, {
service: "EveningDetectiveServer",
method: "UpdateGame",
}) as Promise<UpdateGameRsp>;
},
DeleteGame(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/games/${request.id}`; // eslint-disable-line quotes
const body = null;
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "DELETE",
body,
}, {
service: "EveningDetectiveServer",
method: "DeleteGame",
}) as Promise<DeleteGameRsp>;
},
AddTeam(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
const path = `api/teams`; // eslint-disable-line quotes
const body = JSON.stringify(request);
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "POST",
body,
}, {
service: "EveningDetectiveServer",
method: "AddTeam",
}) as Promise<AddTeamRsp>;
},
UpdateTeam(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/teams/${request.id}`; // eslint-disable-line quotes
const body = JSON.stringify(request);
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "PUT",
body,
}, {
service: "EveningDetectiveServer",
method: "UpdateTeam",
}) as Promise<UpdateTeamRsp>;
},
DeleteTeam(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/teams/${request.id}`; // eslint-disable-line quotes
const body = null;
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "DELETE",
body,
}, {
service: "EveningDetectiveServer",
method: "DeleteTeam",
}) as Promise<DeleteTeamRsp>;
},
GiveTeamApplications(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/teams/${request.id}/applications`; // eslint-disable-line quotes
const body = JSON.stringify(request);
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "POST",
body,
}, {
service: "EveningDetectiveServer",
method: "GiveTeamApplications",
}) as Promise<GiveTeamApplicationsRsp>;
},
GetTeamStory(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/teams/${request.id}/story`; // eslint-disable-line quotes
const body = null;
const queryParams: string[] = [];
if (request.password) {
queryParams.push(`password=${encodeURIComponent(request.password.toString())}`)
}
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "GET",
body,
}, {
service: "EveningDetectiveServer",
method: "GetTeamStory",
}) as Promise<GetTeamStoryRsp>;
},
AddTeamAction(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/teams/${request.id}/actions`; // eslint-disable-line quotes
const body = JSON.stringify(request);
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "POST",
body,
}, {
service: "EveningDetectiveServer",
method: "AddTeamAction",
}) as Promise<AddTeamActionRsp>;
},
DeleteLastTeamAction(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
if (!request.id) {
throw new Error("missing required field request.id");
}
const path = `api/teams/${request.id}/last-actions`; // eslint-disable-line quotes
const body = null;
const queryParams: string[] = [];
let uri = path;
if (queryParams.length > 0) {
uri += `?${queryParams.join("&")}`
}
return handler({
path: uri,
method: "DELETE",
body,
}, {
service: "EveningDetectiveServer",
method: "DeleteLastTeamAction",
}) as Promise<DeleteLastTeamActionRsp>;
},
};
}
// Message that represents an arbitrary HTTP body. It should only be used for