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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<KpiV2VisitsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <BranchId>00000000-0000-0000-0000-000000000000</BranchId>
  <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
  <FromDate>0001-01-01T00:00:00</FromDate>
  <LineId>00000000-0000-0000-0000-000000000000</LineId>
  <Outcome>String</Outcome>
  <Page>0</Page>
  <PageSize>0</PageSize>
  <StationId>00000000-0000-0000-0000-000000000000</StationId>
  <ToDate>0001-01-01T00:00:00</ToDate>
</KpiV2VisitsRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<KpiV2VisitsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1: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>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1: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>
    </d2p1:Meta>
  </ResponseStatus>
  <Visits>
    <CanSeeFinancial>false</CanSeeFinancial>
    <CanSeeStaff>false</CanSeeStaff>
    <OutcomeCounts xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringint>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>0</d3p1:Value>
      </d3p1:KeyValueOfstringint>
    </OutcomeCounts>
    <Page>0</Page>
    <PageSize>0</PageSize>
    <Rows>
      <SvcVisitRow>
        <CheckinId>00000000-0000-0000-0000-000000000000</CheckinId>
        <ContactAgentId>0</ContactAgentId>
        <ContactId>0</ContactId>
        <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
        <CustomerName>String</CustomerName>
        <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
        <EmployeeName>String</EmployeeName>
        <Fee>0</Fee>
        <IsAppointment>false</IsAppointment>
        <LineId>00000000-0000-0000-0000-000000000000</LineId>
        <LocalCalled>0001-01-01T00:00:00</LocalCalled>
        <LocalDate>0001-01-01T00:00:00</LocalDate>
        <LocalEnd>0001-01-01T00:00:00</LocalEnd>
        <LocalHere>0001-01-01T00:00:00</LocalHere>
        <LocalStart>0001-01-01T00:00:00</LocalStart>
        <Outcome>String</Outcome>
        <ServeSec>0</ServeSec>
        <ServiceName>String</ServiceName>
        <StationId>00000000-0000-0000-0000-000000000000</StationId>
        <StationName>String</StationName>
        <TicketLabel>String</TicketLabel>
        <WaitSec>0</WaitSec>
      </SvcVisitRow>
    </Rows>
    <Services>
      <SvcChip>
        <LineId>00000000-0000-0000-0000-000000000000</LineId>
        <N>0</N>
        <Name>String</Name>
      </SvcChip>
    </Services>
    <TotalRows>0</TotalRows>
  </Visits>
</KpiV2VisitsResponse>