Skip to content

Instantly share code, notes, and snippets.

@btshft
Created June 18, 2020 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btshft/8b1abe436681244dcd6c6cb83e30fb14 to your computer and use it in GitHub Desktop.
Save btshft/8b1abe436681244dcd6c6cb83e30fb14 to your computer and use it in GitHub Desktop.
counters draft
{
"openapi": "3.0.1",
"info": {
"title": "Counters API",
"version": "v1"
},
"paths": {
"/Counters/simple/{name}/increment/{key}": {
"post": {
"tags": [
"Counters"
],
"summary": "Увеличивает значение счетчика name по ключу key.",
"parameters": [
{
"name": "name",
"in": "path",
"description": "Наименование счетчика.",
"required": true,
"schema": {
"type": "string",
"description": "Наименование счетчика.",
"nullable": true
}
},
{
"name": "key",
"in": "path",
"description": "Ключ идентифицирующий конкретный объект счетчика. Ключ может быть составным с разделителем '/', например '1234/3452'",
"required": true,
"schema": {
"type": "string",
"description": "Ключ идентифицирующий конкретный объект счетчика. Ключ может быть составным с разделителем '/', например '1234/3452'",
"nullable": true
}
}
],
"requestBody": {
"description": "Модель запроса.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IncrementCounterModel"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/IncrementCounterModel"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/IncrementCounterModel"
}
}
}
},
"responses": {
"200": {
"description": "Success"
}
}
}
},
"/Counters/{name}/{key}": {
"get": {
"tags": [
"Counters"
],
"summary": "Возвращает значение счетчика name по ключу key.",
"parameters": [
{
"name": "name",
"in": "path",
"description": "Наименование счетчика.",
"required": true,
"schema": {
"type": "string",
"description": "Наименование счетчика.",
"nullable": true
}
},
{
"name": "key",
"in": "path",
"description": "Ключ идентифицирующий конкретный объект счетчика.",
"required": true,
"schema": {
"type": "string",
"description": "Ключ идентифицирующий конкретный объект счетчика.",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CounterModel"
}
}
}
}
}
}
},
"/Counters/{name}/values": {
"post": {
"tags": [
"Counters"
],
"summary": "Возвращает значения счетчиков с именем name по массиву ключей.",
"parameters": [
{
"name": "name",
"in": "path",
"description": "Наименование счетчика.",
"required": true,
"schema": {
"type": "string",
"description": "Наименование счетчика.",
"nullable": true
}
}
],
"requestBody": {
"description": "Модель запроса.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetCountersValuesRequest"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/GetCountersValuesRequest"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/GetCountersValuesRequest"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CounterModel"
}
}
}
}
}
}
}
},
"/external/procedure/increment/{procedureId}": {
"post": {
"tags": [
"TestClientProcedureViews"
],
"summary": "Увеличивает счетчик просмотра процедуры.",
"parameters": [
{
"name": "procedureId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "Success"
}
}
}
},
"/external/procedure/{procedureId}": {
"get": {
"tags": [
"TestClientProcedureViews"
],
"summary": "Получает информацию о просмотрах процедуры.",
"parameters": [
{
"name": "procedureId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/CounterModel"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/CounterModel"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/CounterModel"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"IncrementCounterModel": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
"CounterModel": {
"type": "object",
"properties": {
"key": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"value": {
"type": "integer",
"format": "int64"
}
},
"additionalProperties": false
},
"GetCountersValuesRequest": {
"type": "object",
"properties": {
"keys": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"nullable": true
}
},
"additionalProperties": false
}
}
},
"tags": [
{
"name": "Counters",
"description": "Контроллер обычных счетчиков без обеспечения уникальности."
},
{
"name": "TestClientProcedureViews",
"description": "Клиентский контроллер, добавлен для примера работы с API Counters.\r\nЭтого контроллера не будет в реальном API, он лишь показывает как работать с Counters.API будучи клиентом."
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment