178 lines
4.1 KiB
YAML
178 lines
4.1 KiB
YAML
basePath: /api/v1
|
|
definitions:
|
|
entity.ProductDisplay:
|
|
properties:
|
|
created_at:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: integer
|
|
name:
|
|
type: string
|
|
original_price:
|
|
type: number
|
|
price:
|
|
type: number
|
|
quantity:
|
|
type: integer
|
|
status:
|
|
type: boolean
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
httputil.HTTPError:
|
|
properties:
|
|
code:
|
|
example: 400
|
|
type: integer
|
|
message:
|
|
example: status bad request
|
|
type: string
|
|
type: object
|
|
externalDocs:
|
|
description: OpenAPI
|
|
url: https://swagger.io/resources/open-api/
|
|
host: localhost:9000
|
|
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:
|
|
/products:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get Products
|
|
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/entity.ProductDisplay'
|
|
type: array
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: List Products
|
|
tags:
|
|
- Products
|
|
/products/{id}:
|
|
delete:
|
|
consumes:
|
|
- application/json
|
|
description: Delete Product by ID
|
|
parameters:
|
|
- description: product ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
type: string
|
|
"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 product
|
|
tags:
|
|
- Products
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get string by ID
|
|
parameters:
|
|
- description: product ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/entity.ProductDisplay'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/httputil.HTTPError'
|
|
summary: Show an product
|
|
tags:
|
|
- Products
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: update Product by ID
|
|
parameters:
|
|
- description: product ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
type: string
|
|
"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 product
|
|
tags:
|
|
- Products
|
|
securityDefinitions:
|
|
BasicAuth:
|
|
type: basic
|
|
swagger: "2.0"
|