potato/docs/swagger.yaml

458 lines
9.8 KiB
YAML

basePath: /api
definitions:
basic.Vendor:
properties:
id:
type: integer
name:
type: string
uuid:
type: integer
type: object
errcode.Error:
properties:
code:
type: integer
data:
type: object
msg:
type: string
type: object
model.User:
properties:
created_at:
type: string
id:
type: integer
is_admin:
type: boolean
nickname:
type: string
updated_at:
type: string
username:
type: string
type: object
info:
contact: {}
description: This is a potato use golang
title: Potato Api
version: "1.0"
paths:
/auth:
post:
consumes:
- multipart/form-data
parameters:
- description: app key
in: formData
name: app_key
required: true
type: string
- description: app secret
in: formData
name: app_secret
required: true
type: string
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/errcode.Error'
summary: 鉴权验证
/user/login:
post:
consumes:
- multipart/form-data
parameters:
- description: 用户名
in: formData
name: username
required: true
type: string
- description: 密码
in: formData
name: password
required: true
type: string
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/errcode.Error'
summary: 用户登录
/user/register:
post:
consumes:
- multipart/form-data
parameters:
- description: 用户名
in: formData
name: username
required: true
type: string
- description: 密码
in: formData
name: password
required: true
type: string
- description: 昵称
in: formData
name: nickname
type: string
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/errcode.Error'
summary: 用户注册
/v1/upload:
post:
consumes:
- multipart/form-data
parameters:
- description: auth by /auth
in: header
name: token
required: true
type: string
- description: 文件
in: formData
name: file
required: true
type: file
- description: 文件类型
in: formData
name: type
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/errcode.Error'
summary: 上传文件
/v1/users:
get:
consumes:
- application/json
parameters:
- description: auth token
in: header
name: token
required: true
type: string
- description: 页码
in: query
name: page
type: integer
- description: 每页数量
in: query
name: page_size
type: integer
- description: 用户名
in: query
maxLength: 30
name: username
type: string
- description: 昵称
in: query
maxLength: 30
name: nickname
type: string
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/model.User'
summary: 用户列表
tags:
- users
post:
consumes:
- multipart/form-data
parameters:
- description: auth token
in: header
name: token
required: true
type: string
- description: 用户名
in: formData
maxLength: 30
minLength: 1
name: username
required: true
type: string
- description: 密码
in: formData
maxLength: 18
minLength: 1
name: password
required: true
type: string
- description: 昵称
in: formData
maxLength: 30
name: nickname
type: string
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/model.User'
summary: 新增用户
tags:
- users
/v1/users/{id}:
delete:
consumes:
- application/json
parameters:
- description: auth token
in: header
name: token
required: true
type: string
- description: 用户ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/model.User'
summary: 删除用户
tags:
- users
get:
consumes:
- application/json
parameters:
- description: auth token
in: header
name: token
required: true
type: string
- description: 用户 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/model.User'
summary: 用户
tags:
- users
patch:
consumes:
- multipart/form-data
parameters:
- description: auth token
in: header
name: token
required: true
type: string
- description: 用户ID
in: path
name: id
required: true
type: integer
- description: 用户名
in: formData
maxLength: 30
name: username
type: string
- description: 密码
in: formData
maxLength: 18
name: password
type: string
- description: 昵称
in: formData
maxLength: 30
name: nickname
type: string
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/model.User'
summary: 更新用户
tags:
- users
/v1/vendors:
get:
consumes:
- application/json
parameters:
- description: auth by /auth
in: header
name: token
required: true
type: string
- description: 页码
in: query
name: page
type: integer
- description: 每页数量
in: query
name: page_size
type: integer
- description: 系统厂商名称
in: query
maxLength: 100
name: name
type: string
- description: 系统厂商云id
in: query
name: uuid
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/basic.Vendor'
summary: 系统厂商列表
tags:
- vendors
post:
consumes:
- multipart/form-data
parameters:
- description: auth by /auth
in: header
name: token
required: true
type: string
- description: 系统厂商名称
in: formData
maxLength: 100
minLength: 1
name: name
required: true
type: string
- description: 系统厂商云id
in: formData
name: uuid
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/basic.Vendor'
summary: 新增系统厂商
tags:
- vendors
/v1/vendors/{id}:
delete:
consumes:
- application/json
parameters:
- description: auth by /auth
in: header
name: token
required: true
type: string
- description: 系统厂商 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/basic.Vendor'
summary: 删除系统厂商
tags:
- vendors
get:
consumes:
- application/json
parameters:
- description: auth by /auth
in: header
name: token
required: true
type: string
- description: 系统厂商 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/basic.Vendor'
summary: 系统厂商
tags:
- vendors
patch:
consumes:
- multipart/form-data
parameters:
- description: auth by /auth
in: header
name: token
required: true
type: string
- description: 系统厂商 ID
in: path
name: id
required: true
type: integer
- description: 系统厂商名称
in: formData
maxLength: 100
minLength: 1
name: name
type: string
- description: 系统厂商云id
in: formData
name: uuid
type: integer
produces:
- application/json
responses:
"200":
description: 请求成功
schema:
$ref: '#/definitions/basic.Vendor'
summary: 修改系统厂商
tags:
- vendors
swagger: "2.0"