Files

283 lines
5.6 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "聚玩游戏服务",
"description": "管理游戏目录与分类。ID 字段(int64)以 string 传输",
"version": "1.0"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api/v1/games/": {
"get": {
"summary": "获取游戏列表",
"operationId": "ListGames",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GameListResp"
}
}
},
"parameters": [
{
"name": "offset",
"in": "query",
"required": true,
"type": "integer",
"format": "int64",
"default": "0"
},
{
"name": "limit",
"in": "query",
"required": true,
"type": "integer",
"format": "int64",
"default": "20"
}
],
"tags": [
"game"
],
"consumes": [
"multipart/form-data"
]
},
"post": {
"summary": "创建游戏",
"operationId": "CreateGame",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/Game"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Game"
}
}
],
"tags": [
"game"
]
}
},
"/api/v1/games/{id}": {
"get": {
"summary": "获取游戏详情",
"operationId": "GetGame",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/Game"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"game"
]
}
}
},
"definitions": {
"EmptyResp": {
"type": "object",
"title": "EmptyResp"
},
"Game": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"icon": {
"type": "string"
},
"category": {
"type": "string"
}
},
"title": "Game",
"required": [
"name",
"icon",
"category"
]
},
"GameListResp": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/Game"
}
},
"meta": {
"$ref": "#/definitions/PageMeta"
}
},
"title": "GameListResp",
"required": [
"items",
"meta"
]
},
"GetGameReq": {
"type": "object",
"title": "GetGameReq"
},
"PageMeta": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int64"
},
"offset": {
"type": "integer",
"format": "int64"
},
"limit": {
"type": "integer",
"format": "int64"
}
},
"title": "PageMeta",
"required": [
"total",
"offset",
"limit"
]
},
"PageReq": {
"type": "object",
"properties": {
"offset": {
"type": "integer",
"format": "int64",
"default": "0"
},
"limit": {
"type": "integer",
"format": "int64",
"default": "20"
}
},
"title": "PageReq",
"required": [
"offset",
"limit"
]
},
"SimpleUser": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"nickname": {
"type": "string"
},
"avatar": {
"type": "string"
}
},
"title": "SimpleUser",
"required": [
"id",
"nickname",
"avatar"
]
},
"UserProfile": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"username": {
"type": "string"
},
"nickname": {
"type": "string"
},
"avatar": {
"type": "string"
},
"role": {
"type": "string",
"description": " consumer, player, owner, admin"
},
"verifiedRoles": {
"type": "array",
"items": {
"type": "string"
}
},
"verificationStatus": {
"type": "object"
},
"phone": {
"type": "string"
},
"bio": {
"type": "string"
},
"createdAt": {
"type": "string"
}
},
"title": "UserProfile",
"required": [
"id",
"username",
"nickname",
"avatar",
"role",
"verifiedRoles",
"verificationStatus",
"createdAt"
]
}
},
"securityDefinitions": {
"apiKey": {
"type": "apiKey",
"description": "Enter JWT Bearer token **_only_**",
"name": "Authorization",
"in": "header"
}
}
}