Trendsic Platform Service

<back to all web services

DispatchPickupPageRequest

The following routes are available for this service:
GET,OPTIONS/v1/dispatch/public/pickup/{SchedulerUrl}
<?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 DispatchZoneView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Zone=null,
        /** @var float */
        public float $Base=0.0,
        /** @var float */
        public float $PerBag=0.0,
        /** @var float */
        public float $PremiumUpliftPct=0.0,
        /** @var int */
        public int $Drivers=0,
        /** @var int */
        public int $IdleDrivers=0
    ) {
    }

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

class DispatchNeedView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var string|null */
        public ?string $Label=null,
        /** @var string|null */
        public ?string $Sub=null
    ) {
    }

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

class DispatchPickupPageResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CompanyName=null,
        /** @var array<DispatchZoneView>|null */
        public ?array $Zones=null,
        /** @var array<DispatchNeedView>|null */
        public ?array $Needs=null,
        /** @var bool|null */
        public ?bool $CardEnabled=null,
        /** @var string|null */
        public ?string $PublishableKey=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyName'])) $this->CompanyName = $o['CompanyName'];
        if (isset($o['Zones'])) $this->Zones = JsonConverters::fromArray('DispatchZoneView', $o['Zones']);
        if (isset($o['Needs'])) $this->Needs = JsonConverters::fromArray('DispatchNeedView', $o['Needs']);
        if (isset($o['CardEnabled'])) $this->CardEnabled = $o['CardEnabled'];
        if (isset($o['PublishableKey'])) $this->PublishableKey = $o['PublishableKey'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyName)) $o['CompanyName'] = $this->CompanyName;
        if (isset($this->Zones)) $o['Zones'] = JsonConverters::toArray('DispatchZoneView', $this->Zones);
        if (isset($this->Needs)) $o['Needs'] = JsonConverters::toArray('DispatchNeedView', $this->Needs);
        if (isset($this->CardEnabled)) $o['CardEnabled'] = $this->CardEnabled;
        if (isset($this->PublishableKey)) $o['PublishableKey'] = $this->PublishableKey;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

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

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

PHP DispatchPickupPageRequest 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/public/pickup/{SchedulerUrl} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	CompanyName: String,
	Zones: 
	[
		{
			Zone: String,
			Base: 0,
			PerBag: 0,
			PremiumUpliftPct: 0,
			Drivers: 0,
			IdleDrivers: 0
		}
	],
	Needs: 
	[
		{
			Id: String,
			Label: String,
			Sub: String
		}
	],
	CardEnabled: False,
	PublishableKey: String,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}