1691 lines
58 KiB
JSON
1691 lines
58 KiB
JSON
{
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"contact": {}
|
||
},
|
||
"paths": {
|
||
"/api/v1/auth/login": {
|
||
"post": {
|
||
"description": "用户登录获取JWT Token,支持用户名或邮箱登录",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "用户登录",
|
||
"parameters": [
|
||
{
|
||
"description": "登录信息(username字段支持用户名或邮箱)",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.LoginRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "登录成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.LoginResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "登录失败",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/auth/register": {
|
||
"post": {
|
||
"description": "注册新用户账号",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "用户注册",
|
||
"parameters": [
|
||
{
|
||
"description": "注册信息",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.RegisterRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "注册成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/auth/reset-password": {
|
||
"post": {
|
||
"description": "通过邮箱验证码重置密码",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "重置密码",
|
||
"parameters": [
|
||
{
|
||
"description": "重置密码请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.ResetPasswordRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "重置成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/auth/send-code": {
|
||
"post": {
|
||
"description": "发送邮箱验证码(注册/重置密码/更换邮箱)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "发送验证码",
|
||
"parameters": [
|
||
{
|
||
"description": "发送验证码请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.SendVerificationCodeRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "发送成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/profile": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "获取当前用户的所有档案",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"profile"
|
||
],
|
||
"summary": "获取档案列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "创建新的Minecraft角色档案,UUID由后端自动生成",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"profile"
|
||
],
|
||
"summary": "创建Minecraft档案",
|
||
"parameters": [
|
||
{
|
||
"description": "档案信息(仅需提供角色名)",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.CreateProfileRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "创建成功,返回完整档案信息(含自动生成的UUID)",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.ProfileInfo"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误或已达档案数量上限",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/profile/{uuid}": {
|
||
"get": {
|
||
"description": "根据UUID获取档案详细信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"profile"
|
||
],
|
||
"summary": "获取档案详情",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "档案UUID",
|
||
"name": "uuid",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "档案不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "更新档案信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"profile"
|
||
],
|
||
"summary": "更新档案",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "档案UUID",
|
||
"name": "uuid",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "更新信息",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.UpdateProfileRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "无权操作",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "档案不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "删除指定的Minecraft档案",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"profile"
|
||
],
|
||
"summary": "删除档案",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "档案UUID",
|
||
"name": "uuid",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "删除成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "无权操作",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "档案不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/profile/{uuid}/activate": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "将指定档案设置为活跃状态",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"profile"
|
||
],
|
||
"summary": "设置活跃档案",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "档案UUID",
|
||
"name": "uuid",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "设置成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "无权操作",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "档案不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/system/config": {
|
||
"get": {
|
||
"description": "获取公开的系统配置信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"system"
|
||
],
|
||
"summary": "获取系统配置",
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/texture": {
|
||
"get": {
|
||
"description": "根据关键词和类型搜索材质",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "搜索材质",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "关键词",
|
||
"name": "keyword",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "材质类型(SKIN/CAPE)",
|
||
"name": "type",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "boolean",
|
||
"description": "只看公开材质",
|
||
"name": "public_only",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "页码",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 20,
|
||
"description": "每页数量",
|
||
"name": "page_size",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "搜索成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.PaginationResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "文件上传完成后,创建材质记录到数据库",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "创建材质记录",
|
||
"parameters": [
|
||
{
|
||
"description": "创建材质请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.CreateTextureRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "创建成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/texture/favorites": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "获取当前用户收藏的所有材质",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "获取用户收藏的材质列表",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "页码",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 20,
|
||
"description": "每页数量",
|
||
"name": "page_size",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.PaginationResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/texture/my": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "获取当前用户上传的所有材质",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "获取用户上传的材质列表",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "页码",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 20,
|
||
"description": "每页数量",
|
||
"name": "page_size",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.PaginationResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/texture/upload-url": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "生成预签名URL用于上传材质文件",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "生成材质上传URL",
|
||
"parameters": [
|
||
{
|
||
"description": "上传URL请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.GenerateTextureUploadURLRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "生成成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/texture/{id}": {
|
||
"get": {
|
||
"description": "根据ID获取材质详细信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "获取材质详情",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "材质ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "材质不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "更新材质信息(仅上传者可操作)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "更新材质",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "材质ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "更新材质请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.UpdateTextureRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "无权操作",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "删除材质(软删除,仅上传者可操作)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "删除材质",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "材质ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "删除成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "无权操作",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/texture/{id}/favorite": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "收藏或取消收藏材质",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"texture"
|
||
],
|
||
"summary": "切换收藏状态",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "材质ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "切换成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/user/avatar": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "上传完成后更新用户的头像URL到数据库",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "更新头像URL",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "头像URL",
|
||
"name": "avatar_url",
|
||
"in": "query",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/user/avatar/upload-url": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "生成预签名URL用于上传用户头像",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "生成头像上传URL",
|
||
"parameters": [
|
||
{
|
||
"description": "文件名",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.GenerateAvatarUploadURLRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "生成成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/user/change-email": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "通过验证码更换用户邮箱",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "更换邮箱",
|
||
"parameters": [
|
||
{
|
||
"description": "更换邮箱请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.ChangeEmailRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更换成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.UserInfo"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/user/profile": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "获取当前登录用户的详细信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "获取用户信息",
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"description": "更新当前登录用户的头像和密码(修改邮箱请使用 /change-email 接口)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "更新用户信息",
|
||
"parameters": [
|
||
{
|
||
"description": "更新信息(修改密码时需同时提供old_password和new_password)",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.UpdateUserRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/carrotskin_internal_model.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.UserInfo"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "未授权",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "用户不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/carrotskin_internal_model.ErrorResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/health": {
|
||
"get": {
|
||
"description": "检查服务是否正常运行",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"system"
|
||
],
|
||
"summary": "健康检查",
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"carrotskin_internal_model.ErrorResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer"
|
||
},
|
||
"error": {
|
||
"description": "详细错误信息(仅开发环境)",
|
||
"type": "string"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_model.PaginationResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer"
|
||
},
|
||
"data": {},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"page": {
|
||
"description": "当前页码",
|
||
"type": "integer"
|
||
},
|
||
"per_page": {
|
||
"description": "每页数量",
|
||
"type": "integer"
|
||
},
|
||
"total": {
|
||
"description": "总记录数",
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_model.Response": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"description": "业务状态码",
|
||
"type": "integer"
|
||
},
|
||
"data": {
|
||
"description": "响应数据"
|
||
},
|
||
"message": {
|
||
"description": "响应消息",
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.ChangeEmailRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"new_email",
|
||
"verification_code"
|
||
],
|
||
"properties": {
|
||
"new_email": {
|
||
"type": "string",
|
||
"example": "newemail@example.com"
|
||
},
|
||
"verification_code": {
|
||
"type": "string",
|
||
"example": "123456"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.CreateProfileRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"maxLength": 16,
|
||
"minLength": 1,
|
||
"example": "PlayerName"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.CreateTextureRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"hash",
|
||
"name",
|
||
"size",
|
||
"type",
|
||
"url"
|
||
],
|
||
"properties": {
|
||
"description": {
|
||
"type": "string",
|
||
"maxLength": 500,
|
||
"example": "A very cool skin"
|
||
},
|
||
"hash": {
|
||
"type": "string",
|
||
"example": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||
},
|
||
"is_public": {
|
||
"type": "boolean",
|
||
"example": true
|
||
},
|
||
"is_slim": {
|
||
"description": "Alex模型(细臂)为true,Steve模型(粗臂)为false",
|
||
"type": "boolean",
|
||
"example": false
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"maxLength": 100,
|
||
"minLength": 1,
|
||
"example": "My Cool Skin"
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"example": 2048
|
||
},
|
||
"type": {
|
||
"enum": [
|
||
"SKIN",
|
||
"CAPE"
|
||
],
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/carrotskin_internal_types.TextureType"
|
||
}
|
||
],
|
||
"example": "SKIN"
|
||
},
|
||
"url": {
|
||
"type": "string",
|
||
"example": "https://rustfs.example.com/textures/user_1/skin/xxx.png"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.GenerateAvatarUploadURLRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"file_name"
|
||
],
|
||
"properties": {
|
||
"file_name": {
|
||
"type": "string",
|
||
"example": "avatar.png"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.GenerateTextureUploadURLRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"file_name",
|
||
"texture_type"
|
||
],
|
||
"properties": {
|
||
"file_name": {
|
||
"type": "string",
|
||
"example": "skin.png"
|
||
},
|
||
"texture_type": {
|
||
"enum": [
|
||
"SKIN",
|
||
"CAPE"
|
||
],
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/carrotskin_internal_types.TextureType"
|
||
}
|
||
],
|
||
"example": "SKIN"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.LoginRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"password",
|
||
"username"
|
||
],
|
||
"properties": {
|
||
"password": {
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 6,
|
||
"example": "password123"
|
||
},
|
||
"username": {
|
||
"description": "支持用户名或邮箱",
|
||
"type": "string",
|
||
"example": "testuser"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.LoginResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"token": {
|
||
"type": "string"
|
||
},
|
||
"user_info": {
|
||
"$ref": "#/definitions/carrotskin_internal_types.UserInfo"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.ProfileInfo": {
|
||
"type": "object",
|
||
"properties": {
|
||
"cape_id": {
|
||
"type": "integer",
|
||
"example": 2
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"example": "2025-10-01T10:00:00Z"
|
||
},
|
||
"is_active": {
|
||
"type": "boolean",
|
||
"example": true
|
||
},
|
||
"last_used_at": {
|
||
"type": "string",
|
||
"example": "2025-10-01T12:00:00Z"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "PlayerName"
|
||
},
|
||
"skin_id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"example": "2025-10-01T10:00:00Z"
|
||
},
|
||
"user_id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"uuid": {
|
||
"type": "string",
|
||
"example": "550e8400-e29b-41d4-a716-446655440000"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.RegisterRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"password",
|
||
"username",
|
||
"verification_code"
|
||
],
|
||
"properties": {
|
||
"avatar": {
|
||
"description": "可选,用户自定义头像",
|
||
"type": "string",
|
||
"example": "https://rustfs.example.com/avatars/user_1/avatar.png"
|
||
},
|
||
"email": {
|
||
"type": "string",
|
||
"example": "user@example.com"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 6,
|
||
"example": "password123"
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"maxLength": 50,
|
||
"minLength": 3,
|
||
"example": "newuser"
|
||
},
|
||
"verification_code": {
|
||
"description": "邮箱验证码",
|
||
"type": "string",
|
||
"example": "123456"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.ResetPasswordRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"new_password",
|
||
"verification_code"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string",
|
||
"example": "user@example.com"
|
||
},
|
||
"new_password": {
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 6,
|
||
"example": "newpassword123"
|
||
},
|
||
"verification_code": {
|
||
"type": "string",
|
||
"example": "123456"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.SendVerificationCodeRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"type"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string",
|
||
"example": "user@example.com"
|
||
},
|
||
"type": {
|
||
"description": "类型: register/reset_password/change_email",
|
||
"type": "string",
|
||
"enum": [
|
||
"register",
|
||
"reset_password",
|
||
"change_email"
|
||
],
|
||
"example": "register"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.TextureType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"SKIN",
|
||
"CAPE"
|
||
],
|
||
"x-enum-varnames": [
|
||
"TextureTypeSkin",
|
||
"TextureTypeCape"
|
||
]
|
||
},
|
||
"carrotskin_internal_types.UpdateProfileRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"cape_id": {
|
||
"type": "integer",
|
||
"example": 2
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"maxLength": 16,
|
||
"minLength": 1,
|
||
"example": "NewPlayerName"
|
||
},
|
||
"skin_id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.UpdateTextureRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string",
|
||
"maxLength": 500,
|
||
"example": "A cool skin"
|
||
},
|
||
"is_public": {
|
||
"type": "boolean",
|
||
"example": true
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"maxLength": 100,
|
||
"minLength": 1,
|
||
"example": "My Skin"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.UpdateUserRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"avatar": {
|
||
"type": "string",
|
||
"example": "https://example.com/new-avatar.png"
|
||
},
|
||
"new_password": {
|
||
"description": "新密码",
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 6,
|
||
"example": "newpassword123"
|
||
},
|
||
"old_password": {
|
||
"description": "修改密码时必需",
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 6,
|
||
"example": "oldpassword123"
|
||
}
|
||
}
|
||
},
|
||
"carrotskin_internal_types.UserInfo": {
|
||
"type": "object",
|
||
"properties": {
|
||
"avatar": {
|
||
"type": "string",
|
||
"example": "https://example.com/avatar.png"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"example": "2025-10-01T10:00:00Z"
|
||
},
|
||
"email": {
|
||
"type": "string",
|
||
"example": "test@example.com"
|
||
},
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"last_login_at": {
|
||
"type": "string",
|
||
"example": "2025-10-01T12:00:00Z"
|
||
},
|
||
"points": {
|
||
"type": "integer",
|
||
"example": 100
|
||
},
|
||
"role": {
|
||
"type": "string",
|
||
"example": "user"
|
||
},
|
||
"status": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"example": "2025-10-01T10:00:00Z"
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"example": "testuser"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |