Trendsic Platform Service

<back to all web services

DispatchIncidentsRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/dispatch/incidents
<?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 DispatchIncidentMessageView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $MessageId=0,
        /** @var string|null */
        public ?string $Who=null,
        /** @var string|null */
        public ?string $Role=null,
        /** @var string|null */
        public ?string $Msg=null,
        /** @var DateTime */
        public DateTime $AtUtc=new DateTime()
    ) {
    }

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

class DispatchIncidentView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $IncidentId=0,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $KindDetail=null,
        /** @var int|null */
        public ?int $LoadId=null,
        /** @var string|null */
        public ?string $LoadCode=null,
        /** @var string|null */
        public ?string $LoadStatus=null,
        /** @var string|null */
        public ?string $SourceLabel=null,
        /** @var string|null */
        public ?string $DestinationLabel=null,
        /** @var string|null */
        public ?string $QtyText=null,
        /** @var string|null */
        public ?string $TruckCode=null,
        /** @var string|null */
        public ?string $TruckLabel=null,
        /** @var string|null */
        public ?string $LocationText=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null,
        /** @var string|null */
        public ?string $DriverPref=null,
        /** @var string|null */
        public ?string $OpenedBy=null,
        /** @var string|null */
        public ?string $OpenedVia=null,
        /** @var string|null */
        public ?string $Resolver=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $TruckRecovery=null,
        /** @var DateTime|null */
        public ?DateTime $TruckRecoveredUtc=null,
        /** @var string|null */
        public ?string $LoadRecovery=null,
        /** @var DateTime|null */
        public ?DateTime $LoadRecoveredUtc=null,
        /** @var string|null */
        public ?string $TransloadTruckCode=null,
        /** @var int|null */
        public ?int $HoldId=null,
        /** @var string|null */
        public ?string $HoldCode=null,
        /** @var int */
        public int $PhotoCount=0,
        /** @var DateTime */
        public DateTime $OpenedUtc=new DateTime(),
        /** @var DateTime|null */
        public ?DateTime $ResolvedUtc=null,
        /** @var string|null */
        public ?string $ResolvedBy=null,
        /** @var DateTime|null */
        public ?DateTime $ReopenedUtc=null,
        /** @var array<DispatchIncidentMessageView>|null */
        public ?array $Messages=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['IncidentId'])) $this->IncidentId = $o['IncidentId'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['KindDetail'])) $this->KindDetail = $o['KindDetail'];
        if (isset($o['LoadId'])) $this->LoadId = $o['LoadId'];
        if (isset($o['LoadCode'])) $this->LoadCode = $o['LoadCode'];
        if (isset($o['LoadStatus'])) $this->LoadStatus = $o['LoadStatus'];
        if (isset($o['SourceLabel'])) $this->SourceLabel = $o['SourceLabel'];
        if (isset($o['DestinationLabel'])) $this->DestinationLabel = $o['DestinationLabel'];
        if (isset($o['QtyText'])) $this->QtyText = $o['QtyText'];
        if (isset($o['TruckCode'])) $this->TruckCode = $o['TruckCode'];
        if (isset($o['TruckLabel'])) $this->TruckLabel = $o['TruckLabel'];
        if (isset($o['LocationText'])) $this->LocationText = $o['LocationText'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['DriverPref'])) $this->DriverPref = $o['DriverPref'];
        if (isset($o['OpenedBy'])) $this->OpenedBy = $o['OpenedBy'];
        if (isset($o['OpenedVia'])) $this->OpenedVia = $o['OpenedVia'];
        if (isset($o['Resolver'])) $this->Resolver = $o['Resolver'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['TruckRecovery'])) $this->TruckRecovery = $o['TruckRecovery'];
        if (isset($o['TruckRecoveredUtc'])) $this->TruckRecoveredUtc = JsonConverters::from('DateTime', $o['TruckRecoveredUtc']);
        if (isset($o['LoadRecovery'])) $this->LoadRecovery = $o['LoadRecovery'];
        if (isset($o['LoadRecoveredUtc'])) $this->LoadRecoveredUtc = JsonConverters::from('DateTime', $o['LoadRecoveredUtc']);
        if (isset($o['TransloadTruckCode'])) $this->TransloadTruckCode = $o['TransloadTruckCode'];
        if (isset($o['HoldId'])) $this->HoldId = $o['HoldId'];
        if (isset($o['HoldCode'])) $this->HoldCode = $o['HoldCode'];
        if (isset($o['PhotoCount'])) $this->PhotoCount = $o['PhotoCount'];
        if (isset($o['OpenedUtc'])) $this->OpenedUtc = JsonConverters::from('DateTime', $o['OpenedUtc']);
        if (isset($o['ResolvedUtc'])) $this->ResolvedUtc = JsonConverters::from('DateTime', $o['ResolvedUtc']);
        if (isset($o['ResolvedBy'])) $this->ResolvedBy = $o['ResolvedBy'];
        if (isset($o['ReopenedUtc'])) $this->ReopenedUtc = JsonConverters::from('DateTime', $o['ReopenedUtc']);
        if (isset($o['Messages'])) $this->Messages = JsonConverters::fromArray('DispatchIncidentMessageView', $o['Messages']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->IncidentId)) $o['IncidentId'] = $this->IncidentId;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->KindDetail)) $o['KindDetail'] = $this->KindDetail;
        if (isset($this->LoadId)) $o['LoadId'] = $this->LoadId;
        if (isset($this->LoadCode)) $o['LoadCode'] = $this->LoadCode;
        if (isset($this->LoadStatus)) $o['LoadStatus'] = $this->LoadStatus;
        if (isset($this->SourceLabel)) $o['SourceLabel'] = $this->SourceLabel;
        if (isset($this->DestinationLabel)) $o['DestinationLabel'] = $this->DestinationLabel;
        if (isset($this->QtyText)) $o['QtyText'] = $this->QtyText;
        if (isset($this->TruckCode)) $o['TruckCode'] = $this->TruckCode;
        if (isset($this->TruckLabel)) $o['TruckLabel'] = $this->TruckLabel;
        if (isset($this->LocationText)) $o['LocationText'] = $this->LocationText;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->DriverPref)) $o['DriverPref'] = $this->DriverPref;
        if (isset($this->OpenedBy)) $o['OpenedBy'] = $this->OpenedBy;
        if (isset($this->OpenedVia)) $o['OpenedVia'] = $this->OpenedVia;
        if (isset($this->Resolver)) $o['Resolver'] = $this->Resolver;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->TruckRecovery)) $o['TruckRecovery'] = $this->TruckRecovery;
        if (isset($this->TruckRecoveredUtc)) $o['TruckRecoveredUtc'] = JsonConverters::to('DateTime', $this->TruckRecoveredUtc);
        if (isset($this->LoadRecovery)) $o['LoadRecovery'] = $this->LoadRecovery;
        if (isset($this->LoadRecoveredUtc)) $o['LoadRecoveredUtc'] = JsonConverters::to('DateTime', $this->LoadRecoveredUtc);
        if (isset($this->TransloadTruckCode)) $o['TransloadTruckCode'] = $this->TransloadTruckCode;
        if (isset($this->HoldId)) $o['HoldId'] = $this->HoldId;
        if (isset($this->HoldCode)) $o['HoldCode'] = $this->HoldCode;
        if (isset($this->PhotoCount)) $o['PhotoCount'] = $this->PhotoCount;
        if (isset($this->OpenedUtc)) $o['OpenedUtc'] = JsonConverters::to('DateTime', $this->OpenedUtc);
        if (isset($this->ResolvedUtc)) $o['ResolvedUtc'] = JsonConverters::to('DateTime', $this->ResolvedUtc);
        if (isset($this->ResolvedBy)) $o['ResolvedBy'] = $this->ResolvedBy;
        if (isset($this->ReopenedUtc)) $o['ReopenedUtc'] = JsonConverters::to('DateTime', $this->ReopenedUtc);
        if (isset($this->Messages)) $o['Messages'] = JsonConverters::toArray('DispatchIncidentMessageView', $this->Messages);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchIncidentTruckView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $DriverName=null,
        /** @var string|null */
        public ?string $Stage=null,
        /** @var string|null */
        public ?string $OpenLoadCode=null
    ) {
    }

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

class DispatchIncidentsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<DispatchIncidentView>|null */
        public ?array $Incidents=null,
        /** @var array<DispatchIncidentTruckView>|null */
        public ?array $EmptyTrucks=null,
        /** @var array<DispatchIncidentTruckView>|null */
        public ?array $Trucks=null,
        /** @var string|null */
        public ?string $TransloadTruckCode=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Incidents'])) $this->Incidents = JsonConverters::fromArray('DispatchIncidentView', $o['Incidents']);
        if (isset($o['EmptyTrucks'])) $this->EmptyTrucks = JsonConverters::fromArray('DispatchIncidentTruckView', $o['EmptyTrucks']);
        if (isset($o['Trucks'])) $this->Trucks = JsonConverters::fromArray('DispatchIncidentTruckView', $o['Trucks']);
        if (isset($o['TransloadTruckCode'])) $this->TransloadTruckCode = $o['TransloadTruckCode'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Incidents)) $o['Incidents'] = JsonConverters::toArray('DispatchIncidentView', $this->Incidents);
        if (isset($this->EmptyTrucks)) $o['EmptyTrucks'] = JsonConverters::toArray('DispatchIncidentTruckView', $this->EmptyTrucks);
        if (isset($this->Trucks)) $o['Trucks'] = JsonConverters::toArray('DispatchIncidentTruckView', $this->Trucks);
        if (isset($this->TransloadTruckCode)) $o['TransloadTruckCode'] = $this->TransloadTruckCode;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchIncidentsRequest implements JsonSerializable
{
    public function __construct(
        /** @var int|null */
        public ?int $Days=null
    ) {
    }

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

PHP DispatchIncidentsRequest 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/dispatch/incidents HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DispatchIncidentsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <EmptyTrucks>
    <DispatchIncidentTruckView>
      <Code>String</Code>
      <DriverName>String</DriverName>
      <OpenLoadCode>String</OpenLoadCode>
      <Stage>String</Stage>
    </DispatchIncidentTruckView>
  </EmptyTrucks>
  <Incidents>
    <DispatchIncidentView>
      <Code>String</Code>
      <DestinationLabel>String</DestinationLabel>
      <DriverPref>String</DriverPref>
      <HoldCode>String</HoldCode>
      <HoldId>0</HoldId>
      <IncidentId>0</IncidentId>
      <Kind>String</Kind>
      <KindDetail>String</KindDetail>
      <Lat>0</Lat>
      <Lng>0</Lng>
      <LoadCode>String</LoadCode>
      <LoadId>0</LoadId>
      <LoadRecoveredUtc>0001-01-01T00:00:00</LoadRecoveredUtc>
      <LoadRecovery>String</LoadRecovery>
      <LoadStatus>String</LoadStatus>
      <LocationText>String</LocationText>
      <Messages>
        <DispatchIncidentMessageView>
          <AtUtc>0001-01-01T00:00:00</AtUtc>
          <MessageId>0</MessageId>
          <Msg>String</Msg>
          <Role>String</Role>
          <Who>String</Who>
        </DispatchIncidentMessageView>
      </Messages>
      <OpenedBy>String</OpenedBy>
      <OpenedUtc>0001-01-01T00:00:00</OpenedUtc>
      <OpenedVia>String</OpenedVia>
      <PhotoCount>0</PhotoCount>
      <QtyText>String</QtyText>
      <ReopenedUtc>0001-01-01T00:00:00</ReopenedUtc>
      <ResolvedBy>String</ResolvedBy>
      <ResolvedUtc>0001-01-01T00:00:00</ResolvedUtc>
      <Resolver>String</Resolver>
      <SourceLabel>String</SourceLabel>
      <Status>String</Status>
      <TransloadTruckCode>String</TransloadTruckCode>
      <TruckCode>String</TruckCode>
      <TruckLabel>String</TruckLabel>
      <TruckRecoveredUtc>0001-01-01T00:00:00</TruckRecoveredUtc>
      <TruckRecovery>String</TruckRecovery>
    </DispatchIncidentView>
  </Incidents>
  <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>
  <TransloadTruckCode>String</TransloadTruckCode>
  <Trucks>
    <DispatchIncidentTruckView>
      <Code>String</Code>
      <DriverName>String</DriverName>
      <OpenLoadCode>String</OpenLoadCode>
      <Stage>String</Stage>
    </DispatchIncidentTruckView>
  </Trucks>
</DispatchIncidentsResponse>