Trendsic Platform Service

<back to all web services

RoutePlanWeekRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/routeplan/week
<?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 RoutePlanCrew 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 string|null */
        public ?string $HomeZip=null,
        /** @var float|null */
        public ?float $YardLat=null,
        /** @var float|null */
        public ?float $YardLng=null,
        /** @var int */
        public int $DailyCapacityMin=0,
        /** @var int */
        public int $WeeklyCapacityMin=0,
        /** @var bool|null */
        public ?bool $Specialist=null
    ) {
    }

    /** @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['HomeZip'])) $this->HomeZip = $o['HomeZip'];
        if (isset($o['YardLat'])) $this->YardLat = $o['YardLat'];
        if (isset($o['YardLng'])) $this->YardLng = $o['YardLng'];
        if (isset($o['DailyCapacityMin'])) $this->DailyCapacityMin = $o['DailyCapacityMin'];
        if (isset($o['WeeklyCapacityMin'])) $this->WeeklyCapacityMin = $o['WeeklyCapacityMin'];
        if (isset($o['Specialist'])) $this->Specialist = $o['Specialist'];
    }
    
    /** @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->HomeZip)) $o['HomeZip'] = $this->HomeZip;
        if (isset($this->YardLat)) $o['YardLat'] = $this->YardLat;
        if (isset($this->YardLng)) $o['YardLng'] = $this->YardLng;
        if (isset($this->DailyCapacityMin)) $o['DailyCapacityMin'] = $this->DailyCapacityMin;
        if (isset($this->WeeklyCapacityMin)) $o['WeeklyCapacityMin'] = $this->WeeklyCapacityMin;
        if (isset($this->Specialist)) $o['Specialist'] = $this->Specialist;
        return empty($o) ? new class(){} : $o;
    }
}

class RoutePlanVisit implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgreementID=0,
        /** @var int|null */
        public ?int $AgreementJobID=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Sub=null,
        /** @var string|null */
        public ?string $ServiceType=null,
        /** @var string|null */
        public ?string $Zip=null,
        /** @var string|null */
        public ?string $Area=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null,
        /** @var int */
        public int $DurationMin=0,
        /** @var string|null */
        public ?string $DueIso=null,
        /** @var string|null */
        public ?string $DueLabel=null,
        /** @var bool|null */
        public ?bool $Overdue=null,
        /** @var int|null */
        public ?int $DefaultCrewID=null,
        /** @var int|null */
        public ?int $RouteCrewID=null,
        /** @var int|null */
        public ?int $RouteSeq=null,
        /** @var string|null */
        public ?string $RouteDateIso=null,
        /** @var int */
        public int $LateDays=0,
        /** @var bool|null */
        public ?bool $AutoPay=null,
        /** @var string|null */
        public ?string $SkipPolicy=null,
        /** @var float */
        public float $SkipCreditAmount=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AgreementID'])) $this->AgreementID = $o['AgreementID'];
        if (isset($o['AgreementJobID'])) $this->AgreementJobID = $o['AgreementJobID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Sub'])) $this->Sub = $o['Sub'];
        if (isset($o['ServiceType'])) $this->ServiceType = $o['ServiceType'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['Area'])) $this->Area = $o['Area'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['DurationMin'])) $this->DurationMin = $o['DurationMin'];
        if (isset($o['DueIso'])) $this->DueIso = $o['DueIso'];
        if (isset($o['DueLabel'])) $this->DueLabel = $o['DueLabel'];
        if (isset($o['Overdue'])) $this->Overdue = $o['Overdue'];
        if (isset($o['DefaultCrewID'])) $this->DefaultCrewID = $o['DefaultCrewID'];
        if (isset($o['RouteCrewID'])) $this->RouteCrewID = $o['RouteCrewID'];
        if (isset($o['RouteSeq'])) $this->RouteSeq = $o['RouteSeq'];
        if (isset($o['RouteDateIso'])) $this->RouteDateIso = $o['RouteDateIso'];
        if (isset($o['LateDays'])) $this->LateDays = $o['LateDays'];
        if (isset($o['AutoPay'])) $this->AutoPay = $o['AutoPay'];
        if (isset($o['SkipPolicy'])) $this->SkipPolicy = $o['SkipPolicy'];
        if (isset($o['SkipCreditAmount'])) $this->SkipCreditAmount = $o['SkipCreditAmount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AgreementID)) $o['AgreementID'] = $this->AgreementID;
        if (isset($this->AgreementJobID)) $o['AgreementJobID'] = $this->AgreementJobID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Sub)) $o['Sub'] = $this->Sub;
        if (isset($this->ServiceType)) $o['ServiceType'] = $this->ServiceType;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->Area)) $o['Area'] = $this->Area;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->DurationMin)) $o['DurationMin'] = $this->DurationMin;
        if (isset($this->DueIso)) $o['DueIso'] = $this->DueIso;
        if (isset($this->DueLabel)) $o['DueLabel'] = $this->DueLabel;
        if (isset($this->Overdue)) $o['Overdue'] = $this->Overdue;
        if (isset($this->DefaultCrewID)) $o['DefaultCrewID'] = $this->DefaultCrewID;
        if (isset($this->RouteCrewID)) $o['RouteCrewID'] = $this->RouteCrewID;
        if (isset($this->RouteSeq)) $o['RouteSeq'] = $this->RouteSeq;
        if (isset($this->RouteDateIso)) $o['RouteDateIso'] = $this->RouteDateIso;
        if (isset($this->LateDays)) $o['LateDays'] = $this->LateDays;
        if (isset($this->AutoPay)) $o['AutoPay'] = $this->AutoPay;
        if (isset($this->SkipPolicy)) $o['SkipPolicy'] = $this->SkipPolicy;
        if (isset($this->SkipCreditAmount)) $o['SkipCreditAmount'] = $this->SkipCreditAmount;
        return empty($o) ? new class(){} : $o;
    }
}

class RoutePlanSkippedVisit implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgreementJobID=0,
        /** @var int */
        public int $AgreementID=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $DateIso=null,
        /** @var string|null */
        public ?string $Reason=null,
        /** @var float */
        public float $CreditAmount=0.0
    ) {
    }

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

class RoutePlanWeekResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $FromIso=null,
        /** @var string|null */
        public ?string $ToIso=null,
        /** @var array<RoutePlanCrew>|null */
        public ?array $Crews=null,
        /** @var array<RoutePlanVisit>|null */
        public ?array $Visits=null,
        /** @var array<RoutePlanSkippedVisit>|null */
        public ?array $Skipped=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['FromIso'])) $this->FromIso = $o['FromIso'];
        if (isset($o['ToIso'])) $this->ToIso = $o['ToIso'];
        if (isset($o['Crews'])) $this->Crews = JsonConverters::fromArray('RoutePlanCrew', $o['Crews']);
        if (isset($o['Visits'])) $this->Visits = JsonConverters::fromArray('RoutePlanVisit', $o['Visits']);
        if (isset($o['Skipped'])) $this->Skipped = JsonConverters::fromArray('RoutePlanSkippedVisit', $o['Skipped']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->FromIso)) $o['FromIso'] = $this->FromIso;
        if (isset($this->ToIso)) $o['ToIso'] = $this->ToIso;
        if (isset($this->Crews)) $o['Crews'] = JsonConverters::toArray('RoutePlanCrew', $this->Crews);
        if (isset($this->Visits)) $o['Visits'] = JsonConverters::toArray('RoutePlanVisit', $this->Visits);
        if (isset($this->Skipped)) $o['Skipped'] = JsonConverters::toArray('RoutePlanSkippedVisit', $this->Skipped);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

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

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

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

GET /v1/routeplan/week HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<RoutePlanWeekResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Crews>
    <RoutePlanCrew>
      <CrewColor>String</CrewColor>
      <CrewID>0</CrewID>
      <CrewName>String</CrewName>
      <DailyCapacityMin>0</DailyCapacityMin>
      <HomeZip>String</HomeZip>
      <Specialist>false</Specialist>
      <WeeklyCapacityMin>0</WeeklyCapacityMin>
      <YardLat>0</YardLat>
      <YardLng>0</YardLng>
    </RoutePlanCrew>
  </Crews>
  <FromIso>String</FromIso>
  <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>
  <Skipped>
    <RoutePlanSkippedVisit>
      <AgreementID>0</AgreementID>
      <AgreementJobID>0</AgreementJobID>
      <CreditAmount>0</CreditAmount>
      <DateIso>String</DateIso>
      <Name>String</Name>
      <Reason>String</Reason>
    </RoutePlanSkippedVisit>
  </Skipped>
  <ToIso>String</ToIso>
  <Visits>
    <RoutePlanVisit>
      <AgreementID>0</AgreementID>
      <AgreementJobID>0</AgreementJobID>
      <Area>String</Area>
      <AutoPay>false</AutoPay>
      <DefaultCrewID>0</DefaultCrewID>
      <DueIso>String</DueIso>
      <DueLabel>String</DueLabel>
      <DurationMin>0</DurationMin>
      <Lat>0</Lat>
      <LateDays>0</LateDays>
      <Lng>0</Lng>
      <Name>String</Name>
      <Overdue>false</Overdue>
      <RouteCrewID>0</RouteCrewID>
      <RouteDateIso>String</RouteDateIso>
      <RouteSeq>0</RouteSeq>
      <ServiceType>String</ServiceType>
      <SkipCreditAmount>0</SkipCreditAmount>
      <SkipPolicy>String</SkipPolicy>
      <Sub>String</Sub>
      <Zip>String</Zip>
    </RoutePlanVisit>
  </Visits>
</RoutePlanWeekResponse>