Trendsic Platform Service

<back to all web services

DispatchLaneRateSaveRequest

Requires Authentication
The following routes are available for this service:
PUT,OPTIONS/v1/dispatch/rates/lane
<?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 DispatchRateConfigView implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $FuelSurchargePct=0.0,
        /** @var float */
        public float $TransportPerMile=0.0,
        /** @var float */
        public float $TransportJobMin=0.0,
        /** @var float */
        public float $TransportEnclosedUpliftPct=0.0,
        /** @var float */
        public float $OdBase=0.0,
        /** @var float */
        public float $OdPerBag=0.0,
        /** @var float */
        public float $OdPremiumUpliftPct=0.0,
        /** @var string|null */
        public ?string $HaulBasis=null,
        /** @var string|null */
        public ?string $Facility=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var float */
        public float $LoadQty=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['FuelSurchargePct'])) $this->FuelSurchargePct = $o['FuelSurchargePct'];
        if (isset($o['TransportPerMile'])) $this->TransportPerMile = $o['TransportPerMile'];
        if (isset($o['TransportJobMin'])) $this->TransportJobMin = $o['TransportJobMin'];
        if (isset($o['TransportEnclosedUpliftPct'])) $this->TransportEnclosedUpliftPct = $o['TransportEnclosedUpliftPct'];
        if (isset($o['OdBase'])) $this->OdBase = $o['OdBase'];
        if (isset($o['OdPerBag'])) $this->OdPerBag = $o['OdPerBag'];
        if (isset($o['OdPremiumUpliftPct'])) $this->OdPremiumUpliftPct = $o['OdPremiumUpliftPct'];
        if (isset($o['HaulBasis'])) $this->HaulBasis = $o['HaulBasis'];
        if (isset($o['Facility'])) $this->Facility = $o['Facility'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['LoadQty'])) $this->LoadQty = $o['LoadQty'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->FuelSurchargePct)) $o['FuelSurchargePct'] = $this->FuelSurchargePct;
        if (isset($this->TransportPerMile)) $o['TransportPerMile'] = $this->TransportPerMile;
        if (isset($this->TransportJobMin)) $o['TransportJobMin'] = $this->TransportJobMin;
        if (isset($this->TransportEnclosedUpliftPct)) $o['TransportEnclosedUpliftPct'] = $this->TransportEnclosedUpliftPct;
        if (isset($this->OdBase)) $o['OdBase'] = $this->OdBase;
        if (isset($this->OdPerBag)) $o['OdPerBag'] = $this->OdPerBag;
        if (isset($this->OdPremiumUpliftPct)) $o['OdPremiumUpliftPct'] = $this->OdPremiumUpliftPct;
        if (isset($this->HaulBasis)) $o['HaulBasis'] = $this->HaulBasis;
        if (isset($this->Facility)) $o['Facility'] = $this->Facility;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->LoadQty)) $o['LoadQty'] = $this->LoadQty;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchLaneRateView implements JsonSerializable
{
    public function __construct(
        /** @var int|null */
        public ?int $DispatchSiteID=null,
        /** @var int|null */
        public ?int $DispatchSupplierID=null,
        /** @var string|null */
        public ?string $SourceLabel=null,
        /** @var string|null */
        public ?string $SupplierName=null,
        /** @var int|null */
        public ?int $DispatchLaneRateID=null,
        /** @var float|null */
        public ?float $Miles=null,
        /** @var float|null */
        public ?float $RatePerTon=null,
        /** @var float|null */
        public ?float $RatePerLoad=null,
        /** @var float|null */
        public ?float $RatePerTonMile=null,
        /** @var float|null */
        public ?float $RatePerHour=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['DispatchSiteID'])) $this->DispatchSiteID = $o['DispatchSiteID'];
        if (isset($o['DispatchSupplierID'])) $this->DispatchSupplierID = $o['DispatchSupplierID'];
        if (isset($o['SourceLabel'])) $this->SourceLabel = $o['SourceLabel'];
        if (isset($o['SupplierName'])) $this->SupplierName = $o['SupplierName'];
        if (isset($o['DispatchLaneRateID'])) $this->DispatchLaneRateID = $o['DispatchLaneRateID'];
        if (isset($o['Miles'])) $this->Miles = $o['Miles'];
        if (isset($o['RatePerTon'])) $this->RatePerTon = $o['RatePerTon'];
        if (isset($o['RatePerLoad'])) $this->RatePerLoad = $o['RatePerLoad'];
        if (isset($o['RatePerTonMile'])) $this->RatePerTonMile = $o['RatePerTonMile'];
        if (isset($o['RatePerHour'])) $this->RatePerHour = $o['RatePerHour'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->DispatchSiteID)) $o['DispatchSiteID'] = $this->DispatchSiteID;
        if (isset($this->DispatchSupplierID)) $o['DispatchSupplierID'] = $this->DispatchSupplierID;
        if (isset($this->SourceLabel)) $o['SourceLabel'] = $this->SourceLabel;
        if (isset($this->SupplierName)) $o['SupplierName'] = $this->SupplierName;
        if (isset($this->DispatchLaneRateID)) $o['DispatchLaneRateID'] = $this->DispatchLaneRateID;
        if (isset($this->Miles)) $o['Miles'] = $this->Miles;
        if (isset($this->RatePerTon)) $o['RatePerTon'] = $this->RatePerTon;
        if (isset($this->RatePerLoad)) $o['RatePerLoad'] = $this->RatePerLoad;
        if (isset($this->RatePerTonMile)) $o['RatePerTonMile'] = $this->RatePerTonMile;
        if (isset($this->RatePerHour)) $o['RatePerHour'] = $this->RatePerHour;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchZoneRateView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Zone=null,
        /** @var int|null */
        public ?int $DispatchZoneRateID=null,
        /** @var float|null */
        public ?float $Base=null,
        /** @var float|null */
        public ?float $PerBag=null,
        /** @var float|null */
        public ?float $PremiumUpliftPct=null,
        /** @var int */
        public int $Drivers=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Zone'])) $this->Zone = $o['Zone'];
        if (isset($o['DispatchZoneRateID'])) $this->DispatchZoneRateID = $o['DispatchZoneRateID'];
        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'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Zone)) $o['Zone'] = $this->Zone;
        if (isset($this->DispatchZoneRateID)) $o['DispatchZoneRateID'] = $this->DispatchZoneRateID;
        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;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchPayPlanView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $DispatchPayPlanID=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Basis=null,
        /** @var float */
        public float $Rate=0.0,
        /** @var float|null */
        public ?float $Rate2=null,
        /** @var DateTime|null */
        public ?DateTime $EffectiveDate=null,
        /** @var bool|null */
        public ?bool $IsActive=null,
        /** @var int */
        public int $Drivers=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['DispatchPayPlanID'])) $this->DispatchPayPlanID = $o['DispatchPayPlanID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Basis'])) $this->Basis = $o['Basis'];
        if (isset($o['Rate'])) $this->Rate = $o['Rate'];
        if (isset($o['Rate2'])) $this->Rate2 = $o['Rate2'];
        if (isset($o['EffectiveDate'])) $this->EffectiveDate = JsonConverters::from('DateTime', $o['EffectiveDate']);
        if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
        if (isset($o['Drivers'])) $this->Drivers = $o['Drivers'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->DispatchPayPlanID)) $o['DispatchPayPlanID'] = $this->DispatchPayPlanID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Basis)) $o['Basis'] = $this->Basis;
        if (isset($this->Rate)) $o['Rate'] = $this->Rate;
        if (isset($this->Rate2)) $o['Rate2'] = $this->Rate2;
        if (isset($this->EffectiveDate)) $o['EffectiveDate'] = JsonConverters::to('DateTime', $this->EffectiveDate);
        if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
        if (isset($this->Drivers)) $o['Drivers'] = $this->Drivers;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchRatesResponse implements JsonSerializable
{
    public function __construct(
        /** @var DispatchRateConfigView|null */
        public ?DispatchRateConfigView $Config=null,
        /** @var array<DispatchLaneRateView>|null */
        public ?array $Lanes=null,
        /** @var array<DispatchZoneRateView>|null */
        public ?array $Zones=null,
        /** @var array<DispatchPayPlanView>|null */
        public ?array $Plans=null,
        /** @var int|null */
        public ?int $Repriced=null,
        /** @var int|null */
        public ?int $StillNoRevenue=null,
        /** @var int|null */
        public ?int $StillNoPay=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Config'])) $this->Config = JsonConverters::from('DispatchRateConfigView', $o['Config']);
        if (isset($o['Lanes'])) $this->Lanes = JsonConverters::fromArray('DispatchLaneRateView', $o['Lanes']);
        if (isset($o['Zones'])) $this->Zones = JsonConverters::fromArray('DispatchZoneRateView', $o['Zones']);
        if (isset($o['Plans'])) $this->Plans = JsonConverters::fromArray('DispatchPayPlanView', $o['Plans']);
        if (isset($o['Repriced'])) $this->Repriced = $o['Repriced'];
        if (isset($o['StillNoRevenue'])) $this->StillNoRevenue = $o['StillNoRevenue'];
        if (isset($o['StillNoPay'])) $this->StillNoPay = $o['StillNoPay'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Config)) $o['Config'] = JsonConverters::to('DispatchRateConfigView', $this->Config);
        if (isset($this->Lanes)) $o['Lanes'] = JsonConverters::toArray('DispatchLaneRateView', $this->Lanes);
        if (isset($this->Zones)) $o['Zones'] = JsonConverters::toArray('DispatchZoneRateView', $this->Zones);
        if (isset($this->Plans)) $o['Plans'] = JsonConverters::toArray('DispatchPayPlanView', $this->Plans);
        if (isset($this->Repriced)) $o['Repriced'] = $this->Repriced;
        if (isset($this->StillNoRevenue)) $o['StillNoRevenue'] = $this->StillNoRevenue;
        if (isset($this->StillNoPay)) $o['StillNoPay'] = $this->StillNoPay;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchLaneRateSaveRequest implements JsonSerializable
{
    public function __construct(
        /** @var DispatchLaneRateView|null */
        public ?DispatchLaneRateView $Lane=null
    ) {
    }

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

PHP DispatchLaneRateSaveRequest 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.

PUT /v1/dispatch/rates/lane HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Lane: 
	{
		DispatchSiteID: 0,
		DispatchSupplierID: 0,
		SourceLabel: String,
		SupplierName: String,
		DispatchLaneRateID: 0,
		Miles: 0,
		RatePerTon: 0,
		RatePerLoad: 0,
		RatePerTonMile: 0,
		RatePerHour: 0
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Config: 
	{
		FuelSurchargePct: 0,
		TransportPerMile: 0,
		TransportJobMin: 0,
		TransportEnclosedUpliftPct: 0,
		OdBase: 0,
		OdPerBag: 0,
		OdPremiumUpliftPct: 0,
		HaulBasis: String,
		Facility: String,
		Unit: String,
		LoadQty: 0
	},
	Lanes: 
	[
		{
			DispatchSiteID: 0,
			DispatchSupplierID: 0,
			SourceLabel: String,
			SupplierName: String,
			DispatchLaneRateID: 0,
			Miles: 0,
			RatePerTon: 0,
			RatePerLoad: 0,
			RatePerTonMile: 0,
			RatePerHour: 0
		}
	],
	Zones: 
	[
		{
			Zone: String,
			DispatchZoneRateID: 0,
			Base: 0,
			PerBag: 0,
			PremiumUpliftPct: 0,
			Drivers: 0
		}
	],
	Plans: 
	[
		{
			DispatchPayPlanID: 0,
			Name: String,
			Basis: String,
			Rate: 0,
			Rate2: 0,
			EffectiveDate: 0001-01-01,
			IsActive: False,
			Drivers: 0
		}
	],
	Repriced: 0,
	StillNoRevenue: 0,
	StillNoPay: 0,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}