Trendsic Platform Service

<back to all web services

DispatchQuoteRequest

The following routes are available for this service:
GET,OPTIONS/v1/dispatch/quote/{Token}/json
<?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 DispatchQuoteView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var string|null */
        public ?string $Cargo=null,
        /** @var int */
        public int $Units=0,
        /** @var string|null */
        public ?string $FromLoc=null,
        /** @var string|null */
        public ?string $ToLoc=null,
        /** @var int|null */
        public ?int $Miles=null,
        /** @var string|null */
        public ?string $WindowText=null,
        /** @var bool|null */
        public ?bool $IsUrgent=null,
        /** @var int|null */
        public ?int $LoadsNeeded=null,
        /** @var int|null */
        public ?int $UnitsPerTruck=null,
        /** @var float|null */
        public ?float $RatePerLoad=null,
        /** @var float */
        public float $UrgencyPct=0.0,
        /** @var float|null */
        public ?float $QuoteTotal=null,
        /** @var int */
        public int $QuoteVersion=0,
        /** @var string|null */
        public ?string $Status=null,
        /** @var DateTime|null */
        public ?DateTime $QuotedUtc=null,
        /** @var DateTime|null */
        public ?DateTime $ExpiresUtc=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['Cargo'])) $this->Cargo = $o['Cargo'];
        if (isset($o['Units'])) $this->Units = $o['Units'];
        if (isset($o['FromLoc'])) $this->FromLoc = $o['FromLoc'];
        if (isset($o['ToLoc'])) $this->ToLoc = $o['ToLoc'];
        if (isset($o['Miles'])) $this->Miles = $o['Miles'];
        if (isset($o['WindowText'])) $this->WindowText = $o['WindowText'];
        if (isset($o['IsUrgent'])) $this->IsUrgent = $o['IsUrgent'];
        if (isset($o['LoadsNeeded'])) $this->LoadsNeeded = $o['LoadsNeeded'];
        if (isset($o['UnitsPerTruck'])) $this->UnitsPerTruck = $o['UnitsPerTruck'];
        if (isset($o['RatePerLoad'])) $this->RatePerLoad = $o['RatePerLoad'];
        if (isset($o['UrgencyPct'])) $this->UrgencyPct = $o['UrgencyPct'];
        if (isset($o['QuoteTotal'])) $this->QuoteTotal = $o['QuoteTotal'];
        if (isset($o['QuoteVersion'])) $this->QuoteVersion = $o['QuoteVersion'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['QuotedUtc'])) $this->QuotedUtc = JsonConverters::from('DateTime', $o['QuotedUtc']);
        if (isset($o['ExpiresUtc'])) $this->ExpiresUtc = JsonConverters::from('DateTime', $o['ExpiresUtc']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->Cargo)) $o['Cargo'] = $this->Cargo;
        if (isset($this->Units)) $o['Units'] = $this->Units;
        if (isset($this->FromLoc)) $o['FromLoc'] = $this->FromLoc;
        if (isset($this->ToLoc)) $o['ToLoc'] = $this->ToLoc;
        if (isset($this->Miles)) $o['Miles'] = $this->Miles;
        if (isset($this->WindowText)) $o['WindowText'] = $this->WindowText;
        if (isset($this->IsUrgent)) $o['IsUrgent'] = $this->IsUrgent;
        if (isset($this->LoadsNeeded)) $o['LoadsNeeded'] = $this->LoadsNeeded;
        if (isset($this->UnitsPerTruck)) $o['UnitsPerTruck'] = $this->UnitsPerTruck;
        if (isset($this->RatePerLoad)) $o['RatePerLoad'] = $this->RatePerLoad;
        if (isset($this->UrgencyPct)) $o['UrgencyPct'] = $this->UrgencyPct;
        if (isset($this->QuoteTotal)) $o['QuoteTotal'] = $this->QuoteTotal;
        if (isset($this->QuoteVersion)) $o['QuoteVersion'] = $this->QuoteVersion;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->QuotedUtc)) $o['QuotedUtc'] = JsonConverters::to('DateTime', $this->QuotedUtc);
        if (isset($this->ExpiresUtc)) $o['ExpiresUtc'] = JsonConverters::to('DateTime', $this->ExpiresUtc);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchQuoteResponse implements JsonSerializable
{
    public function __construct(
        /** @var DispatchQuoteView|null */
        public ?DispatchQuoteView $Quote=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

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

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

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

GET /v1/dispatch/quote/{Token}/json HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Quote":{"Code":"String","CustomerName":"String","Cargo":"String","Units":0,"FromLoc":"String","ToLoc":"String","Miles":0,"WindowText":"String","IsUrgent":false,"LoadsNeeded":0,"UnitsPerTruck":0,"RatePerLoad":0,"UrgencyPct":0,"QuoteTotal":0,"QuoteVersion":0,"Status":"String","QuotedUtc":"0001-01-01T00:00:00.0000000","ExpiresUtc":"0001-01-01T00:00:00.0000000"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}