Trendsic Platform Service

<back to all web services

ContactVisitsRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/contact/{ContactId}/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 ContactQueueVisit implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CheckinId='',
        /** @var string */
        public string $BranchId='',
        /** @var string|null */
        public ?string $BranchName=null,
        /** @var string */
        public string $LineId='',
        /** @var string|null */
        public ?string $ServiceName=null,
        /** @var int */
        public int $Outcome=0,
        /** @var string|null */
        public ?string $OutcomeLabel=null,
        /** @var bool|null */
        public ?bool $IsAppointment=null,
        /** @var DateTime|null */
        public ?DateTime $SignInUtc=null,
        /** @var DateTime|null */
        public ?DateTime $CalledUtc=null,
        /** @var DateTime|null */
        public ?DateTime $FirstStartUtc=null,
        /** @var DateTime|null */
        public ?DateTime $CompletedTime=null,
        /** @var int|null */
        public ?int $WaitMinutes=null,
        /** @var int|null */
        public ?int $ServiceMinutes=null,
        /** @var string|null */
        public ?string $WindowName=null,
        /** @var string|null */
        public ?string $TicketLabel=null,
        /** @var string|null */
        public ?string $HoldReason=null,
        /** @var DateTime|null */
        public ?DateTime $ReturnedTime=null,
        /** @var int */
        public int $PausedMinutes=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CheckinId'])) $this->CheckinId = $o['CheckinId'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
        if (isset($o['LineId'])) $this->LineId = $o['LineId'];
        if (isset($o['ServiceName'])) $this->ServiceName = $o['ServiceName'];
        if (isset($o['Outcome'])) $this->Outcome = $o['Outcome'];
        if (isset($o['OutcomeLabel'])) $this->OutcomeLabel = $o['OutcomeLabel'];
        if (isset($o['IsAppointment'])) $this->IsAppointment = $o['IsAppointment'];
        if (isset($o['SignInUtc'])) $this->SignInUtc = JsonConverters::from('DateTime', $o['SignInUtc']);
        if (isset($o['CalledUtc'])) $this->CalledUtc = JsonConverters::from('DateTime', $o['CalledUtc']);
        if (isset($o['FirstStartUtc'])) $this->FirstStartUtc = JsonConverters::from('DateTime', $o['FirstStartUtc']);
        if (isset($o['CompletedTime'])) $this->CompletedTime = JsonConverters::from('DateTime', $o['CompletedTime']);
        if (isset($o['WaitMinutes'])) $this->WaitMinutes = $o['WaitMinutes'];
        if (isset($o['ServiceMinutes'])) $this->ServiceMinutes = $o['ServiceMinutes'];
        if (isset($o['WindowName'])) $this->WindowName = $o['WindowName'];
        if (isset($o['TicketLabel'])) $this->TicketLabel = $o['TicketLabel'];
        if (isset($o['HoldReason'])) $this->HoldReason = $o['HoldReason'];
        if (isset($o['ReturnedTime'])) $this->ReturnedTime = JsonConverters::from('DateTime', $o['ReturnedTime']);
        if (isset($o['PausedMinutes'])) $this->PausedMinutes = $o['PausedMinutes'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CheckinId)) $o['CheckinId'] = $this->CheckinId;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
        if (isset($this->LineId)) $o['LineId'] = $this->LineId;
        if (isset($this->ServiceName)) $o['ServiceName'] = $this->ServiceName;
        if (isset($this->Outcome)) $o['Outcome'] = $this->Outcome;
        if (isset($this->OutcomeLabel)) $o['OutcomeLabel'] = $this->OutcomeLabel;
        if (isset($this->IsAppointment)) $o['IsAppointment'] = $this->IsAppointment;
        if (isset($this->SignInUtc)) $o['SignInUtc'] = JsonConverters::to('DateTime', $this->SignInUtc);
        if (isset($this->CalledUtc)) $o['CalledUtc'] = JsonConverters::to('DateTime', $this->CalledUtc);
        if (isset($this->FirstStartUtc)) $o['FirstStartUtc'] = JsonConverters::to('DateTime', $this->FirstStartUtc);
        if (isset($this->CompletedTime)) $o['CompletedTime'] = JsonConverters::to('DateTime', $this->CompletedTime);
        if (isset($this->WaitMinutes)) $o['WaitMinutes'] = $this->WaitMinutes;
        if (isset($this->ServiceMinutes)) $o['ServiceMinutes'] = $this->ServiceMinutes;
        if (isset($this->WindowName)) $o['WindowName'] = $this->WindowName;
        if (isset($this->TicketLabel)) $o['TicketLabel'] = $this->TicketLabel;
        if (isset($this->HoldReason)) $o['HoldReason'] = $this->HoldReason;
        if (isset($this->ReturnedTime)) $o['ReturnedTime'] = JsonConverters::to('DateTime', $this->ReturnedTime);
        if (isset($this->PausedMinutes)) $o['PausedMinutes'] = $this->PausedMinutes;
        return empty($o) ? new class(){} : $o;
    }
}

class ContactQueueVisitSummary implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Visits=0,
        /** @var int */
        public int $Completed=0,
        /** @var int */
        public int $NoShows=0,
        /** @var int */
        public int $NoShows90d=0,
        /** @var int */
        public int $Cancelled=0,
        /** @var int */
        public int $Unfulfilled=0,
        /** @var int */
        public int $Appointments=0,
        /** @var DateTime|null */
        public ?DateTime $LastVisitUtc=null,
        /** @var DateTime|null */
        public ?DateTime $LastNoShowUtc=null,
        /** @var float|null */
        public ?float $AvgWaitMinutes=null,
        /** @var bool|null */
        public ?bool $SmsOptIn=null,
        /** @var int */
        public int $TextsSent90d=0,
        /** @var string|null */
        public ?string $SayNameAs=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Visits'])) $this->Visits = $o['Visits'];
        if (isset($o['Completed'])) $this->Completed = $o['Completed'];
        if (isset($o['NoShows'])) $this->NoShows = $o['NoShows'];
        if (isset($o['NoShows90d'])) $this->NoShows90d = $o['NoShows90d'];
        if (isset($o['Cancelled'])) $this->Cancelled = $o['Cancelled'];
        if (isset($o['Unfulfilled'])) $this->Unfulfilled = $o['Unfulfilled'];
        if (isset($o['Appointments'])) $this->Appointments = $o['Appointments'];
        if (isset($o['LastVisitUtc'])) $this->LastVisitUtc = JsonConverters::from('DateTime', $o['LastVisitUtc']);
        if (isset($o['LastNoShowUtc'])) $this->LastNoShowUtc = JsonConverters::from('DateTime', $o['LastNoShowUtc']);
        if (isset($o['AvgWaitMinutes'])) $this->AvgWaitMinutes = $o['AvgWaitMinutes'];
        if (isset($o['SmsOptIn'])) $this->SmsOptIn = $o['SmsOptIn'];
        if (isset($o['TextsSent90d'])) $this->TextsSent90d = $o['TextsSent90d'];
        if (isset($o['SayNameAs'])) $this->SayNameAs = $o['SayNameAs'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Visits)) $o['Visits'] = $this->Visits;
        if (isset($this->Completed)) $o['Completed'] = $this->Completed;
        if (isset($this->NoShows)) $o['NoShows'] = $this->NoShows;
        if (isset($this->NoShows90d)) $o['NoShows90d'] = $this->NoShows90d;
        if (isset($this->Cancelled)) $o['Cancelled'] = $this->Cancelled;
        if (isset($this->Unfulfilled)) $o['Unfulfilled'] = $this->Unfulfilled;
        if (isset($this->Appointments)) $o['Appointments'] = $this->Appointments;
        if (isset($this->LastVisitUtc)) $o['LastVisitUtc'] = JsonConverters::to('DateTime', $this->LastVisitUtc);
        if (isset($this->LastNoShowUtc)) $o['LastNoShowUtc'] = JsonConverters::to('DateTime', $this->LastNoShowUtc);
        if (isset($this->AvgWaitMinutes)) $o['AvgWaitMinutes'] = $this->AvgWaitMinutes;
        if (isset($this->SmsOptIn)) $o['SmsOptIn'] = $this->SmsOptIn;
        if (isset($this->TextsSent90d)) $o['TextsSent90d'] = $this->TextsSent90d;
        if (isset($this->SayNameAs)) $o['SayNameAs'] = $this->SayNameAs;
        return empty($o) ? new class(){} : $o;
    }
}

class ContactVisitsResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<ContactQueueVisit>|null */
        public ?array $Visits=null,
        /** @var ContactQueueVisitSummary|null */
        public ?ContactQueueVisitSummary $Summary=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::fromArray('ContactQueueVisit', $o['Visits']);
        if (isset($o['Summary'])) $this->Summary = JsonConverters::from('ContactQueueVisitSummary', $o['Summary']);
    }
    
    /** @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::toArray('ContactQueueVisit', $this->Visits);
        if (isset($this->Summary)) $o['Summary'] = JsonConverters::to('ContactQueueVisitSummary', $this->Summary);
        return empty($o) ? new class(){} : $o;
    }
}

class ContactVisitsRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactId=0,
        /** @var int */
        public int $Take=0
    ) {
    }

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

PHP ContactVisitsRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /v1/contact/{ContactId}/visits HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Visits":[{"CheckinId":"00000000000000000000000000000000","BranchId":"00000000000000000000000000000000","BranchName":"String","LineId":"00000000000000000000000000000000","ServiceName":"String","Outcome":0,"OutcomeLabel":"String","IsAppointment":false,"SignInUtc":"0001-01-01T00:00:00.0000000","CalledUtc":"0001-01-01T00:00:00.0000000","FirstStartUtc":"0001-01-01T00:00:00.0000000","CompletedTime":"0001-01-01T00:00:00.0000000","WaitMinutes":0,"ServiceMinutes":0,"WindowName":"String","TicketLabel":"String","HoldReason":"String","ReturnedTime":"0001-01-01T00:00:00.0000000","PausedMinutes":0}],"Summary":{"Visits":0,"Completed":0,"NoShows":0,"NoShows90d":0,"Cancelled":0,"Unfulfilled":0,"Appointments":0,"LastVisitUtc":"0001-01-01T00:00:00.0000000","LastNoShowUtc":"0001-01-01T00:00:00.0000000","AvgWaitMinutes":0,"SmsOptIn":false,"TextsSent90d":0,"SayNameAs":"String"}}