2021-02-16 13:28:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class AutomationsApi extends ApiController
|
|
|
|
{
|
|
|
|
|
|
|
|
public function default()
|
|
|
|
{
|
|
|
|
//$this->requireAuth();
|
|
|
|
$response = [];
|
2021-02-16 13:59:27 +00:00
|
|
|
$automationsData = AutomationManager::getAll();
|
2021-02-16 13:28:31 +00:00
|
|
|
|
2021-02-16 13:59:27 +00:00
|
|
|
foreach ($automationsData as $automationKey => $automation) {
|
2021-02-16 13:28:31 +00:00
|
|
|
$response[] = [
|
|
|
|
"automation_id" => $automation['automation_id'],
|
|
|
|
"name" => $automation['name'],
|
|
|
|
"enabled" => $automation['enabled'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->response($response);
|
|
|
|
}
|
2021-02-16 13:59:27 +00:00
|
|
|
|
|
|
|
public function detail($automationId)
|
|
|
|
{
|
|
|
|
//$this->requireAuth();
|
|
|
|
|
|
|
|
$response = null;
|
|
|
|
$automationData = AutomationManager::getById($automationId);
|
|
|
|
|
|
|
|
$response = [
|
|
|
|
'automation_id' => $automationData['automation_id'],
|
|
|
|
'last_execution_time' => $automationData['last_execution_time'],
|
|
|
|
'owner' => $automationData['owner_id'],
|
|
|
|
'conditions' => $automationData['conditions'],
|
|
|
|
'tasks' => $automationData['tasks'],
|
|
|
|
];
|
|
|
|
|
|
|
|
$this->response($response);
|
|
|
|
}
|
|
|
|
|
2021-02-16 13:28:31 +00:00
|
|
|
}
|