682 lines
No EOL
22 KiB
JSON
682 lines
No EOL
22 KiB
JSON
{
|
||
"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/{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": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"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": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"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.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.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"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |