| POST,OPTIONS | /v1/dispatch/courier/runs |
|---|
<?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 CourierItemView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CourierItemID=0,
/** @var int */
public int $DispatchOdRequestID=0,
/** @var int */
public int $Seq=0,
/** @var string|null */
public ?string $TagCode=null,
/** @var string|null */
public ?string $Custody=null,
/** @var bool|null */
public ?bool $IsOpen=null,
/** @var bool|null */
public ?bool $IsMissing=null,
/** @var string|null */
public ?string $MissingReason=null,
/** @var bool|null */
public ?bool $IsManual=null,
/** @var bool|null */
public ?bool $ReTagFlag=null,
/** @var bool|null */
public ?bool $Scanned=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CourierItemID'])) $this->CourierItemID = $o['CourierItemID'];
if (isset($o['DispatchOdRequestID'])) $this->DispatchOdRequestID = $o['DispatchOdRequestID'];
if (isset($o['Seq'])) $this->Seq = $o['Seq'];
if (isset($o['TagCode'])) $this->TagCode = $o['TagCode'];
if (isset($o['Custody'])) $this->Custody = $o['Custody'];
if (isset($o['IsOpen'])) $this->IsOpen = $o['IsOpen'];
if (isset($o['IsMissing'])) $this->IsMissing = $o['IsMissing'];
if (isset($o['MissingReason'])) $this->MissingReason = $o['MissingReason'];
if (isset($o['IsManual'])) $this->IsManual = $o['IsManual'];
if (isset($o['ReTagFlag'])) $this->ReTagFlag = $o['ReTagFlag'];
if (isset($o['Scanned'])) $this->Scanned = $o['Scanned'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CourierItemID)) $o['CourierItemID'] = $this->CourierItemID;
if (isset($this->DispatchOdRequestID)) $o['DispatchOdRequestID'] = $this->DispatchOdRequestID;
if (isset($this->Seq)) $o['Seq'] = $this->Seq;
if (isset($this->TagCode)) $o['TagCode'] = $this->TagCode;
if (isset($this->Custody)) $o['Custody'] = $this->Custody;
if (isset($this->IsOpen)) $o['IsOpen'] = $this->IsOpen;
if (isset($this->IsMissing)) $o['IsMissing'] = $this->IsMissing;
if (isset($this->MissingReason)) $o['MissingReason'] = $this->MissingReason;
if (isset($this->IsManual)) $o['IsManual'] = $this->IsManual;
if (isset($this->ReTagFlag)) $o['ReTagFlag'] = $this->ReTagFlag;
if (isset($this->Scanned)) $o['Scanned'] = $this->Scanned;
return empty($o) ? new class(){} : $o;
}
}
class CourierStopView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Sequence=0,
/** @var string|null */
public ?string $Status=null,
/** @var int */
public int $DispatchOdRequestID=0,
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $CourierStep=null,
/** @var string|null */
public ?string $Address=null,
/** @var string|null */
public ?string $Unit=null,
/** @var string|null */
public ?string $City=null,
/** @var string|null */
public ?string $Zip=null,
/** @var float|null */
public ?float $Lat=null,
/** @var float|null */
public ?float $Lng=null,
/** @var string|null */
public ?string $CustomerName=null,
/** @var string|null */
public ?string $CustomerPhone=null,
/** @var string|null */
public ?string $Handoff=null,
/** @var string|null */
public ?string $GateCode=null,
/** @var string|null */
public ?string $Instructions=null,
/** @var int */
public int $Units=0,
/** @var string|null */
public ?string $DueText=null,
/** @var string|null */
public ?string $Note=null,
/** @var array<string>|null */
public ?array $Needs=null,
/** @var array<CourierItemView>|null */
public ?array $Items=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Sequence'])) $this->Sequence = $o['Sequence'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['DispatchOdRequestID'])) $this->DispatchOdRequestID = $o['DispatchOdRequestID'];
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['CourierStep'])) $this->CourierStep = $o['CourierStep'];
if (isset($o['Address'])) $this->Address = $o['Address'];
if (isset($o['Unit'])) $this->Unit = $o['Unit'];
if (isset($o['City'])) $this->City = $o['City'];
if (isset($o['Zip'])) $this->Zip = $o['Zip'];
if (isset($o['Lat'])) $this->Lat = $o['Lat'];
if (isset($o['Lng'])) $this->Lng = $o['Lng'];
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['CustomerPhone'])) $this->CustomerPhone = $o['CustomerPhone'];
if (isset($o['Handoff'])) $this->Handoff = $o['Handoff'];
if (isset($o['GateCode'])) $this->GateCode = $o['GateCode'];
if (isset($o['Instructions'])) $this->Instructions = $o['Instructions'];
if (isset($o['Units'])) $this->Units = $o['Units'];
if (isset($o['DueText'])) $this->DueText = $o['DueText'];
if (isset($o['Note'])) $this->Note = $o['Note'];
if (isset($o['Needs'])) $this->Needs = JsonConverters::fromArray('string', $o['Needs']);
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('CourierItemView', $o['Items']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Sequence)) $o['Sequence'] = $this->Sequence;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->DispatchOdRequestID)) $o['DispatchOdRequestID'] = $this->DispatchOdRequestID;
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->CourierStep)) $o['CourierStep'] = $this->CourierStep;
if (isset($this->Address)) $o['Address'] = $this->Address;
if (isset($this->Unit)) $o['Unit'] = $this->Unit;
if (isset($this->City)) $o['City'] = $this->City;
if (isset($this->Zip)) $o['Zip'] = $this->Zip;
if (isset($this->Lat)) $o['Lat'] = $this->Lat;
if (isset($this->Lng)) $o['Lng'] = $this->Lng;
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->CustomerPhone)) $o['CustomerPhone'] = $this->CustomerPhone;
if (isset($this->Handoff)) $o['Handoff'] = $this->Handoff;
if (isset($this->GateCode)) $o['GateCode'] = $this->GateCode;
if (isset($this->Instructions)) $o['Instructions'] = $this->Instructions;
if (isset($this->Units)) $o['Units'] = $this->Units;
if (isset($this->DueText)) $o['DueText'] = $this->DueText;
if (isset($this->Note)) $o['Note'] = $this->Note;
if (isset($this->Needs)) $o['Needs'] = JsonConverters::toArray('string', $this->Needs);
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('CourierItemView', $this->Items);
return empty($o) ? new class(){} : $o;
}
}
class CourierRunView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CourierRunID=0,
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $Status=null,
/** @var int */
public int $CourierProfileId=0,
/** @var string|null */
public ?string $ProfileName=null,
/** @var int */
public int $CourierFacilityId=0,
/** @var string|null */
public ?string $FacilityName=null,
/** @var string|null */
public ?string $FacilityAddress=null,
/** @var int|null */
public ?int $DriverContactId=null,
/** @var string|null */
public ?string $DriverName=null,
/** @var int|null */
public ?int $EquipmentID=null,
/** @var string|null */
public ?string $VehicleUnit=null,
/** @var string|null */
public ?string $UnitOne=null,
/** @var string|null */
public ?string $UnitMany=null,
/** @var int */
public int $Units=0,
/** @var int */
public int $StopCount=0,
/** @var int */
public int $StopsDone=0,
/** @var float|null */
public ?float $Pay=null,
/** @var DateTime|null */
public ?DateTime $BuiltUtc=null,
/** @var DateTime|null */
public ?DateTime $StartedUtc=null,
/** @var DateTime|null */
public ?DateTime $CompletedUtc=null,
/** @var int */
public int $ToLoad=0,
/** @var int */
public int $ToReturn=0,
/** @var array<CourierStopView>|null */
public ?array $Stops=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CourierRunID'])) $this->CourierRunID = $o['CourierRunID'];
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['CourierProfileId'])) $this->CourierProfileId = $o['CourierProfileId'];
if (isset($o['ProfileName'])) $this->ProfileName = $o['ProfileName'];
if (isset($o['CourierFacilityId'])) $this->CourierFacilityId = $o['CourierFacilityId'];
if (isset($o['FacilityName'])) $this->FacilityName = $o['FacilityName'];
if (isset($o['FacilityAddress'])) $this->FacilityAddress = $o['FacilityAddress'];
if (isset($o['DriverContactId'])) $this->DriverContactId = $o['DriverContactId'];
if (isset($o['DriverName'])) $this->DriverName = $o['DriverName'];
if (isset($o['EquipmentID'])) $this->EquipmentID = $o['EquipmentID'];
if (isset($o['VehicleUnit'])) $this->VehicleUnit = $o['VehicleUnit'];
if (isset($o['UnitOne'])) $this->UnitOne = $o['UnitOne'];
if (isset($o['UnitMany'])) $this->UnitMany = $o['UnitMany'];
if (isset($o['Units'])) $this->Units = $o['Units'];
if (isset($o['StopCount'])) $this->StopCount = $o['StopCount'];
if (isset($o['StopsDone'])) $this->StopsDone = $o['StopsDone'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
if (isset($o['BuiltUtc'])) $this->BuiltUtc = JsonConverters::from('DateTime', $o['BuiltUtc']);
if (isset($o['StartedUtc'])) $this->StartedUtc = JsonConverters::from('DateTime', $o['StartedUtc']);
if (isset($o['CompletedUtc'])) $this->CompletedUtc = JsonConverters::from('DateTime', $o['CompletedUtc']);
if (isset($o['ToLoad'])) $this->ToLoad = $o['ToLoad'];
if (isset($o['ToReturn'])) $this->ToReturn = $o['ToReturn'];
if (isset($o['Stops'])) $this->Stops = JsonConverters::fromArray('CourierStopView', $o['Stops']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CourierRunID)) $o['CourierRunID'] = $this->CourierRunID;
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->CourierProfileId)) $o['CourierProfileId'] = $this->CourierProfileId;
if (isset($this->ProfileName)) $o['ProfileName'] = $this->ProfileName;
if (isset($this->CourierFacilityId)) $o['CourierFacilityId'] = $this->CourierFacilityId;
if (isset($this->FacilityName)) $o['FacilityName'] = $this->FacilityName;
if (isset($this->FacilityAddress)) $o['FacilityAddress'] = $this->FacilityAddress;
if (isset($this->DriverContactId)) $o['DriverContactId'] = $this->DriverContactId;
if (isset($this->DriverName)) $o['DriverName'] = $this->DriverName;
if (isset($this->EquipmentID)) $o['EquipmentID'] = $this->EquipmentID;
if (isset($this->VehicleUnit)) $o['VehicleUnit'] = $this->VehicleUnit;
if (isset($this->UnitOne)) $o['UnitOne'] = $this->UnitOne;
if (isset($this->UnitMany)) $o['UnitMany'] = $this->UnitMany;
if (isset($this->Units)) $o['Units'] = $this->Units;
if (isset($this->StopCount)) $o['StopCount'] = $this->StopCount;
if (isset($this->StopsDone)) $o['StopsDone'] = $this->StopsDone;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
if (isset($this->BuiltUtc)) $o['BuiltUtc'] = JsonConverters::to('DateTime', $this->BuiltUtc);
if (isset($this->StartedUtc)) $o['StartedUtc'] = JsonConverters::to('DateTime', $this->StartedUtc);
if (isset($this->CompletedUtc)) $o['CompletedUtc'] = JsonConverters::to('DateTime', $this->CompletedUtc);
if (isset($this->ToLoad)) $o['ToLoad'] = $this->ToLoad;
if (isset($this->ToReturn)) $o['ToReturn'] = $this->ToReturn;
if (isset($this->Stops)) $o['Stops'] = JsonConverters::toArray('CourierStopView', $this->Stops);
return empty($o) ? new class(){} : $o;
}
}
class CourierRunResponse implements JsonSerializable
{
public function __construct(
/** @var array<CourierRunView>|null */
public ?array $Runs=null,
/** @var CourierRunView|null */
public ?CourierRunView $Run=null,
/** @var string|null */
public ?string $Message=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Runs'])) $this->Runs = JsonConverters::fromArray('CourierRunView', $o['Runs']);
if (isset($o['Run'])) $this->Run = JsonConverters::from('CourierRunView', $o['Run']);
if (isset($o['Message'])) $this->Message = $o['Message'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Runs)) $o['Runs'] = JsonConverters::toArray('CourierRunView', $this->Runs);
if (isset($this->Run)) $o['Run'] = JsonConverters::to('CourierRunView', $this->Run);
if (isset($this->Message)) $o['Message'] = $this->Message;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class CourierRunBuildRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProfileId=0,
/** @var string|null */
public ?string $FacilityCode=null,
/** @var array<string>|null */
public ?array $Codes=null,
/** @var int|null */
public ?int $DriverContactId=null,
/** @var int|null */
public ?int $EquipmentID=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProfileId'])) $this->ProfileId = $o['ProfileId'];
if (isset($o['FacilityCode'])) $this->FacilityCode = $o['FacilityCode'];
if (isset($o['Codes'])) $this->Codes = JsonConverters::fromArray('string', $o['Codes']);
if (isset($o['DriverContactId'])) $this->DriverContactId = $o['DriverContactId'];
if (isset($o['EquipmentID'])) $this->EquipmentID = $o['EquipmentID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProfileId)) $o['ProfileId'] = $this->ProfileId;
if (isset($this->FacilityCode)) $o['FacilityCode'] = $this->FacilityCode;
if (isset($this->Codes)) $o['Codes'] = JsonConverters::toArray('string', $this->Codes);
if (isset($this->DriverContactId)) $o['DriverContactId'] = $this->DriverContactId;
if (isset($this->EquipmentID)) $o['EquipmentID'] = $this->EquipmentID;
return empty($o) ? new class(){} : $o;
}
}
PHP CourierRunBuildRequest 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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/dispatch/courier/runs HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"ProfileId":0,"FacilityCode":"String","Codes":["String"],"DriverContactId":0,"EquipmentID":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"Runs":[{"CourierRunID":0,"Code":"String","Status":"String","CourierProfileId":0,"ProfileName":"String","CourierFacilityId":0,"FacilityName":"String","FacilityAddress":"String","DriverContactId":0,"DriverName":"String","EquipmentID":0,"VehicleUnit":"String","UnitOne":"String","UnitMany":"String","Units":0,"StopCount":0,"StopsDone":0,"Pay":0,"BuiltUtc":"0001-01-01T00:00:00.0000000","StartedUtc":"0001-01-01T00:00:00.0000000","CompletedUtc":"0001-01-01T00:00:00.0000000","ToLoad":0,"ToReturn":0,"Stops":[{"Sequence":0,"Status":"String","DispatchOdRequestID":0,"Code":"String","CourierStep":"String","Address":"String","Unit":"String","City":"String","Zip":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","Units":0,"DueText":"String","Note":"String","Needs":["String"],"Items":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}]}]}],"Run":{"CourierRunID":0,"Code":"String","Status":"String","CourierProfileId":0,"ProfileName":"String","CourierFacilityId":0,"FacilityName":"String","FacilityAddress":"String","DriverContactId":0,"DriverName":"String","EquipmentID":0,"VehicleUnit":"String","UnitOne":"String","UnitMany":"String","Units":0,"StopCount":0,"StopsDone":0,"Pay":0,"BuiltUtc":"0001-01-01T00:00:00.0000000","StartedUtc":"0001-01-01T00:00:00.0000000","CompletedUtc":"0001-01-01T00:00:00.0000000","ToLoad":0,"ToReturn":0,"Stops":[{"Sequence":0,"Status":"String","DispatchOdRequestID":0,"Code":"String","CourierStep":"String","Address":"String","Unit":"String","City":"String","Zip":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","Units":0,"DueText":"String","Note":"String","Needs":["String"],"Items":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}]}]},"Message":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}