| POST,OPTIONS | /v1/dashboard/dispatch |
|---|
<?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 DashboardStatTile implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Key=null,
/** @var string|null */
public ?string $Label=null,
/** @var float */
public float $Value=0.0,
/** @var float|null */
public ?float $PreviousValue=null,
/** @var string|null */
public ?string $Unit=null,
/** @var float|null */
public ?float $DeltaPct=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['Label'])) $this->Label = $o['Label'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['PreviousValue'])) $this->PreviousValue = $o['PreviousValue'];
if (isset($o['Unit'])) $this->Unit = $o['Unit'];
if (isset($o['DeltaPct'])) $this->DeltaPct = $o['DeltaPct'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->Label)) $o['Label'] = $this->Label;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->PreviousValue)) $o['PreviousValue'] = $this->PreviousValue;
if (isset($this->Unit)) $o['Unit'] = $this->Unit;
if (isset($this->DeltaPct)) $o['DeltaPct'] = $this->DeltaPct;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportDayRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Label=null,
/** @var int */
public int $Loads=0,
/** @var float */
public float $Revenue=0.0,
/** @var float */
public float $Pay=0.0,
/** @var float */
public float $Qty=0.0,
/** @var float|null */
public ?float $AvgCycleMins=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Label'])) $this->Label = $o['Label'];
if (isset($o['Loads'])) $this->Loads = $o['Loads'];
if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
if (isset($o['Qty'])) $this->Qty = $o['Qty'];
if (isset($o['AvgCycleMins'])) $this->AvgCycleMins = $o['AvgCycleMins'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Label)) $o['Label'] = $this->Label;
if (isset($this->Loads)) $o['Loads'] = $this->Loads;
if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
if (isset($this->Qty)) $o['Qty'] = $this->Qty;
if (isset($this->AvgCycleMins)) $o['AvgCycleMins'] = $this->AvgCycleMins;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportModuleRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Module=null,
/** @var int */
public int $Loads=0,
/** @var float */
public float $Qty=0.0,
/** @var float */
public float $Revenue=0.0,
/** @var float */
public float $Pay=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Module'])) $this->Module = $o['Module'];
if (isset($o['Loads'])) $this->Loads = $o['Loads'];
if (isset($o['Qty'])) $this->Qty = $o['Qty'];
if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Module)) $o['Module'] = $this->Module;
if (isset($this->Loads)) $o['Loads'] = $this->Loads;
if (isset($this->Qty)) $o['Qty'] = $this->Qty;
if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportLaneRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $SupplierName=null,
/** @var string|null */
public ?string $SourceLabel=null,
/** @var int */
public int $Loads=0,
/** @var float */
public float $Qty=0.0,
/** @var float */
public float $Revenue=0.0,
/** @var float|null */
public ?float $AvgCycleMins=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SupplierName'])) $this->SupplierName = $o['SupplierName'];
if (isset($o['SourceLabel'])) $this->SourceLabel = $o['SourceLabel'];
if (isset($o['Loads'])) $this->Loads = $o['Loads'];
if (isset($o['Qty'])) $this->Qty = $o['Qty'];
if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
if (isset($o['AvgCycleMins'])) $this->AvgCycleMins = $o['AvgCycleMins'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SupplierName)) $o['SupplierName'] = $this->SupplierName;
if (isset($this->SourceLabel)) $o['SourceLabel'] = $this->SourceLabel;
if (isset($this->Loads)) $o['Loads'] = $this->Loads;
if (isset($this->Qty)) $o['Qty'] = $this->Qty;
if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
if (isset($this->AvgCycleMins)) $o['AvgCycleMins'] = $this->AvgCycleMins;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportTruckRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $TruckLabel=null,
/** @var string|null */
public ?string $DriverLabel=null,
/** @var int */
public int $Loads=0,
/** @var float */
public float $Qty=0.0,
/** @var float */
public float $Revenue=0.0,
/** @var float */
public float $Pay=0.0,
/** @var float|null */
public ?float $AvgCycleMins=null,
/** @var int */
public int $DaysActive=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TruckLabel'])) $this->TruckLabel = $o['TruckLabel'];
if (isset($o['DriverLabel'])) $this->DriverLabel = $o['DriverLabel'];
if (isset($o['Loads'])) $this->Loads = $o['Loads'];
if (isset($o['Qty'])) $this->Qty = $o['Qty'];
if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
if (isset($o['AvgCycleMins'])) $this->AvgCycleMins = $o['AvgCycleMins'];
if (isset($o['DaysActive'])) $this->DaysActive = $o['DaysActive'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TruckLabel)) $o['TruckLabel'] = $this->TruckLabel;
if (isset($this->DriverLabel)) $o['DriverLabel'] = $this->DriverLabel;
if (isset($this->Loads)) $o['Loads'] = $this->Loads;
if (isset($this->Qty)) $o['Qty'] = $this->Qty;
if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
if (isset($this->AvgCycleMins)) $o['AvgCycleMins'] = $this->AvgCycleMins;
if (isset($this->DaysActive)) $o['DaysActive'] = $this->DaysActive;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportDriverRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Driver=null,
/** @var int|null */
public ?int $DriverContactId=null,
/** @var int */
public int $Loads=0,
/** @var float */
public float $Qty=0.0,
/** @var float */
public float $Pay=0.0,
/** @var int */
public int $DaysActive=0,
/** @var int */
public int $Unpriced=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Driver'])) $this->Driver = $o['Driver'];
if (isset($o['DriverContactId'])) $this->DriverContactId = $o['DriverContactId'];
if (isset($o['Loads'])) $this->Loads = $o['Loads'];
if (isset($o['Qty'])) $this->Qty = $o['Qty'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
if (isset($o['DaysActive'])) $this->DaysActive = $o['DaysActive'];
if (isset($o['Unpriced'])) $this->Unpriced = $o['Unpriced'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Driver)) $o['Driver'] = $this->Driver;
if (isset($this->DriverContactId)) $o['DriverContactId'] = $this->DriverContactId;
if (isset($this->Loads)) $o['Loads'] = $this->Loads;
if (isset($this->Qty)) $o['Qty'] = $this->Qty;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
if (isset($this->DaysActive)) $o['DaysActive'] = $this->DaysActive;
if (isset($this->Unpriced)) $o['Unpriced'] = $this->Unpriced;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportJobRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $JobCode=null,
/** @var string|null */
public ?string $Customer=null,
/** @var string|null */
public ?string $Cargo=null,
/** @var string|null */
public ?string $Route=null,
/** @var int */
public int $Miles=0,
/** @var float|null */
public ?float $Revenue=null,
/** @var float|null */
public ?float $Pay=null,
/** @var float|null */
public ?float $MarginPct=null,
/** @var DateTime|null */
public ?DateTime $ClosedUtc=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['JobCode'])) $this->JobCode = $o['JobCode'];
if (isset($o['Customer'])) $this->Customer = $o['Customer'];
if (isset($o['Cargo'])) $this->Cargo = $o['Cargo'];
if (isset($o['Route'])) $this->Route = $o['Route'];
if (isset($o['Miles'])) $this->Miles = $o['Miles'];
if (isset($o['Revenue'])) $this->Revenue = $o['Revenue'];
if (isset($o['Pay'])) $this->Pay = $o['Pay'];
if (isset($o['MarginPct'])) $this->MarginPct = $o['MarginPct'];
if (isset($o['ClosedUtc'])) $this->ClosedUtc = JsonConverters::from('DateTime', $o['ClosedUtc']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->JobCode)) $o['JobCode'] = $this->JobCode;
if (isset($this->Customer)) $o['Customer'] = $this->Customer;
if (isset($this->Cargo)) $o['Cargo'] = $this->Cargo;
if (isset($this->Route)) $o['Route'] = $this->Route;
if (isset($this->Miles)) $o['Miles'] = $this->Miles;
if (isset($this->Revenue)) $o['Revenue'] = $this->Revenue;
if (isset($this->Pay)) $o['Pay'] = $this->Pay;
if (isset($this->MarginPct)) $o['MarginPct'] = $this->MarginPct;
if (isset($this->ClosedUtc)) $o['ClosedUtc'] = JsonConverters::to('DateTime', $this->ClosedUtc);
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportIncidentRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Kind=null,
/** @var int */
public int $Opened=0,
/** @var int */
public int $Resolved=0,
/** @var float|null */
public ?float $AvgResolveMins=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['Opened'])) $this->Opened = $o['Opened'];
if (isset($o['Resolved'])) $this->Resolved = $o['Resolved'];
if (isset($o['AvgResolveMins'])) $this->AvgResolveMins = $o['AvgResolveMins'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->Opened)) $o['Opened'] = $this->Opened;
if (isset($this->Resolved)) $o['Resolved'] = $this->Resolved;
if (isset($this->AvgResolveMins)) $o['AvgResolveMins'] = $this->AvgResolveMins;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportHoldRow implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ScopeKind=null,
/** @var int */
public int $Holds=0,
/** @var int */
public int $PausedMins=0,
/** @var int */
public int $Weather=0,
/** @var int */
public int $FromIncidents=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ScopeKind'])) $this->ScopeKind = $o['ScopeKind'];
if (isset($o['Holds'])) $this->Holds = $o['Holds'];
if (isset($o['PausedMins'])) $this->PausedMins = $o['PausedMins'];
if (isset($o['Weather'])) $this->Weather = $o['Weather'];
if (isset($o['FromIncidents'])) $this->FromIncidents = $o['FromIncidents'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ScopeKind)) $o['ScopeKind'] = $this->ScopeKind;
if (isset($this->Holds)) $o['Holds'] = $this->Holds;
if (isset($this->PausedMins)) $o['PausedMins'] = $this->PausedMins;
if (isset($this->Weather)) $o['Weather'] = $this->Weather;
if (isset($this->FromIncidents)) $o['FromIncidents'] = $this->FromIncidents;
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportResponse implements JsonSerializable
{
public function __construct(
/** @var array<DashboardStatTile>|null */
public ?array $Stats=null,
/** @var string|null */
public ?string $Unit=null,
/** @var array<DispatchReportDayRow>|null */
public ?array $Trend=null,
/** @var array<DispatchReportModuleRow>|null */
public ?array $ByModule=null,
/** @var array<DispatchReportLaneRow>|null */
public ?array $ByLane=null,
/** @var array<DispatchReportTruckRow>|null */
public ?array $ByTruck=null,
/** @var array<DispatchReportDriverRow>|null */
public ?array $ByDriver=null,
/** @var array<DispatchReportJobRow>|null */
public ?array $Jobs=null,
/** @var array<DispatchReportIncidentRow>|null */
public ?array $Incidents=null,
/** @var array<DispatchReportHoldRow>|null */
public ?array $Holds=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Stats'])) $this->Stats = JsonConverters::fromArray('DashboardStatTile', $o['Stats']);
if (isset($o['Unit'])) $this->Unit = $o['Unit'];
if (isset($o['Trend'])) $this->Trend = JsonConverters::fromArray('DispatchReportDayRow', $o['Trend']);
if (isset($o['ByModule'])) $this->ByModule = JsonConverters::fromArray('DispatchReportModuleRow', $o['ByModule']);
if (isset($o['ByLane'])) $this->ByLane = JsonConverters::fromArray('DispatchReportLaneRow', $o['ByLane']);
if (isset($o['ByTruck'])) $this->ByTruck = JsonConverters::fromArray('DispatchReportTruckRow', $o['ByTruck']);
if (isset($o['ByDriver'])) $this->ByDriver = JsonConverters::fromArray('DispatchReportDriverRow', $o['ByDriver']);
if (isset($o['Jobs'])) $this->Jobs = JsonConverters::fromArray('DispatchReportJobRow', $o['Jobs']);
if (isset($o['Incidents'])) $this->Incidents = JsonConverters::fromArray('DispatchReportIncidentRow', $o['Incidents']);
if (isset($o['Holds'])) $this->Holds = JsonConverters::fromArray('DispatchReportHoldRow', $o['Holds']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Stats)) $o['Stats'] = JsonConverters::toArray('DashboardStatTile', $this->Stats);
if (isset($this->Unit)) $o['Unit'] = $this->Unit;
if (isset($this->Trend)) $o['Trend'] = JsonConverters::toArray('DispatchReportDayRow', $this->Trend);
if (isset($this->ByModule)) $o['ByModule'] = JsonConverters::toArray('DispatchReportModuleRow', $this->ByModule);
if (isset($this->ByLane)) $o['ByLane'] = JsonConverters::toArray('DispatchReportLaneRow', $this->ByLane);
if (isset($this->ByTruck)) $o['ByTruck'] = JsonConverters::toArray('DispatchReportTruckRow', $this->ByTruck);
if (isset($this->ByDriver)) $o['ByDriver'] = JsonConverters::toArray('DispatchReportDriverRow', $this->ByDriver);
if (isset($this->Jobs)) $o['Jobs'] = JsonConverters::toArray('DispatchReportJobRow', $this->Jobs);
if (isset($this->Incidents)) $o['Incidents'] = JsonConverters::toArray('DispatchReportIncidentRow', $this->Incidents);
if (isset($this->Holds)) $o['Holds'] = JsonConverters::toArray('DispatchReportHoldRow', $this->Holds);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class DispatchReportRequest implements JsonSerializable
{
public function __construct(
/** @var DateTime */
public DateTime $FromDate=new DateTime(),
/** @var DateTime */
public DateTime $ToDate=new DateTime(),
/** @var array<string>|null */
public ?array $LocationIds=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['FromDate'])) $this->FromDate = JsonConverters::from('DateTime', $o['FromDate']);
if (isset($o['ToDate'])) $this->ToDate = JsonConverters::from('DateTime', $o['ToDate']);
if (isset($o['LocationIds'])) $this->LocationIds = JsonConverters::fromArray('Guid', $o['LocationIds']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->FromDate)) $o['FromDate'] = JsonConverters::to('DateTime', $this->FromDate);
if (isset($this->ToDate)) $o['ToDate'] = JsonConverters::to('DateTime', $this->ToDate);
if (isset($this->LocationIds)) $o['LocationIds'] = JsonConverters::toArray('Guid', $this->LocationIds);
return empty($o) ? new class(){} : $o;
}
}
PHP DispatchReportRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/dashboard/dispatch HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
FromDate: 0001-01-01,
ToDate: 0001-01-01,
LocationIds:
[
00000000000000000000000000000000
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Stats:
[
{
Key: String,
Label: String,
Value: 0,
PreviousValue: 0,
Unit: String
}
],
Unit: String,
Trend:
[
{
Label: String,
Loads: 0,
Revenue: 0,
Pay: 0,
Qty: 0,
AvgCycleMins: 0
}
],
ByModule:
[
{
Module: String,
Loads: 0,
Qty: 0,
Revenue: 0,
Pay: 0
}
],
ByLane:
[
{
SupplierName: String,
SourceLabel: String,
Loads: 0,
Qty: 0,
Revenue: 0,
AvgCycleMins: 0
}
],
ByTruck:
[
{
TruckLabel: String,
DriverLabel: String,
Loads: 0,
Qty: 0,
Revenue: 0,
Pay: 0,
AvgCycleMins: 0,
DaysActive: 0
}
],
ByDriver:
[
{
Driver: String,
DriverContactId: 0,
Loads: 0,
Qty: 0,
Pay: 0,
DaysActive: 0,
Unpriced: 0
}
],
Jobs:
[
{
JobCode: String,
Customer: String,
Cargo: String,
Route: String,
Miles: 0,
Revenue: 0,
Pay: 0,
MarginPct: 0,
ClosedUtc: 0001-01-01
}
],
Incidents:
[
{
Kind: String,
Opened: 0,
Resolved: 0,
AvgResolveMins: 0
}
],
Holds:
[
{
ScopeKind: String,
Holds: 0,
PausedMins: 0,
Weather: 0,
FromIncidents: 0
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}