Files

340 lines
6.8 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/wallet/balance": {
"get": {
"summary": "获取余额",
"operationId": "GetBalance",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/WalletBalance"
}
}
},
"tags": [
"wallet"
]
}
},
"/api/v1/wallet/topup": {
"post": {
"summary": "充值",
"operationId": "Topup",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/EmptyResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TopupReq"
}
}
],
"tags": [
"wallet"
]
}
},
"/api/v1/wallet/transactions": {
"get": {
"summary": "获取流水",
"operationId": "ListTransactions",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/TransactionListResp"
}
}
},
"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": [
"wallet"
],
"consumes": [
"multipart/form-data"
]
}
},
"/api/v1/wallet/withdraw": {
"post": {
"summary": "提现",
"operationId": "Withdraw",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/EmptyResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TopupReq"
}
}
],
"tags": [
"wallet"
]
}
}
},
"definitions": {
"EmptyResp": {
"type": "object",
"title": "EmptyResp"
},
"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"
]
},
"TopupReq": {
"type": "object",
"properties": {
"amount": {
"type": "string"
},
"method": {
"type": "string"
}
},
"title": "TopupReq",
"required": [
"amount",
"method"
]
},
"Transaction": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string"
},
"amount": {
"type": "string"
},
"description": {
"type": "string"
},
"orderId": {
"type": "string"
},
"createdAt": {
"type": "string"
}
},
"title": "Transaction",
"required": [
"id",
"type",
"amount",
"description",
"createdAt"
]
},
"TransactionListResp": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/Transaction"
}
},
"meta": {
"$ref": "#/definitions/PageMeta"
}
},
"title": "TransactionListResp",
"required": [
"items",
"meta"
]
},
"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"
]
},
"WalletBalance": {
"type": "object",
"properties": {
"balance": {
"type": "string"
},
"frozenBalance": {
"type": "string"
}
},
"title": "WalletBalance",
"required": [
"balance",
"frozenBalance"
]
}
},
"securityDefinitions": {
"apiKey": {
"type": "apiKey",
"description": "Enter JWT Bearer token **_only_**",
"name": "Authorization",
"in": "header"
}
}
}