gin-blog/docs/swagger.json

449 lines
10 KiB
JSON
Raw Normal View History

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