Files
ignis-core/openapi.json
2026-05-15 23:12:28 +07:00

1509 lines
35 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.
{
"openapi": "3.1.0",
"info": {
"title": "Ignis Core API",
"version": "0.1.0"
},
"paths": {
"/devices": {
"get": {
"tags": [
"Devices & Groups"
],
"summary": "Get All Devices",
"operationId": "get_all_devices_devices_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/devices/groups": {
"get": {
"tags": [
"Devices & Groups"
],
"summary": "Get Groups",
"operationId": "get_groups_devices_groups_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
},
"post": {
"tags": [
"Devices & Groups"
],
"summary": "Create Group",
"operationId": "create_group_devices_groups_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GroupCreateSchema"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/devices/scenes": {
"get": {
"tags": [
"Devices & Groups"
],
"summary": "Get Scenes",
"operationId": "get_scenes_devices_scenes_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/devices/groups/{group_id}": {
"delete": {
"tags": [
"Devices & Groups"
],
"summary": "Delete Group",
"operationId": "delete_group_devices_groups__group_id__delete",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "group_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Group Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/devices/rescan": {
"post": {
"tags": [
"Devices & Groups"
],
"summary": "Rescan Network",
"operationId": "rescan_network_devices_rescan_post",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/control/device/{device_id}": {
"post": {
"tags": [
"Control"
],
"summary": "Control Device",
"operationId": "control_device_control_device__device_id__post",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "device_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Device Id"
}
},
{
"name": "state",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "State"
}
},
{
"name": "brightness",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Brightness"
}
},
{
"name": "scene",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Scene"
}
},
{
"name": "temp",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Temp"
}
},
{
"name": "r",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "R"
}
},
{
"name": "g",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "G"
}
},
{
"name": "b",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "B"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/control/group/{group_id}": {
"post": {
"tags": [
"Control"
],
"summary": "Control Group",
"operationId": "control_group_control_group__group_id__post",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "group_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Group Id"
}
},
{
"name": "state",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "State"
}
},
{
"name": "brightness",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Brightness"
}
},
{
"name": "scene",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Scene"
}
},
{
"name": "temp",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Temp"
}
},
{
"name": "r",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "R"
}
},
{
"name": "g",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "G"
}
},
{
"name": "b",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "B"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/control/device/{device_id}/blink": {
"post": {
"tags": [
"Control"
],
"summary": "Blink Device",
"operationId": "blink_device_control_device__device_id__blink_post",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "device_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Device Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/control/device/{device_id}/status": {
"get": {
"tags": [
"Control"
],
"summary": "Get Device Status",
"description": "Опрос реального состояния конкретной лампы.",
"operationId": "get_device_status_control_device__device_id__status_get",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "device_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Device Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/control/group/{group_id}/status": {
"get": {
"tags": [
"Control"
],
"summary": "Get Group Status",
"description": "Опрос состояния всей группы (возвращает список статусов).",
"operationId": "get_group_status_control_group__group_id__status_get",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "group_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Group Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/schedules/once": {
"post": {
"tags": [
"Schedules"
],
"summary": "Schedule Once",
"operationId": "schedule_once_schedules_once_post",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "target_id",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Target Id"
}
},
{
"name": "state",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "State"
}
},
{
"name": "run_at",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Run At"
}
},
{
"name": "hours_from_now",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Hours From Now"
}
},
{
"name": "is_group",
"in": "query",
"required": false,
"schema": {
"type": "boolean",
"default": true,
"title": "Is Group"
}
},
{
"name": "brightness",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Brightness"
}
},
{
"name": "scene",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Scene"
}
},
{
"name": "temp",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Temp"
}
},
{
"name": "r",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "R"
}
},
{
"name": "g",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "G"
}
},
{
"name": "b",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "B"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/schedules/cron": {
"post": {
"tags": [
"Schedules"
],
"summary": "Add Cron Task",
"operationId": "add_cron_task_schedules_cron_post",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "target_id",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Target Id"
}
},
{
"name": "hour",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Hour"
}
},
{
"name": "minute",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Minute"
}
},
{
"name": "day_of_week",
"in": "query",
"required": false,
"schema": {
"type": "string",
"default": "*",
"title": "Day Of Week"
}
},
{
"name": "is_group",
"in": "query",
"required": false,
"schema": {
"type": "boolean",
"default": true,
"title": "Is Group"
}
},
{
"name": "state",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "State"
}
},
{
"name": "brightness",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Brightness"
}
},
{
"name": "scene",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Scene"
}
},
{
"name": "temp",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Temp"
}
},
{
"name": "r",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "R"
}
},
{
"name": "g",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "G"
}
},
{
"name": "b",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "B"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/schedules/tasks": {
"get": {
"tags": [
"Schedules"
],
"summary": "Get All Tasks",
"operationId": "get_all_tasks_schedules_tasks_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/schedules/{job_id}": {
"delete": {
"tags": [
"Schedules"
],
"summary": "Cancel Task",
"operationId": "cancel_task_schedules__job_id__delete",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "job_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Job Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api-keys": {
"get": {
"tags": [
"API Keys"
],
"summary": "List Keys",
"description": "Список всех гостевых ключей.\n\nВ ответе поле `key` содержит публичный идентификатор, а не сам секрет.\nЭто сохраняет совместимость с текущим UI и не раскрывает токены повторно.",
"operationId": "list_keys_api_keys_get",
"security": [
{
"APIKeyHeader": []
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
},
"post": {
"tags": [
"API Keys"
],
"summary": "Create Key",
"description": "Создать гостевой ключ. Возвращает сгенерированный токен.",
"operationId": "create_key_api_keys_post",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "name",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Name"
}
},
{
"name": "is_admin",
"in": "query",
"required": false,
"schema": {
"type": "boolean",
"default": false,
"title": "Is Admin"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api-keys/revoke": {
"post": {
"tags": [
"API Keys"
],
"summary": "Revoke Key",
"description": "Деактивировать (отозвать) гостевой ключ. Ключ передаётся в body, не в URL.",
"operationId": "revoke_key_api_keys_revoke_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KeyActionRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/api-keys/activate": {
"post": {
"tags": [
"API Keys"
],
"summary": "Activate Key",
"description": "Повторно активировать ключ. Ключ передаётся в body, не в URL.",
"operationId": "activate_key_api_keys_activate_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KeyActionRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
},
"/stats/summary": {
"get": {
"tags": [
"Stats"
],
"summary": "Get Summary",
"description": "Сводная статистика за последние N дней.\nВозвращает по каждой группе/устройству:\n- total_commands -- общее количество команд\n- toggles_on / toggles_off -- включений / выключений\n- estimated_hours -- оценка часов работы (по парам on/off)",
"operationId": "get_summary_stats_summary_get",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "days",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"maximum": 365,
"minimum": 1,
"default": 7,
"title": "Days"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/stats/log": {
"get": {
"tags": [
"Stats"
],
"summary": "Get Log",
"description": "Последние N событий (для просмотра лога).",
"operationId": "get_log_stats_log_get",
"security": [
{
"APIKeyHeader": []
}
],
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"maximum": 500,
"minimum": 1,
"default": 50,
"title": "Limit"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/": {
"get": {
"summary": "Read Index",
"operationId": "read_index__get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/auth/me": {
"get": {
"summary": "Auth Me",
"operationId": "auth_me_auth_me_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [
{
"APIKeyHeader": []
}
]
}
}
},
"components": {
"schemas": {
"GroupCreateSchema": {
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"macs": {
"items": {
"type": "string"
},
"type": "array",
"title": "Macs"
}
},
"type": "object",
"required": [
"id",
"name",
"macs"
],
"title": "GroupCreateSchema"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"KeyActionRequest": {
"properties": {
"key": {
"type": "string",
"title": "Key"
}
},
"type": "object",
"required": [
"key"
],
"title": "KeyActionRequest",
"description": "Тело запроса для операций с ключом (чтобы токен не летел в URL)."
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
},
"securitySchemes": {
"APIKeyHeader": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
}
}
}
}