syntax = "proto3"; package hyapp.game.v1; option go_package = "hyapp.local/api/proto/game/v1;gamev1"; // RequestMeta 是 game-service 内部 RPC 的最小追踪和租户上下文。 message RequestMeta { string request_id = 1; string caller = 2; string gateway_node_id = 3; int64 actor_user_id = 4; int64 sent_at_ms = 5; string app_code = 6; } message GamePlatform { string app_code = 1; string platform_code = 2; string platform_name = 3; string status = 4; string api_base_url = 5; int32 sort_order = 6; int64 created_at_ms = 7; int64 updated_at_ms = 8; string adapter_type = 9; // callback_secret is visible to admin platform configuration pages and writable for key rotation. string callback_secret = 10; bool callback_secret_set = 11; repeated string callback_ip_whitelist = 12; string adapter_config_json = 13; } message GameCatalogItem { string app_code = 1; string game_id = 2; string platform_code = 3; string provider_game_id = 4; string game_name = 5; string category = 6; string icon_url = 7; string cover_url = 8; string launch_mode = 9; string orientation = 10; int64 min_coin = 11; string status = 12; int32 sort_order = 13; repeated string tags = 14; int64 created_at_ms = 15; int64 updated_at_ms = 16; int32 safe_height = 17; } message AppGame { string game_id = 1; string platform_code = 2; string name_key = 3; string name = 4; string icon_url = 5; string cover_url = 6; string category = 7; string launch_mode = 8; string orientation = 9; int64 min_coin = 10; bool enabled = 11; bool maintenance = 12; int32 sort_order = 13; int32 safe_height = 14; } message ListGamesRequest { RequestMeta meta = 1; int64 user_id = 2; string scene = 3; string room_id = 4; int64 region_id = 5; string language = 6; string client_platform = 7; } message ListGamesResponse { repeated AppGame games = 1; int64 server_time_ms = 2; } message LaunchGameRequest { RequestMeta meta = 1; int64 user_id = 2; string display_user_id = 3; string game_id = 4; string scene = 5; string room_id = 6; // access_token is the same bearer token used by the App request. // Provider adapters pass it through as the game token instead of minting a separate game token. string access_token = 7; } message LaunchGameResponse { string session_id = 1; string launch_url = 2; int64 expires_at_ms = 3; string orientation = 4; int64 server_time_ms = 5; int32 safe_height = 6; } message CallbackRequest { RequestMeta meta = 1; string platform_code = 2; string operation = 3; bytes raw_body = 4; map headers = 5; map query = 6; string remote_addr = 7; } message CallbackResponse { bytes raw_body = 1; string content_type = 2; } message CronBatchRequest { RequestMeta meta = 1; string run_id = 2; string worker_id = 3; int32 batch_size = 4; int64 lock_ttl_ms = 5; } message CronBatchResponse { int32 claimed_count = 1; int32 processed_count = 2; int32 success_count = 3; int32 failure_count = 4; bool has_more = 5; } message ListPlatformsRequest { RequestMeta meta = 1; string status = 2; } message ListPlatformsResponse { repeated GamePlatform platforms = 1; int64 server_time_ms = 2; } message UpsertPlatformRequest { RequestMeta meta = 1; GamePlatform platform = 2; } message PlatformResponse { GamePlatform platform = 1; int64 server_time_ms = 2; } message ListCatalogRequest { RequestMeta meta = 1; string platform_code = 2; string status = 3; int32 page_size = 4; string cursor = 5; } message ListCatalogResponse { repeated GameCatalogItem games = 1; string next_cursor = 2; int64 server_time_ms = 3; } message UpsertCatalogRequest { RequestMeta meta = 1; GameCatalogItem game = 2; } message CatalogResponse { GameCatalogItem game = 1; int64 server_time_ms = 2; } message SetGameStatusRequest { RequestMeta meta = 1; string game_id = 2; string status = 3; } message DeleteCatalogRequest { RequestMeta meta = 1; string game_id = 2; } message DeleteCatalogResponse { int64 server_time_ms = 1; } service GameAppService { rpc ListGames(ListGamesRequest) returns (ListGamesResponse); rpc LaunchGame(LaunchGameRequest) returns (LaunchGameResponse); } service GameCallbackService { rpc HandleCallback(CallbackRequest) returns (CallbackResponse); } // GameCronService 只给 cron-service 触发 game-service 拥有的补偿批处理。 service GameCronService { rpc ProcessLevelEventOutboxBatch(CronBatchRequest) returns (CronBatchResponse); } service GameAdminService { rpc ListPlatforms(ListPlatformsRequest) returns (ListPlatformsResponse); rpc UpsertPlatform(UpsertPlatformRequest) returns (PlatformResponse); rpc ListCatalog(ListCatalogRequest) returns (ListCatalogResponse); rpc UpsertCatalog(UpsertCatalogRequest) returns (CatalogResponse); rpc SetGameStatus(SetGameStatusRequest) returns (CatalogResponse); rpc DeleteCatalog(DeleteCatalogRequest) returns (DeleteCatalogResponse); }