Trendsic Platform Service

<back to all web services

KpiV2VisitsRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/kpiv2/visits
<?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 SvcVisitRow implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CheckinId='',
        /** @var string|null */
        public ?string $TicketLabel=null,
        /** @var DateTime */
        public DateTime $LocalDate=new DateTime(),
        /** @var string */
        public string $LineId='',
        /** @var string|null */
        public ?string $ServiceName=null,
        /** @var string|null */
        public ?string $StationId=null,
        /** @var string|null */
        public ?string $StationName=null,
        /** @var string|null */
        public ?string $EmployeeId=null,
        /** @var string|null */
        public ?string $EmployeeName=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var int|null */
        public ?int $ContactId=null,
        /** @var int|null */
        public ?int $ContactAgentId=null,
        /** @var string */
        public string $CustomerId='',
        /** @var bool|null */
        public ?bool $IsAppointment=null,
        /** @var DateTime|null */
        public ?DateTime $LocalHere=null,
        /** @var DateTime|null */
        public ?DateTime $LocalCalled=null,
        /** @var DateTime|null */
        public ?DateTime $LocalStart=null,
        /** @var DateTime|null */
        public ?DateTime $LocalEnd=null,
        /** @var int|null */
        public ?int $WaitSec=null,
        /** @var int|null */
        public ?int $ServeSec=null,
        /** @var string|null */
        public ?string $Outcome=null,
        /** @var float|null */
        public ?float $Fee=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CheckinId'])) $this->CheckinId = $o['CheckinId'];
        if (isset($o['TicketLabel'])) $this->TicketLabel = $o['TicketLabel'];
        if (isset($o['LocalDate'])) $this->LocalDate = JsonConverters::from('DateTime', $o['LocalDate']);
        if (isset($o['LineId'])) $this->LineId = $o['LineId'];
        if (isset($o['ServiceName'])) $this->ServiceName = $o['ServiceName'];
        if (isset($o['StationId'])) $this->StationId = $o['StationId'];
        if (isset($o['StationName'])) $this->StationName = $o['StationName'];
        if (isset($o['EmployeeId'])) $this->EmployeeId = $o['EmployeeId'];
        if (isset($o['EmployeeName'])) $this->EmployeeName = $o['EmployeeName'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['ContactAgentId'])) $this->ContactAgentId = $o['ContactAgentId'];
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        if (isset($o['IsAppointment'])) $this->IsAppointment = $o['IsAppointment'];
        if (isset($o['LocalHere'])) $this->LocalHere = JsonConverters::from('DateTime', $o['LocalHere']);
        if (isset($o['LocalCalled'])) $this->LocalCalled = JsonConverters::from('DateTime', $o['LocalCalled']);
        if (isset($o['LocalStart'])) $this->LocalStart = JsonConverters::from('DateTime', $o['LocalStart']);
        if (isset($o['LocalEnd'])) $this->LocalEnd = JsonConverters::from('DateTime', $o['LocalEnd']);
        if (isset($o['WaitSec'])) $this->WaitSec = $o['WaitSec'];
        if (isset($o['ServeSec'])) $this->ServeSec = $o['ServeSec'];
        if (isset($o['Outcome'])) $this->Outcome = $o['Outcome'];
        if (isset($o['Fee'])) $this->Fee = $o['Fee'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CheckinId)) $o['CheckinId'] = $this->CheckinId;
        if (isset($this->TicketLabel)) $o['TicketLabel'] = $this->TicketLabel;
        if (isset($this->LocalDate)) $o['LocalDate'] = JsonConverters::to('DateTime', $this->LocalDate);
        if (isset($this->LineId)) $o['LineId'] = $this->LineId;
        if (isset($this->ServiceName)) $o['ServiceName'] = $this->ServiceName;
        if (isset($this->StationId)) $o['StationId'] = $this->StationId;
        if (isset($this->StationName)) $o['StationName'] = $this->StationName;
        if (isset($this->EmployeeId)) $o['EmployeeId'] = $this->EmployeeId;
        if (isset($this->EmployeeName)) $o['EmployeeName'] = $this->EmployeeName;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->ContactAgentId)) $o['ContactAgentId'] = $this->ContactAgentId;
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        if (isset($this->IsAppointment)) $o['IsAppointment'] = $this->IsAppointment;
        if (isset($this->LocalHere)) $o['LocalHere'] = JsonConverters::to('DateTime', $this->LocalHere);
        if (isset($this->LocalCalled)) $o['LocalCalled'] = JsonConverters::to('DateTime', $this->LocalCalled);
        if (isset($this->LocalStart)) $o['LocalStart'] = JsonConverters::to('DateTime', $this->LocalStart);
        if (isset($this->LocalEnd)) $o['LocalEnd'] = JsonConverters::to('DateTime', $this->LocalEnd);
        if (isset($this->WaitSec)) $o['WaitSec'] = $this->WaitSec;
        if (isset($this->ServeSec)) $o['ServeSec'] = $this->ServeSec;
        if (isset($this->Outcome)) $o['Outcome'] = $this->Outcome;
        if (isset($this->Fee)) $o['Fee'] = $this->Fee;
        return empty($o) ? new class(){} : $o;
    }
}

class SvcChip implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $LineId='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var int */
        public int $N=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['LineId'])) $this->LineId = $o['LineId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['N'])) $this->N = $o['N'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->LineId)) $o['LineId'] = $this->LineId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->N)) $o['N'] = $this->N;
        return empty($o) ? new class(){} : $o;
    }
}

class SvcVisitPage implements JsonSerializable
{
    public function __construct(
        /** @var array<SvcVisitRow>|null */
        public ?array $Rows=null,
        /** @var int */
        public int $TotalRows=0,
        /** @var int */
        public int $Page=0,
        /** @var int */
        public int $PageSize=0,
        /** @var array<string,int>|null */
        public ?array $OutcomeCounts=null,
        /** @var array<SvcChip>|null */
        public ?array $Services=null,
        /** @var bool|null */
        public ?bool $CanSeeStaff=null,
        /** @var bool|null */
        public ?bool $CanSeeFinancial=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Rows'])) $this->Rows = JsonConverters::fromArray('SvcVisitRow', $o['Rows']);
        if (isset($o['TotalRows'])) $this->TotalRows = $o['TotalRows'];
        if (isset($o['Page'])) $this->Page = $o['Page'];
        if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
        if (isset($o['OutcomeCounts'])) $this->OutcomeCounts = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','int']), $o['OutcomeCounts']);
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('SvcChip', $o['Services']);
        if (isset($o['CanSeeStaff'])) $this->CanSeeStaff = $o['CanSeeStaff'];
        if (isset($o['CanSeeFinancial'])) $this->CanSeeFinancial = $o['CanSeeFinancial'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Rows)) $o['Rows'] = JsonConverters::toArray('SvcVisitRow', $this->Rows);
        if (isset($this->TotalRows)) $o['TotalRows'] = $this->TotalRows;
        if (isset($this->Page)) $o['Page'] = $this->Page;
        if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
        if (isset($this->OutcomeCounts)) $o['OutcomeCounts'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','int']), $this->OutcomeCounts);
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('SvcChip', $this->Services);
        if (isset($this->CanSeeStaff)) $o['CanSeeStaff'] = $this->CanSeeStaff;
        if (isset($this->CanSeeFinancial)) $o['CanSeeFinancial'] = $this->CanSeeFinancial;
        return empty($o) ? new class(){} : $o;
    }
}

class KpiV2VisitsResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var SvcVisitPage|null */
        public ?SvcVisitPage $Visits=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['Visits'])) $this->Visits = JsonConverters::from('SvcVisitPage', $o['Visits']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->Visits)) $o['Visits'] = JsonConverters::to('SvcVisitPage', $this->Visits);
        return empty($o) ? new class(){} : $o;
    }
}

class KpiV2VisitsRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $BranchId='',
        /** @var DateTime */
        public DateTime $FromDate=new DateTime(),
        /** @var DateTime */
        public DateTime $ToDate=new DateTime(),
        /** @var string|null */
        public ?string $StationId=null,
        /** @var string|null */
        public ?string $EmployeeId=null,
        /** @var string|null */
        public ?string $Outcome=null,
        /** @var string|null */
        public ?string $LineId=null,
        /** @var int */
        public int $Page=0,
        /** @var int */
        public int $PageSize=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['FromDate'])) $this->FromDate = JsonConverters::from('DateTime', $o['FromDate']);
        if (isset($o['ToDate'])) $this->ToDate = JsonConverters::from('DateTime', $o['ToDate']);
        if (isset($o['StationId'])) $this->StationId = $o['StationId'];
        if (isset($o['EmployeeId'])) $this->EmployeeId = $o['EmployeeId'];
        if (isset($o['Outcome'])) $this->Outcome = $o['Outcome'];
        if (isset($o['LineId'])) $this->LineId = $o['LineId'];
        if (isset($o['Page'])) $this->Page = $o['Page'];
        if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->FromDate)) $o['FromDate'] = JsonConverters::to('DateTime', $this->FromDate);
        if (isset($this->ToDate)) $o['ToDate'] = JsonConverters::to('DateTime', $this->ToDate);
        if (isset($this->StationId)) $o['StationId'] = $this->StationId;
        if (isset($this->EmployeeId)) $o['EmployeeId'] = $this->EmployeeId;
        if (isset($this->Outcome)) $o['Outcome'] = $this->Outcome;
        if (isset($this->LineId)) $o['LineId'] = $this->LineId;
        if (isset($this->Page)) $o['Page'] = $this->Page;
        if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
        return empty($o) ? new class(){} : $o;
    }
}

PHP KpiV2VisitsRequest 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 /v1/dashboard/kpiv2/visits HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	BranchId: 00000000000000000000000000000000,
	FromDate: 0001-01-01,
	ToDate: 0001-01-01,
	StationId: 00000000000000000000000000000000,
	EmployeeId: 00000000000000000000000000000000,
	Outcome: String,
	LineId: 00000000000000000000000000000000,
	Page: 0,
	PageSize: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Visits: 
	{
		Rows: 
		[
			{
				CheckinId: 00000000000000000000000000000000,
				TicketLabel: String,
				LocalDate: 0001-01-01,
				LineId: 00000000000000000000000000000000,
				ServiceName: String,
				StationId: 00000000000000000000000000000000,
				StationName: String,
				EmployeeId: 00000000000000000000000000000000,
				EmployeeName: String,
				CustomerName: String,
				ContactId: 0,
				ContactAgentId: 0,
				CustomerId: 00000000000000000000000000000000,
				IsAppointment: False,
				LocalHere: 0001-01-01,
				LocalCalled: 0001-01-01,
				LocalStart: 0001-01-01,
				LocalEnd: 0001-01-01,
				WaitSec: 0,
				ServeSec: 0,
				Outcome: String,
				Fee: 0
			}
		],
		TotalRows: 0,
		Page: 0,
		PageSize: 0,
		OutcomeCounts: 
		{
			String: 0
		},
		Services: 
		[
			{
				LineId: 00000000000000000000000000000000,
				Name: String,
				N: 0
			}
		],
		CanSeeStaff: False,
		CanSeeFinancial: False
	}
}