Trendsic Platform Service

<back to all web services

DispatchTrackRequest

The following routes are available for this service:
GET,OPTIONS/v1/dispatch/track/{Token}/json
<?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 DispatchTrackStepView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var DateTime|null */
        public ?DateTime $At=null,
        /** @var bool|null */
        public ?bool $Done=null,
        /** @var bool|null */
        public ?bool $Current=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['At'])) $this->At = JsonConverters::from('DateTime', $o['At']);
        if (isset($o['Done'])) $this->Done = $o['Done'];
        if (isset($o['Current'])) $this->Current = $o['Current'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->At)) $o['At'] = JsonConverters::to('DateTime', $this->At);
        if (isset($this->Done)) $o['Done'] = $this->Done;
        if (isset($this->Current)) $o['Current'] = $this->Current;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchTrackResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $What=null,
        /** @var string|null */
        public ?string $FromLoc=null,
        /** @var string|null */
        public ?string $ToLoc=null,
        /** @var int|null */
        public ?int $Bags=null,
        /** @var float|null */
        public ?float $Fare=null,
        /** @var string|null */
        public ?string $PayMode=null,
        /** @var string|null */
        public ?string $CardLast4=null,
        /** @var bool|null */
        public ?bool $Charged=null,
        /** @var string|null */
        public ?string $Stage=null,
        /** @var string|null */
        public ?string $Headline=null,
        /** @var string|null */
        public ?string $Sub=null,
        /** @var bool|null */
        public ?bool $IsClosed=null,
        /** @var string|null */
        public ?string $Eta=null,
        /** @var string|null */
        public ?string $DriverName=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var array<DispatchTrackStepView>|null */
        public ?array $Steps=null,
        /** @var bool|null */
        public ?bool $Expired=null,
        /** @var bool|null */
        public ?bool $Invalid=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['What'])) $this->What = $o['What'];
        if (isset($o['FromLoc'])) $this->FromLoc = $o['FromLoc'];
        if (isset($o['ToLoc'])) $this->ToLoc = $o['ToLoc'];
        if (isset($o['Bags'])) $this->Bags = $o['Bags'];
        if (isset($o['Fare'])) $this->Fare = $o['Fare'];
        if (isset($o['PayMode'])) $this->PayMode = $o['PayMode'];
        if (isset($o['CardLast4'])) $this->CardLast4 = $o['CardLast4'];
        if (isset($o['Charged'])) $this->Charged = $o['Charged'];
        if (isset($o['Stage'])) $this->Stage = $o['Stage'];
        if (isset($o['Headline'])) $this->Headline = $o['Headline'];
        if (isset($o['Sub'])) $this->Sub = $o['Sub'];
        if (isset($o['IsClosed'])) $this->IsClosed = $o['IsClosed'];
        if (isset($o['Eta'])) $this->Eta = $o['Eta'];
        if (isset($o['DriverName'])) $this->DriverName = $o['DriverName'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['Steps'])) $this->Steps = JsonConverters::fromArray('DispatchTrackStepView', $o['Steps']);
        if (isset($o['Expired'])) $this->Expired = $o['Expired'];
        if (isset($o['Invalid'])) $this->Invalid = $o['Invalid'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->What)) $o['What'] = $this->What;
        if (isset($this->FromLoc)) $o['FromLoc'] = $this->FromLoc;
        if (isset($this->ToLoc)) $o['ToLoc'] = $this->ToLoc;
        if (isset($this->Bags)) $o['Bags'] = $this->Bags;
        if (isset($this->Fare)) $o['Fare'] = $this->Fare;
        if (isset($this->PayMode)) $o['PayMode'] = $this->PayMode;
        if (isset($this->CardLast4)) $o['CardLast4'] = $this->CardLast4;
        if (isset($this->Charged)) $o['Charged'] = $this->Charged;
        if (isset($this->Stage)) $o['Stage'] = $this->Stage;
        if (isset($this->Headline)) $o['Headline'] = $this->Headline;
        if (isset($this->Sub)) $o['Sub'] = $this->Sub;
        if (isset($this->IsClosed)) $o['IsClosed'] = $this->IsClosed;
        if (isset($this->Eta)) $o['Eta'] = $this->Eta;
        if (isset($this->DriverName)) $o['DriverName'] = $this->DriverName;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->Steps)) $o['Steps'] = JsonConverters::toArray('DispatchTrackStepView', $this->Steps);
        if (isset($this->Expired)) $o['Expired'] = $this->Expired;
        if (isset($this->Invalid)) $o['Invalid'] = $this->Invalid;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchTrackRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Token=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Token'])) $this->Token = $o['Token'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Token)) $o['Token'] = $this->Token;
        return empty($o) ? new class(){} : $o;
    }
}

PHP DispatchTrackRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /v1/dispatch/track/{Token}/json HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Kind: String,
	Code: String,
	What: String,
	FromLoc: String,
	ToLoc: String,
	Bags: 0,
	Fare: 0,
	PayMode: String,
	CardLast4: String,
	Charged: False,
	Stage: String,
	Headline: String,
	Sub: String,
	IsClosed: False,
	Eta: String,
	DriverName: String,
	CustomerName: String,
	Steps: 
	[
		{
			Name: String,
			At: 0001-01-01,
			Done: False,
			Current: False
		}
	],
	Expired: False,
	Invalid: False,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}