{ "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": [] } ], "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": [] } ], "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": [] } ], "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": [] } ], "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" } } } } }, "/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" } } } } }, "/upload/file": { "post": { "security": [ { "ApiKeyAuth": [] } ], "produces": [ "application/json" ], "summary": "上传图片", "parameters": [ { "enum": [ 1, 2, 3 ], "type": "integer", "description": "文件类型1图片", "name": "type", "in": "formData", "required": true }, { "type": "file", "description": "文件", "name": "file", "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": { "api.res": { "type": "object" }, "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" } } }