Protocols/serviceProto.ts
2024-03-06 17:28:02 +08:00

313 lines
8.0 KiB
TypeScript

import { ServiceProto } from 'tsrpc-proto';
import { ReqLogin, ResLogin } from './account/PtlLogin';
import { MsgChat } from './MsgChat';
import { MsgChangeState } from './room/MsgChangeState';
import { MsgExit } from './room/MsgExit';
import { MsgGoToGame } from './room/MsgGoToGame';
import { ReqChangeState, ResChangeState } from './room/PtlChangeState';
import { ReqCreate, ResCreate } from './room/PtlCreate';
import { ReqExit, ResExit } from './room/PtlExit';
import { ReqJoin, ResJoin } from './room/PtlJoin';
import { ReqList, ResList } from './room/PtlList';
import { ReqSendAns, ResSendAns } from './room/PtlSendAns';
export interface ServiceType {
api: {
"account/Login": {
req: ReqLogin,
res: ResLogin
},
"room/ChangeState": {
req: ReqChangeState,
res: ResChangeState
},
"room/Create": {
req: ReqCreate,
res: ResCreate
},
"room/Exit": {
req: ReqExit,
res: ResExit
},
"room/Join": {
req: ReqJoin,
res: ResJoin
},
"room/List": {
req: ReqList,
res: ResList
},
"room/SendAns": {
req: ReqSendAns,
res: ResSendAns
}
},
msg: {
"Chat": MsgChat,
"room/ChangeState": MsgChangeState,
"room/Exit": MsgExit,
"room/GoToGame": MsgGoToGame
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"version": 6,
"services": [
{
"id": 0,
"name": "account/Login",
"type": "api"
},
{
"id": 1,
"name": "Chat",
"type": "msg"
},
{
"id": 2,
"name": "room/ChangeState",
"type": "msg"
},
{
"id": 3,
"name": "room/Exit",
"type": "msg"
},
{
"id": 4,
"name": "room/GoToGame",
"type": "msg"
},
{
"id": 5,
"name": "room/ChangeState",
"type": "api"
},
{
"id": 6,
"name": "room/Create",
"type": "api"
},
{
"id": 7,
"name": "room/Exit",
"type": "api"
},
{
"id": 8,
"name": "room/Join",
"type": "api"
},
{
"id": 9,
"name": "room/List",
"type": "api"
},
{
"id": 10,
"name": "room/SendAns",
"type": "api"
}
],
"types": {
"account/PtlLogin/ReqLogin": {
"type": "Interface",
"properties": [
{
"id": 1,
"name": "token",
"type": {
"type": "String"
}
}
]
},
"account/PtlLogin/ResLogin": {
"type": "Reference",
"target": "define/interface/ILiffData"
},
"define/interface/ILiffData": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "userId",
"type": {
"type": "String"
}
},
{
"id": 1,
"name": "displayName",
"type": {
"type": "String"
}
},
{
"id": 2,
"name": "statusMessage",
"type": {
"type": "String"
}
},
{
"id": 3,
"name": "pictureUrl",
"type": {
"type": "String"
}
}
]
},
"MsgChat/MsgChat": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "content",
"type": {
"type": "String"
}
},
{
"id": 1,
"name": "time",
"type": {
"type": "Date"
}
}
]
},
"room/MsgChangeState/MsgChangeState": {
"type": "Array",
"elementType": {
"type": "Any"
}
},
"room/MsgExit/MsgExit": {
"type": "Number"
},
"room/MsgGoToGame/MsgGoToGame": {
"type": "Tuple",
"elementTypes": [
{
"type": "Number"
},
{
"type": "Tuple",
"elementTypes": [
{
"type": "Reference",
"target": "define/interface/ILiffData"
},
{
"type": "Reference",
"target": "define/interface/ILiffData"
}
]
}
]
},
"room/PtlChangeState/ReqChangeState": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "state",
"type": {
"type": "Number"
}
}
]
},
"room/PtlChangeState/ResChangeState": {
"type": "Number"
},
"room/PtlCreate/ReqCreate": {
"type": "Interface",
"properties": [
{
"id": 1,
"name": "type",
"type": {
"type": "Number"
}
}
]
},
"room/PtlCreate/ResCreate": {
"type": "Number"
},
"room/PtlExit/ReqExit": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "null",
"type": {
"type": "String"
}
}
]
},
"room/PtlExit/ResExit": {
"type": "Number"
},
"room/PtlJoin/ReqJoin": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "roomId",
"type": {
"type": "Number"
}
}
]
},
"room/PtlJoin/ResJoin": {
"type": "Tuple",
"elementTypes": [
{
"type": "Number"
},
{
"type": "Number"
}
]
},
"room/PtlList/ReqList": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "null",
"type": {
"type": "String"
}
}
]
},
"room/PtlList/ResList": {
"type": "Array",
"elementType": {
"type": "Any"
}
},
"room/PtlSendAns/ReqSendAns": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "answer",
"type": {
"type": "Number"
}
}
]
},
"room/PtlSendAns/ResSendAns": {
"type": "Boolean"
}
}
};