GET | /v1/vehicle/MotabilityVehicles | Get motability eligible 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 GetMotabilityVehiclesRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
class Package implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Description=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Description'])) $this->Description = $o['Description'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Description)) $o['Description'] = $this->Description;
return empty($o) ? new class(){} : $o;
}
}
class MotabilityVehicle implements IPackages, IMotabilityFilterFields, JsonSerializable
{
public function __construct(
/** @var string */
public string $CommissionNumber='',
/** @var string */
public string $Vin='',
/** @var string|null */
public ?string $Vtn=null,
/** @var string */
public string $Description='',
/** @var string */
public string $Model='',
/** @var string */
public string $BM7NST='',
/** @var string */
public string $ModelYearCode='',
/** @var string */
public string $HalfModelYearCode='',
/** @var string */
public string $FullModelYearCode='',
/** @var string */
public string $Fuel='',
/** @var string */
public string $PrimaryPaintColourCode='',
/** @var string */
public string $Colour='',
/** @var string */
public string $PrimaryUpholsteryCode='',
/** @var string */
public string $Upholstery='',
/** @var array<Package>|null */
public ?array $Packages=null,
/** @var string */
public string $Account='',
/** @var string */
public string $Location='',
/** @var bool|null */
public ?bool $IsDisplayStock=null,
/** @var string */
public string $DisplayStockAgent='',
/** @var bool|null */
public ?bool $IsSellable=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CommissionNumber'])) $this->CommissionNumber = $o['CommissionNumber'];
if (isset($o['Vin'])) $this->Vin = $o['Vin'];
if (isset($o['Vtn'])) $this->Vtn = $o['Vtn'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Model'])) $this->Model = $o['Model'];
if (isset($o['BM7NST'])) $this->BM7NST = $o['BM7NST'];
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['Fuel'])) $this->Fuel = $o['Fuel'];
if (isset($o['PrimaryPaintColourCode'])) $this->PrimaryPaintColourCode = $o['PrimaryPaintColourCode'];
if (isset($o['Colour'])) $this->Colour = $o['Colour'];
if (isset($o['PrimaryUpholsteryCode'])) $this->PrimaryUpholsteryCode = $o['PrimaryUpholsteryCode'];
if (isset($o['Upholstery'])) $this->Upholstery = $o['Upholstery'];
if (isset($o['Packages'])) $this->Packages = JsonConverters::fromArray('Package', $o['Packages']);
if (isset($o['Account'])) $this->Account = $o['Account'];
if (isset($o['Location'])) $this->Location = $o['Location'];
if (isset($o['IsDisplayStock'])) $this->IsDisplayStock = $o['IsDisplayStock'];
if (isset($o['DisplayStockAgent'])) $this->DisplayStockAgent = $o['DisplayStockAgent'];
if (isset($o['IsSellable'])) $this->IsSellable = $o['IsSellable'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CommissionNumber)) $o['CommissionNumber'] = $this->CommissionNumber;
if (isset($this->Vin)) $o['Vin'] = $this->Vin;
if (isset($this->Vtn)) $o['Vtn'] = $this->Vtn;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Model)) $o['Model'] = $this->Model;
if (isset($this->BM7NST)) $o['BM7NST'] = $this->BM7NST;
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->Fuel)) $o['Fuel'] = $this->Fuel;
if (isset($this->PrimaryPaintColourCode)) $o['PrimaryPaintColourCode'] = $this->PrimaryPaintColourCode;
if (isset($this->Colour)) $o['Colour'] = $this->Colour;
if (isset($this->PrimaryUpholsteryCode)) $o['PrimaryUpholsteryCode'] = $this->PrimaryUpholsteryCode;
if (isset($this->Upholstery)) $o['Upholstery'] = $this->Upholstery;
if (isset($this->Packages)) $o['Packages'] = JsonConverters::toArray('Package', $this->Packages);
if (isset($this->Account)) $o['Account'] = $this->Account;
if (isset($this->Location)) $o['Location'] = $this->Location;
if (isset($this->IsDisplayStock)) $o['IsDisplayStock'] = $this->IsDisplayStock;
if (isset($this->DisplayStockAgent)) $o['DisplayStockAgent'] = $this->DisplayStockAgent;
if (isset($this->IsSellable)) $o['IsSellable'] = $this->IsSellable;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class MotabilityStockResponse implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): MotabilityStockResponse {
$to = new MotabilityStockResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var int */
public mixed $TotalVehicles=0,
/** @var array<MotabilityVehicle>|null */
public mixed $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('MotabilityVehicle', $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('MotabilityVehicle', $this->Vehicles);
return empty($o) ? new class(){} : $o;
}
}
PHP GetMotabilityVehiclesRequest DTOs
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/vehicle/MotabilityVehicles HTTP/1.1 Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { TotalVehicles: 0, Vehicles: [ { CommissionNumber: String, Vin: String, Vtn: String, Description: String, Model: String, BM7NST: String, ModelYearCode: String, HalfModelYearCode: String, FullModelYearCode: String.String, Fuel: String, PrimaryPaintColourCode: String, Colour: String, PrimaryUpholsteryCode: String, Upholstery: String, Account: String, Location: String, IsDisplayStock: False, DisplayStockAgent: String, IsSellable: False } ] }