gin-blog/docs/swagger.yaml
2021-05-31 17:40:47 +08:00

283 lines
6.5 KiB
YAML

definitions:
api.res:
type: object
app.Pager:
properties:
page:
type: integer
page_size:
type: integer
total_rows:
type: integer
type: object
errorcode.Error:
type: object
model.Tag:
properties:
created_by:
type: string
created_on:
type: integer
deleted_on:
type: integer
id:
type: integer
is_del:
type: integer
modified_by:
type: string
modified_on:
type: integer
name:
type: string
state:
type: integer
type: object
model.TagSwagger:
properties:
list:
items:
$ref: '#/definitions/model.Tag'
type: array
pager:
$ref: '#/definitions/app.Pager'
type: object
service.FileInfo:
properties:
accessUrl:
type: string
name:
type: string
type: object
info:
contact: { }
description: Go 语言编程之旅:一起用 Go 做项目
termsOfService: https://github.com/go-programming-tour-book
title: 博客系统
version: "1.0"
paths:
/api/v1/tags:
get:
parameters:
- description: token
in: query
name: token
required: true
type: string
- description: 标签名称
in: query
maxLength: 100
name: name
type: string
- default: 1
description: 状态
enum:
- 0
- 1
in: query
name: state
type: integer
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: 成功
schema:
$ref: '#/definitions/model.TagSwagger'
"400":
description: 请求错误
schema:
$ref: '#/definitions/errorcode.Error'
"500":
description: 内部错误
schema:
$ref: '#/definitions/errorcode.Error'
summary: 获取多个标签
post:
parameters:
- description: 标签名称
in: formData
maxLength: 100
minLength: 3
name: name
required: true
type: string
- default: 1
description: 状态
enum:
- 0
- 1
in: formData
name: state
type: integer
- description: 创建者
in: formData
maxLength: 100
minLength: 3
name: created_by
required: true
type: string
produces:
- application/json
responses:
"200":
description: 成功
schema:
$ref: '#/definitions/model.TagSwagger'
"400":
description: 请求错误
schema:
$ref: '#/definitions/errorcode.Error'
"500":
description: 内部错误
schema:
$ref: '#/definitions/errorcode.Error'
summary: 新增标签
/api/v1/tags/{id}:
delete:
parameters:
- description: 标签 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 成功
schema:
type: string
"400":
description: 请求错误
schema:
$ref: '#/definitions/errorcode.Error'
"500":
description: 内部错误
schema:
$ref: '#/definitions/errorcode.Error'
summary: 删除标签
put:
parameters:
- description: 标签 ID
in: path
name: id
required: true
type: integer
- description: 标签名称
in: formData
minLength: 3
name: name
type: string
- default: 1
description: 状态
enum:
- 0
- 1
in: formData
name: state
type: integer
- description: 修改者
in: formData
maxLength: 100
minLength: 3
name: modified_by
required: true
type: string
produces:
- application/json
responses:
"200":
description: 成功
schema:
items:
$ref: '#/definitions/model.TagSwagger'
type: array
"400":
description: 请求错误
schema:
$ref: '#/definitions/errorcode.Error'
"500":
description: 内部错误
schema:
$ref: '#/definitions/errorcode.Error'
summary: 更新标签
/auth:
post:
parameters:
- description: appkey
in: formData
name: app_key
required: true
type: string
- description: appsecret
in: formData
name: app_secret
required: true
type: string
produces:
- application/json
responses:
"200":
description: 成功
schema:
allOf:
- $ref: '#/definitions/api.res'
- properties:
token:
type: string
type: object
"400":
description: 请求错误
schema:
$ref: '#/definitions/errorcode.Error'
"500":
description: 内部错误
schema:
$ref: '#/definitions/errorcode.Error'
summary: 获取token
/upload/file:
post:
parameters:
- description: 文件类型1图片
enum:
- 1
- 2
- 3
in: formData
name: type
required: true
type: integer
- description: 文件
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: 成功
schema:
$ref: '#/definitions/service.FileInfo'
"400":
description: 请求错误
schema:
$ref: '#/definitions/errorcode.Error'
"500":
description: 内部错误
schema:
$ref: '#/definitions/errorcode.Error'
summary: 上传图片
swagger: "2.0"