Files
luos/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntry.php
Victor Saisa Lopez 98f3ff777c ProcessMaker-BE "Role and User (Endpoints)"
- Se han implementado los siguientes Endpoints:
    GET    /api/1.0/{workspace}/role/{rol_uid}/users?filter={filter}&start={start}&limit={limit}
    GET    /api/1.0/{workspace}/role/{rol_uid}/available-users?filter={filter}&start={start}&limit={limit}
    POST   /api/1.0/{workspace}/role/{rol_uid}/user
    DELETE /api/1.0/{workspace}/role/{rol_uid}/user/{usr_uid}
2014-05-28 15:01:18 -04:00

119 lines
3.0 KiB
PHP

<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\WebEntry Api Controller
*
* @protected
*/
class WebEntry extends Api
{
private $webEntry;
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$this->webEntry = new \ProcessMaker\BusinessModel\WebEntry();
$this->webEntry->setFormatFieldNameInUppercase(false);
$this->webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:prj_uid/web-entries
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetWebEntries($prj_uid)
{
try {
$response = $this->webEntry->getWebEntries($prj_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:prj_uid/web-entry/:we_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $we_uid {@min 32}{@max 32}
*/
public function doGetWebEntry($prj_uid, $we_uid)
{
try {
$response = $this->webEntry->getWebEntry($we_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:prj_uid/web-entry
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
*
* @status 201
*/
public function doPostWebEntry($prj_uid, array $request_data)
{
try {
$arrayData = $this->webEntry->create($prj_uid, $this->getUserId(), $request_data);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url PUT /:prj_uid/web-entry/:we_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $we_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPutWebEntry($prj_uid, $we_uid, array $request_data)
{
try {
$arrayData = $this->webEntry->update($we_uid, $this->getUserId(), $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:prj_uid/web-entry/:we_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $we_uid {@min 32}{@max 32}
*/
public function doDeleteWebEntry($prj_uid, $we_uid)
{
try {
$this->webEntry->delete($we_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}