| POST,OPTIONS | /v1/dispatch/requests |
|---|
<?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 DispatchRequestEventView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $EventId=0,
/** @var string|null */
public ?string $Kind=null,
/** @var string|null */
public ?string $Detail=null,
/** @var DateTime */
public DateTime $AtUtc=new DateTime(),
/** @var string|null */
public ?string $ByWho=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['EventId'])) $this->EventId = $o['EventId'];
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['Detail'])) $this->Detail = $o['Detail'];
if (isset($o['AtUtc'])) $this->AtUtc = JsonConverters::from('DateTime', $o['AtUtc']);
if (isset($o['ByWho'])) $this->ByWho = $o['ByWho'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->EventId)) $o['EventId'] = $this->EventId;
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->Detail)) $o['Detail'] = $this->Detail;
if (isset($this->AtUtc)) $o['AtUtc'] = JsonConverters::to('DateTime', $this->AtUtc);
if (isset($this->ByWho)) $o['ByWho'] = $this->ByWho;
return empty($o) ? new class(){} : $o;
}
}
class DispatchRequestView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $RequestId=0,
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $CustomerName=null,
/** @var string|null */
public ?string $CustomerPhone=null,
/** @var string|null */
public ?string $CustomerEmail=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 string|null */
public ?string $Notes=null,
/** @var string|null */
public ?string $Source=null,
/** @var string|null */
public ?string $Status=null,
/** @var string|null */
public ?string $RequiredRig=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 $CostPerLoad=null,
/** @var int|null */
public ?int $LoadsNeeded=null,
/** @var float|null */
public ?float $QuoteTotal=null,
/** @var int */
public int $QuoteVersion=0,
/** @var DateTime|null */
public ?DateTime $QuotedUtc=null,
/** @var string|null */
public ?string $QuotedBy=null,
/** @var DateTime|null */
public ?DateTime $AcceptTokenExpiresUtc=null,
/** @var DateTime|null */
public ?DateTime $AcceptedUtc=null,
/** @var string|null */
public ?string $AcceptedVia=null,
/** @var DateTime|null */
public ?DateTime $DeclinedUtc=null,
/** @var string|null */
public ?string $DeclinedBy=null,
/** @var string|null */
public ?string $DeclineReason=null,
/** @var int */
public int $JobsCreated=0,
/** @var int */
public int $JobsDone=0,
/** @var int */
public int $JobsNeedDriver=0,
/** @var DateTime */
public DateTime $CreatedUtc=new DateTime(),
/** @var string|null */
public ?string $CreatedBy=null,
/** @var array<DispatchRequestEventView>|null */
public ?array $Events=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['RequestId'])) $this->RequestId = $o['RequestId'];
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['CustomerPhone'])) $this->CustomerPhone = $o['CustomerPhone'];
if (isset($o['CustomerEmail'])) $this->CustomerEmail = $o['CustomerEmail'];
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['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['Source'])) $this->Source = $o['Source'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['RequiredRig'])) $this->RequiredRig = $o['RequiredRig'];
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['CostPerLoad'])) $this->CostPerLoad = $o['CostPerLoad'];
if (isset($o['LoadsNeeded'])) $this->LoadsNeeded = $o['LoadsNeeded'];
if (isset($o['QuoteTotal'])) $this->QuoteTotal = $o['QuoteTotal'];
if (isset($o['QuoteVersion'])) $this->QuoteVersion = $o['QuoteVersion'];
if (isset($o['QuotedUtc'])) $this->QuotedUtc = JsonConverters::from('DateTime', $o['QuotedUtc']);
if (isset($o['QuotedBy'])) $this->QuotedBy = $o['QuotedBy'];
if (isset($o['AcceptTokenExpiresUtc'])) $this->AcceptTokenExpiresUtc = JsonConverters::from('DateTime', $o['AcceptTokenExpiresUtc']);
if (isset($o['AcceptedUtc'])) $this->AcceptedUtc = JsonConverters::from('DateTime', $o['AcceptedUtc']);
if (isset($o['AcceptedVia'])) $this->AcceptedVia = $o['AcceptedVia'];
if (isset($o['DeclinedUtc'])) $this->DeclinedUtc = JsonConverters::from('DateTime', $o['DeclinedUtc']);
if (isset($o['DeclinedBy'])) $this->DeclinedBy = $o['DeclinedBy'];
if (isset($o['DeclineReason'])) $this->DeclineReason = $o['DeclineReason'];
if (isset($o['JobsCreated'])) $this->JobsCreated = $o['JobsCreated'];
if (isset($o['JobsDone'])) $this->JobsDone = $o['JobsDone'];
if (isset($o['JobsNeedDriver'])) $this->JobsNeedDriver = $o['JobsNeedDriver'];
if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['Events'])) $this->Events = JsonConverters::fromArray('DispatchRequestEventView', $o['Events']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->RequestId)) $o['RequestId'] = $this->RequestId;
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->CustomerPhone)) $o['CustomerPhone'] = $this->CustomerPhone;
if (isset($this->CustomerEmail)) $o['CustomerEmail'] = $this->CustomerEmail;
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->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->Source)) $o['Source'] = $this->Source;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->RequiredRig)) $o['RequiredRig'] = $this->RequiredRig;
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->CostPerLoad)) $o['CostPerLoad'] = $this->CostPerLoad;
if (isset($this->LoadsNeeded)) $o['LoadsNeeded'] = $this->LoadsNeeded;
if (isset($this->QuoteTotal)) $o['QuoteTotal'] = $this->QuoteTotal;
if (isset($this->QuoteVersion)) $o['QuoteVersion'] = $this->QuoteVersion;
if (isset($this->QuotedUtc)) $o['QuotedUtc'] = JsonConverters::to('DateTime', $this->QuotedUtc);
if (isset($this->QuotedBy)) $o['QuotedBy'] = $this->QuotedBy;
if (isset($this->AcceptTokenExpiresUtc)) $o['AcceptTokenExpiresUtc'] = JsonConverters::to('DateTime', $this->AcceptTokenExpiresUtc);
if (isset($this->AcceptedUtc)) $o['AcceptedUtc'] = JsonConverters::to('DateTime', $this->AcceptedUtc);
if (isset($this->AcceptedVia)) $o['AcceptedVia'] = $this->AcceptedVia;
if (isset($this->DeclinedUtc)) $o['DeclinedUtc'] = JsonConverters::to('DateTime', $this->DeclinedUtc);
if (isset($this->DeclinedBy)) $o['DeclinedBy'] = $this->DeclinedBy;
if (isset($this->DeclineReason)) $o['DeclineReason'] = $this->DeclineReason;
if (isset($this->JobsCreated)) $o['JobsCreated'] = $this->JobsCreated;
if (isset($this->JobsDone)) $o['JobsDone'] = $this->JobsDone;
if (isset($this->JobsNeedDriver)) $o['JobsNeedDriver'] = $this->JobsNeedDriver;
if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->Events)) $o['Events'] = JsonConverters::toArray('DispatchRequestEventView', $this->Events);
return empty($o) ? new class(){} : $o;
}
}
class DispatchRigCountView implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $RigType=null,
/** @var int */
public int $Rigs=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['RigType'])) $this->RigType = $o['RigType'];
if (isset($o['Rigs'])) $this->Rigs = $o['Rigs'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->RigType)) $o['RigType'] = $this->RigType;
if (isset($this->Rigs)) $o['Rigs'] = $this->Rigs;
return empty($o) ? new class(){} : $o;
}
}
class DispatchCarrierPickView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $VendorID=0,
/** @var string|null */
public ?string $VendorName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['VendorID'])) $this->VendorID = $o['VendorID'];
if (isset($o['VendorName'])) $this->VendorName = $o['VendorName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->VendorID)) $o['VendorID'] = $this->VendorID;
if (isset($this->VendorName)) $o['VendorName'] = $this->VendorName;
return empty($o) ? new class(){} : $o;
}
}
class DispatchRequestsResponse implements JsonSerializable
{
public function __construct(
/** @var array<DispatchRequestView>|null */
public ?array $Requests=null,
/** @var DispatchRequestView|null */
public ?DispatchRequestView $Request=null,
/** @var array<DispatchRigCountView>|null */
public ?array $RigCounts=null,
/** @var array<DispatchCarrierPickView>|null */
public ?array $Carriers=null,
/** @var string|null */
public ?string $QuoteLink=null,
/** @var string|null */
public ?string $Delivery=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Requests'])) $this->Requests = JsonConverters::fromArray('DispatchRequestView', $o['Requests']);
if (isset($o['Request'])) $this->Request = JsonConverters::from('DispatchRequestView', $o['Request']);
if (isset($o['RigCounts'])) $this->RigCounts = JsonConverters::fromArray('DispatchRigCountView', $o['RigCounts']);
if (isset($o['Carriers'])) $this->Carriers = JsonConverters::fromArray('DispatchCarrierPickView', $o['Carriers']);
if (isset($o['QuoteLink'])) $this->QuoteLink = $o['QuoteLink'];
if (isset($o['Delivery'])) $this->Delivery = $o['Delivery'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Requests)) $o['Requests'] = JsonConverters::toArray('DispatchRequestView', $this->Requests);
if (isset($this->Request)) $o['Request'] = JsonConverters::to('DispatchRequestView', $this->Request);
if (isset($this->RigCounts)) $o['RigCounts'] = JsonConverters::toArray('DispatchRigCountView', $this->RigCounts);
if (isset($this->Carriers)) $o['Carriers'] = JsonConverters::toArray('DispatchCarrierPickView', $this->Carriers);
if (isset($this->QuoteLink)) $o['QuoteLink'] = $this->QuoteLink;
if (isset($this->Delivery)) $o['Delivery'] = $this->Delivery;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class DispatchRequestCreateRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $CustomerName=null,
/** @var string|null */
public ?string $CustomerPhone=null,
/** @var string|null */
public ?string $CustomerEmail=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 string|null */
public ?string $Notes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['CustomerPhone'])) $this->CustomerPhone = $o['CustomerPhone'];
if (isset($o['CustomerEmail'])) $this->CustomerEmail = $o['CustomerEmail'];
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['Notes'])) $this->Notes = $o['Notes'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->CustomerPhone)) $o['CustomerPhone'] = $this->CustomerPhone;
if (isset($this->CustomerEmail)) $o['CustomerEmail'] = $this->CustomerEmail;
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->Notes)) $o['Notes'] = $this->Notes;
return empty($o) ? new class(){} : $o;
}
}
PHP DispatchRequestCreateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/dispatch/requests HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CustomerName":"String","CustomerPhone":"String","CustomerEmail":"String","Cargo":"String","Units":0,"FromLoc":"String","ToLoc":"String","Miles":0,"WindowText":"String","IsUrgent":false,"Notes":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"Requests":[{"RequestId":0,"Code":"String","CustomerName":"String","CustomerPhone":"String","CustomerEmail":"String","Cargo":"String","Units":0,"FromLoc":"String","ToLoc":"String","Miles":0,"WindowText":"String","IsUrgent":false,"Notes":"String","Source":"String","Status":"String","RequiredRig":"String","UnitsPerTruck":0,"RatePerLoad":0,"UrgencyPct":0,"CostPerLoad":0,"LoadsNeeded":0,"QuoteTotal":0,"QuoteVersion":0,"QuotedUtc":"0001-01-01T00:00:00.0000000","QuotedBy":"String","AcceptTokenExpiresUtc":"0001-01-01T00:00:00.0000000","AcceptedUtc":"0001-01-01T00:00:00.0000000","AcceptedVia":"String","DeclinedUtc":"0001-01-01T00:00:00.0000000","DeclinedBy":"String","DeclineReason":"String","JobsCreated":0,"JobsDone":0,"JobsNeedDriver":0,"CreatedUtc":"0001-01-01T00:00:00.0000000","CreatedBy":"String","Events":[{"EventId":0,"Kind":"String","Detail":"String","AtUtc":"0001-01-01T00:00:00.0000000","ByWho":"String"}]}],"Request":{"RequestId":0,"Code":"String","CustomerName":"String","CustomerPhone":"String","CustomerEmail":"String","Cargo":"String","Units":0,"FromLoc":"String","ToLoc":"String","Miles":0,"WindowText":"String","IsUrgent":false,"Notes":"String","Source":"String","Status":"String","RequiredRig":"String","UnitsPerTruck":0,"RatePerLoad":0,"UrgencyPct":0,"CostPerLoad":0,"LoadsNeeded":0,"QuoteTotal":0,"QuoteVersion":0,"QuotedUtc":"0001-01-01T00:00:00.0000000","QuotedBy":"String","AcceptTokenExpiresUtc":"0001-01-01T00:00:00.0000000","AcceptedUtc":"0001-01-01T00:00:00.0000000","AcceptedVia":"String","DeclinedUtc":"0001-01-01T00:00:00.0000000","DeclinedBy":"String","DeclineReason":"String","JobsCreated":0,"JobsDone":0,"JobsNeedDriver":0,"CreatedUtc":"0001-01-01T00:00:00.0000000","CreatedBy":"String","Events":[{"EventId":0,"Kind":"String","Detail":"String","AtUtc":"0001-01-01T00:00:00.0000000","ByWho":"String"}]},"RigCounts":[{"RigType":"String","Rigs":0}],"Carriers":[{"VendorID":0,"VendorName":"String"}],"QuoteLink":"String","Delivery":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}