Files
luos/workflow/engine/src/ProcessMaker/Services/Api/Scheduler.php

52 lines
1.2 KiB
PHP
Raw Normal View History

2020-05-29 18:36:07 +00:00
<?php
namespace ProcessMaker\Services\Api;
use Exception;
use Luracast\Restler\RestException;
2020-05-29 18:36:07 +00:00
use ProcessMaker\BusinessModel\TaskSchedulerBM;
use ProcessMaker\Services\Api;
2020-05-29 18:36:07 +00:00
/**
* TaskScheduler Controller
*
* @protected
*/
class Scheduler extends Api
{
/**
* Returns the records of SchedulerTask by category
2020-05-29 18:36:07 +00:00
* @url GET
*
* @param string $category
*
* @return mixed
* @throws RestException
2020-05-29 18:36:07 +00:00
*/
public function doGet($category = null) {
try {
return TaskSchedulerBM::getSchedule($category);
} catch (Exception $e) {
2020-05-29 18:36:07 +00:00
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* Receive the options sent from Scheduler UI
2020-05-29 18:36:07 +00:00
* @url POST
* @status 200
*
* @param array $request_data
*
* @return array
* @throws RestException
*
*/
public function doPost(array $request) {
2020-05-29 18:36:07 +00:00
try {
return TaskSchedulerBM::saveSchedule($request);
} catch (Exception $e) {
2020-05-29 18:36:07 +00:00
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}