Trendsic Platform Service

<back to all web services

VisitBoardRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/visits/board
<?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 VisitCard implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $VisitKey=null,
        /** @var int */
        public int $JobID=0,
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectUID=null,
        /** @var int|null */
        public ?int $AgreementJobID=null,
        /** @var string|null */
        public ?string $ScheduledDate=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var string|null */
        public ?string $JobName=null,
        /** @var string|null */
        public ?string $LocationName=null,
        /** @var string|null */
        public ?string $City=null,
        /** @var string|null */
        public ?string $Zip=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null,
        /** @var int|null */
        public ?int $CrewID=null,
        /** @var string|null */
        public ?string $CrewName=null,
        /** @var int */
        public int $SortOrder=0,
        /** @var string|null */
        public ?string $Status=null,
        /** @var int */
        public int $DurationMinutes=0,
        /** @var string|null */
        public ?string $EtaWindow=null,
        /** @var bool|null */
        public ?bool $IsCommercial=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['VisitKey'])) $this->VisitKey = $o['VisitKey'];
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectUID'])) $this->ProjectUID = $o['ProjectUID'];
        if (isset($o['AgreementJobID'])) $this->AgreementJobID = $o['AgreementJobID'];
        if (isset($o['ScheduledDate'])) $this->ScheduledDate = $o['ScheduledDate'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['JobName'])) $this->JobName = $o['JobName'];
        if (isset($o['LocationName'])) $this->LocationName = $o['LocationName'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
        if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
        if (isset($o['SortOrder'])) $this->SortOrder = $o['SortOrder'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['DurationMinutes'])) $this->DurationMinutes = $o['DurationMinutes'];
        if (isset($o['EtaWindow'])) $this->EtaWindow = $o['EtaWindow'];
        if (isset($o['IsCommercial'])) $this->IsCommercial = $o['IsCommercial'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->VisitKey)) $o['VisitKey'] = $this->VisitKey;
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectUID)) $o['ProjectUID'] = $this->ProjectUID;
        if (isset($this->AgreementJobID)) $o['AgreementJobID'] = $this->AgreementJobID;
        if (isset($this->ScheduledDate)) $o['ScheduledDate'] = $this->ScheduledDate;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->JobName)) $o['JobName'] = $this->JobName;
        if (isset($this->LocationName)) $o['LocationName'] = $this->LocationName;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
        if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
        if (isset($this->SortOrder)) $o['SortOrder'] = $this->SortOrder;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->DurationMinutes)) $o['DurationMinutes'] = $this->DurationMinutes;
        if (isset($this->EtaWindow)) $o['EtaWindow'] = $this->EtaWindow;
        if (isset($this->IsCommercial)) $o['IsCommercial'] = $this->IsCommercial;
        return empty($o) ? new class(){} : $o;
    }
}

class CrewColumn implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CrewID=0,
        /** @var string|null */
        public ?string $CrewName=null,
        /** @var string|null */
        public ?string $CrewColor=null,
        /** @var int */
        public int $MemberCount=0,
        /** @var array<VisitCard>|null */
        public ?array $Visits=null,
        /** @var float */
        public float $DriveMiles=0.0,
        /** @var int */
        public int $DriveMinutes=0,
        /** @var int */
        public int $OnSiteMinutes=0,
        /** @var int */
        public int $BillablePct=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
        if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
        if (isset($o['CrewColor'])) $this->CrewColor = $o['CrewColor'];
        if (isset($o['MemberCount'])) $this->MemberCount = $o['MemberCount'];
        if (isset($o['Visits'])) $this->Visits = JsonConverters::fromArray('VisitCard', $o['Visits']);
        if (isset($o['DriveMiles'])) $this->DriveMiles = $o['DriveMiles'];
        if (isset($o['DriveMinutes'])) $this->DriveMinutes = $o['DriveMinutes'];
        if (isset($o['OnSiteMinutes'])) $this->OnSiteMinutes = $o['OnSiteMinutes'];
        if (isset($o['BillablePct'])) $this->BillablePct = $o['BillablePct'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
        if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
        if (isset($this->CrewColor)) $o['CrewColor'] = $this->CrewColor;
        if (isset($this->MemberCount)) $o['MemberCount'] = $this->MemberCount;
        if (isset($this->Visits)) $o['Visits'] = JsonConverters::toArray('VisitCard', $this->Visits);
        if (isset($this->DriveMiles)) $o['DriveMiles'] = $this->DriveMiles;
        if (isset($this->DriveMinutes)) $o['DriveMinutes'] = $this->DriveMinutes;
        if (isset($this->OnSiteMinutes)) $o['OnSiteMinutes'] = $this->OnSiteMinutes;
        if (isset($this->BillablePct)) $o['BillablePct'] = $this->BillablePct;
        return empty($o) ? new class(){} : $o;
    }
}

class BoardReadiness implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $TotalVisits=0,
        /** @var int */
        public int $Assigned=0,
        /** @var int */
        public int $Unassigned=0,
        /** @var int */
        public int $Conflicts=0,
        /** @var int */
        public int $AssignedPct=0
    ) {
    }

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

class VisitBoardResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Date=null,
        /** @var array<CrewColumn>|null */
        public ?array $Crews=null,
        /** @var array<VisitCard>|null */
        public ?array $Unassigned=null,
        /** @var BoardReadiness|null */
        public ?BoardReadiness $Readiness=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Date'])) $this->Date = $o['Date'];
        if (isset($o['Crews'])) $this->Crews = JsonConverters::fromArray('CrewColumn', $o['Crews']);
        if (isset($o['Unassigned'])) $this->Unassigned = JsonConverters::fromArray('VisitCard', $o['Unassigned']);
        if (isset($o['Readiness'])) $this->Readiness = JsonConverters::from('BoardReadiness', $o['Readiness']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Date)) $o['Date'] = $this->Date;
        if (isset($this->Crews)) $o['Crews'] = JsonConverters::toArray('CrewColumn', $this->Crews);
        if (isset($this->Unassigned)) $o['Unassigned'] = JsonConverters::toArray('VisitCard', $this->Unassigned);
        if (isset($this->Readiness)) $o['Readiness'] = JsonConverters::to('BoardReadiness', $this->Readiness);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class VisitBoardRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Date=null
    ) {
    }

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

PHP VisitBoardRequest 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.

GET /v1/visits/board HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Date: String,
	Crews: 
	[
		{
			CrewID: 0,
			CrewName: String,
			CrewColor: String,
			MemberCount: 0,
			Visits: 
			[
				{
					VisitKey: String,
					JobID: 0,
					ProjectID: 0,
					ProjectUID: String,
					AgreementJobID: 0,
					ScheduledDate: String,
					CustomerName: String,
					JobName: String,
					LocationName: String,
					City: String,
					Zip: String,
					Lat: 0,
					Lng: 0,
					CrewID: 0,
					CrewName: String,
					SortOrder: 0,
					Status: String,
					DurationMinutes: 0,
					EtaWindow: String,
					IsCommercial: False
				}
			],
			DriveMiles: 0,
			DriveMinutes: 0,
			OnSiteMinutes: 0,
			BillablePct: 0
		}
	],
	Unassigned: 
	[
		{
			VisitKey: String,
			JobID: 0,
			ProjectID: 0,
			ProjectUID: String,
			AgreementJobID: 0,
			ScheduledDate: String,
			CustomerName: String,
			JobName: String,
			LocationName: String,
			City: String,
			Zip: String,
			Lat: 0,
			Lng: 0,
			CrewID: 0,
			CrewName: String,
			SortOrder: 0,
			Status: String,
			DurationMinutes: 0,
			EtaWindow: String,
			IsCommercial: False
		}
	],
	Readiness: 
	{
		TotalVisits: 0,
		Assigned: 0,
		Unassigned: 0,
		Conflicts: 0,
		AssignedPct: 0
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}