potato/docs/swagger.json

684 lines
22 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "This is a potato use golang",
"title": "Potato Api",
"contact": {},
"version": "1.0"
},
"basePath": "/api",
"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"
}
}
}
}
}