| GET | /api/processes/{ProcessID} |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class UserOrGroup implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ID=0,
/** @var string|null */
public ?string $Title=null,
/** @var bool|null */
public ?bool $IsChecked=null,
/** @var string|null */
public ?string $Image=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['Title'])) $this->Title = $o['Title'];
if (isset($o['IsChecked'])) $this->IsChecked = $o['IsChecked'];
if (isset($o['Image'])) $this->Image = $o['Image'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->Title)) $o['Title'] = $this->Title;
if (isset($this->IsChecked)) $o['IsChecked'] = $this->IsChecked;
if (isset($this->Image)) $o['Image'] = $this->Image;
return empty($o) ? new class(){} : $o;
}
}
class User extends UserOrGroup implements JsonSerializable
{
/**
* @param int $ID
* @param string|null $Title
* @param bool|null $IsChecked
* @param string|null $Image
*/
public function __construct(
int $ID=0,
?string $Title=null,
?bool $IsChecked=null,
?string $Image=null
) {
parent::__construct($ID,$Title,$IsChecked,$Image);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Image'])) $this->Image = $o['Image'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Image)) $o['Image'] = $this->Image;
return empty($o) ? new class(){} : $o;
}
}
class Group extends UserOrGroup implements JsonSerializable
{
/**
* @param int $ID
* @param string|null $Title
* @param bool|null $IsChecked
* @param string|null $Image
*/
public function __construct(
int $ID=0,
?string $Title=null,
?bool $IsChecked=null,
?string $Image=null
) {
parent::__construct($ID,$Title,$IsChecked,$Image);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Image'])) $this->Image = $o['Image'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Image)) $o['Image'] = $this->Image;
return empty($o) ? new class(){} : $o;
}
}
class WorkflowTaskDelay implements JsonSerializable
{
public function __construct(
/** @var DateTime|null */
public ?DateTime $DelayDate=null,
/** @var string|null */
public ?string $Reason=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DelayDate'])) $this->DelayDate = JsonConverters::from('DateTime', $o['DelayDate']);
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DelayDate)) $o['DelayDate'] = JsonConverters::to('DateTime', $this->DelayDate);
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
return empty($o) ? new class(){} : $o;
}
}
class WorkflowTaskReason implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Reason=null,
/** @var bool|null */
public ?bool $Required=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['Required'])) $this->Required = $o['Required'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->Required)) $o['Required'] = $this->Required;
return empty($o) ? new class(){} : $o;
}
}
class WorkflowTaskAdhocTransition implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ID='',
/** @var string|null */
public ?string $Title=null,
/** @var bool|null */
public ?bool $AssignmentAllowed=null,
/** @var bool|null */
public ?bool $AssignmentRequired=null,
/** @var int */
public int $UserEnvironment=0,
/** @var array<User>|null */
public ?array $Users=null,
/** @var array<Group>|null */
public ?array $Groups=null,
/** @var WorkflowTaskDelay|null */
public ?WorkflowTaskDelay $Delay=null,
/** @var WorkflowTaskReason|null */
public ?WorkflowTaskReason $Reason=null,
/** @var array<UserOrGroup>|null */
public ?array $UsersOrGroups=null,
/** @var string|null */
public ?string $Value=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['Title'])) $this->Title = $o['Title'];
if (isset($o['AssignmentAllowed'])) $this->AssignmentAllowed = $o['AssignmentAllowed'];
if (isset($o['AssignmentRequired'])) $this->AssignmentRequired = $o['AssignmentRequired'];
if (isset($o['UserEnvironment'])) $this->UserEnvironment = $o['UserEnvironment'];
if (isset($o['Users'])) $this->Users = JsonConverters::fromArray('User', $o['Users']);
if (isset($o['Groups'])) $this->Groups = JsonConverters::fromArray('Group', $o['Groups']);
if (isset($o['Delay'])) $this->Delay = JsonConverters::from('WorkflowTaskDelay', $o['Delay']);
if (isset($o['Reason'])) $this->Reason = JsonConverters::from('WorkflowTaskReason', $o['Reason']);
if (isset($o['UsersOrGroups'])) $this->UsersOrGroups = JsonConverters::fromArray('UserOrGroup', $o['UsersOrGroups']);
if (isset($o['Value'])) $this->Value = $o['Value'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->Title)) $o['Title'] = $this->Title;
if (isset($this->AssignmentAllowed)) $o['AssignmentAllowed'] = $this->AssignmentAllowed;
if (isset($this->AssignmentRequired)) $o['AssignmentRequired'] = $this->AssignmentRequired;
if (isset($this->UserEnvironment)) $o['UserEnvironment'] = $this->UserEnvironment;
if (isset($this->Users)) $o['Users'] = JsonConverters::toArray('User', $this->Users);
if (isset($this->Groups)) $o['Groups'] = JsonConverters::toArray('Group', $this->Groups);
if (isset($this->Delay)) $o['Delay'] = JsonConverters::to('WorkflowTaskDelay', $this->Delay);
if (isset($this->Reason)) $o['Reason'] = JsonConverters::to('WorkflowTaskReason', $this->Reason);
if (isset($this->UsersOrGroups)) $o['UsersOrGroups'] = JsonConverters::toArray('UserOrGroup', $this->UsersOrGroups);
if (isset($this->Value)) $o['Value'] = $this->Value;
return empty($o) ? new class(){} : $o;
}
}
class AdhocTransitionDetails implements JsonSerializable
{
public function __construct(
/** @var array<WorkflowTaskAdhocTransition>|null */
public ?array $AdhocTransitions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AdhocTransitions'])) $this->AdhocTransitions = JsonConverters::fromArray('WorkflowTaskAdhocTransition', $o['AdhocTransitions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AdhocTransitions)) $o['AdhocTransitions'] = JsonConverters::toArray('WorkflowTaskAdhocTransition', $this->AdhocTransitions);
return empty($o) ? new class(){} : $o;
}
}
class WorkflowTaskActionComment implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Comment=null,
/** @var bool|null */
public ?bool $Required=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Comment'])) $this->Comment = $o['Comment'];
if (isset($o['Required'])) $this->Required = $o['Required'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Comment)) $o['Comment'] = $this->Comment;
if (isset($this->Required)) $o['Required'] = $this->Required;
return empty($o) ? new class(){} : $o;
}
}
class SideStepDetails extends AdhocTransitionDetails implements JsonSerializable
{
/**
* @param array<WorkflowTaskAdhocTransition>|null $AdhocTransitions
*/
public function __construct(
?array $AdhocTransitions=null,
/** @var User|null */
public ?User $Coordinator=null,
/** @var WorkflowTaskActionComment|null */
public ?WorkflowTaskActionComment $Comment=null,
/** @var bool|null */
public ?bool $Urgent=null
) {
parent::__construct($AdhocTransitions);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Coordinator'])) $this->Coordinator = JsonConverters::from('User', $o['Coordinator']);
if (isset($o['Comment'])) $this->Comment = JsonConverters::from('WorkflowTaskActionComment', $o['Comment']);
if (isset($o['Urgent'])) $this->Urgent = $o['Urgent'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Coordinator)) $o['Coordinator'] = JsonConverters::to('User', $this->Coordinator);
if (isset($this->Comment)) $o['Comment'] = JsonConverters::to('WorkflowTaskActionComment', $this->Comment);
if (isset($this->Urgent)) $o['Urgent'] = $this->Urgent;
return empty($o) ? new class(){} : $o;
}
}
class ProcessDetails extends SideStepDetails implements JsonSerializable
{
/**
* @param array<WorkflowTaskAdhocTransition>|null $AdhocTransitions
* @param User|null $Coordinator
* @param WorkflowTaskActionComment|null $Comment
* @param bool|null $Urgent
*/
public function __construct(
?array $AdhocTransitions=null,
?User $Coordinator=null,
?WorkflowTaskActionComment $Comment=null,
?bool $Urgent=null,
/** @var bool|null */
public ?bool $ShowCoordinatorField=null
) {
parent::__construct($AdhocTransitions,$Coordinator,$Comment,$Urgent);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ShowCoordinatorField'])) $this->ShowCoordinatorField = $o['ShowCoordinatorField'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ShowCoordinatorField)) $o['ShowCoordinatorField'] = $this->ShowCoordinatorField;
return empty($o) ? new class(){} : $o;
}
}
class GetProcessDetails implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProcessID=0,
/** @var int */
public int $WorkflowTaskID=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProcessID'])) $this->ProcessID = $o['ProcessID'];
if (isset($o['WorkflowTaskID'])) $this->WorkflowTaskID = $o['WorkflowTaskID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProcessID)) $o['ProcessID'] = $this->ProcessID;
if (isset($this->WorkflowTaskID)) $o['WorkflowTaskID'] = $this->WorkflowTaskID;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/processes/{ProcessID} HTTP/1.1
Host: test-do-services.klokgroep.nl
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ShowCoordinatorField: False,
Coordinator:
{
Image: Icons/User,
ID: 0,
Title: String,
IsChecked: False
},
Comment:
{
Comment: String,
Required: False
},
Urgent: False,
AdhocTransitions:
[
{
Title: String,
AssignmentAllowed: False,
AssignmentRequired: False,
UserEnvironment: 0,
Users:
[
{
Image: Icons/User,
ID: 0,
Title: String,
IsChecked: False
}
],
Groups:
[
{
Image: Icons/Group,
ID: 0,
Title: String,
IsChecked: False
}
],
Delay:
{
DelayDate: 0001-01-01,
Reason: String
},
Reason:
{
Reason: String,
Required: False
},
UsersOrGroups:
[
{
__type: "IDB.API.DTO.User, IDB.API.DTO",
Image: Icons/User,
ID: 0,
Title: String,
IsChecked: False
},
{
__type: "IDB.API.DTO.Group, IDB.API.DTO",
Image: Icons/Group,
ID: 0,
Title: String,
IsChecked: False
}
],
Value: "String
String"
}
]
}