799 lines
17 KiB
JSON
799 lines
17 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/comments/{id}/like": {
|
|
"delete": {
|
|
"summary": "取消点赞评论",
|
|
"operationId": "UnlikeComment",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/EmptyResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PathId"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
},
|
|
"post": {
|
|
"summary": "点赞评论",
|
|
"operationId": "LikeComment",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/EmptyResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PathId"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/posts": {
|
|
"get": {
|
|
"summary": "获取帖子列表",
|
|
"operationId": "ListPosts",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/PostListResp"
|
|
}
|
|
}
|
|
},
|
|
"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"
|
|
},
|
|
{
|
|
"name": "tags",
|
|
"in": "query",
|
|
"required": false,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "sortBy",
|
|
"in": "query",
|
|
"required": false,
|
|
"type": "string"
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
],
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
]
|
|
},
|
|
"post": {
|
|
"summary": "发布帖子",
|
|
"operationId": "CreatePost",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/Post"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/CreatePostReq"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/posts/{id}": {
|
|
"get": {
|
|
"summary": "获取帖子详情",
|
|
"operationId": "GetPost",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/Post"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/posts/{id}/comments": {
|
|
"get": {
|
|
"summary": "获取帖子评论",
|
|
"operationId": "ListComments",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/CommentListResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "id",
|
|
"in": "query",
|
|
"required": true,
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
{
|
|
"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": [
|
|
"community"
|
|
]
|
|
},
|
|
"post": {
|
|
"summary": "发表评论",
|
|
"operationId": "CreateComment",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/Comment"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/CreateCommentReq"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/posts/{id}/like": {
|
|
"delete": {
|
|
"summary": "取消点赞帖子",
|
|
"operationId": "UnlikePost",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/EmptyResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PathId"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
},
|
|
"post": {
|
|
"summary": "点赞帖子",
|
|
"operationId": "LikePost",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/EmptyResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PathId"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/posts/{id}/pin": {
|
|
"delete": {
|
|
"summary": "取消置顶",
|
|
"operationId": "UnpinPost",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/EmptyResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PathId"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
},
|
|
"post": {
|
|
"summary": "置顶帖子",
|
|
"operationId": "PinPost",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/EmptyResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PathId"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"community"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/users/{id}/posts": {
|
|
"get": {
|
|
"summary": "获取用户帖子",
|
|
"operationId": "ListUserPosts",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/PostListResp"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "id",
|
|
"in": "query",
|
|
"required": true,
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
{
|
|
"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": [
|
|
"community"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"Comment": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"author": {
|
|
"$ref": "#/definitions/UserProfile"
|
|
},
|
|
"likeCount": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"liked": {
|
|
"type": "boolean",
|
|
"format": "boolean"
|
|
},
|
|
"createdAt": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "Comment",
|
|
"required": [
|
|
"id",
|
|
"content",
|
|
"author",
|
|
"likeCount",
|
|
"liked",
|
|
"createdAt"
|
|
]
|
|
},
|
|
"CommentListResp": {
|
|
"type": "object",
|
|
"properties": {
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Comment"
|
|
}
|
|
},
|
|
"meta": {
|
|
"$ref": "#/definitions/PageMeta"
|
|
}
|
|
},
|
|
"title": "CommentListResp",
|
|
"required": [
|
|
"items",
|
|
"meta"
|
|
]
|
|
},
|
|
"CreateCommentReq": {
|
|
"type": "object",
|
|
"properties": {
|
|
"postId": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "CreateCommentReq",
|
|
"required": [
|
|
"-",
|
|
"content"
|
|
]
|
|
},
|
|
"CreatePostReq": {
|
|
"type": "object",
|
|
"properties": {
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"images": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"tags": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"linkedOrderId": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "CreatePostReq",
|
|
"required": [
|
|
"title",
|
|
"content",
|
|
"images",
|
|
"tags"
|
|
]
|
|
},
|
|
"EmptyResp": {
|
|
"type": "object",
|
|
"title": "EmptyResp"
|
|
},
|
|
"ListCommentsReq": {
|
|
"type": "object",
|
|
"properties": {
|
|
"offset": {
|
|
"type": "integer",
|
|
"format": "int64",
|
|
"default": "0"
|
|
},
|
|
"limit": {
|
|
"type": "integer",
|
|
"format": "int64",
|
|
"default": "20"
|
|
}
|
|
},
|
|
"title": "ListCommentsReq"
|
|
},
|
|
"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"
|
|
]
|
|
},
|
|
"PathId": {
|
|
"type": "object",
|
|
"title": "PathId"
|
|
},
|
|
"Post": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"images": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"tags": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"linkedOrderId": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"pinned": {
|
|
"type": "boolean",
|
|
"format": "boolean"
|
|
},
|
|
"likeCount": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"commentCount": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"liked": {
|
|
"type": "boolean",
|
|
"format": "boolean"
|
|
},
|
|
"author": {
|
|
"$ref": "#/definitions/UserProfile"
|
|
},
|
|
"createdAt": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "Post",
|
|
"required": [
|
|
"id",
|
|
"title",
|
|
"content",
|
|
"images",
|
|
"tags",
|
|
"pinned",
|
|
"likeCount",
|
|
"commentCount",
|
|
"liked",
|
|
"author",
|
|
"createdAt"
|
|
]
|
|
},
|
|
"PostListReq": {
|
|
"type": "object",
|
|
"properties": {
|
|
"offset": {
|
|
"type": "integer",
|
|
"format": "int64",
|
|
"default": "0"
|
|
},
|
|
"limit": {
|
|
"type": "integer",
|
|
"format": "int64",
|
|
"default": "20"
|
|
},
|
|
"tags": {
|
|
"type": "string"
|
|
},
|
|
"sortBy": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "PostListReq"
|
|
},
|
|
"PostListResp": {
|
|
"type": "object",
|
|
"properties": {
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Post"
|
|
}
|
|
},
|
|
"meta": {
|
|
"$ref": "#/definitions/PageMeta"
|
|
}
|
|
},
|
|
"title": "PostListResp",
|
|
"required": [
|
|
"items",
|
|
"meta"
|
|
]
|
|
},
|
|
"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"
|
|
}
|
|
}
|
|
}
|