<?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 Outlook365Properties implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $PidTag=null,
/** @var string|null */
public ?string $ItemId=null,
/** @var string|null */
public ?string $EwsUrl=null,
/** @var string|null */
public ?string $Token=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['PidTag'])) $this->PidTag = $o['PidTag'];
if (isset($o['ItemId'])) $this->ItemId = $o['ItemId'];
if (isset($o['EwsUrl'])) $this->EwsUrl = $o['EwsUrl'];
if (isset($o['Token'])) $this->Token = $o['Token'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->PidTag)) $o['PidTag'] = $this->PidTag;
if (isset($this->ItemId)) $o['ItemId'] = $this->ItemId;
if (isset($this->EwsUrl)) $o['EwsUrl'] = $this->EwsUrl;
if (isset($this->Token)) $o['Token'] = $this->Token;
return empty($o) ? new class(){} : $o;
}
}
class FieldState implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $Required=null,
/** @var bool|null */
public ?bool $Visible=null,
/** @var bool|null */
public ?bool $Readonly=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Required'])) $this->Required = $o['Required'];
if (isset($o['Visible'])) $this->Visible = $o['Visible'];
if (isset($o['Readonly'])) $this->Readonly = $o['Readonly'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Required)) $o['Required'] = $this->Required;
if (isset($this->Visible)) $o['Visible'] = $this->Visible;
if (isset($this->Readonly)) $o['Readonly'] = $this->Readonly;
return empty($o) ? new class(){} : $o;
}
}
class RegistrationProfileFieldStateBase extends FieldState implements JsonSerializable
{
/**
* @param bool|null $Required
* @param bool|null $Visible
* @param bool|null $Readonly
*/
public function __construct(
?bool $Required=null,
?bool $Visible=null,
?bool $Readonly=null,
/** @var string */
public string $DocumentFieldID=''
) {
parent::__construct($Required,$Visible,$Readonly);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['DocumentFieldID'])) $this->DocumentFieldID = $o['DocumentFieldID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->DocumentFieldID)) $o['DocumentFieldID'] = $this->DocumentFieldID;
return empty($o) ? new class(){} : $o;
}
}
class CorporateIdentityMail implements JsonSerializable
{
public function __construct(
/** @var string */
public string $DocumentId='',
/** @var string|null */
public ?string $EmailHtml=null,
/** @var bool|null */
public ?bool $IsRegistered=null,
/** @var string|null */
public ?string $DocumentNr=null,
/** @var array<RegistrationProfileFieldStateBase>|null */
public ?array $Values=null,
/** @var string */
public string $RegistrationProfileID='',
/** @var bool|null */
public ?bool $RegisterAutomatically=null,
/** @var string|null */
public ?string $RegistrationEmailadress=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DocumentId'])) $this->DocumentId = $o['DocumentId'];
if (isset($o['EmailHtml'])) $this->EmailHtml = $o['EmailHtml'];
if (isset($o['IsRegistered'])) $this->IsRegistered = $o['IsRegistered'];
if (isset($o['DocumentNr'])) $this->DocumentNr = $o['DocumentNr'];
if (isset($o['Values'])) $this->Values = JsonConverters::fromArray('RegistrationProfileFieldStateBase', $o['Values']);
if (isset($o['RegistrationProfileID'])) $this->RegistrationProfileID = $o['RegistrationProfileID'];
if (isset($o['RegisterAutomatically'])) $this->RegisterAutomatically = $o['RegisterAutomatically'];
if (isset($o['RegistrationEmailadress'])) $this->RegistrationEmailadress = $o['RegistrationEmailadress'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DocumentId)) $o['DocumentId'] = $this->DocumentId;
if (isset($this->EmailHtml)) $o['EmailHtml'] = $this->EmailHtml;
if (isset($this->IsRegistered)) $o['IsRegistered'] = $this->IsRegistered;
if (isset($this->DocumentNr)) $o['DocumentNr'] = $this->DocumentNr;
if (isset($this->Values)) $o['Values'] = JsonConverters::toArray('RegistrationProfileFieldStateBase', $this->Values);
if (isset($this->RegistrationProfileID)) $o['RegistrationProfileID'] = $this->RegistrationProfileID;
if (isset($this->RegisterAutomatically)) $o['RegisterAutomatically'] = $this->RegisterAutomatically;
if (isset($this->RegistrationEmailadress)) $o['RegistrationEmailadress'] = $this->RegistrationEmailadress;
return empty($o) ? new class(){} : $o;
}
}
class RegistrationValue implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Key='',
/** @var string|null */
public ?string $Value=null,
/** @var string|null */
public ?string $ShadowValue=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['ShadowValue'])) $this->ShadowValue = $o['ShadowValue'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->ShadowValue)) $o['ShadowValue'] = $this->ShadowValue;
return empty($o) ? new class(){} : $o;
}
}
class Transition implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ID='',
/** @var string|null */
public ?string $Reason=null,
/** @var DateTime|null */
public ?DateTime $DelayDate=null,
/** @var string|null */
public ?string $DelayReason=null,
/** @var array<int>|null */
public ?array $UserIDs=null,
/** @var array<int>|null */
public ?array $GroupIDs=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['DelayDate'])) $this->DelayDate = JsonConverters::from('DateTime', $o['DelayDate']);
if (isset($o['DelayReason'])) $this->DelayReason = $o['DelayReason'];
if (isset($o['UserIDs'])) $this->UserIDs = JsonConverters::fromArray('int', $o['UserIDs']);
if (isset($o['GroupIDs'])) $this->GroupIDs = JsonConverters::fromArray('int', $o['GroupIDs']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->DelayDate)) $o['DelayDate'] = JsonConverters::to('DateTime', $this->DelayDate);
if (isset($this->DelayReason)) $o['DelayReason'] = $this->DelayReason;
if (isset($this->UserIDs)) $o['UserIDs'] = JsonConverters::toArray('int', $this->UserIDs);
if (isset($this->GroupIDs)) $o['GroupIDs'] = JsonConverters::toArray('int', $this->GroupIDs);
return empty($o) ? new class(){} : $o;
}
}
class Process implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ID=0,
/** @var string|null */
public ?string $Title=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Note=null,
/** @var string|null */
public ?string $Coordinator=null,
/** @var bool|null */
public ?bool $Urgent=null,
/** @var array<Transition>|null */
public ?array $Transitions=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['Description'])) $this->Description = $o['Description'];
if (isset($o['Note'])) $this->Note = $o['Note'];
if (isset($o['Coordinator'])) $this->Coordinator = $o['Coordinator'];
if (isset($o['Urgent'])) $this->Urgent = $o['Urgent'];
if (isset($o['Transitions'])) $this->Transitions = JsonConverters::fromArray('Transition', $o['Transitions']);
}
/** @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->Description)) $o['Description'] = $this->Description;
if (isset($this->Note)) $o['Note'] = $this->Note;
if (isset($this->Coordinator)) $o['Coordinator'] = $this->Coordinator;
if (isset($this->Urgent)) $o['Urgent'] = $this->Urgent;
if (isset($this->Transitions)) $o['Transitions'] = JsonConverters::toArray('Transition', $this->Transitions);
return empty($o) ? new class(){} : $o;
}
}
class CreateDraftCorporateIdentityMail extends Outlook365Properties implements JsonSerializable
{
/**
* @param string|null $PidTag
* @param string|null $ItemId
* @param string|null $EwsUrl
* @param string|null $Token
*/
public function __construct(
?string $PidTag=null,
?string $ItemId=null,
?string $EwsUrl=null,
?string $Token=null,
/** @var string */
public string $RegistrationProfileID='',
/** @var array<RegistrationValue>|null */
public ?array $Values=null,
/** @var array<Process>|null */
public ?array $Processes=null,
/** @var string|null */
public ?string $DocumentUploadId=null,
/** @var string|null */
public ?string $MessageQueueId=null,
/** @var string|null */
public ?string $ReplyEmailHtml=null,
/** @var string|null */
public ?string $NewEmailHtml=null
) {
parent::__construct($PidTag,$ItemId,$EwsUrl,$Token);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['RegistrationProfileID'])) $this->RegistrationProfileID = $o['RegistrationProfileID'];
if (isset($o['Values'])) $this->Values = JsonConverters::fromArray('RegistrationValue', $o['Values']);
if (isset($o['Processes'])) $this->Processes = JsonConverters::fromArray('Process', $o['Processes']);
if (isset($o['DocumentUploadId'])) $this->DocumentUploadId = $o['DocumentUploadId'];
if (isset($o['MessageQueueId'])) $this->MessageQueueId = $o['MessageQueueId'];
if (isset($o['ReplyEmailHtml'])) $this->ReplyEmailHtml = $o['ReplyEmailHtml'];
if (isset($o['NewEmailHtml'])) $this->NewEmailHtml = $o['NewEmailHtml'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->RegistrationProfileID)) $o['RegistrationProfileID'] = $this->RegistrationProfileID;
if (isset($this->Values)) $o['Values'] = JsonConverters::toArray('RegistrationValue', $this->Values);
if (isset($this->Processes)) $o['Processes'] = JsonConverters::toArray('Process', $this->Processes);
if (isset($this->DocumentUploadId)) $o['DocumentUploadId'] = $this->DocumentUploadId;
if (isset($this->MessageQueueId)) $o['MessageQueueId'] = $this->MessageQueueId;
if (isset($this->ReplyEmailHtml)) $o['ReplyEmailHtml'] = $this->ReplyEmailHtml;
if (isset($this->NewEmailHtml)) $o['NewEmailHtml'] = $this->NewEmailHtml;
return empty($o) ? new class(){} : $o;
}
}
class CreateOrUpdateEmailDraft extends CreateDraftCorporateIdentityMail implements JsonSerializable
{
/**
* @param string|null $PidTag
* @param string|null $ItemId
* @param string|null $EwsUrl
* @param string|null $Token
* @param string $RegistrationProfileID
* @param array<RegistrationValue>|null $Values
* @param array<Process>|null $Processes
* @param string|null $DocumentUploadId
* @param string|null $MessageQueueId
* @param string|null $ReplyEmailHtml
* @param string|null $NewEmailHtml
*/
public function __construct(
?string $PidTag=null,
?string $ItemId=null,
?string $EwsUrl=null,
?string $Token=null,
string $RegistrationProfileID='',
?array $Values=null,
?array $Processes=null,
?string $DocumentUploadId=null,
?string $MessageQueueId=null,
?string $ReplyEmailHtml=null,
?string $NewEmailHtml=null
) {
parent::__construct($PidTag,$ItemId,$EwsUrl,$Token,$RegistrationProfileID,$Values,$Processes,$DocumentUploadId,$MessageQueueId,$ReplyEmailHtml,$NewEmailHtml);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
PHP CreateOrUpdateEmailDraft DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /json/reply/CreateOrUpdateEmailDraft HTTP/1.1
Host: dogw.klokgroep.nl
Accept: application/json
Content-Type: application/json
Content-Length: length
{"RegistrationProfileID":"00000000-0000-0000-0000-000000000000","Values":[{"Key":"00000000-0000-0000-0000-000000000000","Value":"String","ShadowValue":"String"}],"Processes":[{"ID":0,"Title":"String","Description":"String","Note":"String","Coordinator":"String","Urgent":false,"Transitions":[{"ID":"00000000-0000-0000-0000-000000000000","Reason":"String","DelayDate":"0001-01-01T00:00:00.0000000","DelayReason":"String","UserIDs":[0],"GroupIDs":[0]}]}],"DocumentUploadId":"String","MessageQueueId":"String","ReplyEmailHtml":"String","NewEmailHtml":"String","PidTag":"String","ItemId":"String","EwsUrl":"String","Token":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"DocumentId":"00000000-0000-0000-0000-000000000000","EmailHtml":"String","IsRegistered":false,"DocumentNr":"String","Values":[{"DocumentFieldID":"00000000-0000-0000-0000-000000000000","Required":false,"Visible":false,"Readonly":false}],"RegistrationProfileID":"00000000-0000-0000-0000-000000000000","RegisterAutomatically":false,"RegistrationEmailadress":"String"}