748 lines
23 KiB
Go
748 lines
23 KiB
Go
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
|
// This file was generated by swaggo/swag
|
|
|
|
package docs
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"strings"
|
|
|
|
"github.com/alecthomas/template"
|
|
"github.com/swaggo/swag"
|
|
)
|
|
|
|
var doc = `{
|
|
"schemes": {{ marshal .Schemes }},
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "{{.Description}}",
|
|
"title": "{{.Title}}",
|
|
"contact": {},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/auth": {
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "鉴权验证",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "app key",
|
|
"name": "app_key",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "app secret",
|
|
"name": "app_secret",
|
|
"in": "formData",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/user/login": {
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "用户登录",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "用户名",
|
|
"name": "username",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "密码",
|
|
"name": "password",
|
|
"in": "formData",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/user/register": {
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "用户注册",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "用户名",
|
|
"name": "username",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "密码",
|
|
"name": "password",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "昵称",
|
|
"name": "nickname",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/upload": {
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "上传文件",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "file",
|
|
"description": "文件",
|
|
"name": "file",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "文件类型",
|
|
"name": "type",
|
|
"in": "formData",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/users": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "用户列表",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth token",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "页码",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "每页数量",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"maxLength": 30,
|
|
"type": "string",
|
|
"description": "用户名",
|
|
"name": "username",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"maxLength": 30,
|
|
"type": "string",
|
|
"description": "昵称",
|
|
"name": "nickname",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "新增用户",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth token",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 30,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "用户名",
|
|
"name": "username",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 18,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "密码",
|
|
"name": "password",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 30,
|
|
"type": "string",
|
|
"description": "昵称",
|
|
"name": "nickname",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/users/{id}": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "用户",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth token",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "用户 ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "删除用户",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth token",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "用户ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"users"
|
|
],
|
|
"summary": "更新用户",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth token",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "用户ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 30,
|
|
"type": "string",
|
|
"description": "用户名",
|
|
"name": "username",
|
|
"in": "formData"
|
|
},
|
|
{
|
|
"maxLength": 18,
|
|
"type": "string",
|
|
"description": "密码",
|
|
"name": "password",
|
|
"in": "formData"
|
|
},
|
|
{
|
|
"maxLength": 30,
|
|
"type": "string",
|
|
"description": "昵称",
|
|
"name": "nickname",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/vendors": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "系统厂商列表",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "页码",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "每页数量",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"type": "string",
|
|
"description": "系统厂商名称",
|
|
"name": "name",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商云id",
|
|
"name": "uuid",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/basic.Vendor"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "新增系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "系统厂商名称",
|
|
"name": "name",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商云id",
|
|
"name": "uuid",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/basic.Vendor"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/vendors/{id}": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商 ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/basic.Vendor"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "删除系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商 ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/basic.Vendor"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "修改系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "token",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商 ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "系统厂商名称",
|
|
"name": "name",
|
|
"in": "formData"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商云id",
|
|
"name": "uuid",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/basic.Vendor"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"basic.Vendor": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"uuid": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"errcode.Error": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer"
|
|
},
|
|
"data": {
|
|
"type": "object"
|
|
},
|
|
"msg": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"is_admin": {
|
|
"type": "boolean"
|
|
},
|
|
"nickname": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}`
|
|
|
|
type swaggerInfo struct {
|
|
Version string
|
|
Host string
|
|
BasePath string
|
|
Schemes []string
|
|
Title string
|
|
Description string
|
|
}
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = swaggerInfo{
|
|
Version: "1.0",
|
|
Host: "",
|
|
BasePath: "/api",
|
|
Schemes: []string{},
|
|
Title: "Potato Api",
|
|
Description: "This is a potato use golang",
|
|
}
|
|
|
|
type s struct{}
|
|
|
|
func (s *s) ReadDoc() string {
|
|
sInfo := SwaggerInfo
|
|
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
|
|
|
|
t, err := template.New("swagger_info").Funcs(template.FuncMap{
|
|
"marshal": func(v interface{}) string {
|
|
a, _ := json.Marshal(v)
|
|
return string(a)
|
|
},
|
|
}).Parse(doc)
|
|
if err != nil {
|
|
return doc
|
|
}
|
|
|
|
var tpl bytes.Buffer
|
|
if err := t.Execute(&tpl, sInfo); err != nil {
|
|
return doc
|
|
}
|
|
|
|
return tpl.String()
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(swag.Name, &s{})
|
|
}
|