Files

46 lines
794 B
Plaintext

syntax = "v1"
import "common.api"
info (
title: "聚玩游戏服务"
desc: "管理游戏目录与分类。ID 字段(int64)以 string 传输"
author: "Asadz"
version: "1.0"
)
type (
Game {
Id int64 `json:"id,string,optional"`
Name string `json:"name"`
Icon string `json:"icon"`
Category string `json:"category"`
}
GameListResp {
Items []Game `json:"items"`
Meta PageMeta `json:"meta"`
}
GetGameReq {
Id int64 `path:"id"`
}
)
@server (
prefix: api/v1/games
group: game
)
service game-api {
@doc "获取游戏列表"
@handler ListGames
get / (PageReq) returns (GameListResp)
@doc "获取游戏详情"
@handler GetGame
get /:id (GetGameReq) returns (Game)
@doc "创建游戏"
@handler CreateGame
post / (Game) returns (Game)
}