<?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 JsonServerInformationRequest 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 $ClientHostName=null,
/** @var string|null */
public ?string $UserName=null,
/** @var bool|null */
public ?bool $IsPro=null,
/** @var string|null */
public ?string $ClientId=null
) {
parent::__construct($ClientCode,$ClientRegistrationCode,$Token);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ClientHostName'])) $this->ClientHostName = $o['ClientHostName'];
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['IsPro'])) $this->IsPro = $o['IsPro'];
if (isset($o['ClientId'])) $this->ClientId = $o['ClientId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ClientHostName)) $o['ClientHostName'] = $this->ClientHostName;
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->IsPro)) $o['IsPro'] = $this->IsPro;
if (isset($this->ClientId)) $o['ClientId'] = $this->ClientId;
return empty($o) ? new class(){} : $o;
}
}
class JsonServerInformationResponse extends JsonDto implements JsonSerializable
{
public function __construct(
/** @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 $UserHomeFolder=null,
/** @var string|null */
public ?string $UserEmail=null,
/** @var string|null */
public ?string $ServerVersion=null,
/** @var bool|null */
public ?bool $AllowUpdate=null,
/** @var string|null */
public ?string $FtpUsername=null,
/** @var string|null */
public ?string $FtpPassword=null,
/** @var string|null */
public ?string $AdminUsername=null,
/** @var string|null */
public ?string $AdminPassword=null,
/** @var int */
public int $FtpPort=0,
/** @var string[]|null */
public ?array $SupportedDocumentFormats=null,
/** @var string|null */
public ?string $HpnVersion=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
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['UserHomeFolder'])) $this->UserHomeFolder = $o['UserHomeFolder'];
if (isset($o['UserEmail'])) $this->UserEmail = $o['UserEmail'];
if (isset($o['ServerVersion'])) $this->ServerVersion = $o['ServerVersion'];
if (isset($o['AllowUpdate'])) $this->AllowUpdate = $o['AllowUpdate'];
if (isset($o['FtpUsername'])) $this->FtpUsername = $o['FtpUsername'];
if (isset($o['FtpPassword'])) $this->FtpPassword = $o['FtpPassword'];
if (isset($o['AdminUsername'])) $this->AdminUsername = $o['AdminUsername'];
if (isset($o['AdminPassword'])) $this->AdminPassword = $o['AdminPassword'];
if (isset($o['FtpPort'])) $this->FtpPort = $o['FtpPort'];
if (isset($o['SupportedDocumentFormats'])) $this->SupportedDocumentFormats = JsonConverters::fromArray('string', $o['SupportedDocumentFormats']);
if (isset($o['HpnVersion'])) $this->HpnVersion = $o['HpnVersion'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
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->UserHomeFolder)) $o['UserHomeFolder'] = $this->UserHomeFolder;
if (isset($this->UserEmail)) $o['UserEmail'] = $this->UserEmail;
if (isset($this->ServerVersion)) $o['ServerVersion'] = $this->ServerVersion;
if (isset($this->AllowUpdate)) $o['AllowUpdate'] = $this->AllowUpdate;
if (isset($this->FtpUsername)) $o['FtpUsername'] = $this->FtpUsername;
if (isset($this->FtpPassword)) $o['FtpPassword'] = $this->FtpPassword;
if (isset($this->AdminUsername)) $o['AdminUsername'] = $this->AdminUsername;
if (isset($this->AdminPassword)) $o['AdminPassword'] = $this->AdminPassword;
if (isset($this->FtpPort)) $o['FtpPort'] = $this->FtpPort;
if (isset($this->SupportedDocumentFormats)) $o['SupportedDocumentFormats'] = JsonConverters::toArray('string', $this->SupportedDocumentFormats);
if (isset($this->HpnVersion)) $o['HpnVersion'] = $this->HpnVersion;
return empty($o) ? new class(){} : $o;
}
}
PHP JsonServerInformationRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsonl/reply/JsonServerInformationRequest HTTP/1.1
Host: buildmax.org
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"ClientHostName":"String","UserName":"String","IsPro":false,"ClientId":"String","ClientCode":"String","ClientRegistrationCode":"String","Token":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"ClientIpAddress":"String","ClientGuid":"String","ClientName":"String","ClientId":"String","UserHomeFolder":"String","UserEmail":"String","ServerVersion":"String","AllowUpdate":false,"FtpUsername":"String","FtpPassword":"String","AdminUsername":"String","AdminPassword":"String","FtpPort":0,"SupportedDocumentFormats":["String"],"HpnVersion":"String"}