Protocols/serviceProto.ts

190 lines
4.6 KiB
TypeScript
Raw Normal View History

2023-08-31 11:28:49 +00:00
import { ServiceProto } from 'tsrpc-proto';
2023-09-02 14:33:23 +00:00
import { ReqLogin, ResLogin } from './account/PtlLogin';
2023-08-31 11:28:49 +00:00
import { MsgChat } from './MsgChat';
2023-09-02 14:33:23 +00:00
import { MsgExit } from './room/MsgExit';
import { MsgGoToGame } from './room/MsgGoToGame';
import { ReqCreate, ResCreate } from './room/PtlCreate';
import { ReqExit, ResExit } from './room/PtlExit';
import { ReqJoin, ResJoin } from './room/PtlJoin';
import { ReqList, ResList } from './room/PtlList';
2023-08-31 11:28:49 +00:00
export interface ServiceType {
api: {
2023-09-02 14:33:23 +00:00
"account/Login": {
req: ReqLogin,
res: ResLogin
2023-08-31 11:28:49 +00:00
},
2023-09-02 14:33:23 +00:00
"room/Create": {
req: ReqCreate,
res: ResCreate
2023-08-31 11:28:49 +00:00
},
2023-09-02 14:33:23 +00:00
"room/Exit": {
req: ReqExit,
res: ResExit
},
"room/Join": {
req: ReqJoin,
res: ResJoin
},
"room/List": {
req: ReqList,
res: ResList
2023-08-31 11:28:49 +00:00
}
},
msg: {
2023-09-02 14:33:23 +00:00
"Chat": MsgChat,
"room/Exit": MsgExit,
"room/GoToGame": MsgGoToGame
2023-08-31 11:28:49 +00:00
}
}
export const serviceProto: ServiceProto<ServiceType> = {
2023-09-02 14:33:23 +00:00
"version": 10,
2023-08-31 11:28:49 +00:00
"services": [
2023-09-02 14:33:23 +00:00
{
"id": 4,
"name": "account/Login",
"type": "api"
},
2023-08-31 11:28:49 +00:00
{
"id": 0,
"name": "Chat",
"type": "msg"
},
{
2023-09-02 14:33:23 +00:00
"id": 10,
"name": "room/Exit",
"type": "msg"
},
{
"id": 11,
"name": "room/GoToGame",
"type": "msg"
},
{
"id": 6,
"name": "room/Create",
2023-08-31 11:28:49 +00:00
"type": "api"
},
{
2023-09-02 14:33:23 +00:00
"id": 7,
"name": "room/Exit",
2023-08-31 11:28:49 +00:00
"type": "api"
},
{
2023-09-02 14:33:23 +00:00
"id": 8,
"name": "room/Join",
"type": "api"
},
{
"id": 9,
"name": "room/List",
2023-08-31 11:28:49 +00:00
"type": "api"
}
],
"types": {
2023-09-02 14:33:23 +00:00
"account/PtlLogin/ReqLogin": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "name",
"type": {
"type": "String"
}
}
]
},
"account/PtlLogin/ResLogin": {
"type": "Number"
},
2023-08-31 11:28:49 +00:00
"MsgChat/MsgChat": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "content",
"type": {
"type": "String"
}
},
{
"id": 1,
"name": "time",
"type": {
"type": "Date"
}
}
]
},
2023-09-02 14:33:23 +00:00
"room/MsgExit/MsgExit": {
"type": "Number"
},
"room/MsgGoToGame/MsgGoToGame": {
"type": "Number"
},
"room/PtlCreate/ReqCreate": {
2023-08-31 11:28:49 +00:00
"type": "Interface",
"properties": [
{
2023-09-02 14:33:23 +00:00
"id": 1,
"name": "null",
2023-08-31 11:28:49 +00:00
"type": {
"type": "String"
}
}
]
},
2023-09-02 14:33:23 +00:00
"room/PtlCreate/ResCreate": {
2023-08-31 11:28:49 +00:00
"type": "Number"
},
2023-09-02 14:33:23 +00:00
"room/PtlExit/ReqExit": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "null",
"type": {
"type": "String"
}
}
]
2023-08-31 11:28:49 +00:00
},
2023-09-02 14:33:23 +00:00
"room/PtlExit/ResExit": {
"type": "Number"
2023-08-31 11:28:49 +00:00
},
2023-09-02 14:33:23 +00:00
"room/PtlJoin/ReqJoin": {
2023-08-31 11:28:49 +00:00
"type": "Interface",
"properties": [
{
"id": 0,
2023-09-02 14:33:23 +00:00
"name": "roomId",
2023-08-31 11:28:49 +00:00
"type": {
2023-09-02 14:33:23 +00:00
"type": "Number"
2023-08-31 11:28:49 +00:00
}
}
]
},
2023-09-02 14:33:23 +00:00
"room/PtlJoin/ResJoin": {
"type": "Number"
},
"room/PtlList/ReqList": {
2023-08-31 11:28:49 +00:00
"type": "Interface",
"properties": [
{
"id": 0,
2023-09-02 14:33:23 +00:00
"name": "null",
2023-08-31 11:28:49 +00:00
"type": {
2023-09-02 14:33:23 +00:00
"type": "String"
2023-08-31 11:28:49 +00:00
}
}
]
2023-09-02 14:33:23 +00:00
},
"room/PtlList/ResList": {
"type": "Array",
"elementType": {
"type": "Any"
}
2023-08-31 11:28:49 +00:00
}
}
2023-08-31 08:59:11 +00:00
};