Trendsic Platform Service

<back to all web services

DispatchLoadsRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/dispatch/loads
<?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 DispatchLoadStageView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Stage=null,
        /** @var DateTime */
        public DateTime $AtUtc=new DateTime(),
        /** @var string|null */
        public ?string $Note=null
    ) {
    }

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

class DispatchLoadView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $LoadId=0,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Module=null,
        /** @var string|null */
        public ?string $TruckLabel=null,
        /** @var string|null */
        public ?string $DriverLabel=null,
        /** @var string|null */
        public ?string $CarrierLabel=null,
        /** @var string|null */
        public ?string $SourceLabel=null,
        /** @var string|null */
        public ?string $DestinationLabel=null,
        /** @var float|null */
        public ?float $Qty=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var string|null */
        public ?string $QtyText=null,
        /** @var string|null */
        public ?string $TicketCode=null,
        /** @var float|null */
        public ?float $RateApplied=null,
        /** @var string|null */
        public ?string $RateBasis=null,
        /** @var float|null */
        public ?float $Revenue=null,
        /** @var string|null */
        public ?string $PayPlanLabel=null,
        /** @var float|null */
        public ?float $Pay=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var DateTime */
        public DateTime $OpenedUtc=new DateTime(),
        /** @var DateTime|null */
        public ?DateTime $ClosedUtc=null,
        /** @var int */
        public int $Photos=0,
        /** @var array<DispatchLoadStageView>|null */
        public ?array $Stages=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['LoadId'])) $this->LoadId = $o['LoadId'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['Module'])) $this->Module = $o['Module'];
        if (isset($o['TruckLabel'])) $this->TruckLabel = $o['TruckLabel'];
        if (isset($o['DriverLabel'])) $this->DriverLabel = $o['DriverLabel'];
        if (isset($o['CarrierLabel'])) $this->CarrierLabel = $o['CarrierLabel'];
        if (isset($o['SourceLabel'])) $this->SourceLabel = $o['SourceLabel'];
        if (isset($o['DestinationLabel'])) $this->DestinationLabel = $o['DestinationLabel'];
        if (isset($o['Qty'])) $this->Qty = $o['Qty'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['QtyText'])) $this->QtyText = $o['QtyText'];
        if (isset($o['TicketCode'])) $this->TicketCode = $o['TicketCode'];
        if (isset($o['RateApplied'])) $this->RateApplied = $o['RateApplied'];
        if (isset($o['RateBasis'])) $this->RateBasis = $o['RateBasis'];
        if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
        if (isset($o['PayPlanLabel'])) $this->PayPlanLabel = $o['PayPlanLabel'];
        if (isset($o['Pay'])) $this->Pay = $o['Pay'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['OpenedUtc'])) $this->OpenedUtc = JsonConverters::from('DateTime', $o['OpenedUtc']);
        if (isset($o['ClosedUtc'])) $this->ClosedUtc = JsonConverters::from('DateTime', $o['ClosedUtc']);
        if (isset($o['Photos'])) $this->Photos = $o['Photos'];
        if (isset($o['Stages'])) $this->Stages = JsonConverters::fromArray('DispatchLoadStageView', $o['Stages']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->LoadId)) $o['LoadId'] = $this->LoadId;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->Module)) $o['Module'] = $this->Module;
        if (isset($this->TruckLabel)) $o['TruckLabel'] = $this->TruckLabel;
        if (isset($this->DriverLabel)) $o['DriverLabel'] = $this->DriverLabel;
        if (isset($this->CarrierLabel)) $o['CarrierLabel'] = $this->CarrierLabel;
        if (isset($this->SourceLabel)) $o['SourceLabel'] = $this->SourceLabel;
        if (isset($this->DestinationLabel)) $o['DestinationLabel'] = $this->DestinationLabel;
        if (isset($this->Qty)) $o['Qty'] = $this->Qty;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->QtyText)) $o['QtyText'] = $this->QtyText;
        if (isset($this->TicketCode)) $o['TicketCode'] = $this->TicketCode;
        if (isset($this->RateApplied)) $o['RateApplied'] = $this->RateApplied;
        if (isset($this->RateBasis)) $o['RateBasis'] = $this->RateBasis;
        if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
        if (isset($this->PayPlanLabel)) $o['PayPlanLabel'] = $this->PayPlanLabel;
        if (isset($this->Pay)) $o['Pay'] = $this->Pay;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->OpenedUtc)) $o['OpenedUtc'] = JsonConverters::to('DateTime', $this->OpenedUtc);
        if (isset($this->ClosedUtc)) $o['ClosedUtc'] = JsonConverters::to('DateTime', $this->ClosedUtc);
        if (isset($this->Photos)) $o['Photos'] = $this->Photos;
        if (isset($this->Stages)) $o['Stages'] = JsonConverters::toArray('DispatchLoadStageView', $this->Stages);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchLoadsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<DispatchLoadView>|null */
        public ?array $Loads=null,
        /** @var int */
        public int $Hours=0,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class DispatchLoadsRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Hours=0,
        /** @var string|null */
        public ?string $Module=null
    ) {
    }

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

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

{"Loads":[{"LoadId":0,"Code":"String","Module":"String","TruckLabel":"String","DriverLabel":"String","CarrierLabel":"String","SourceLabel":"String","DestinationLabel":"String","Qty":0,"Unit":"String","QtyText":"String","TicketCode":"String","RateApplied":0,"RateBasis":"String","Revenue":0,"PayPlanLabel":"String","Pay":0,"Status":"String","OpenedUtc":"0001-01-01T00:00:00.0000000","ClosedUtc":"0001-01-01T00:00:00.0000000","Photos":0,"Stages":[{"Stage":"String","AtUtc":"0001-01-01T00:00:00.0000000","Note":"String"}]}],"Hours":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}