{ "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/labels": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Получить все метки товаров", "produces": [ "application/json" ], "tags": [ "Merch labels" ], "summary": "Получить все метки товаров", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/merch.LabelsList" } } }, "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": { "security": [ { "BearerAuth": [] } ], "description": "Создать новую метку для товара", "consumes": [ "application/json" ], "tags": [ "Merch labels" ], "summary": "Создать новую метку для товара", "parameters": [ { "description": "payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/merch.LabelDTO" } } ], "responses": { "200": { "description": "OK" }, "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/labels/attach": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Прикрепить метку к товару", "consumes": [ "application/json" ], "tags": [ "Merch labels" ], "summary": "Прикрепить метку к товару", "parameters": [ { "description": "payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/merch.LabelLink" } } ], "responses": { "200": { "description": "OK" }, "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/labels/detach": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Удалить привязку метки к товару", "consumes": [ "application/json" ], "tags": [ "Merch labels" ], "summary": "Удалить привязку метки к товару", "parameters": [ { "description": "payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/merch.LabelLink" } } ], "responses": { "200": { "description": "OK" }, "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/labels/{uuid}": { "get": { "description": "Получить персональные данные. Запрос данных по gRPC у сервиса авторизации.", "produces": [ "application/json" ], "tags": [ "User" ], "summary": "Получить персональные данные.", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.PersonalDTO" } }, "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" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Изменить метку", "consumes": [ "application/json" ], "tags": [ "Merch labels" ], "summary": "Изменить метку", "parameters": [ { "type": "string", "description": "label uuid", "name": "uuid", "in": "path", "required": true }, { "description": "payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/merch.LabelDTO" } } ], "responses": { "200": { "description": "OK" }, "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": { "security": [ { "BearerAuth": [] } ], "description": "Пометить метку как удаленную", "tags": [ "Merch labels" ], "summary": "Пометить метку как удаленную", "parameters": [ { "type": "string", "description": "label uuid", "name": "uuid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "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.listResponse" } } }, "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}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Получить всю информацию про мерч по его uuid", "produces": [ "application/json" ], "tags": [ "Merch" ], "summary": "Получить всю информацию про мерч", "parameters": [ { "type": "string", "description": "merch_uuid", "name": "uuid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/merch.singleMerchResponse" } }, "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" } } } }, "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.", "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" } } } } }, "/user": { "post": { "description": "Adds local user record based on user uuid from auth service", "consumes": [ "application/json" ], "tags": [ "User" ], "summary": "Create new user", "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": "Returns user data", "consumes": [ "application/json" ], "tags": [ "User" ], "summary": "Returns user data", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/user.MeDTO" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/responses.BadRequest" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/responses.Unauthorized" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/responses.NotFound" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/responses.InternalServerError" } } } } } }, "definitions": { "common.PersonalDTO": { "type": "object", "properties": { "email": { "type": "string" }, "name": { "type": "string" }, "surname": { "type": "string" }, "username": { "type": "string" }, "uuid": { "type": "string" } } }, "merch.DeleteZeroPrices": { "type": "object", "properties": { "id": { "type": "integer" }, "merch_uuid": { "type": "string" } } }, "merch.LabelDTO": { "type": "object", "properties": { "bg_color": { "type": "string" }, "color": { "type": "string" }, "name": { "type": "string" } } }, "merch.LabelLink": { "type": "object", "properties": { "label_uuid": { "type": "string" }, "merch_uuid": { "type": "string" } } }, "merch.LabelsList": { "type": "object", "properties": { "bg_color": { "type": "string" }, "color": { "type": "string" }, "label_uuid": { "type": "string" }, "name": { "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.listResponse": { "type": "object", "properties": { "labels": { "type": "array", "items": { "type": "string" } }, "merch_uuid": { "type": "string" }, "name": { "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.singleMerchResponse": { "type": "object", "properties": { "merch_uuid": { "type": "string" }, "name": { "type": "string" }, "origins": { "type": "array", "items": { "$ref": "#/definitions/merch.originLink" } } } }, "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.NotFound": { "type": "object", "properties": { "error": { "type": "string", "example": "error" } } }, "responses.Unauthorized": { "type": "object", "properties": { "error": { "type": "string", "example": "error" } } }, "user.MeDTO": { "type": "object", "properties": { "user_uuid": { "type": "string" } } } } }