{ "openapi": "3.0.0", "info": { "title": "TSRPC Open API", "version": "1.0.0" }, "paths": { "/game/CreateRoom": { "post": { "tags": [ "game" ], "operationId": "game/CreateRoom", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/game_PtlCreateRoom_ReqCreateRoom" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/game_PtlCreateRoom_ResCreateRoom" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/game/GetAllUserLocations": { "post": { "tags": [ "game" ], "operationId": "game/GetAllUserLocations", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/game_PtlGetAllUserLocations_ReqGetAllUserLocations" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/game_PtlGetAllUserLocations_ResGetAllUserLocations" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/game/GetRoomStates": { "post": { "tags": [ "game" ], "operationId": "game/GetRoomStates", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/game_PtlGetRoomStates_ReqGetRoomStates" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/game_PtlGetRoomStates_ResGetRoomStates" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/game/KickUser": { "post": { "tags": [ "game" ], "operationId": "game/KickUser", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/game_PtlKickUser_ReqKickUser" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/game_PtlKickUser_ResKickUser" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/master/GetGameServerList": { "post": { "tags": [ "master" ], "operationId": "master/GetGameServerList", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/master_PtlGetGameServerList_ReqGetGameServerList" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/master_PtlGetGameServerList_ResGetGameServerList" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/master/GetMatchServerList": { "post": { "tags": [ "master" ], "operationId": "master/GetMatchServerList", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/master_PtlGetMatchServerList_ReqGetMatchServerList" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/master_PtlGetMatchServerList_ResGetMatchServerList" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/master/GetUserLocation": { "post": { "tags": [ "master" ], "operationId": "master/GetUserLocation", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/master_PtlGetUserLocation_ReqGetUserLocation" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/master_PtlGetUserLocation_ResGetUserLocation" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/master/ReportServerState": { "post": { "tags": [ "master" ], "operationId": "master/ReportServerState", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/master_PtlReportServerState_ReqReportServerState" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/master_PtlReportServerState_ResReportServerState" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/master/UpdateUserLocation": { "post": { "tags": [ "master" ], "operationId": "master/UpdateUserLocation", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/master_PtlUpdateUserLocation_ReqUpdateUserLocation" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/master_PtlUpdateUserLocation_ResUpdateUserLocation" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/master/UserLoginPrepare": { "post": { "tags": [ "master" ], "operationId": "master/UserLoginPrepare", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/master_PtlUserLoginPrepare_ReqUserLoginPrepare" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/master_PtlUserLoginPrepare_ResUserLoginPrepare" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/match/CancelMatch": { "post": { "tags": [ "match" ], "operationId": "match/CancelMatch", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/match_PtlCancelMatch_ReqCancelMatch" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/match_PtlCancelMatch_ResCancelMatch" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/match/CreateRoomOnMinLoadServer": { "post": { "tags": [ "match" ], "operationId": "match/CreateRoomOnMinLoadServer", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/match_PtlCreateRoomOnMinLoadServer_ReqCreateRoomOnMinLoadServer" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/match_PtlCreateRoomOnMinLoadServer_ResCreateRoomOnMinLoadServer" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/match/GetRoomListByType": { "post": { "tags": [ "match" ], "operationId": "match/GetRoomListByType", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/match_PtlGetRoomListByType_ReqGetRoomListByType" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/match_PtlGetRoomListByType_ResGetRoomListByType" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/match/GetRoomServerState": { "post": { "tags": [ "match" ], "operationId": "match/GetRoomServerState", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/match_PtlGetRoomServerState_ReqGetRoomServerState" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/match_PtlGetRoomServerState_ResGetRoomServerState" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/match/StartMatch": { "post": { "tags": [ "match" ], "operationId": "match/StartMatch", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/match_PtlStartMatch_ReqStartMatch" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/match_PtlStartMatch_ResStartMatch" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } }, "/CheckServerAlive": { "post": { "operationId": "CheckServerAlive", "requestBody": { "description": "Req", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PtlCheckServerAlive_ReqCheckServerAlive" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "description": "ApiReturn", "properties": { "isSucc": { "type": "boolean", "enum": [ true ], "default": true }, "res": { "$ref": "#/components/schemas/PtlCheckServerAlive_ResCheckServerAlive" } } } } } }, "default": { "description": "Error", "$ref": "#/components/responses/error" } } } } }, "components": { "schemas": { "game_MsgChatTransform_MsgChatTransform": { "type": "object", "properties": { "time": { "type": "string", "format": "date-time" }, "user": { "$ref": "#/components/schemas/___shared_types_UserInfo_UserInfo" }, "channel": { "type": "string" }, "content": { "type": "string" } }, "required": [ "time", "user", "content" ] }, "___shared_types_UserInfo_UserInfo": { "type": "object", "properties": { "uid": { "type": "string" }, "name": { "type": "string" }, "visualId": { "type": "number" }, "gender": { "type": "number" }, "introduction": { "type": "string" }, "coin": { "type": "number" } }, "required": [ "uid" ] }, "game_MsgUpdateRoomState_MsgUpdateRoomState": { "type": "object", "properties": { "internalUrl": { "type": "string" }, "publicUrl": { "type": "string" }, "connNum": { "type": "integer" }, "rooms": { "type": "array", "items": { "$ref": "#/components/schemas/game_MsgUpdateRoomState_IRoomState" } }, "gameTypes": { "type": "array", "items": { "type": "string" } }, "disabled": { "type": "boolean" } }, "required": [ "internalUrl", "publicUrl", "connNum", "rooms", "gameTypes" ] }, "game_MsgUpdateRoomState_IRoomState": { "type": "object", "properties": { "id": { "type": "string" }, "displayId": { "type": "string" }, "gameType": { "type": "string" }, "name": { "type": "string" }, "userNum": { "type": "integer" }, "maxUserNum": { "type": "integer" }, "playerNum": { "type": "integer" }, "maxPlayerNum": { "type": "integer" }, "startMatchTime": { "type": "integer", "description": "为 undefined 代表不在匹配中" }, "updateTime": { "type": "integer" }, "password": { "type": "string" } }, "required": [ "id", "displayId", "gameType", "name", "userNum", "maxUserNum", "playerNum", "maxPlayerNum", "updateTime" ] }, "game_PtlCreateRoom_ReqCreateRoom": { "type": "object", "properties": { "roomId": { "type": "string" }, "displayId": { "type": "string" }, "roomName": { "type": "string" }, "gameType": { "type": "string" }, "password": { "type": "string" } }, "required": [ "roomId", "displayId", "roomName", "gameType", "password" ] }, "game_PtlCreateRoom_ResCreateRoom": { "type": "object", "properties": { "roomId": { "type": "string" } }, "required": [ "roomId" ] }, "game_PtlGetAllUserLocations_ReqGetAllUserLocations": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": {} } ] }, "___shared_protocols_base_BaseRequest": { "type": "object", "properties": {} }, "game_PtlGetAllUserLocations_ResGetAllUserLocations": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "locations": { "type": "array", "items": { "type": "object", "properties": { "uid": { "type": "string" }, "roomId": { "type": "string" }, "gameType": { "type": "string" } }, "required": [ "uid" ] } } }, "required": [ "locations" ] } ] }, "___shared_protocols_base_BaseResponse": { "type": "object", "properties": {} }, "game_PtlGetRoomStates_ReqGetRoomStates": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": {} } ], "description": "@en get all room states on this server, will be called by match server periodically\n@zh 获取当前服务器上所有的房间状态,匹配服会按一定间隔调用" }, "game_PtlGetRoomStates_ResGetRoomStates": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "internalUrl": { "type": "string" }, "publicUrl": { "type": "string" }, "connNum": { "type": "integer" }, "rooms": { "type": "array", "items": { "$ref": "#/components/schemas/game_MsgUpdateRoomState_IRoomState" } }, "gameTypes": { "type": "array", "items": { "type": "string" } }, "disabled": { "type": "boolean" } }, "required": [ "internalUrl", "publicUrl", "connNum", "rooms", "gameTypes" ] } ] }, "game_PtlKickUser_ReqKickUser": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "uid": { "type": "string" }, "reason": { "type": "string" } }, "required": [ "uid", "reason" ] } ], "description": "@en kick user\n@zh 踢人" }, "game_PtlKickUser_ResKickUser": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": {} } ] }, "master_PtlGetGameServerList_ReqGetGameServerList": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": {} } ] }, "master_PtlGetGameServerList_ResGetGameServerList": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "serverList": { "type": "array", "items": { "$ref": "#/components/schemas/___shared_types_ServerDef_ServerState" } } }, "required": [ "serverList" ] } ] }, "___shared_types_ServerDef_ServerState": { "type": "object", "properties": { "type": { "type": "number", "description": "@en server type\n@zh 服务器类型" }, "ip": { "type": "string", "description": "@en server ip\n@zh 服务器 IP" }, "port": { "type": "number", "description": "@en server port\n@zh 服务器 端口" }, "interalUrl": { "type": "string" }, "publicUrl": { "type": "string", "description": "@en server public url, for client connection\n@zh 服务器对外 URL,用于客户端通信" }, "userNum": { "type": "number" }, "roomNum": { "type": "number" }, "lastUpdateTime": { "type": "number" } }, "required": [ "type", "ip", "port" ], "description": "@en server info, for cluster load balance and server list display\n@zh 服务器信息,用于集群负载均衡,以及服务器列表显示" }, "master_PtlGetMatchServerList_ReqGetMatchServerList": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": {} } ] }, "master_PtlGetMatchServerList_ResGetMatchServerList": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": {} } ] }, "master_PtlGetUserLocation_ReqGetUserLocation": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "uid": { "type": "string" } }, "required": [ "uid" ] } ] }, "master_PtlGetUserLocation_ResGetUserLocation": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "serverUrl": { "type": "string" }, "roomId": { "type": "string" }, "gameType": { "type": "string" } } } ] }, "master_PtlReportServerState_ReqReportServerState": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "state": { "$ref": "#/components/schemas/___shared_types_ServerDef_ServerState" } }, "required": [ "state" ] } ] }, "master_PtlReportServerState_ResReportServerState": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": {} } ] }, "master_PtlUpdateUserLocation_ReqUpdateUserLocation": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "uid": { "type": "string" }, "serverUrl": { "type": "string" }, "roomId": { "type": "string" }, "gameType": { "type": "string" } }, "required": [ "uid" ] } ] }, "master_PtlUpdateUserLocation_ResUpdateUserLocation": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": {} } ] }, "master_PtlUserLoginPrepare_ReqUserLoginPrepare": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "uid": { "type": "string" }, "serverUrl": { "type": "string" } }, "required": [ "uid", "serverUrl" ] } ] }, "master_PtlUserLoginPrepare_ResUserLoginPrepare": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": {} } ] }, "match_PtlCancelMatch_ReqCancelMatch": { "type": "object", "properties": { "uid": { "type": "string" } }, "required": [ "uid" ] }, "match_PtlCancelMatch_ResCancelMatch": { "type": "object", "properties": {} }, "match_PtlCreateRoomOnMinLoadServer_ReqCreateRoomOnMinLoadServer": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "uid": { "type": "string" }, "roomName": { "type": "string" }, "gameType": { "type": "string" }, "password": { "type": "string" } }, "required": [ "uid", "roomName", "gameType", "password" ] } ] }, "match_PtlCreateRoomOnMinLoadServer_ResCreateRoomOnMinLoadServer": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "serverUrl": { "type": "string" }, "roomId": { "type": "string" } }, "required": [ "serverUrl", "roomId" ] } ] }, "match_PtlGetRoomListByType_ReqGetRoomListByType": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "gameType": { "type": "string" } }, "required": [ "gameType" ] } ] }, "match_PtlGetRoomListByType_ResGetRoomListByType": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "roomList": { "type": "array", "items": { "$ref": "#/components/schemas/game_MsgUpdateRoomState_IRoomState" } } }, "required": [ "roomList" ] } ] }, "match_PtlGetRoomServerState_ReqGetRoomServerState": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": { "roomId": { "type": "string" } }, "required": [ "roomId" ] } ] }, "match_PtlGetRoomServerState_ResGetRoomServerState": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": { "state": { "$ref": "#/components/schemas/game_MsgUpdateRoomState_IRoomState" }, "serverInternalUrl": { "type": "string" }, "serverPublicUrl": { "type": "string" } } } ] }, "match_PtlStartMatch_ReqStartMatch": { "type": "object", "properties": { "uid": { "type": "string" }, "type": { "type": "string" }, "immediate": { "type": "boolean" } }, "required": [ "uid", "type" ] }, "match_PtlStartMatch_ResStartMatch": { "allOf": [ { "$ref": "#/components/schemas/___shared_types_GameServerAuthParams_GameServerAuthParams" }, { "type": "object", "properties": {} } ] }, "___shared_types_GameServerAuthParams_GameServerAuthParams": { "type": "object", "properties": { "roomId": { "type": "string" }, "gameType": { "type": "string" }, "token": { "type": "string" }, "time": { "type": "number" }, "serverUrl": { "type": "string" } }, "required": [ "roomId", "gameType", "token", "time", "serverUrl" ] }, "PtlCheckServerAlive_ReqCheckServerAlive": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseRequest" }, { "type": "object", "properties": {} } ] }, "PtlCheckServerAlive_ResCheckServerAlive": { "allOf": [ { "$ref": "#/components/schemas/___shared_protocols_base_BaseResponse" }, { "type": "object", "properties": {} } ] }, "?bson_ObjectID": { "type": "string" }, "?bson_ObjectId": { "type": "string" }, "?mongodb_ObjectID": { "type": "string" }, "?mongodb_ObjectId": { "type": "string" } }, "responses": { "error": { "description": "Error", "content": { "application/json": { "schema": { "type": "object", "title": "API 错误", "description": "业务错误(ApiError)返回 HTTP 状态码 200,其它错误返回 HTTP 状态码 500", "properties": { "isSucc": { "type": "boolean", "enum": [ false ], "default": false }, "err": { "type": "object", "description": "TsrpcError", "properties": { "message": { "type": "string" }, "type": { "type": "string", "enum": [ "ApiError", "NetworkError", "ServerError", "ClientError" ] }, "code": { "oneOf": [ { "type": "string" }, { "type": "integer" } ], "nullable": true } }, "required": [ "message", "type" ] } } } } } } } } }