Files
OpenFlare/docs/swagger.yaml
T
2026-06-08 20:34:28 +08:00

1338 lines
36 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
basePath: /
definitions:
auth_source.AuthSourceRequest:
properties:
client_id:
type: string
client_secret:
type: string
display_name:
type: string
icon_url:
type: string
is_active:
type: boolean
name:
type: string
openid_discovery_url:
type: string
scopes:
type: string
type:
type: string
type: object
auth_source.ToggleAuthSourceRequest:
properties:
is_active:
type: boolean
type: object
model.AuthSource:
properties:
client_id:
type: string
client_secret_configured:
type: boolean
created_at:
type: string
display_name:
type: string
icon_url:
type: string
id:
type: integer
is_active:
type: boolean
name:
type: string
openid_discovery_url:
type: string
scopes:
type: string
type:
type: string
updated_at:
type: string
type: object
model.ExternalAccountView:
properties:
auth_source_id:
type: integer
auth_source_label:
type: string
auth_source_name:
type: string
auth_source_type:
type: string
created_at:
type: string
email:
type: string
external_username:
type: string
id:
type: integer
type: object
model.SystemConfig:
properties:
created_at:
type: string
description:
type: string
key:
type: string
type:
type: string
updated_at:
type: string
value:
type: string
type: object
model.TrustLevel:
enum:
- 0
- 1
- 2
- 3
- 4
type: integer
x-enum-varnames:
- TrustLevelNewUser
- TrustLevelBasicUser
- TrustLevelUser
- TrustLevelActiveUser
- TrustLevelLeader
oauth.AuthSourceView:
properties:
client_secret_configured:
type: boolean
display_name:
type: string
icon_url:
type: string
id:
type: integer
is_active:
type: boolean
name:
type: string
type:
type: string
type: object
oauth.BasicUserInfo:
properties:
available_balance:
type: number
avatar_url:
type: string
community_balance:
type: number
daily_limit:
type: integer
id:
type: integer
is_admin:
type: boolean
nickname:
type: string
pay_level:
type: string
pay_score:
type: integer
pending_balance:
type: number
remain_quota:
type: number
total_community:
type: number
total_payment:
type: number
total_receive:
type: number
total_transfer:
type: number
trust_level:
$ref: '#/definitions/model.TrustLevel'
username:
type: string
type: object
oauth.CallbackRequest:
properties:
code:
type: string
state:
type: string
required:
- code
- state
type: object
oauth.OAuthAuthorizeResponse:
properties:
authorize_url:
type: string
type: object
oauth.OAuthCallbackResult:
properties:
status:
type: string
user:
$ref: '#/definitions/oauth.BasicUserInfo'
type: object
system_config.CreateSystemConfigRequest:
properties:
description:
maxLength: 255
type: string
key:
maxLength: 64
type: string
type:
enum:
- system
- business
type: string
value:
maxLength: 255
type: string
required:
- key
- type
- value
type: object
system_config.UpdateSystemConfigRequest:
properties:
description:
maxLength: 255
type: string
value:
maxLength: 255
type: string
required:
- value
type: object
task.DispatchTaskRequest:
properties:
end_time:
type: string
start_time:
type: string
task_type:
type: string
user_id:
type: integer
required:
- task_type
type: object
task.TaskMeta:
properties:
asynqTask:
type: string
description:
type: string
maxRetry:
type: integer
name:
type: string
queue:
type: string
supportsTime:
type: boolean
type:
type: string
type: object
user.listUsersResponse:
properties:
total:
type: integer
users:
items:
$ref: '#/definitions/user.user'
type: array
type: object
user.loginRequest:
properties:
password:
type: string
username:
type: string
type: object
user.registerRequest:
properties:
display_name:
type: string
nickname:
type: string
password:
type: string
username:
type: string
type: object
user.updateUserStatusRequest:
properties:
is_active:
type: boolean
type: object
user.user:
properties:
available_balance:
type: number
avatar_url:
type: string
community_balance:
type: number
created_at:
type: string
id:
type: integer
is_active:
type: boolean
is_admin:
type: boolean
last_login_at:
type: string
nickname:
type: string
pay_score:
type: integer
total_community:
type: number
total_payment:
type: number
total_receive:
type: number
total_transfer:
type: number
trust_level:
$ref: '#/definitions/model.TrustLevel'
updated_at:
type: string
username:
type: string
type: object
util.ResponseAny:
properties:
data: {}
error_msg:
example: ""
type: string
type: object
info:
contact:
name: LINUX DO Credit
url: https://linux.do
description: LINUX DO Credit 平台后端 API,提供用户认证、商户 API Key 管理、系统配置等功能。
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: LINUX DO Credit
version: 1.0.0
paths:
/api/v1/admin/auth-sources:
get:
description: 返回所有已配置的 OAuth/OIDC 认证源列表,包括已启用和未启用的,需要管理员权限
produces:
- application/json
responses:
"200":
description: 认证源列表
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
items:
$ref: '#/definitions/model.AuthSource'
type: array
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取认证源列表
tags:
- admin
post:
consumes:
- application/json
description: 创建一个新的 OAuth/OIDC 认证源配置,认证源名称必须唯一且符合命名规范,需要管理员权限
parameters:
- description: 创建认证源参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/auth_source.AuthSourceRequest'
produces:
- application/json
responses:
"200":
description: 创建成功,返回认证源信息
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/model.AuthSource'
type: object
"400":
description: 参数错误或验证失败
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 创建认证源
tags:
- admin
/api/v1/admin/auth-sources/{id}:
delete:
description: 删除指定认证源及其关联的所有外部帐号绑定记录,警告:删除后相关用户将无法通过该源登录,需要管理员权限
parameters:
- description: 认证源 ID 或名称
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 删除成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: ID 无效或删除失败
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 删除认证源
tags:
- admin
put:
consumes:
- application/json
description: 更新指定 ID 的认证源配置。若 client_secret 字段为空,则保留原有密钥不变,需要管理员权限
parameters:
- description: 认证源 ID 或名称
in: path
name: id
required: true
type: integer
- description: 更新认证源参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/auth_source.AuthSourceRequest'
produces:
- application/json
responses:
"200":
description: 更新成功,返回更新后的认证源信息
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/model.AuthSource'
type: object
"400":
description: 参数错误或验证失败
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 更新认证源
tags:
- admin
/api/v1/admin/auth-sources/{id}/toggle:
put:
consumes:
- application/json
description: 启用或禁用指定认证源。尝试启用时将验证 Client ID 和 Client Secret 是否已配置,需要管理员权限
parameters:
- description: 认证源 ID 或名称
in: path
name: id
required: true
type: integer
- description: 启用状态
in: body
name: request
required: true
schema:
$ref: '#/definitions/auth_source.ToggleAuthSourceRequest'
produces:
- application/json
responses:
"200":
description: 切换成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: 验证失败或认证源不存在
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 切换认证源启用状态
tags:
- admin
/api/v1/admin/system-configs:
get:
description: 返回所有系统配置列表,支持按配置类型(system/business)过滤,需要管理员权限
parameters:
- description: 配置类型(system/business)
in: query
name: type
type: string
produces:
- application/json
responses:
"200":
description: 系统配置列表
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
items:
$ref: '#/definitions/model.SystemConfig'
type: array
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取系统配置列表
tags:
- admin
post:
consumes:
- application/json
description: 创建一条新的系统配置项,配置键不可重复,同时将新配置同步到 Redis,需要管理员权限
parameters:
- description: 创建请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/system_config.CreateSystemConfigRequest'
produces:
- application/json
responses:
"200":
description: 创建成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: 参数错误或配置键已存在
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 创建系统配置
tags:
- admin
/api/v1/admin/system-configs/{key}:
delete:
description: 根据配置键删除对应配置,同时从 Redis 中移除对应缓存,需要管理员权限
parameters:
- description: 配置键
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: 删除成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 配置不存在
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 删除系统配置
tags:
- admin
get:
description: 根据配置键获取对应的系统配置详情,需要管理员权限
parameters:
- description: 配置键
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: 系统配置详情
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/model.SystemConfig'
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 配置不存在
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取单个系统配置
tags:
- admin
put:
consumes:
- application/json
description: 根据配置键更新对应的配置内容,同时将更新同步到 Redis,需要管理员权限
parameters:
- description: 配置键
in: path
name: key
required: true
type: string
- description: 更新请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/system_config.UpdateSystemConfigRequest'
produces:
- application/json
responses:
"200":
description: 更新成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 配置不存在
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 更新系统配置
tags:
- admin
/api/v1/admin/tasks/dispatch:
post:
consumes:
- application/json
description: 手动触发指定类型的异步任务,支持指定时间范围和用户,需要管理员权限
parameters:
- description: 任务请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/task.DispatchTaskRequest'
produces:
- application/json
responses:
"200":
description: 任务已入队
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: 任务类型不存在或参数错误
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 任务入队失败
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 下发异步任务
tags:
- admin
/api/v1/admin/tasks/types:
get:
description: 返回系统支持的所有可调度任务类型列表,包括任务名称、描述、是否支持时间范围等元数据,需要管理员权限
produces:
- application/json
responses:
"200":
description: 任务类型列表
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
items:
$ref: '#/definitions/task.TaskMeta'
type: array
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取支持的任务类型
tags:
- admin
/api/v1/admin/users:
get:
description: 分页返回用户列表,支持按用户 ID 和用户名筛选,需要管理员权限
parameters:
- in: query
minimum: 1
name: page
type: integer
- in: query
maximum: 100
minimum: 1
name: page_size
type: integer
- in: query
name: user_id
type: integer
- in: query
name: username
type: string
produces:
- application/json
responses:
"200":
description: 用户列表
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/user.listUsersResponse'
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取用户列表
tags:
- admin
/api/v1/admin/users/{id}/status:
put:
consumes:
- application/json
description: 启用或禁用指定用户,管理员账号无法被禁用,需要管理员权限
parameters:
- description: 用户 ID
in: path
name: id
required: true
type: integer
- description: 状态参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/user.updateUserStatusRequest'
produces:
- application/json
responses:
"200":
description: 更新成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限或尝试禁用管理员
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 用户不存在
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 更新用户状态
tags:
- admin
/api/v1/config/public:
get:
consumes:
- application/json
description: 返回对前端公开的系统配置信息,如允许上传的文件类型、站点名称、是否开放注册等
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseAny'
summary: 获取公共配置
tags:
- config
/api/v1/health:
get:
description: 检查服务是否正常运行,可用于负载均衡存活探测
produces:
- application/json
responses:
"200":
description: 服务正常
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
summary: 健康检查
tags:
- health
/api/v1/oauth/{source}/authorize:
get:
description: 根据指定认证源名称发起 OAuth 授权,支持 purpose 参数用于区分登录和账号绑定场景。认证源必须已启用。
parameters:
- description: 认证源名称
in: path
name: source
required: true
type: string
- description: 授权目的:login(登录)或 bind(绑定账号),默认 login
in: query
name: purpose
type: string
produces:
- application/json
responses:
"200":
description: 授权 URL
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/oauth.OAuthAuthorizeResponse'
type: object
"400":
description: 认证源不存在或未启用
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: Redis 异常或构造 URL 失败
schema:
$ref: '#/definitions/util.ResponseAny'
summary: 发起指定认证源授权
tags:
- oauth
/api/v1/oauth/callback:
post:
consumes:
- application/json
description: 接收前端传回的 state 和 code,完成 OAuth/OIDC 认证并建立会话。支持登录(login)和账号绑定(bind)两种场景。
parameters:
- description: 回调请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/oauth.CallbackRequest'
produces:
- application/json
responses:
"200":
description: 登录或绑定成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/oauth.OAuthCallbackResult'
type: object
"400":
description: state 无效、参数错误或认证源错误
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 绑定场景未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: OAuth 认证失败或内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
summary: OAuth 回调处理
tags:
- oauth
/api/v1/oauth/external-accounts:
get:
description: 返回当前登录用户已绑定的所有外部 OAuth 帐号信息,需要登录
produces:
- application/json
responses:
"200":
description: 外部帐号列表
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
items:
$ref: '#/definitions/model.ExternalAccountView'
type: array
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取外部帐号列表
tags:
- oauth
/api/v1/oauth/external-accounts/{id}/delete:
post:
description: 解除当前登录用户与指定外部帐号的绑定关系,需要登录
parameters:
- description: 外部帐号绑定记录 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 解除绑定成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"400":
description: ID 无效或解除失败
schema:
$ref: '#/definitions/util.ResponseAny'
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 解除外部帐号绑定
tags:
- oauth
/api/v1/oauth/login:
get:
description: 根据指定认证源生成 OAuth 授权 URL,前端跳转到该 URL 完成 OAuth 登录授权。source 参数为空时使用默认认证源。
parameters:
- description: 认证源名称,为空使用默认源
in: query
name: source
type: string
produces:
- application/json
responses:
"200":
description: 授权 URL
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/oauth.OAuthAuthorizeResponse'
type: object
"400":
description: 认证源不存在或未配置
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: Redis 异常或构造 URL 失败
schema:
$ref: '#/definitions/util.ResponseAny'
summary: 获取登录授权地址
tags:
- oauth
/api/v1/oauth/logout:
get:
description: 清除当前用户的登录会话,完成退出。清除 Cookie 中的 Session 数据。
produces:
- application/json
responses:
"200":
description: 退出成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"500":
description: Session 清除失败
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 退出登录
tags:
- oauth
/api/v1/oauth/sources:
get:
description: 返回当前系统已启用的所有 OAuth 登录源,前端展示登录按钮列表时调用
produces:
- application/json
responses:
"200":
description: 登录源列表
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
items:
$ref: '#/definitions/oauth.AuthSourceView'
type: array
type: object
summary: 获取可用登录源
tags:
- oauth
/api/v1/oauth/user-info:
get:
description: 返回当前登录用户的基本信息及余额数据,需要登录。包括用户 ID、用户名、信任等级、各类余额信息等。
produces:
- application/json
responses:
"200":
description: 用户信息
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/oauth.BasicUserInfo'
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取当前登录用户信息
tags:
- oauth
/api/v1/user/login:
post:
consumes:
- application/json
description: 使用用户名和密码登录,登录成功后建立 Session。若管理员已关闭密码登录功能则返回错误。
parameters:
- description: 登录请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/user.loginRequest'
produces:
- application/json
responses:
"200":
description: 登录成功,返回用户信息
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/oauth.BasicUserInfo'
type: object
"400":
description: 用户名或密码错误、帐号已禁用等
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 服务内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
summary: 用户密码登录
tags:
- user
/api/v1/user/logout:
get:
description: 清除用户登录 Session,完成退出
produces:
- application/json
responses:
"200":
description: 退出成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
"500":
description: Session 清除失败
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 用户退出登录
tags:
- user
/api/v1/user/register:
post:
consumes:
- application/json
description: 使用用户名和密码注册新账号,注册成功后自动登录并建立 Session。密码长度不能少于 8 位。
parameters:
- description: 注册请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/user.registerRequest'
produces:
- application/json
responses:
"200":
description: 注册并登录成功,返回用户信息
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/oauth.BasicUserInfo'
type: object
"400":
description: 参数错误、用户名已存在或注册已关闭
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 服务内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
summary: 用户注册
tags:
- user
/f/{id}:
get:
description: 根据文件 ID 获取并提供已上传的临时或正式文件,若配置了缓存则优先走本地缓存,否则从 S3 等后端存储读取并流式返回
parameters:
- description: 文件 ID
in: path
name: id
required: true
type: string
produces:
- application/octet-stream
responses:
"200":
description: 成功获取文件内容
schema:
type: file
"400":
description: 文件 ID 格式错误
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 文件未找到
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 服务内部错误
schema:
$ref: '#/definitions/util.ResponseAny'
summary: 获取已上传文件
tags:
- upload
securityDefinitions:
SessionCookie:
in: cookie
name: session
type: apiKey
swagger: "2.0"