Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
hubman
Configurator
Merge requests
!7
Base of openapi
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Лошкарев Сергей Алексеевич
requested to merge
base-of-openapi
into
master
1 year ago
Overview
1
Commits
5
Pipelines
0
Changes
1
0
0
Compare
master
version 1
ce0af21f
1 year ago
master (base)
and
latest version
latest version
c83f5db4
5 commits,
1 year ago
version 1
ce0af21f
4 commits,
1 year ago
1 file
+
597
−
0
Expand all files
Preferences
Preferences
File browser
List view
Tree view
Compare changes
Inline
Side-by-side
Show whitespace changes
Show one file at a time
api/openapi.yaml
+
597
−
0
Options
View file @ c83f5db4
Edit in single-file editor
Open in Web IDE
openapi
:
3.0.3
info
:
title
:
ConfiguratorAPI
description
:
notice for ConfiguratorAPI
version
:
1.0.0
servers
:
-
url
:
'
https'
paths
:
/api/setups
:
get
:
tags
:
-
Setup
description
:
Получить список доступных Setup'ов
responses
:
200
:
description
:
Список доступных Setup'ов получен успешно
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/SetupList'
post
:
description
:
Создать новый Setup
requestBody
:
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/NewSetup'
tags
:
-
Setup
responses
:
201
:
description
:
Setup успешно создан
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Setup'
400
:
description
:
Setup не создан, параметры не верны
/api/setups/:setup_id
:
get
:
tags
:
-
Setup
description
:
Получить Setup по его setup_id
responses
:
200
:
description
:
Информация о Setup'е
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Setup"
400
:
description
:
Ошибка валидации
404
:
description
:
Setup с :setup_id не найден
patch
:
tags
:
-
Setup
description
:
Обновить Setup по его setup_id
requestBody
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/UpdSetup"
responses
:
200
:
description
:
Изменения применены, новые знания о Setup'е
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Setup"
400
:
description
:
Не возможно обновить какой-то из параметров, ошибка валидации
404
:
description
:
Setup с :setup_id не найден
delete
:
tags
:
-
Setup
description
:
Удалить Setup по его setup_id
responses
:
200
:
description
:
Успешно удалено
404
:
description
:
Setup с :setup_id не найден
/api/setups/:setup_id/activate
:
post
:
tags
:
-
Setup
description
:
Сделать Setup активным
responses
:
200
:
description
:
Setup переключен
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Setup"
400
:
description
:
Невозможно активировать setup
404
:
description
:
Setup с :setup_id не найден
/api/setups/:setup_id/deactivate
:
post
:
tags
:
-
Setup
description
:
Сделать Setup неактивным
responses
:
200
:
description
:
Setup переключен
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Setup"
404
:
description
:
Setup с :setup_id не найден
/api/setups/:setup_id/devices
:
get
:
tags
:
-
Device
description
:
Получить список девайсов в setup'е
responses
:
200
:
description
:
Список девайсов в setup'у
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/DeviceList"
404
:
description
:
Сетап не найден
post
:
tags
:
-
Device
description
:
Создать новый девайс в setup'е
requestBody
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/NewDevice"
responses
:
201
:
description
:
Новый девайс успешно создан к setup'у
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/ExtendedDeviceModel"
400
:
description
:
Неверны параметры запроса
404
:
description
:
Setup не найден
/api/setups/:setup_id/devices/:device_id
:
get
:
tags
:
-
Device
description
:
Получить девайс с :device_id в setup'е с setup_id
responses
:
200
:
description
:
Информация о девайсе с :device_id в setup'е c :setup_id
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/ExtendedDeviceModel"
404
:
description
:
Setup или Device не найден
patch
:
tags
:
-
Device
description
:
Обновить девайс с :device_id в setup'е с setup_id
requestBody
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/UpdDevice"
responses
:
200
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/ExtendedDeviceModel"
description
:
Девайсе с :device_id в setup'е c :setup_id успешно обновлен
400
:
description
:
Неверны параметры запроса
404
:
description
:
Setup или Device не найден
delete
:
tags
:
-
Device
description
:
Удалить девайс c :device_id в setup'е c :setup_id
responses
:
200
:
description
:
Девайс с :device_id в setup'е c :setup_id успешно удален
404
:
description
:
Setup или Device не найден
/api/setups/:setup_id/rules
:
get
:
tags
:
-
Rule
description
:
Получить список правил в setup'е
responses
:
200
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/RuleList"
description
:
Список правил к setup'у
404
:
description
:
Setup или связанные девайсы не найдены
post
:
tags
:
-
Rule
description
:
Создать новое правило в setup'е
requestBody
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/NewRule"
responses
:
201
:
description
:
Новое правило успешно создано к setup'у
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Rule"
400
:
description
:
Неверны параметры, ошибка валидации
404
:
description
:
Setup или связанные девайсы не найдены не найден
/api/setups/:setup_id/rules/:rule_id
:
get
:
tags
:
-
Rule
description
:
Получить правило в setup'е по его :rule_id
responses
:
200
:
description
:
Информация о правиле с :rule_id в setup'е c :setup_id
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Rule"
404
:
description
:
Setup или правило не найдено
patch
:
tags
:
-
Rule
description
:
Обновить правило c :rule_id в setup'е c :setup_id
requestBody
:
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/UpdRule"
responses
:
200
:
description
:
Правило с :rule_id в setup'е c :setup_id успешно обновлен
content
:
application/json
:
schema
:
$ref
:
"
#/components/schemas/Rule"
400
:
description
:
Неверны параметры, ошибка валидации
404
:
description
:
Setup или правило не найдены
delete
:
tags
:
-
Rule
description
:
Удалить правило c :rule_id в setup'е c :setup_id
responses
:
200
:
description
:
Правило с :rule_id в setup'е c :setup_id успешно удален
404
:
description
:
Setup или правило не найдены
components
:
schemas
:
Setup
:
type
:
object
required
:
-
id
-
name
-
is_active
properties
:
id
:
type
:
integer
name
:
type
:
string
is_active
:
type
:
boolean
example
:
id
:
11
is_active
:
false
name
:
'
studio-setup'
NewSetup
:
type
:
object
required
:
-
name
properties
:
name
:
type
:
string
example
:
name
:
'
studio-setup'
UpdSetup
:
type
:
object
properties
:
name
:
type
:
string
example
:
name
:
'
studio-setup-2'
SetupList
:
type
:
array
items
:
$ref
:
'
#/components/schemas/Setup'
example
:
-
id
:
1
name
:
'
studio-setup'
is_active
:
true
-
id
:
2
name
:
'
studio-setup-2'
is_active
:
false
DeviceDescriptor
:
type
:
object
required
:
-
device_id
-
code
-
descriptor_type
-
description
-
args
properties
:
device_id
:
type
:
integer
code
:
type
:
string
descriptor_type
:
type
:
string
enum
:
-
'
signal'
-
'
command'
description
:
type
:
string
args
:
type
:
object
example
:
{
"
key_code"
:
"
integer"
,
"
key_name"
:
"
string"
}
description
:
'
Формат
как
в
примере,
собирается
описание
атрибутов
от
дескриптора'
example
:
device_id
:
12
code
:
'
key_pressed'
descriptor_type
:
'
signal'
description
:
'
Происходит,
когда
пользователь
нажимает
на
кнопку'
args
:
{
"
key_code"
:
"
integer"
,
"
key_name"
:
"
string"
}
Device
:
type
:
object
required
:
-
id
-
setup_id
-
name
-
is_manipulator
-
is_executor
-
url
properties
:
id
:
type
:
integer
setup_id
:
type
:
integer
name
:
type
:
string
is_manipulator
:
type
:
boolean
is_executor
:
type
:
boolean
url
:
type
:
string
format
:
url
last_sync_time
:
type
:
integer
description
:
'
Время
последней
синхронизации'
rules_request_id
:
type
:
string
format
:
uuid
description
:
'
Ключ
для
синхронизации
с
правилами
агента'
bindings_request_id
:
type
:
string
format
:
uuid
description
:
'
Ключ
для
синхронизации
с
биндингами
агента'
example
:
id
:
3
setup_id
:
1
name
:
'
onvif-executor'
is_manipulator
:
false
is_executor
:
true
url
:
'
http://192.168.1.5:8080'
last_sync_time
:
211231321
rules_request_id
:
'
074d0615-2a5b-4961-a3b3-c2dec42b8ff4'
bindings_request_id
:
'
511469f3-e2b4-4e86-8817-c956636ea3fc'
DeviceList
:
type
:
array
items
:
$ref
:
'
#/components/schemas/Device'
NewDevice
:
type
:
object
required
:
-
name
-
is_manipulator
-
is_executor
-
url
properties
:
name
:
type
:
string
is_manipulator
:
type
:
boolean
is_executor
:
type
:
boolean
url
:
type
:
string
format
:
url
example
:
name
:
'
onvif-executor'
is_manipulator
:
false
is_executor
:
true
url
:
'
http://192.168.1.5:8080'
UpdDevice
:
type
:
object
properties
:
name
:
type
:
string
url
:
type
:
string
format
:
url
example
:
name
:
'
onvif-executor'
url
:
'
http://192.168.1.5:8081'
ExtendedDeviceModel
:
allOf
:
-
$ref
:
'
#/components/schemas/Device'
-
properties
:
signals
:
type
:
array
required
:
true
items
:
$ref
:
'
#/components/schemas/DeviceDescriptor'
commands
:
type
:
array
required
:
true
items
:
$ref
:
'
#/components/schemas/DeviceDescriptor'
example
:
id
:
3
setup_id
:
1
name
:
'
onvif-executor'
is_manipulator
:
false
is_executor
:
true
url
:
'
http://192.168.1.5:8080'
last_sync_time
:
211231321
rules_request_id
:
'
074d0615-2a5b-4961-a3b3-c2dec42b8ff4'
bindings_request_id
:
'
511469f3-e2b4-4e86-8817-c956636ea3fc'
signals
:
-
device_id
:
12
code
:
'
key_pressed'
descriptor_type
:
'
signal'
description
:
'
Происходит,
когда
пользователь
нажимает
на
кнопку'
args
:
{
"
key_code"
:
"
integer"
,
"
key_name"
:
"
string"
}
-
device_id
:
13
code
:
'
key_released'
descriptor_type
:
'
signal'
description
:
'
Происходит,
когда
пользователь
отпускает
кнопку'
args
:
{
"
key_code"
:
"
integer"
,
"
key_name"
:
"
string"
}
commands
:
-
device_id
:
13
code
:
'
key_pressed'
descriptor_type
:
'
signal'
description
:
'
Происходит,
когда
пользователь
нажимает
на
кнопку'
args
:
{
"
key_code"
:
"
integer"
,
"
key_name"
:
"
string"
}
-
device_id
:
14
code
:
'
key_released'
descriptor_type
:
'
signal'
description
:
'
Происходит,
когда
пользователь
отпускает
кнопку'
args
:
{
"
key_code"
:
"
integer"
,
"
key_name"
:
"
string"
}
Rule
:
type
:
object
required
:
-
id
-
setup_id
-
agent_rule_id
-
name
-
manipulator_id
-
signal_code
-
executor_id
-
command_code
-
trigger
-
logic
properties
:
id
:
type
:
integer
setup_id
:
type
:
integer
agent_rule_id
:
type
:
string
format
:
uuid
name
:
type
:
string
description
:
type
:
string
manipulator_id
:
type
:
integer
signal_code
:
type
:
string
executor_id
:
type
:
integer
command_code
:
type
:
string
logic
:
type
:
object
description
:
Ключи - названия атрибутов, значения - произвольный объект подходящий под jsonlogic
trigger
:
description
:
Произвольный объект подходящий под jsonlogic
example
:
id
:
3
setup_id
:
1
agent_rule_id
:
"
3422b448-2460-4fd2-9183-8000de6f8343"
name
:
"
first-rule"
manipulator_id
:
6
signal_code
:
"
number"
executor_id
:
5
command_code
:
"
greet"
trigger
:
{
"
=="
:
[
{
"
var"
:
"
gg"
},
1
]
}
logic
:
{
"
greeter"
:
{
"
=="
:
[
1
,
1
]
},
"
greeting"
:
{
"
=="
:
[
1
,
1
]
}
}
RuleList
:
type
:
array
required
:
true
items
:
$ref
:
'
#/components/schemas/Rule'
NewRule
:
type
:
object
required
:
-
name
-
manipulator_id
-
signal_code
-
executor_id
-
command_code
-
trigger
-
logic
properties
:
name
:
type
:
string
description
:
type
:
string
manipulator_id
:
type
:
integer
signal_code
:
type
:
string
executor_id
:
type
:
integer
command_code
:
type
:
string
logic
:
type
:
object
description
:
Ключи - названия атрибутов, значения - произвольный объект подходящий под jsonlogic
trigger
:
description
:
Произвольный объект подходящий под jsonlogic
example
:
name
:
"
first-rule"
manipulator_id
:
6
signal_code
:
"
number"
executor_id
:
5
command_code
:
"
greet"
trigger
:
{
"
=="
:
[
{
"
var"
:
"
gg"
},
1
]
}
logic
:
{
"
greeter"
:
{
"
=="
:
[
1
,
1
]
},
"
greeting"
:
{
"
=="
:
[
1
,
1
]
}
}
UpdRule
:
type
:
object
properties
:
name
:
type
:
string
description
:
type
:
string
manipulator_id
:
type
:
integer
signal_code
:
type
:
string
executor_id
:
type
:
integer
command_code
:
type
:
string
logic
:
type
:
object
description
:
Ключи - названия атрибутов, значения - произвольный объект подходящий под jsonlogic
trigger
:
description
:
Произвольный объект подходящий под jsonlogic
example
:
name
:
"
first-rule"
manipulator_id
:
6
signal_code
:
"
number"
executor_id
:
5
command_code
:
"
greet"
trigger
:
{
"
=="
:
[
{
"
var"
:
"
gg"
},
1
]
}
logic
:
{
"
greeter"
:
{
"
=="
:
[
1
,
1
]
},
"
greeting"
:
{
"
=="
:
[
1
,
1
]
}
}
\ No newline at end of file
Menu
Explore
Projects
Groups
Topics
Snippets