merch-api/docs/swagger.json
2026-03-11 20:17:40 +03:00

843 lines
No EOL
28 KiB
JSON
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.

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