<?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 JsonDto implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
class JsonRequestDto extends JsonDto implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ClientCode=null,
/** @var string|null */
public ?string $ClientRegistrationCode=null,
/** @var string|null */
public ?string $Token=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ClientCode'])) $this->ClientCode = $o['ClientCode'];
if (isset($o['ClientRegistrationCode'])) $this->ClientRegistrationCode = $o['ClientRegistrationCode'];
if (isset($o['Token'])) $this->Token = $o['Token'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ClientCode)) $o['ClientCode'] = $this->ClientCode;
if (isset($this->ClientRegistrationCode)) $o['ClientRegistrationCode'] = $this->ClientRegistrationCode;
if (isset($this->Token)) $o['Token'] = $this->Token;
return empty($o) ? new class(){} : $o;
}
}
class JsonMetadataUploadRequest extends JsonRequestDto implements JsonSerializable
{
/**
* @param string|null $ClientCode
* @param string|null $ClientRegistrationCode
* @param string|null $Token
*/
public function __construct(
?string $ClientCode=null,
?string $ClientRegistrationCode=null,
?string $Token=null,
/** @var string|null */
public ?string $UploadFileName=null,
/** @var string|null */
public ?string $OriginalFileName=null,
/** @var string|null */
public ?string $TemplateGuid=null,
/** @var string|null */
public ?string $ClientIpAddress=null,
/** @var string|null */
public ?string $ClientGuid=null,
/** @var string|null */
public ?string $ClientName=null,
/** @var string|null */
public ?string $ClientId=null,
/** @var string|null */
public ?string $ClientSerialNumber=null,
/** @var string|null */
public ?string $UserName=null,
/** @var string|null */
public ?string $UserEmail=null,
/** @var string|null */
public ?string $UserHomeFolder=null,
/** @var array<string,string>|null */
public ?array $TemplateQuestions=null,
/** @var array<string,string>|null */
public ?array $GlobalQuestions=null
) {
parent::__construct($ClientCode,$ClientRegistrationCode,$Token);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['UploadFileName'])) $this->UploadFileName = $o['UploadFileName'];
if (isset($o['OriginalFileName'])) $this->OriginalFileName = $o['OriginalFileName'];
if (isset($o['TemplateGuid'])) $this->TemplateGuid = $o['TemplateGuid'];
if (isset($o['ClientIpAddress'])) $this->ClientIpAddress = $o['ClientIpAddress'];
if (isset($o['ClientGuid'])) $this->ClientGuid = $o['ClientGuid'];
if (isset($o['ClientName'])) $this->ClientName = $o['ClientName'];
if (isset($o['ClientId'])) $this->ClientId = $o['ClientId'];
if (isset($o['ClientSerialNumber'])) $this->ClientSerialNumber = $o['ClientSerialNumber'];
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['UserEmail'])) $this->UserEmail = $o['UserEmail'];
if (isset($o['UserHomeFolder'])) $this->UserHomeFolder = $o['UserHomeFolder'];
if (isset($o['TemplateQuestions'])) $this->TemplateQuestions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['TemplateQuestions']);
if (isset($o['GlobalQuestions'])) $this->GlobalQuestions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['GlobalQuestions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->UploadFileName)) $o['UploadFileName'] = $this->UploadFileName;
if (isset($this->OriginalFileName)) $o['OriginalFileName'] = $this->OriginalFileName;
if (isset($this->TemplateGuid)) $o['TemplateGuid'] = $this->TemplateGuid;
if (isset($this->ClientIpAddress)) $o['ClientIpAddress'] = $this->ClientIpAddress;
if (isset($this->ClientGuid)) $o['ClientGuid'] = $this->ClientGuid;
if (isset($this->ClientName)) $o['ClientName'] = $this->ClientName;
if (isset($this->ClientId)) $o['ClientId'] = $this->ClientId;
if (isset($this->ClientSerialNumber)) $o['ClientSerialNumber'] = $this->ClientSerialNumber;
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->UserEmail)) $o['UserEmail'] = $this->UserEmail;
if (isset($this->UserHomeFolder)) $o['UserHomeFolder'] = $this->UserHomeFolder;
if (isset($this->TemplateQuestions)) $o['TemplateQuestions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->TemplateQuestions);
if (isset($this->GlobalQuestions)) $o['GlobalQuestions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->GlobalQuestions);
return empty($o) ? new class(){} : $o;
}
}
class JsonMetadataUploadResponse extends JsonDto implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $TemplateGuid=null,
/** @var bool|null */
public ?bool $InError=null,
/** @var string|null */
public ?string $ErrorMessage=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['TemplateGuid'])) $this->TemplateGuid = $o['TemplateGuid'];
if (isset($o['InError'])) $this->InError = $o['InError'];
if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->TemplateGuid)) $o['TemplateGuid'] = $this->TemplateGuid;
if (isset($this->InError)) $o['InError'] = $this->InError;
if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
return empty($o) ? new class(){} : $o;
}
}
PHP JsonMetadataUploadRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /xml/reply/JsonMetadataUploadRequest HTTP/1.1
Host: buildmax.org
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<JsonMetadataUploadRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ScannerVision.WebService.Json.Dto">
<ClientCode>String</ClientCode>
<ClientRegistrationCode>String</ClientRegistrationCode>
<Token>String</Token>
<ClientGuid>String</ClientGuid>
<ClientId>String</ClientId>
<ClientIpAddress>String</ClientIpAddress>
<ClientName>String</ClientName>
<ClientSerialNumber>String</ClientSerialNumber>
<GlobalQuestions xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
<OriginalFileName>String</OriginalFileName>
<TemplateGuid>String</TemplateGuid>
<TemplateQuestions xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
<UploadFileName>String</UploadFileName>
<UserEmail>String</UserEmail>
<UserHomeFolder>String</UserHomeFolder>
<UserName>String</UserName>
</JsonMetadataUploadRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <JsonMetadataUploadResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ScannerVision.WebService.Json.Dto"> <ErrorMessage>String</ErrorMessage> <InError>false</InError> <TemplateGuid>String</TemplateGuid> </JsonMetadataUploadResponse>