Add Bird configuration endpoints (GET/POST) and update OpenAPI documentation

This commit is contained in:
Jeppe Bundgaard
2026-02-27 01:38:45 +01:00
parent 32f017778f
commit abd33ed6d9
2 changed files with 55 additions and 1 deletions
+14
View File
@@ -6552,6 +6552,20 @@ paths:
responses:
'200': {description: Success}
/bird/config:
get:
tags: [Config]
summary: Get Bird config
operationId: getBirdConfig
responses:
'200': {description: Success}
post:
tags: [Config]
summary: Update Bird config
operationId: updateBirdConfig
responses:
'200': {description: Success}
/motorapi/config:
get:
tags: [Config]
@@ -215,6 +215,46 @@ class moduleConfigRoute
]
);
/** Bird config > GET */
$this->get('/bird/config', function () {
global $response;
$this->requirePermission('modules_bird_config');
$user = (new authentication())->get_user();
if ($user) {
(new logs_o())->add('bird_config', 'global', 1, $user->id, 'BIRD_CONFIG', 'Successfully fetched bird config');
$response->success(
(new \classes\bird())->config->getConfigRequest()
);
} else {
(new logs_o())->add('bird_config', 'global', 1, 0, 'BIRD_CONFIG', 'No user found, or invalid session');
$response->error('Invalid session', 400);
}
},
[
'modules_bird_config' => 'Get bird config'
]
);
/** Bird config > POST */
$this->post('/bird/config', function () {
global $response;
$this->requirePermission('modules_bird_config');
$user = (new authentication())->get_user();
if ($user) {
(new logs_o())->add('bird_config', 'global', 1, $user->id, 'BIRD_CONFIG', 'Successfully updated bird config');
$response->success(
(new \classes\bird())->config->postConfigRequest()
);
} else {
(new logs_o())->add('bird_config', 'global', 1, 0, 'BIRD_CONFIG', 'No user found, or invalid session');
$response->error('Invalid session', 400);
}
},
[
'modules_bird_config' => 'Update bird config'
]
);
/** MotorAPI config > GET */
$this->get('/motorapi/config', function () {
global $response;
@@ -701,4 +741,4 @@ class moduleConfigRoute
}
});
}
}
}