merch-api/docs/swagger.yaml
2026-03-10 23:44:59 +03:00

444 lines
11 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

basePath: /api/v2
definitions:
merch.OriginWithPrices:
properties:
origin:
type: string
prices:
items:
$ref: '#/definitions/merch.PriceEntry'
type: array
type: object
merch.PriceEntry:
properties:
created_at:
type: integer
value:
type: integer
type: object
merch.PricesResponse:
properties:
merch_uuid:
type: string
name:
type: string
origins:
items:
$ref: '#/definitions/merch.OriginWithPrices'
type: array
type: object
merch.deleteOriginDTO:
properties:
name:
type: string
type: object
merch.extraDataDTO:
properties:
links:
items:
$ref: '#/definitions/merch.originLink'
type: array
merch_uuid:
type: string
type: object
merch.merchDTO:
properties:
created_at:
type: string
merch_uuid:
type: string
name:
type: string
updated_at:
type: string
type: object
merch.newMerchDTO:
properties:
links:
items:
$ref: '#/definitions/merch.originLink'
type: array
name:
type: string
type: object
merch.newOriginDTO:
properties:
name:
type: string
type: object
merch.originItem:
properties:
id:
type: integer
name:
type: string
type: object
merch.originLink:
properties:
origin:
type: string
origin_link:
type: string
type: object
merch.originsDTO:
properties:
origins:
items:
$ref: '#/definitions/merch.originItem'
type: array
type: object
merch.updateMerchDTO:
properties:
merch_uuid:
type: string
name:
type: string
type: object
responses.BadRequest:
properties:
error:
example: error
type: string
type: object
responses.InternalServerError:
properties:
error:
example: error
type: string
type: object
responses.Unauthorized:
properties:
error:
example: error
type: string
type: object
info:
contact: {}
description: Stores data about merch and prices
title: Merch API
version: "2.3"
paths:
/merch/{uuid}:
delete:
consumes:
- application/json
description: Marks merch and all its extra data as deleted by uuid.
parameters:
- description: merch uuid
in: path
name: uuid
required: true
type: string
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Delete merch
tags:
- Merch
put:
consumes:
- application/json
description: Update merch general info (except extra data)
parameters:
- description: merch uuid
in: path
name: uuid
required: true
type: string
- description: payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/merch.updateMerchDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/merch.merchDTO'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Update merch
tags:
- Merch
/merch/create:
post:
consumes:
- application/json
description: Create new merch
parameters:
- description: merch body
in: body
name: merch
required: true
schema:
$ref: '#/definitions/merch.newMerchDTO'
responses:
"201":
description: Created
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Create new merch
tags:
- Merch
/merch/extra/{uuid}:
put:
consumes:
- application/json
description: Update ONLY merch extra data
parameters:
- description: merch uuid
in: path
name: uuid
required: true
type: string
- description: payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/merch.extraDataDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/merch.extraDataDTO'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Update merch extra data
tags:
- Merch
/merch/list:
get:
description: Get all merch without origins
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/merch.merchDTO'
type: array
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Get all merch
tags:
- Merch
/merch/origins:
delete:
consumes:
- application/json
description: Marks origin as deleted by name.
parameters:
- description: origin body
in: body
name: origin
required: true
schema:
$ref: '#/definitions/merch.deleteOriginDTO'
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Delete origin
tags:
- Origins
get:
description: Get all origins
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/merch.originsDTO'
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Get all origins
tags:
- Origins
post:
consumes:
- application/json
description: Create new origin with name
parameters:
- description: origin body
in: body
name: origin
required: true
schema:
$ref: '#/definitions/merch.newOriginDTO'
responses:
"201":
description: Created
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Create new origin
tags:
- Origins
/prices:
get:
description: Получить цены мерча за период
parameters:
- description: period in days
in: query
name: days
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/merch.PricesResponse'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
security:
- BearerAuth: []
summary: Получить цены мерча за период
tags:
- Merch
/prices/{uuid}:
get:
description: Получить перепады цен мерча за период по его merch_uuid
parameters:
- description: merch_uuid
in: path
name: uuid
required: true
type: string
- description: period in days
in: query
name: days
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/merch.PricesResponse'
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
security:
- BearerAuth: []
summary: Получить перепады цен мерча за период по его merch_uuid
tags:
- Merch
swagger: "2.0"