gin-blog/docs/swagger.yaml

293 lines
6.7 KiB
YAML
Raw Permalink Normal View History

2021-05-28 10:40:39 +00:00
definitions:
2021-05-31 09:40:47 +00:00
api.res:
type: object
2021-05-28 10:40:39 +00:00
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: 标签名称
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'
security:
- ApiKeyAuth: [ ]
2021-05-28 10:40:39 +00:00
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'
security:
- ApiKeyAuth: [ ]
2021-05-28 10:40:39 +00:00
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'
security:
- ApiKeyAuth: [ ]
2021-05-28 10:40:39 +00:00
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'
security:
- ApiKeyAuth: [ ]
2021-05-28 10:40:39 +00:00
summary: 更新标签
2021-05-31 09:40:47 +00:00
/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
2021-05-28 10:40:39 +00:00
/upload/file:
post:
parameters:
- description: 文件类型1图片
enum:
- 1
- 2
- 3
in: formData
name: type
required: true
type: integer
- description: 文件
in: formData
2021-05-31 02:13:26 +00:00
name: file
2021-05-28 10:40:39 +00:00
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'
security:
- ApiKeyAuth: [ ]
2021-05-28 10:40:39 +00:00
summary: 上传图片
securityDefinitions:
ApiKeyAuth:
in: header
name: Authorization
type: apiKey
2021-05-28 10:40:39 +00:00
swagger: "2.0"