You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

752 lines
18 KiB

basePath: /api
definitions:
model.CaptchaResponse:
properties:
captcha_id:
type: string
captcha_image:
description: Base64编码的图片
type: string
expires_in:
type: integer
type: object
model.LoginRequest:
properties:
captcha:
type: string
captcha_id:
type: string
client_ip:
description: 客户端IP地址
type: string
password:
maxLength: 100
minLength: 6
type: string
username:
maxLength: 50
minLength: 3
type: string
required:
- captcha
- captcha_id
- password
- username
type: object
model.LoginResponse:
properties:
expires_in:
type: integer
force_change_password:
description: 是否需要强制修改密码
type: boolean
refresh_token:
type: string
token:
type: string
token_type:
type: string
user:
$ref: '#/definitions/model.UserInfo'
type: object
model.LogoutRequest:
properties:
token:
type: string
required:
- token
type: object
model.Permission:
properties:
action:
description: create, read, update, delete等
type: string
created_at:
type: string
description:
type: string
id:
type: integer
name:
type: string
resource:
type: string
updated_at:
type: string
type: object
model.PermissionInfo:
properties:
action:
type: string
description:
type: string
id:
type: integer
name:
type: string
resource:
type: string
type: object
model.RefreshTokenRequest:
properties:
refresh_token:
type: string
required:
- refresh_token
type: object
model.Role:
properties:
code:
type: string
created_at:
type: string
description:
type: string
id:
type: integer
name:
type: string
permissions:
items:
$ref: '#/definitions/model.Permission'
type: array
updated_at:
type: string
type: object
model.RoleInfo:
properties:
code:
type: string
description:
type: string
id:
type: integer
name:
type: string
permissions:
items:
$ref: '#/definitions/model.PermissionInfo'
type: array
type: object
model.User:
properties:
created_at:
type: string
email:
type: string
force_change_password:
description: 是否强制修改密码
type: boolean
id:
type: integer
last_login_at:
description: 最后登录时间
type: string
last_login_ip:
description: 最后登录IP
type: string
password_changed_at:
description: 密码最后修改时间
type: string
phone:
type: string
roles:
items:
$ref: '#/definitions/model.Role'
type: array
status:
description: 1-正常 2-禁用 3-锁定
type: integer
updated_at:
type: string
username:
type: string
type: object
model.UserInfo:
properties:
created_at:
type: string
email:
type: string
id:
type: integer
last_login_at:
type: string
last_login_ip:
type: string
phone:
type: string
roles:
items:
$ref: '#/definitions/model.RoleInfo'
type: array
status:
type: integer
username:
type: string
type: object
response.Response:
properties:
code:
description: 响应状态码
type: integer
data:
description: 响应数据
error:
description: 错误信息
type: string
message:
description: 响应消息
type: string
type: object
host: localhost:8080
info:
contact:
email: support@gofaster.com
name: API支持
url: http://www.gofaster.com/support
description: GoFaster项目API文档
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: GoFaster API
version: "1.0"
paths:
/auth/captcha:
get:
description: 生成图形验证码,用于登录验证
produces:
- application/json
responses:
"200":
description: 验证码生成成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.CaptchaResponse'
type: object
summary: 生成验证码
tags:
- 认证
/auth/login:
post:
consumes:
- application/json
description: 用户登录接口,支持验证码验证和密码错误次数限制
parameters:
- description: 登录请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/model.LoginRequest'
produces:
- application/json
responses:
"200":
description: 登录成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.LoginResponse'
type: object
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/response.Response'
"401":
description: 认证失败
schema:
$ref: '#/definitions/response.Response'
"423":
description: 账户被锁定
schema:
$ref: '#/definitions/response.Response'
summary: 用户登录
tags:
- 认证
/auth/logout:
post:
consumes:
- application/json
description: 用户登出接口
parameters:
- description: 登出请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/model.LogoutRequest'
produces:
- application/json
responses:
"200":
description: 登出成功
schema:
$ref: '#/definitions/response.Response'
summary: 用户登出
tags:
- 认证
/auth/refresh:
post:
consumes:
- application/json
description: 使用刷新令牌获取新的访问令牌
parameters:
- description: 刷新令牌请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/model.RefreshTokenRequest'
produces:
- application/json
responses:
"200":
description: 刷新成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.LoginResponse'
type: object
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/response.Response'
"401":
description: 刷新令牌无效
schema:
$ref: '#/definitions/response.Response'
summary: 刷新访问令牌
tags:
- 认证
/auth/roles:
get:
consumes:
- application/json
description: 分页获取角色列表
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: pageSize
type: integer
produces:
- application/json
responses:
"200":
description: 获取成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
properties:
data:
items:
$ref: '#/definitions/model.Role'
type: array
page:
type: integer
size:
type: integer
total:
type: integer
type: object
type: object
"500":
description: 服务器内部错误
schema:
$ref: '#/definitions/response.Response'
security:
- BearerAuth: []
summary: 获取角色列表
tags:
- 角色管理
post:
consumes:
- application/json
description: 创建新的角色
parameters:
- description: 角色信息
in: body
name: role
required: true
schema:
$ref: '#/definitions/model.Role'
produces:
- application/json
responses:
"200":
description: 创建成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.Role'
type: object
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/response.Response'
"500":
description: 服务器内部错误
schema:
$ref: '#/definitions/response.Response'
security:
- BearerAuth: []
summary: 创建角色
tags:
- 角色管理
/auth/roles/{id}:
delete:
consumes:
- application/json
description: 根据ID删除角色
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 删除成功
schema:
$ref: '#/definitions/response.Response'
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/response.Response'
"500":
description: 服务器内部错误
schema:
$ref: '#/definitions/response.Response'
security:
- BearerAuth: []
summary: 删除角色
tags:
- 角色管理
get:
consumes:
- application/json
description: 根据ID获取角色详细信息
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 获取成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.Role'
type: object
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/response.Response'
"404":
description: 角色不存在
schema:
$ref: '#/definitions/response.Response'
security:
- BearerAuth: []
summary: 获取角色详情
tags:
- 角色管理
put:
consumes:
- application/json
description: 根据ID更新角色信息
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
- description: 角色信息
in: body
name: role
required: true
schema:
$ref: '#/definitions/model.Role'
produces:
- application/json
responses:
"200":
description: 更新成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.Role'
type: object
"400":
description: 请求参数错误
schema:
$ref: '#/definitions/response.Response'
"500":
description: 服务器内部错误
schema:
$ref: '#/definitions/response.Response'
security:
- BearerAuth: []
summary: 更新角色
tags:
- 角色管理
/auth/userinfo:
get:
consumes:
- application/json
description: 获取当前登录用户的详细信息
produces:
- application/json
responses:
"200":
description: 获取成功
schema:
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/model.UserInfo'
type: object
"401":
description: 未授权
schema:
$ref: '#/definitions/response.Response'
security:
- BearerAuth: []
summary: 获取用户信息
tags:
- 认证
/roles:
get:
consumes:
- application/json
description: 获取分页角色列表
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 100
description: 每页数量
in: query
name: pageSize
type: integer
produces:
- application/json
responses:
"200":
description: 角色列表
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 获取角色列表
tags:
- 用户管理
/users:
get:
consumes:
- application/json
description: 获取分页用户列表
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: pageSize
type: integer
produces:
- application/json
responses:
"200":
description: 用户列表
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 获取用户列表
tags:
- 用户管理
/users/{id}:
delete:
consumes:
- application/json
description: 根据ID删除用户
parameters:
- description: 用户ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"204":
description: 删除成功
"400":
description: 无效的用户ID
schema:
additionalProperties:
type: string
type: object
"404":
description: 用户不存在
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 删除用户
tags:
- 用户管理
get:
consumes:
- application/json
description: 根据ID获取用户详情
parameters:
- description: 用户ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 用户信息
schema:
$ref: '#/definitions/model.User'
"400":
description: 无效的用户ID
schema:
additionalProperties:
type: string
type: object
"404":
description: 用户不存在
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 获取用户详情
tags:
- 用户管理
put:
consumes:
- application/json
description: 根据ID更新用户信息
parameters:
- description: 用户ID
in: path
name: id
required: true
type: integer
- description: 用户信息
in: body
name: user
required: true
schema:
$ref: '#/definitions/model.User'
produces:
- application/json
responses:
"200":
description: 更新后的用户信息
schema:
$ref: '#/definitions/model.User'
"400":
description: 无效的用户ID或请求参数
schema:
additionalProperties:
type: string
type: object
"404":
description: 用户不存在
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 更新用户信息
tags:
- 用户管理
schemes:
- http
securityDefinitions:
BearerAuth:
description: '请输入 "Bearer " + JWT token,例如: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."'
in: header
name: Authorization
type: apiKey
swagger: "2.0"