<?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};
// @DataContract
class AnalyticsLogInfo implements JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var int */
public int $Id=0,
// @DataMember(Order=2)
/** @var DateTime */
public DateTime $DateTime=new DateTime(),
// @DataMember(Order=3)
/** @var string|null */
public ?string $Browser=null,
// @DataMember(Order=4)
/** @var string|null */
public ?string $Device=null,
// @DataMember(Order=5)
/** @var string|null */
public ?string $Bot=null,
// @DataMember(Order=6)
/** @var string|null */
public ?string $Op=null,
// @DataMember(Order=7)
/** @var string|null */
public ?string $UserId=null,
// @DataMember(Order=8)
/** @var string|null */
public ?string $UserName=null,
// @DataMember(Order=9)
/** @var string|null */
public ?string $ApiKey=null,
// @DataMember(Order=10)
/** @var string|null */
public ?string $Ip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['DateTime'])) $this->DateTime = JsonConverters::from('DateTime', $o['DateTime']);
if (isset($o['Browser'])) $this->Browser = $o['Browser'];
if (isset($o['Device'])) $this->Device = $o['Device'];
if (isset($o['Bot'])) $this->Bot = $o['Bot'];
if (isset($o['Op'])) $this->Op = $o['Op'];
if (isset($o['UserId'])) $this->UserId = $o['UserId'];
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
if (isset($o['Ip'])) $this->Ip = $o['Ip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->DateTime)) $o['DateTime'] = JsonConverters::to('DateTime', $this->DateTime);
if (isset($this->Browser)) $o['Browser'] = $this->Browser;
if (isset($this->Device)) $o['Device'] = $this->Device;
if (isset($this->Bot)) $o['Bot'] = $this->Bot;
if (isset($this->Op)) $o['Op'] = $this->Op;
if (isset($this->UserId)) $o['UserId'] = $this->UserId;
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
if (isset($this->Ip)) $o['Ip'] = $this->Ip;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetAnalyticsInfoResponse implements JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var array<string>|null */
public ?array $Months=null,
// @DataMember(Order=2)
/** @var AnalyticsLogInfo|null */
public ?AnalyticsLogInfo $Result=null,
// @DataMember(Order=3)
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Months'])) $this->Months = JsonConverters::fromArray('string', $o['Months']);
if (isset($o['Result'])) $this->Result = JsonConverters::from('AnalyticsLogInfo', $o['Result']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Months)) $o['Months'] = JsonConverters::toArray('string', $this->Months);
if (isset($this->Result)) $o['Result'] = JsonConverters::to('AnalyticsLogInfo', $this->Result);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetAnalyticsInfo implements IGet, JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var DateTime|null */
public ?DateTime $Month=null,
// @DataMember(Order=2)
/** @var string|null */
public ?string $Type=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $Op=null,
// @DataMember(Order=4)
/** @var string|null */
public ?string $ApiKey=null,
// @DataMember(Order=5)
/** @var string|null */
public ?string $UserId=null,
// @DataMember(Order=6)
/** @var string|null */
public ?string $Ip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Month'])) $this->Month = JsonConverters::from('DateTime', $o['Month']);
if (isset($o['Type'])) $this->Type = $o['Type'];
if (isset($o['Op'])) $this->Op = $o['Op'];
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
if (isset($o['UserId'])) $this->UserId = $o['UserId'];
if (isset($o['Ip'])) $this->Ip = $o['Ip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Month)) $o['Month'] = JsonConverters::to('DateTime', $this->Month);
if (isset($this->Type)) $o['Type'] = $this->Type;
if (isset($this->Op)) $o['Op'] = $this->Op;
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
if (isset($this->UserId)) $o['UserId'] = $this->UserId;
if (isset($this->Ip)) $o['Ip'] = $this->Ip;
return empty($o) ? new class(){} : $o;
}
}
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/GetAnalyticsInfo HTTP/1.1
Host: test-do-services.klokgroep.nl
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetAnalyticsInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Month>0001-01-01T00:00:00</Month>
<Type>String</Type>
<Op>String</Op>
<ApiKey>String</ApiKey>
<UserId>String</UserId>
<Ip>String</Ip>
</GetAnalyticsInfo>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetAnalyticsInfoResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Months xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</Months>
<Result>
<Id>0</Id>
<DateTime>0001-01-01T00:00:00</DateTime>
<Browser>String</Browser>
<Device>String</Device>
<Bot>String</Bot>
<Op>String</Op>
<UserId>String</UserId>
<UserName>String</UserName>
<ApiKey>String</ApiKey>
<Ip>String</Ip>
</Result>
<ResponseStatus>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
<Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</Meta>
</ResponseError>
</Errors>
<Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</Meta>
</ResponseStatus>
</GetAnalyticsInfoResponse>