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
@@ -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