| 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 int */
public int $Total=0,
/** @var int */
public int $InFlight=0,
/** @var int */
public int $Priced=0,
/** @var float|null */
public ?float $Revenue=null,
/** @var int */
public int $Paid=0,
/** @var float|null */
public ?float $Pay=null,
/** @var int */
public int $PendingLoads=0,
/** @var int */
public int $Offset=0,
/** @var int */
public int $PageSize=0,
/** @var array<string,int>|null */
public ?array $ModuleCounts=null,
/** @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['Total'])) $this->Total = $o['Total'];
if (isset($o['InFlight'])) $this->InFlight = $o['InFlight'];
if (isset($o['Priced'])) $this->Priced = $o['Priced'];
if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
if (isset($o['Paid'])) $this->Paid = $o['Paid'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
if (isset($o['PendingLoads'])) $this->PendingLoads = $o['PendingLoads'];
if (isset($o['Offset'])) $this->Offset = $o['Offset'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
if (isset($o['ModuleCounts'])) $this->ModuleCounts = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','int']), $o['ModuleCounts']);
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->Total)) $o['Total'] = $this->Total;
if (isset($this->InFlight)) $o['InFlight'] = $this->InFlight;
if (isset($this->Priced)) $o['Priced'] = $this->Priced;
if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
if (isset($this->Paid)) $o['Paid'] = $this->Paid;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
if (isset($this->PendingLoads)) $o['PendingLoads'] = $this->PendingLoads;
if (isset($this->Offset)) $o['Offset'] = $this->Offset;
if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
if (isset($this->ModuleCounts)) $o['ModuleCounts'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','int']), $this->ModuleCounts);
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,
/** @var string|null */
public ?string $Search=null,
/** @var string|null */
public ?string $Status=null,
/** @var bool|null */
public ?bool $Pending=null,
/** @var int */
public int $Offset=0,
/** @var int */
public int $PageSize=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Hours'])) $this->Hours = $o['Hours'];
if (isset($o['Module'])) $this->Module = $o['Module'];
if (isset($o['Search'])) $this->Search = $o['Search'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['Pending'])) $this->Pending = $o['Pending'];
if (isset($o['Offset'])) $this->Offset = $o['Offset'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Hours)) $o['Hours'] = $this->Hours;
if (isset($this->Module)) $o['Module'] = $this->Module;
if (isset($this->Search)) $o['Search'] = $this->Search;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->Pending)) $o['Pending'] = $this->Pending;
if (isset($this->Offset)) $o['Offset'] = $this->Offset;
if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
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,"Total":0,"InFlight":0,"Priced":0,"Revenue":0,"Paid":0,"Pay":0,"PendingLoads":0,"Offset":0,"PageSize":0,"ModuleCounts":{"String":0},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}