<?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: blazordiffusion.com
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>