Mercedes.VehicleManagement.API

<back to all web services

AllAvailableVehiclesRequest

Vehicle
Requires Authentication
The following routes are available for this service:
GET/v1/AllAvailableVehicles/{vehicleType}/{includeBackOrderAccounts}Get all available vehicles
<?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 BaseAllAvailableVehiclesRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $vehicleType='',
        /** @var bool|null */
        public ?bool $includeBackOrderAccounts=null
    ) {
    }

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

class BasicBackOrderVehicle implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $commissionNumber='',
        /** @var string */
        public string $description='',
        /** @var string */
        public string $model='',
        /** @var string */
        public string $colour='',
        /** @var string */
        public string $fuelType='',
        /** @var string */
        public string $transmission='',
        /** @var string */
        public string $packages='',
        /** @var string */
        public string $lines='',
        /** @var string */
        public string $upholstery='',
        /** @var string */
        public string $emissionCombined='',
        /** @var float */
        public float $actualPrice=0.0,
        /** @var string */
        public string $usageCode='',
        /** @var bool|null */
        public ?bool $secured=null,
        /** @var string */
        public string $account='',
        /** @var string|null */
        public ?string $securedTime=null,
        /** @var string|null */
        public ?string $securedReason=null,
        /** @var string|null */
        public ?string $securedByGasId=null,
        /** @var DateTime|null */
        public ?DateTime $securedDate=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['commissionNumber'])) $this->commissionNumber = $o['commissionNumber'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['model'])) $this->model = $o['model'];
        if (isset($o['colour'])) $this->colour = $o['colour'];
        if (isset($o['fuelType'])) $this->fuelType = $o['fuelType'];
        if (isset($o['transmission'])) $this->transmission = $o['transmission'];
        if (isset($o['packages'])) $this->packages = $o['packages'];
        if (isset($o['lines'])) $this->lines = $o['lines'];
        if (isset($o['upholstery'])) $this->upholstery = $o['upholstery'];
        if (isset($o['emissionCombined'])) $this->emissionCombined = $o['emissionCombined'];
        if (isset($o['actualPrice'])) $this->actualPrice = $o['actualPrice'];
        if (isset($o['usageCode'])) $this->usageCode = $o['usageCode'];
        if (isset($o['secured'])) $this->secured = $o['secured'];
        if (isset($o['account'])) $this->account = $o['account'];
        if (isset($o['securedTime'])) $this->securedTime = $o['securedTime'];
        if (isset($o['securedReason'])) $this->securedReason = $o['securedReason'];
        if (isset($o['securedByGasId'])) $this->securedByGasId = $o['securedByGasId'];
        if (isset($o['securedDate'])) $this->securedDate = JsonConverters::from('DateTime', $o['securedDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->commissionNumber)) $o['commissionNumber'] = $this->commissionNumber;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->model)) $o['model'] = $this->model;
        if (isset($this->colour)) $o['colour'] = $this->colour;
        if (isset($this->fuelType)) $o['fuelType'] = $this->fuelType;
        if (isset($this->transmission)) $o['transmission'] = $this->transmission;
        if (isset($this->packages)) $o['packages'] = $this->packages;
        if (isset($this->lines)) $o['lines'] = $this->lines;
        if (isset($this->upholstery)) $o['upholstery'] = $this->upholstery;
        if (isset($this->emissionCombined)) $o['emissionCombined'] = $this->emissionCombined;
        if (isset($this->actualPrice)) $o['actualPrice'] = $this->actualPrice;
        if (isset($this->usageCode)) $o['usageCode'] = $this->usageCode;
        if (isset($this->secured)) $o['secured'] = $this->secured;
        if (isset($this->account)) $o['account'] = $this->account;
        if (isset($this->securedTime)) $o['securedTime'] = $this->securedTime;
        if (isset($this->securedReason)) $o['securedReason'] = $this->securedReason;
        if (isset($this->securedByGasId)) $o['securedByGasId'] = $this->securedByGasId;
        if (isset($this->securedDate)) $o['securedDate'] = JsonConverters::to('DateTime', $this->securedDate);
        return empty($o) ? new class(){} : $o;
    }
}

class BackOrderVehicle extends BasicBackOrderVehicle implements JsonSerializable
{
    /**
     * @param string $commissionNumber
     * @param string $description
     * @param string $model
     * @param string $colour
     * @param string $fuelType
     * @param string $transmission
     * @param string $packages
     * @param string $lines
     * @param string $upholstery
     * @param string $emissionCombined
     * @param float $actualPrice
     * @param string $usageCode
     * @param bool|null $secured
     * @param string $account
     * @param string|null $securedTime
     * @param string|null $securedReason
     * @param string|null $securedByGasId
     * @param DateTime|null $securedDate
     */
    public function __construct(
        string $commissionNumber='',
        string $description='',
        string $model='',
        string $colour='',
        string $fuelType='',
        string $transmission='',
        string $packages='',
        string $lines='',
        string $upholstery='',
        string $emissionCombined='',
        float $actualPrice=0.0,
        string $usageCode='',
        ?bool $secured=null,
        string $account='',
        ?string $securedTime=null,
        ?string $securedReason=null,
        ?string $securedByGasId=null,
        ?DateTime $securedDate=null,
        /** @var int */
        public int $id=0,
        /** @var string */
        public string $vin='',
        /** @var string */
        public string $vehicleType='',
        /** @var string */
        public string $vid='',
        /** @var string */
        public string $fin='',
        /** @var string */
        public string $chassisNumber='',
        /** @var string */
        public string $modelYear='',
        /** @var string */
        public string $modelYearCode='',
        /** @var string */
        public string $halfModelYearCode='',
        /** @var string */
        public string $fullModelYearCode='',
        /** @var string */
        public string $salesDescriptionLong='',
        /** @var string */
        public string $vehicleClass='',
        /** @var float */
        public float $retailPrice_ExVAT=0.0,
        /** @var float */
        public float $retailPrice_IncVAT=0.0,
        /** @var float */
        public float $otr=0.0,
        /** @var string */
        public string $bodyStyle='',
        /** @var string */
        public string $productRange='',
        /** @var string */
        public string $engine='',
        /** @var bool|null */
        public ?bool $isAMG=null,
        /** @var string */
        public string $colourGroup='',
        /** @var string */
        public string $upholsteryCode='',
        /** @var string */
        public string $nst='',
        /** @var string */
        public string $bm7NST='',
        /** @var float|null */
        public ?float $acceleration=null,
        /** @var int|null */
        public ?int $bootCapacity=null,
        /** @var float|null */
        public ?float $topSpeed=null,
        /** @var string */
        public string $driveConcept='',
        /** @var float|null */
        public ?float $combustionPowerHp=null,
        /** @var float|null */
        public ?float $electricPowerKw=null,
        /** @var float|null */
        public ?float $electricPowerHp=null,
        /** @var float|null */
        public ?float $combinedPowerKw=null,
        /** @var float|null */
        public ?float $combinedPowerHP=null,
        /** @var float|null */
        public ?float $electricRange=null,
        /** @var float|null */
        public ?float $electricConsumption=null,
        /** @var float|null */
        public ?float $emission=null,
        /** @var string */
        public string $emissionDirective='',
        /** @var string */
        public string $emissionExtraUrban='',
        /** @var string */
        public string $emissionUrban='',
        /** @var string */
        public string $energyEfficiencyClass='',
        /** @var string */
        public string $wltpEmissionCombined='',
        /** @var string */
        public string $wltpCombined='',
        /** @var string */
        public string $wltpLow='',
        /** @var string */
        public string $wltpMedium='',
        /** @var string */
        public string $wltpHigh='',
        /** @var string */
        public string $wltpExtraHigh='',
        /** @var DateTime|null */
        public ?DateTime $productionDate=null,
        /** @var DateTime|null */
        public ?DateTime $portArrivalDate=null,
        /** @var DateTime */
        public DateTime $creationDate=new DateTime(),
        /** @var DateTime|null */
        public ?DateTime $lastUpdated=null,
        /** @var bool|null */
        public ?bool $isDisplayStock=null,
        /** @var string */
        public string $displayStockAgent='',
        /** @var bool|null */
        public ?bool $isSpecialistCar=null,
        /** @var string */
        public string $location='',
        /** @var string */
        public string $cesarIdShipToParty='',
        /** @var bool|null */
        public ?bool $isSellable=null,
        /** @var bool|null */
        public ?bool $underOffer=null,
        /** @var string */
        public string $baumuster=''
    ) {
        parent::__construct($commissionNumber,$description,$model,$colour,$fuelType,$transmission,$packages,$lines,$upholstery,$emissionCombined,$actualPrice,$usageCode,$secured,$account,$securedTime,$securedReason,$securedByGasId,$securedDate);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['vin'])) $this->vin = $o['vin'];
        if (isset($o['vehicleType'])) $this->vehicleType = $o['vehicleType'];
        if (isset($o['vid'])) $this->vid = $o['vid'];
        if (isset($o['fin'])) $this->fin = $o['fin'];
        if (isset($o['chassisNumber'])) $this->chassisNumber = $o['chassisNumber'];
        if (isset($o['modelYear'])) $this->modelYear = $o['modelYear'];
        if (isset($o['modelYearCode'])) $this->modelYearCode = $o['modelYearCode'];
        if (isset($o['halfModelYearCode'])) $this->halfModelYearCode = $o['halfModelYearCode'];
        if (isset($o['fullModelYearCode'])) $this->fullModelYearCode = $o['fullModelYearCode'];
        if (isset($o['salesDescriptionLong'])) $this->salesDescriptionLong = $o['salesDescriptionLong'];
        if (isset($o['vehicleClass'])) $this->vehicleClass = $o['vehicleClass'];
        if (isset($o['retailPrice_ExVAT'])) $this->retailPrice_ExVAT = $o['retailPrice_ExVAT'];
        if (isset($o['retailPrice_IncVAT'])) $this->retailPrice_IncVAT = $o['retailPrice_IncVAT'];
        if (isset($o['otr'])) $this->otr = $o['otr'];
        if (isset($o['bodyStyle'])) $this->bodyStyle = $o['bodyStyle'];
        if (isset($o['productRange'])) $this->productRange = $o['productRange'];
        if (isset($o['engine'])) $this->engine = $o['engine'];
        if (isset($o['isAMG'])) $this->isAMG = $o['isAMG'];
        if (isset($o['colourGroup'])) $this->colourGroup = $o['colourGroup'];
        if (isset($o['upholsteryCode'])) $this->upholsteryCode = $o['upholsteryCode'];
        if (isset($o['nst'])) $this->nst = $o['nst'];
        if (isset($o['bm7NST'])) $this->bm7NST = $o['bm7NST'];
        if (isset($o['acceleration'])) $this->acceleration = $o['acceleration'];
        if (isset($o['bootCapacity'])) $this->bootCapacity = $o['bootCapacity'];
        if (isset($o['topSpeed'])) $this->topSpeed = $o['topSpeed'];
        if (isset($o['driveConcept'])) $this->driveConcept = $o['driveConcept'];
        if (isset($o['combustionPowerHp'])) $this->combustionPowerHp = $o['combustionPowerHp'];
        if (isset($o['electricPowerKw'])) $this->electricPowerKw = $o['electricPowerKw'];
        if (isset($o['electricPowerHp'])) $this->electricPowerHp = $o['electricPowerHp'];
        if (isset($o['combinedPowerKw'])) $this->combinedPowerKw = $o['combinedPowerKw'];
        if (isset($o['combinedPowerHP'])) $this->combinedPowerHP = $o['combinedPowerHP'];
        if (isset($o['electricRange'])) $this->electricRange = $o['electricRange'];
        if (isset($o['electricConsumption'])) $this->electricConsumption = $o['electricConsumption'];
        if (isset($o['emission'])) $this->emission = $o['emission'];
        if (isset($o['emissionDirective'])) $this->emissionDirective = $o['emissionDirective'];
        if (isset($o['emissionExtraUrban'])) $this->emissionExtraUrban = $o['emissionExtraUrban'];
        if (isset($o['emissionUrban'])) $this->emissionUrban = $o['emissionUrban'];
        if (isset($o['energyEfficiencyClass'])) $this->energyEfficiencyClass = $o['energyEfficiencyClass'];
        if (isset($o['wltpEmissionCombined'])) $this->wltpEmissionCombined = $o['wltpEmissionCombined'];
        if (isset($o['wltpCombined'])) $this->wltpCombined = $o['wltpCombined'];
        if (isset($o['wltpLow'])) $this->wltpLow = $o['wltpLow'];
        if (isset($o['wltpMedium'])) $this->wltpMedium = $o['wltpMedium'];
        if (isset($o['wltpHigh'])) $this->wltpHigh = $o['wltpHigh'];
        if (isset($o['wltpExtraHigh'])) $this->wltpExtraHigh = $o['wltpExtraHigh'];
        if (isset($o['productionDate'])) $this->productionDate = JsonConverters::from('DateTime', $o['productionDate']);
        if (isset($o['portArrivalDate'])) $this->portArrivalDate = JsonConverters::from('DateTime', $o['portArrivalDate']);
        if (isset($o['creationDate'])) $this->creationDate = JsonConverters::from('DateTime', $o['creationDate']);
        if (isset($o['lastUpdated'])) $this->lastUpdated = JsonConverters::from('DateTime', $o['lastUpdated']);
        if (isset($o['isDisplayStock'])) $this->isDisplayStock = $o['isDisplayStock'];
        if (isset($o['displayStockAgent'])) $this->displayStockAgent = $o['displayStockAgent'];
        if (isset($o['isSpecialistCar'])) $this->isSpecialistCar = $o['isSpecialistCar'];
        if (isset($o['location'])) $this->location = $o['location'];
        if (isset($o['cesarIdShipToParty'])) $this->cesarIdShipToParty = $o['cesarIdShipToParty'];
        if (isset($o['isSellable'])) $this->isSellable = $o['isSellable'];
        if (isset($o['underOffer'])) $this->underOffer = $o['underOffer'];
        if (isset($o['baumuster'])) $this->baumuster = $o['baumuster'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->vin)) $o['vin'] = $this->vin;
        if (isset($this->vehicleType)) $o['vehicleType'] = $this->vehicleType;
        if (isset($this->vid)) $o['vid'] = $this->vid;
        if (isset($this->fin)) $o['fin'] = $this->fin;
        if (isset($this->chassisNumber)) $o['chassisNumber'] = $this->chassisNumber;
        if (isset($this->modelYear)) $o['modelYear'] = $this->modelYear;
        if (isset($this->modelYearCode)) $o['modelYearCode'] = $this->modelYearCode;
        if (isset($this->halfModelYearCode)) $o['halfModelYearCode'] = $this->halfModelYearCode;
        if (isset($this->fullModelYearCode)) $o['fullModelYearCode'] = $this->fullModelYearCode;
        if (isset($this->salesDescriptionLong)) $o['salesDescriptionLong'] = $this->salesDescriptionLong;
        if (isset($this->vehicleClass)) $o['vehicleClass'] = $this->vehicleClass;
        if (isset($this->retailPrice_ExVAT)) $o['retailPrice_ExVAT'] = $this->retailPrice_ExVAT;
        if (isset($this->retailPrice_IncVAT)) $o['retailPrice_IncVAT'] = $this->retailPrice_IncVAT;
        if (isset($this->otr)) $o['otr'] = $this->otr;
        if (isset($this->bodyStyle)) $o['bodyStyle'] = $this->bodyStyle;
        if (isset($this->productRange)) $o['productRange'] = $this->productRange;
        if (isset($this->engine)) $o['engine'] = $this->engine;
        if (isset($this->isAMG)) $o['isAMG'] = $this->isAMG;
        if (isset($this->colourGroup)) $o['colourGroup'] = $this->colourGroup;
        if (isset($this->upholsteryCode)) $o['upholsteryCode'] = $this->upholsteryCode;
        if (isset($this->nst)) $o['nst'] = $this->nst;
        if (isset($this->bm7NST)) $o['bm7NST'] = $this->bm7NST;
        if (isset($this->acceleration)) $o['acceleration'] = $this->acceleration;
        if (isset($this->bootCapacity)) $o['bootCapacity'] = $this->bootCapacity;
        if (isset($this->topSpeed)) $o['topSpeed'] = $this->topSpeed;
        if (isset($this->driveConcept)) $o['driveConcept'] = $this->driveConcept;
        if (isset($this->combustionPowerHp)) $o['combustionPowerHp'] = $this->combustionPowerHp;
        if (isset($this->electricPowerKw)) $o['electricPowerKw'] = $this->electricPowerKw;
        if (isset($this->electricPowerHp)) $o['electricPowerHp'] = $this->electricPowerHp;
        if (isset($this->combinedPowerKw)) $o['combinedPowerKw'] = $this->combinedPowerKw;
        if (isset($this->combinedPowerHP)) $o['combinedPowerHP'] = $this->combinedPowerHP;
        if (isset($this->electricRange)) $o['electricRange'] = $this->electricRange;
        if (isset($this->electricConsumption)) $o['electricConsumption'] = $this->electricConsumption;
        if (isset($this->emission)) $o['emission'] = $this->emission;
        if (isset($this->emissionDirective)) $o['emissionDirective'] = $this->emissionDirective;
        if (isset($this->emissionExtraUrban)) $o['emissionExtraUrban'] = $this->emissionExtraUrban;
        if (isset($this->emissionUrban)) $o['emissionUrban'] = $this->emissionUrban;
        if (isset($this->energyEfficiencyClass)) $o['energyEfficiencyClass'] = $this->energyEfficiencyClass;
        if (isset($this->wltpEmissionCombined)) $o['wltpEmissionCombined'] = $this->wltpEmissionCombined;
        if (isset($this->wltpCombined)) $o['wltpCombined'] = $this->wltpCombined;
        if (isset($this->wltpLow)) $o['wltpLow'] = $this->wltpLow;
        if (isset($this->wltpMedium)) $o['wltpMedium'] = $this->wltpMedium;
        if (isset($this->wltpHigh)) $o['wltpHigh'] = $this->wltpHigh;
        if (isset($this->wltpExtraHigh)) $o['wltpExtraHigh'] = $this->wltpExtraHigh;
        if (isset($this->productionDate)) $o['productionDate'] = JsonConverters::to('DateTime', $this->productionDate);
        if (isset($this->portArrivalDate)) $o['portArrivalDate'] = JsonConverters::to('DateTime', $this->portArrivalDate);
        if (isset($this->creationDate)) $o['creationDate'] = JsonConverters::to('DateTime', $this->creationDate);
        if (isset($this->lastUpdated)) $o['lastUpdated'] = JsonConverters::to('DateTime', $this->lastUpdated);
        if (isset($this->isDisplayStock)) $o['isDisplayStock'] = $this->isDisplayStock;
        if (isset($this->displayStockAgent)) $o['displayStockAgent'] = $this->displayStockAgent;
        if (isset($this->isSpecialistCar)) $o['isSpecialistCar'] = $this->isSpecialistCar;
        if (isset($this->location)) $o['location'] = $this->location;
        if (isset($this->cesarIdShipToParty)) $o['cesarIdShipToParty'] = $this->cesarIdShipToParty;
        if (isset($this->isSellable)) $o['isSellable'] = $this->isSellable;
        if (isset($this->underOffer)) $o['underOffer'] = $this->underOffer;
        if (isset($this->baumuster)) $o['baumuster'] = $this->baumuster;
        return empty($o) ? new class(){} : $o;
    }
}

class StockManagementResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $totalVehicles=0,
        /** @var array<BackOrderVehicle>|null */
        public ?array $vehicles=null
    ) {
    }

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

class AllAvailableVehiclesRequest extends BaseAllAvailableVehiclesRequest implements IGet, JsonSerializable
{
    /**
     * @param string $vehicleType
     * @param bool|null $includeBackOrderAccounts
     */
    public function __construct(
        string $vehicleType='',
        ?bool $includeBackOrderAccounts=null
    ) {
        parent::__construct($vehicleType,$includeBackOrderAccounts);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

PHP AllAvailableVehiclesRequest DTOs

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

HTTP + CSV

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

GET /v1/AllAvailableVehicles/{vehicleType}/{includeBackOrderAccounts} HTTP/1.1 
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"totalVehicles":0,"vehicles":null}