DigiOffice API Services Services

<back to all web services

GetAnalyticsInfo

<?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;
    }
}

PHP GetAnalyticsInfo DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/GetAnalyticsInfo HTTP/1.1 
Host: test-do-services.klokgroep.nl 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Month: 0001-01-01,
	Type: String,
	Op: String,
	ApiKey: String,
	UserId: String,
	Ip: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Months: 
	[
		String
	],
	Result: 
	{
		Id: 0,
		DateTime: 0001-01-01,
		Browser: String,
		Device: String,
		Bot: String,
		Op: String,
		UserId: String,
		UserName: String,
		ApiKey: String,
		Ip: String
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}