This commit is contained in:
2026-10-07 01:43:36 +07:00
parent 22c0b7ab4b
commit 71355777fd
7 changed files with 812 additions and 18 deletions
+211 -10
View File
@@ -277,6 +277,62 @@ service EveningDetectiveServer {
};
}
rpc GetPlaylists(GetPlaylistsReq) returns (GetPlaylistsRsp) {
option (google.api.http) = { get: "/api/playlists" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Получить плейлисты";
};
}
rpc CreatePlaylist(CreatePlaylistReq) returns (CreatePlaylistRsp) {
option (google.api.http) = { post: "/api/playlists" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Создать плейлист";
};
}
rpc UpdatePlaylist(UpdatePlaylistReq) returns (UpdatePlaylistRsp) {
option (google.api.http) = { put: "/api/playlists/{ID}" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Изменить плейлист";
};
}
rpc DeletePlaylist(DeletePlaylistReq) returns (DeletePlaylistRsp) {
option (google.api.http) = { delete: "/api/playlists/{ID}" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Удалить плейлист";
};
}
rpc UploadPlaylistTrack(UploadPlaylistTrackReq) returns (UploadPlaylistTrackRsp) {
option (google.api.http) = { post: "/api/playlists/{playlistID}/tracks" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Загрузить MP3 в плейлист";
};
}
rpc DeletePlaylistTrack(DeletePlaylistTrackReq) returns (DeletePlaylistTrackRsp) {
option (google.api.http) = { delete: "/api/playlists/{playlistID}/tracks/{trackID}" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Удалить MP3 из плейлиста";
};
}
rpc SetScenarioPlaylist(SetScenarioPlaylistReq) returns (SetScenarioPlaylistRsp) {
option (google.api.http) = { put: "/api/scenarios/{ID}/playlist" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Назначить плейлист сценарию";
};
}
rpc AddScenario(AddScenarioReq) returns (AddScenarioRsp) {
option (google.api.http) = {
post: "/api/scenario"
@@ -596,6 +652,31 @@ service EveningDetectiveServer {
};
}
rpc GetGameMusic(GetGameMusicReq) returns (GetGameMusicRsp) {
option (google.api.http) = { get: "/api/games/{gameID}/music" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Получить музыку игры";
};
}
rpc SetGameMusic(SetGameMusicReq) returns (SetGameMusicRsp) {
option (google.api.http) = { post: "/api/games/{gameID}/music" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Музыка";
summary: "Изменить музыку игры";
};
}
rpc AdvanceScreenMusic(AdvanceScreenMusicReq) returns (AdvanceScreenMusicRsp) {
option (google.api.http) = { post: "/api/screens/music/advance" body: "*" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: { security_requirement: {} }
tags: "Музыка";
summary: "Перейти к следующему треку экрана";
};
}
// Привязать экран к игре. Требует авторизацию организатора, автора или администратора.
rpc BindScreen(BindScreenReq) returns (BindScreenRsp) {
option (google.api.http) = {
@@ -688,18 +769,18 @@ service EveningDetectiveServer {
rpc GetScreenPlan(GetScreenPlanReq) returns (GetScreenPlanRsp) {
option (google.api.http) = { get: "/api/games/{gameID}/screen-plan" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Экраны";
tags : "Экраны";
summary: "Получить план экранов";
};
}
rpc SaveScreenPlan(SaveScreenPlanReq) returns (SaveScreenPlanRsp) {
option (google.api.http) = {
put: "/api/games/{gameID}/screen-plan"
put : "/api/games/{gameID}/screen-plan"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Экраны";
tags : "Экраны";
summary: "Сохранить план экранов";
};
}
@@ -710,7 +791,7 @@ service EveningDetectiveServer {
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Экраны";
tags : "Экраны";
summary: "Перейти на шаг плана экранов";
};
}
@@ -1164,6 +1245,73 @@ message DownloadFileReq {
string filename = 1;
}
message PlaylistTrack {
int32 ID = 1;
string name = 2;
string filename = 3;
int32 position = 4;
}
message Playlist {
int32 ID = 1;
string name = 2;
repeated PlaylistTrack tracks = 3;
}
message GetPlaylistsReq {}
message GetPlaylistsRsp {
repeated Playlist playlists = 1;
}
message CreatePlaylistReq {
string name = 1;
}
message CreatePlaylistRsp {
Playlist playlist = 1;
}
message UpdatePlaylistReq {
int32 ID = 1;
string name = 2;
}
message UpdatePlaylistRsp {
Playlist playlist = 1;
}
message DeletePlaylistReq {
int32 ID = 1;
}
message DeletePlaylistRsp {}
message UploadPlaylistTrackReq {
int32 playlistID = 1;
string name = 2;
string filename = 3;
bytes data = 4;
}
message UploadPlaylistTrackRsp {
Playlist playlist = 1;
}
message DeletePlaylistTrackReq {
int32 playlistID = 1;
int32 trackID = 2;
}
message DeletePlaylistTrackRsp {}
message SetScenarioPlaylistReq {
int32 ID = 1;
int32 playlistID = 2;
}
message SetScenarioPlaylistRsp {}
message AddScenarioReq {
string name = 1;
}
@@ -1206,6 +1354,7 @@ message Scenario {
double average_rating = 11;
int32 reviews_count = 12;
string difficulty = 13;
optional int32 music_playlist_id = 14 [json_name = "music_playlist_id"];
}
message Story {
@@ -1487,6 +1636,7 @@ message ScreenState {
int64 timer_remaining_seconds = 18;
ScreenTimerState timer_state = 19;
string text = 20;
MusicState music = 21;
}
message CreateScreenSessionReq {}
@@ -1513,6 +1663,57 @@ message GetGameScreensRsp {
repeated ScreenState screens = 1;
}
enum MusicPlaybackState {
MUSIC_PLAYBACK_UNSPECIFIED = 0;
MUSIC_PLAYBACK_STOPPED = 1;
MUSIC_PLAYBACK_PLAYING = 2;
MUSIC_PLAYBACK_PAUSED = 3;
}
message MusicState {
Playlist playlist = 1;
int32 track_index = 2;
int64 position_ms = 3;
int32 volume = 4;
bool loop = 5;
MusicPlaybackState playback = 6;
int64 state_version = 7;
}
message GetGameMusicReq {
int32 gameID = 1;
}
message GetGameMusicRsp {
repeated Playlist playlists = 1;
MusicState state = 2;
int32 scenario_playlist_id = 3;
int32 game_playlist_id = 4;
}
message SetGameMusicReq {
int32 gameID = 1;
int32 playlistID = 2;
int32 track_index = 3;
int64 position_ms = 4;
int32 volume = 5;
bool loop = 6;
MusicPlaybackState playback = 7;
}
message SetGameMusicRsp {
MusicState state = 1;
}
message AdvanceScreenMusicReq {
string screenID = 1;
string accessToken = 2;
}
message AdvanceScreenMusicRsp {
MusicState state = 1;
}
message BindScreenReq {
string screenID = 1;
string accessToken = 2;
@@ -1603,8 +1804,8 @@ message ScreenPlanStep {
}
message ScreenPlan {
repeated ScreenPlanStep steps = 1;
int32 current_step = 2;
repeated ScreenPlanStep steps = 1;
int32 current_step = 2;
}
message GetScreenPlanReq {
@@ -1616,9 +1817,9 @@ message GetScreenPlanRsp {
}
message SaveScreenPlanReq {
int32 gameID = 1;
repeated ScreenPlanStep steps = 2;
int32 current_step = 3;
int32 gameID = 1;
repeated ScreenPlanStep steps = 2;
int32 current_step = 3;
}
message SaveScreenPlanRsp {
@@ -1626,7 +1827,7 @@ message SaveScreenPlanRsp {
}
message SetScreenPlanStepReq {
int32 gameID = 1;
int32 gameID = 1;
int32 current_step = 2;
}