| GET,OPTIONS | /v1/fleet/live |
|---|
<?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 FleetRowDto implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ContactID=0,
/** @var string|null */
public ?string $WorkerName=null,
/** @var int|null */
public ?int $CrewID=null,
/** @var string|null */
public ?string $CrewName=null,
/** @var string|null */
public ?string $BranchId=null,
/** @var string|null */
public ?string $LiveStatus=null,
/** @var int|null */
public ?int $WorkerScheduleItemID=null,
/** @var int|null */
public ?int $JobID=null,
/** @var string|null */
public ?string $CurProperty=null,
/** @var string|null */
public ?string $CurAddress=null,
/** @var string|null */
public ?string $CurZip=null,
/** @var string|null */
public ?string $EnRouteAt=null,
/** @var string|null */
public ?string $StartedAt=null,
/** @var float|null */
public ?float $LastLat=null,
/** @var float|null */
public ?float $LastLng=null,
/** @var string|null */
public ?string $LastLocAt=null,
/** @var string|null */
public ?string $NextProperty=null,
/** @var int */
public int $DoneVisits=0,
/** @var int */
public int $TotalVisits=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
if (isset($o['WorkerName'])) $this->WorkerName = $o['WorkerName'];
if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['LiveStatus'])) $this->LiveStatus = $o['LiveStatus'];
if (isset($o['WorkerScheduleItemID'])) $this->WorkerScheduleItemID = $o['WorkerScheduleItemID'];
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['CurProperty'])) $this->CurProperty = $o['CurProperty'];
if (isset($o['CurAddress'])) $this->CurAddress = $o['CurAddress'];
if (isset($o['CurZip'])) $this->CurZip = $o['CurZip'];
if (isset($o['EnRouteAt'])) $this->EnRouteAt = $o['EnRouteAt'];
if (isset($o['StartedAt'])) $this->StartedAt = $o['StartedAt'];
if (isset($o['LastLat'])) $this->LastLat = $o['LastLat'];
if (isset($o['LastLng'])) $this->LastLng = $o['LastLng'];
if (isset($o['LastLocAt'])) $this->LastLocAt = $o['LastLocAt'];
if (isset($o['NextProperty'])) $this->NextProperty = $o['NextProperty'];
if (isset($o['DoneVisits'])) $this->DoneVisits = $o['DoneVisits'];
if (isset($o['TotalVisits'])) $this->TotalVisits = $o['TotalVisits'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
if (isset($this->WorkerName)) $o['WorkerName'] = $this->WorkerName;
if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->LiveStatus)) $o['LiveStatus'] = $this->LiveStatus;
if (isset($this->WorkerScheduleItemID)) $o['WorkerScheduleItemID'] = $this->WorkerScheduleItemID;
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->CurProperty)) $o['CurProperty'] = $this->CurProperty;
if (isset($this->CurAddress)) $o['CurAddress'] = $this->CurAddress;
if (isset($this->CurZip)) $o['CurZip'] = $this->CurZip;
if (isset($this->EnRouteAt)) $o['EnRouteAt'] = $this->EnRouteAt;
if (isset($this->StartedAt)) $o['StartedAt'] = $this->StartedAt;
if (isset($this->LastLat)) $o['LastLat'] = $this->LastLat;
if (isset($this->LastLng)) $o['LastLng'] = $this->LastLng;
if (isset($this->LastLocAt)) $o['LastLocAt'] = $this->LastLocAt;
if (isset($this->NextProperty)) $o['NextProperty'] = $this->NextProperty;
if (isset($this->DoneVisits)) $o['DoneVisits'] = $this->DoneVisits;
if (isset($this->TotalVisits)) $o['TotalVisits'] = $this->TotalVisits;
return empty($o) ? new class(){} : $o;
}
}
class FleetLiveResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<FleetRowDto>|null */
public ?array $Rows=null,
/** @var int */
public int $ActiveWorkers=0,
/** @var int */
public int $EnRoute=0,
/** @var int */
public int $OnSite=0,
/** @var int */
public int $Waiting=0,
/** @var int */
public int $Done=0,
/** @var int */
public int $RunningLate=0,
/** @var int */
public int $PageTotal=0,
/** @var int */
public int $Page=0,
/** @var int */
public int $PageSize=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Rows'])) $this->Rows = JsonConverters::fromArray('FleetRowDto', $o['Rows']);
if (isset($o['ActiveWorkers'])) $this->ActiveWorkers = $o['ActiveWorkers'];
if (isset($o['EnRoute'])) $this->EnRoute = $o['EnRoute'];
if (isset($o['OnSite'])) $this->OnSite = $o['OnSite'];
if (isset($o['Waiting'])) $this->Waiting = $o['Waiting'];
if (isset($o['Done'])) $this->Done = $o['Done'];
if (isset($o['RunningLate'])) $this->RunningLate = $o['RunningLate'];
if (isset($o['PageTotal'])) $this->PageTotal = $o['PageTotal'];
if (isset($o['Page'])) $this->Page = $o['Page'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Rows)) $o['Rows'] = JsonConverters::toArray('FleetRowDto', $this->Rows);
if (isset($this->ActiveWorkers)) $o['ActiveWorkers'] = $this->ActiveWorkers;
if (isset($this->EnRoute)) $o['EnRoute'] = $this->EnRoute;
if (isset($this->OnSite)) $o['OnSite'] = $this->OnSite;
if (isset($this->Waiting)) $o['Waiting'] = $this->Waiting;
if (isset($this->Done)) $o['Done'] = $this->Done;
if (isset($this->RunningLate)) $o['RunningLate'] = $this->RunningLate;
if (isset($this->PageTotal)) $o['PageTotal'] = $this->PageTotal;
if (isset($this->Page)) $o['Page'] = $this->Page;
if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
return empty($o) ? new class(){} : $o;
}
}
class FleetLiveRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Date=null,
/** @var string|null */
public ?string $Status=null,
/** @var int|null */
public ?int $CrewID=null,
/** @var string|null */
public ?string $Zip=null,
/** @var string|null */
public ?string $BranchId=null,
/** @var string|null */
public ?string $Search=null,
/** @var int */
public int $Page=0,
/** @var int */
public int $PageSize=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Date'])) $this->Date = $o['Date'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
if (isset($o['Zip'])) $this->Zip = $o['Zip'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['Search'])) $this->Search = $o['Search'];
if (isset($o['Page'])) $this->Page = $o['Page'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Date)) $o['Date'] = $this->Date;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
if (isset($this->Zip)) $o['Zip'] = $this->Zip;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->Search)) $o['Search'] = $this->Search;
if (isset($this->Page)) $o['Page'] = $this->Page;
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 .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/fleet/live HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Rows:
[
{
ContactID: 0,
WorkerName: String,
CrewID: 0,
CrewName: String,
BranchId: 00000000000000000000000000000000,
LiveStatus: String,
WorkerScheduleItemID: 0,
JobID: 0,
CurProperty: String,
CurAddress: String,
CurZip: String,
EnRouteAt: String,
StartedAt: String,
LastLat: 0,
LastLng: 0,
LastLocAt: String,
NextProperty: String,
DoneVisits: 0,
TotalVisits: 0
}
],
ActiveWorkers: 0,
EnRoute: 0,
OnSite: 0,
Waiting: 0,
Done: 0,
RunningLate: 0,
PageTotal: 0,
Page: 0,
PageSize: 0
}