From 4174ad304a2b5aafda4f302743fc408e19a4d518 Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Thu, 20 Aug 2026 23:22:46 +0700 Subject: [PATCH] update api --- proto/main.proto | 30 ++++++++++++ .../crabs/evening_detective_server/index.ts | 48 +++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/proto/main.proto b/proto/main.proto index 7502a81..10f37e7 100644 --- a/proto/main.proto +++ b/proto/main.proto @@ -365,6 +365,27 @@ service EveningDetectiveServer { }; } + rpc DownloadScenarioArchive(DownloadScenarioArchiveReq) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/api/scenarios/{id}/archive" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags : "Сценарии"; + summary: "Скачать сценарий архивом (со всеми материалами и картинками)"; + }; + } + + rpc UploadScenarioArchive(google.api.HttpBody) returns (UploadScenarioArchiveRsp) { + option (google.api.http) = { + post: "/api/scenarios/archive" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags : "Сценарии"; + summary: "Создать сценарий из архива"; + }; + } + rpc AddGame(AddGameReq) returns (AddGameRsp) { option (google.api.http) = { post: "/api/games" @@ -847,6 +868,15 @@ message DeleteScenarioPlaceRsp { string error = 1; } +message DownloadScenarioArchiveReq { + int32 id = 1; +} + +message UploadScenarioArchiveRsp { + string error = 1; + int32 id = 2; +} + message AddGameReq { string name = 1; string description = 2; diff --git a/src/api/generated/crabs/evening_detective_server/index.ts b/src/api/generated/crabs/evening_detective_server/index.ts index 1166636..dbdeb2d 100644 --- a/src/api/generated/crabs/evening_detective_server/index.ts +++ b/src/api/generated/crabs/evening_detective_server/index.ts @@ -312,6 +312,15 @@ export type DeleteScenarioPlaceRsp = { error: string | undefined; }; +export type DownloadScenarioArchiveReq = { + id: number | undefined; +}; + +export type UploadScenarioArchiveRsp = { + error: string | undefined; + id: number | undefined; +}; + export type AddGameReq = { name: string | undefined; description: string | undefined; @@ -519,6 +528,8 @@ export interface EveningDetectiveServer { AddScenarioPlace(request: AddScenarioPlaceReq): Promise; UpdateScenarioPlace(request: UpdateScenarioPlaceReq): Promise; DeleteScenarioPlace(request: DeleteScenarioPlaceReq): Promise; + DownloadScenarioArchive(request: DownloadScenarioArchiveReq): Promise; + UploadScenarioArchive(request: googleapi_HttpBody): Promise; AddGame(request: AddGameReq): Promise; GetGames(request: GetGamesReq): Promise; GetGame(request: GetGameReq): Promise; @@ -1108,6 +1119,43 @@ export function createEveningDetectiveServerClient( method: "DeleteScenarioPlace", }) as Promise; }, + DownloadScenarioArchive(request) { // eslint-disable-line @typescript-eslint/no-unused-vars + if (!request.id) { + throw new Error("missing required field request.id"); + } + const path = `api/scenarios/${request.id}/archive`; // 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: "DownloadScenarioArchive", + }) as Promise; + }, + UploadScenarioArchive(request) { // eslint-disable-line @typescript-eslint/no-unused-vars + const path = `api/scenarios/archive`; // 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: "UploadScenarioArchive", + }) as Promise; + }, AddGame(request) { // eslint-disable-line @typescript-eslint/no-unused-vars const path = `api/games`; // eslint-disable-line quotes const body = JSON.stringify(request);