693 lines
16 KiB
YAML
693 lines
16 KiB
YAML
basePath: /api/v1
|
|
definitions:
|
|
controller.Message:
|
|
properties:
|
|
message:
|
|
example: message
|
|
type: string
|
|
type: object
|
|
httputil.HTTPError:
|
|
properties:
|
|
code:
|
|
example: 400
|
|
type: integer
|
|
message:
|
|
example: status bad request
|
|
type: string
|
|
type: object
|
|
model.Account:
|
|
properties:
|
|
id:
|
|
example: 1
|
|
format: int64
|
|
type: integer
|
|
name:
|
|
example: account name
|
|
type: string
|
|
uuid:
|
|
example: 550e8400-e29b-41d4-a716-446655440000
|
|
format: uuid
|
|
type: string
|
|
type: object
|
|
model.AddAccount:
|
|
properties:
|
|
name:
|
|
example: account name
|
|
type: string
|
|
type: object
|
|
model.Admin:
|
|
properties:
|
|
id:
|
|
example: 1
|
|
type: integer
|
|
name:
|
|
example: admin name
|
|
type: string
|
|
type: object
|
|
model.Bottle:
|
|
properties:
|
|
account:
|
|
$ref: '#/definitions/model.Account'
|
|
id:
|
|
example: 1
|
|
type: integer
|
|
name:
|
|
example: bottle_name
|
|
type: string
|
|
type: object
|
|
model.UpdateAccount:
|
|
properties:
|
|
name:
|
|
example: account name
|
|
type: string
|
|
type: object
|
|
host: localhost:8080
|
|
info:
|
|
contact:
|
|
email: support@swagger.io
|
|
name: API Support
|
|
url: http://www.swagger.io/support
|
|
description: This is a sample server celler server.
|
|
license:
|
|
name: Apache 2.0
|
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
|
termsOfService: http://swagger.io/terms/
|
|
title: Swagger Example API
|
|
version: "1.0"
|
|
paths:
|
|
/accounts:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get accounts
|
|
parameters:
|
|
- description: name search by q
|
|
format: email
|
|
in: query
|
|
name: q
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/model.Account'
|
|
type: array
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: List accounts
|
|
tags:
|
|
- accounts
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: add by json account
|
|
parameters:
|
|
- description: Add account
|
|
in: body
|
|
name: account
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/model.AddAccount'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/model.Account'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Add an account
|
|
tags:
|
|
- accounts
|
|
/accounts/{id}:
|
|
delete:
|
|
consumes:
|
|
- application/json
|
|
description: Delete by account ID
|
|
parameters:
|
|
- description: Account ID
|
|
format: int64
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: No Content
|
|
schema:
|
|
$ref: '#/definitions/model.Account'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Delete an account
|
|
tags:
|
|
- accounts
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get string by ID
|
|
parameters:
|
|
- description: Account ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/model.Account'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Show an account
|
|
tags:
|
|
- accounts
|
|
patch:
|
|
consumes:
|
|
- application/json
|
|
description: Update by json account
|
|
parameters:
|
|
- description: Account ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
- description: Update account
|
|
in: body
|
|
name: account
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/model.UpdateAccount'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/model.Account'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Update an account
|
|
tags:
|
|
- accounts
|
|
/accounts/{id}/images:
|
|
post:
|
|
consumes:
|
|
- multipart/form-data
|
|
description: Upload file
|
|
parameters:
|
|
- description: Account ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
- description: account image
|
|
in: formData
|
|
name: file
|
|
required: true
|
|
type: file
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/controller.Message'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Upload account image
|
|
tags:
|
|
- accounts
|
|
/admin/auth:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: get admin info
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/model.Admin'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
security:
|
|
- ApiKeyAuth: []
|
|
summary: Auth admin
|
|
tags:
|
|
- accounts
|
|
- admin
|
|
/bottles:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get bottles
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/model.Bottle'
|
|
type: array
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: List bottles
|
|
tags:
|
|
- bottles
|
|
/bottles/{id}:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get string by ID
|
|
operationId: get-string-by-int
|
|
parameters:
|
|
- description: Bottle ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/model.Bottle'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Show a bottle
|
|
tags:
|
|
- bottles
|
|
/examples/attribute:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: attribute
|
|
parameters:
|
|
- description: string enums
|
|
enum:
|
|
- A
|
|
- B
|
|
- C
|
|
in: query
|
|
name: enumstring
|
|
type: string
|
|
- description: int enums
|
|
enum:
|
|
- 1
|
|
- 2
|
|
- 3
|
|
in: query
|
|
name: enumint
|
|
type: integer
|
|
- description: int enums
|
|
enum:
|
|
- 1.1
|
|
- 1.2
|
|
- 1.3
|
|
in: query
|
|
name: enumnumber
|
|
type: number
|
|
- description: string valid
|
|
in: query
|
|
maxLength: 10
|
|
minLength: 5
|
|
name: string
|
|
type: string
|
|
- description: int valid
|
|
in: query
|
|
maximum: 10
|
|
minimum: 1
|
|
name: int
|
|
type: integer
|
|
- default: A
|
|
description: string default
|
|
in: query
|
|
name: default
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: answer
|
|
schema:
|
|
type: string
|
|
"400":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
summary: attribute example
|
|
tags:
|
|
- example
|
|
/examples/calc:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: plus
|
|
parameters:
|
|
- description: used for calc
|
|
in: query
|
|
name: val1
|
|
required: true
|
|
type: integer
|
|
- description: used for calc
|
|
in: query
|
|
name: val2
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: answer
|
|
schema:
|
|
type: integer
|
|
"400":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
summary: calc example
|
|
tags:
|
|
- example
|
|
/examples/groups/{group_id}/accounts/{account_id}:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: path params
|
|
parameters:
|
|
- description: Group ID
|
|
in: path
|
|
name: group_id
|
|
required: true
|
|
type: integer
|
|
- description: Account ID
|
|
in: path
|
|
name: account_id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: answer
|
|
schema:
|
|
type: string
|
|
"400":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
summary: path params example
|
|
tags:
|
|
- example
|
|
/examples/header:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: custome header
|
|
parameters:
|
|
- description: Authentication header
|
|
in: header
|
|
name: Authorization
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: answer
|
|
schema:
|
|
type: string
|
|
"400":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
summary: custome header example
|
|
tags:
|
|
- example
|
|
/examples/ping:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: do ping
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: pong
|
|
schema:
|
|
type: string
|
|
"400":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
summary: ping example
|
|
tags:
|
|
- example
|
|
/examples/post:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: post request example
|
|
parameters:
|
|
- description: Account Info
|
|
in: body
|
|
name: message
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/model.Account'
|
|
produces:
|
|
- text/plain
|
|
responses:
|
|
"200":
|
|
description: success
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: fail
|
|
schema:
|
|
type: string
|
|
summary: post request example
|
|
/examples/securities:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: custome header
|
|
parameters:
|
|
- description: Authentication header
|
|
in: header
|
|
name: Authorization
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: answer
|
|
schema:
|
|
type: string
|
|
"400":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
"500":
|
|
description: ok
|
|
schema:
|
|
type: string
|
|
security:
|
|
- ApiKeyAuth: []
|
|
- OAuth2Implicit:
|
|
- admin
|
|
- write
|
|
summary: custome header example
|
|
tags:
|
|
- example
|
|
securityDefinitions:
|
|
ApiKeyAuth:
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
BasicAuth:
|
|
type: basic
|
|
OAuth2AccessCode:
|
|
authorizationUrl: https://example.com/oauth/authorize
|
|
flow: accessCode
|
|
scopes:
|
|
admin: ' Grants read and write access to administrative
|
|
information'
|
|
tokenUrl: https://example.com/oauth/token
|
|
type: oauth2
|
|
OAuth2Application:
|
|
flow: application
|
|
scopes:
|
|
admin: ' Grants read and write access to administrative
|
|
information'
|
|
write: ' Grants write access'
|
|
tokenUrl: https://example.com/oauth/token
|
|
type: oauth2
|
|
OAuth2Implicit:
|
|
authorizationUrl: https://example.com/oauth/authorize
|
|
flow: implicit
|
|
scopes:
|
|
admin: ' Grants read and write access to administrative
|
|
information'
|
|
write: ' Grants write access'
|
|
type: oauth2
|
|
OAuth2Password:
|
|
flow: password
|
|
scopes:
|
|
admin: ' Grants read and write access to administrative
|
|
information'
|
|
read: ' Grants read access'
|
|
write: ' Grants write access'
|
|
tokenUrl: https://example.com/oauth/token
|
|
type: oauth2
|
|
swagger: "2.0"
|