Skip to content

Instantly share code, notes, and snippets.

@goququ
Last active July 11, 2023 10:40
Show Gist options
  • Save goququ/359839b21dfface62d9a38a79a5972db to your computer and use it in GitHub Desktop.
Save goququ/359839b21dfface62d9a38a79a5972db to your computer and use it in GitHub Desktop.
analytics
{
"openapi": "3.0.1",
"info": {
"title": "ML.Analytics",
"version": "v1"
},
"paths": {
"/api/analytics/clients/{clientId}/instant": {
"get": {
"tags": [
"Clients"
],
"summary": "Получение данных моментальной статистики по клиенту. (Auth policies: read:analytics)",
"operationId": "GetClientInstant",
"parameters": [
{
"name": "clientId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"description": "Идентификатор клиента.",
"format": "uuid"
}
},
{
"name": "timestamp",
"in": "query",
"schema": {
"type": "string",
"description": "Временная метка.",
"format": "date-time"
}
}
],
"responses": {
"200": {
"description": "Данные получены.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClientInstantDtoSuccessResponseWrapper"
}
}
}
},
"404": {
"description": "Данные клиента не найдены.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseWrapper"
}
}
}
}
}
},
"put": {
"tags": [
"Clients"
],
"summary": "Обновляет текущие данные статистики клиента. (Auth policies: edit:analytics)",
"operationId": "UpdateClientInstant",
"parameters": [
{
"name": "clientId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"description": "Идентификатор клиента.",
"format": "uuid"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateClientInstantSingleDto"
}
}
}
},
"responses": {
"202": {
"description": "Изменения приняты.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MessageDtoSuccessResponseWrapper"
}
}
}
},
"304": {
"description": "Без изменений.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MessageDtoSuccessResponseWrapper"
}
}
}
}
}
}
},
"/api/analytics/clients/instant": {
"put": {
"tags": [
"Clients"
],
"summary": "Обновляет текущие данные статистики клиентов. (Auth policies: edit:analytics)",
"operationId": "BatchUpdateClientInstant",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateClientInstantBatchDto"
}
}
}
},
"responses": {
"202": {
"description": "Изменения приняты.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MessageDtoSuccessResponseWrapper"
}
}
}
}
}
}
},
"/api/analytics/kitchens/{kitchenId}/daily": {
"get": {
"tags": [
"Kitchens"
],
"summary": "Получение данных статистики по кухне за определенные сутки. (Auth policies: read:analytics)",
"operationId": "GetKitchenDaily",
"parameters": [
{
"name": "kitchenId",
"in": "path",
"required": true,
"schema": {
"title": "Идентификатор кухни.",
"type": "integer",
"format": "int32"
}
},
{
"name": "includeShift",
"in": "query",
"description": "\n\nCurrentOnly\n\nPreviousOnly",
"schema": {
"$ref": "#/components/schemas/IncludeShift"
},
"x-enumNames": [
"CurrentOnly",
"PreviousOnly"
]
},
{
"name": "createdAt",
"in": "query",
"schema": {
"title": "Дата сохранения суточной статистики.",
"type": "string",
"format": "date"
}
}
],
"responses": {
"200": {
"description": "Данные получены.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KitchenInstantDtoSuccessResponseWrapper"
}
}
}
}
}
}
},
"/api/analytics/kitchens/{kitchenId}/instant": {
"get": {
"tags": [
"Kitchens"
],
"summary": "Получение данных моментальной статистики по кухне. (Auth policies: read:analytics)",
"operationId": "GetKitchenInstant",
"parameters": [
{
"name": "kitchenId",
"in": "path",
"required": true,
"schema": {
"title": "Идентификатор кухни.",
"type": "integer",
"format": "int32"
}
},
{
"name": "includeShift",
"in": "query",
"description": "\n\nCurrentOnly\n\nPreviousOnly",
"schema": {
"$ref": "#/components/schemas/IncludeShift"
},
"x-enumNames": [
"CurrentOnly",
"PreviousOnly"
]
}
],
"responses": {
"200": {
"description": "Данные получены.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KitchenInstantDtoSuccessResponseWrapper"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"BaseInstantDto": {
"type": "object",
"additionalProperties": false
},
"Cancelled": {
"required": [
"count",
"g_m_v"
],
"type": "object",
"properties": {
"count": {
"title": "Количество отмененных.",
"type": "integer",
"format": "int32"
},
"g_m_v": {
"title": "GMV отмененных.",
"type": "number",
"format": "double"
}
},
"additionalProperties": false
},
"ClientInstant": {
"type": "object",
"properties": {
"client_id": {
"title": "Идентификатор клиента",
"type": "string",
"format": "uuid"
},
"orders": {
"$ref": "#/components/schemas/ClientOrders"
},
"reviews": {
"$ref": "#/components/schemas/ReviewsStats"
}
},
"additionalProperties": false
},
"ClientInstantDto": {
"required": [
"client_id",
"orders",
"reviews"
],
"type": "object",
"properties": {
"client_id": {
"title": "Идентификатор клиета.",
"type": "string",
"format": "uuid"
},
"orders": {
"$ref": "#/components/schemas/ClientOrders"
},
"reviews": {
"$ref": "#/components/schemas/ReviewsStats"
}
},
"additionalProperties": false
},
"ClientInstantDtoSuccessResponseWrapper": {
"required": [
"data"
],
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/ClientInstantDto"
}
},
"additionalProperties": false
},
"ClientOrders": {
"type": "object",
"properties": {
"completed_count": {
"title": "Количетсво заврешенных.",
"maximum": 2147483647,
"minimum": 0,
"type": "integer",
"format": "int32",
"nullable": true
},
"l_t_v": {
"title": "LTV.",
"type": "number",
"description": "LTV после всех скидок.",
"format": "double",
"nullable": true
},
"first_created_at": {
"title": "Дата создания первого заказа.",
"type": "string",
"format": "date-time",
"nullable": true
},
"last_created_at": {
"title": "Дата создания последнего заказа.",
"type": "string",
"format": "date-time",
"nullable": true
}
},
"additionalProperties": false
},
"Delivery": {
"required": [
"orders"
],
"type": "object",
"properties": {
"orders": {
"$ref": "#/components/schemas/KitchenOrders"
}
},
"additionalProperties": false
},
"DeliveryByClient": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/Delivery"
}
],
"additionalProperties": false
},
"DeliveryByCourier": {
"required": [
"click_to_eat",
"delay_time",
"delays_percentage",
"delivery_time"
],
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/Delivery"
}
],
"properties": {
"delays_percentage": {
"title": "Процент опозданий.",
"type": "number",
"format": "float"
},
"delivery_time": {
"title": "Среднее время доставки.",
"type": "string",
"example": "00:00:00"
},
"click_to_eat": {
"title": "Средний Click-to-eat.",
"type": "string",
"example": "00:00:00"
},
"delay_time": {
"title": "Среднее время опоздания.",
"type": "string",
"example": "00:00:00"
}
},
"additionalProperties": false
},
"ErrorResponseWrapper": {
"required": [
"error"
],
"type": "object",
"properties": {
"error": {
"$ref": "#/components/schemas/ErrorResultDto"
}
},
"additionalProperties": false
},
"ErrorResultDto": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"nullable": true
},
"message": {
"type": "string"
},
"errors": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
"Hourly": {
"required": [
"cancelled",
"deliveries",
"orders",
"ticket_time"
],
"type": "object",
"properties": {
"orders": {
"$ref": "#/components/schemas/KitchenOrders"
},
"cancelled": {
"title": "Количестов отмененных в разрезе маркетплейса.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Cancelled"
}
},
"ticket_time": {
"title": "Текущий тикет-тайм по часу.",
"type": "string",
"example": "00:00:00"
},
"deliveries": {
"title": "Статистика в разрезе типа доставки.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"$ref": "#/components/schemas/DeliveryByClient"
},
{
"$ref": "#/components/schemas/DeliveryByCourier"
}
]
}
}
},
"additionalProperties": false
},
"IncludeShift": {
"enum": [
"CurrentOnly",
"PreviousOnly"
],
"type": "string",
"description": "\n\nCurrentOnly\n\nPreviousOnly",
"x-enumNames": [
"CurrentOnly",
"PreviousOnly"
]
},
"KitchenInstantDto": {
"required": [
"kitchen_id",
"ticket_time"
],
"type": "object",
"properties": {
"kitchen_id": {
"title": "Идентификатор кухни.",
"type": "integer",
"format": "int32"
},
"current_shift": {
"$ref": "#/components/schemas/Shift"
},
"previous_shift": {
"$ref": "#/components/schemas/Shift"
},
"ticket_time": {
"title": "Текущий тикет-тайм кухни.",
"type": "string",
"example": "00:00:00"
}
},
"additionalProperties": false
},
"KitchenInstantDtoSuccessResponseWrapper": {
"required": [
"data"
],
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/KitchenInstantDto"
}
},
"additionalProperties": false
},
"KitchenOrders": {
"required": [
"count",
"g_m_v"
],
"type": "object",
"properties": {
"count": {
"title": "Текущее количество заказов в смене.",
"type": "integer",
"format": "int32"
},
"g_m_v": {
"title": "Текущий GMV.",
"type": "number",
"format": "double"
}
},
"additionalProperties": false
},
"MessageDto": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"additionalProperties": false
},
"MessageDtoSuccessResponseWrapper": {
"required": [
"data"
],
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/MessageDto"
}
},
"additionalProperties": false
},
"PartOfDay": {
"enum": [
"Day",
"Night"
],
"type": "string",
"description": "\n\nDay\n\nNight",
"x-enumNames": [
"Day",
"Night"
]
},
"ReviewsStats": {
"type": "object",
"properties": {
"negative_count": {
"title": "Количетсво негативных отзывов.",
"maximum": 2147483647,
"minimum": 0,
"type": "integer",
"format": "int32",
"nullable": true
},
"positive_count": {
"title": "Количетсво позитивных отзывов.",
"maximum": 2147483647,
"minimum": 0,
"type": "integer",
"format": "int32",
"nullable": true
}
},
"additionalProperties": false
},
"Shift": {
"required": [
"begin_at",
"cancelled",
"deliveries",
"end_at",
"hours",
"orders",
"part_of_day",
"ticket_time"
],
"type": "object",
"properties": {
"part_of_day": {
"$ref": "#/components/schemas/PartOfDay"
},
"begin_at": {
"title": "Дата и время начала смены.",
"type": "string",
"format": "date-time"
},
"end_at": {
"title": "Дата и время окончания смены.",
"type": "string",
"format": "date-time"
},
"orders": {
"$ref": "#/components/schemas/KitchenOrders"
},
"cancelled": {
"title": "Количестов отмененных в разрезе маркетплейса за смену.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Cancelled"
}
},
"ticket_time": {
"title": "Текущий тикет-тайм смены.",
"type": "string",
"example": "00:00:00"
},
"hours": {
"title": "Данные смены по часам.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Hourly"
}
},
"deliveries": {
"title": "Статистика в разрезе типа доставки по смене.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"$ref": "#/components/schemas/DeliveryByClient"
},
{
"$ref": "#/components/schemas/DeliveryByCourier"
}
]
}
}
},
"additionalProperties": false
},
"UpdateClientInstantBatchDto": {
"required": [
"client_instants"
],
"type": "object",
"properties": {
"client_instants": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ClientInstant"
}
}
},
"additionalProperties": false
},
"UpdateClientInstantSingleDto": {
"type": "object",
"properties": {
"orders": {
"$ref": "#/components/schemas/ClientOrders"
},
"reviews": {
"$ref": "#/components/schemas/ReviewsStats"
}
},
"additionalProperties": false
}
},
"securitySchemes": {
"Bearer": {
"type": "oauth2",
"flows": {
"password": {
"tokenUrl": "https://keycloak.mlkitchen.ai/auth/realms/MnogoLososya/protocol/openid-connect/token?audience=https://platform.mlkitchen.ai",
"scopes": {
"read:analytics": "Provides read access to analytics",
"edit:analytics": "Provides edit access to analytics"
}
}
}
}
}
},
"security": [
{
"Bearer": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment