Trendsic Platform Service

<back to all web services

DispatchIncidentOpenRequest

Requires Authentication
Requires any of the permissions:DISPATCH:HAUL:MANAGE, DISPATCH:JOB:MANAGE, DISPATCH:ONDEMAND:MANAGE
The following routes are available for this service:
POST,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 DispatchIncidentOpenRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $KindDetail=null,
        /** @var string|null */
        public ?string $TruckCode=null,
        /** @var string|null */
        public ?string $LoadCode=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 $Note=null,
        /** @var string|null */
        public ?string $OpenedBy=null,
        /** @var string|null */
        public ?string $OpenedVia=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['KindDetail'])) $this->KindDetail = $o['KindDetail'];
        if (isset($o['TruckCode'])) $this->TruckCode = $o['TruckCode'];
        if (isset($o['LoadCode'])) $this->LoadCode = $o['LoadCode'];
        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['Note'])) $this->Note = $o['Note'];
        if (isset($o['OpenedBy'])) $this->OpenedBy = $o['OpenedBy'];
        if (isset($o['OpenedVia'])) $this->OpenedVia = $o['OpenedVia'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->KindDetail)) $o['KindDetail'] = $this->KindDetail;
        if (isset($this->TruckCode)) $o['TruckCode'] = $this->TruckCode;
        if (isset($this->LoadCode)) $o['LoadCode'] = $this->LoadCode;
        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->Note)) $o['Note'] = $this->Note;
        if (isset($this->OpenedBy)) $o['OpenedBy'] = $this->OpenedBy;
        if (isset($this->OpenedVia)) $o['OpenedVia'] = $this->OpenedVia;
        return empty($o) ? new class(){} : $o;
    }
}

PHP DispatchIncidentOpenRequest DTOs

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

HTTP + OTHER

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

POST /v1/dispatch/incidents HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Kind":"String","KindDetail":"String","TruckCode":"String","LoadCode":"String","LocationText":"String","Lat":0,"Lng":0,"DriverPref":"String","Note":"String","OpenedBy":"String","OpenedVia":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Incidents":[{"IncidentId":0,"Code":"String","Kind":"String","KindDetail":"String","LoadId":0,"LoadCode":"String","LoadStatus":"String","SourceLabel":"String","DestinationLabel":"String","QtyText":"String","TruckCode":"String","TruckLabel":"String","LocationText":"String","Lat":0,"Lng":0,"DriverPref":"String","OpenedBy":"String","OpenedVia":"String","Resolver":"String","Status":"String","TruckRecovery":"String","TruckRecoveredUtc":"0001-01-01T00:00:00.0000000","LoadRecovery":"String","LoadRecoveredUtc":"0001-01-01T00:00:00.0000000","TransloadTruckCode":"String","HoldId":0,"HoldCode":"String","PhotoCount":0,"OpenedUtc":"0001-01-01T00:00:00.0000000","ResolvedUtc":"0001-01-01T00:00:00.0000000","ResolvedBy":"String","ReopenedUtc":"0001-01-01T00:00:00.0000000","Messages":[{"MessageId":0,"Who":"String","Role":"String","Msg":"String","AtUtc":"0001-01-01T00:00:00.0000000"}]}],"EmptyTrucks":[{"Code":"String","DriverName":"String","Stage":"String","OpenLoadCode":"String"}],"Trucks":[{"Code":"String","DriverName":"String","Stage":"String","OpenLoadCode":"String"}],"TransloadTruckCode":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}