POST | /v1/{VehicleType}/Vehicle/CentralCsv | Filter central vehicle data for CSV |
---|
<?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 CsvVehicleData implements JsonSerializable
{
public function __construct(
// @DataMember(Name="Comm")
/** @var string */
public string $Comm='',
/** @var string */
public string $retailer='',
/** @var string */
public string $description='',
/** @var string */
public string $model='',
/** @var string */
public string $colour='',
// @DataMember(Name="Fuel Type")
/** @var string */
public string $Fuel_Type='',
// @DataMember(Name="Trans")
/** @var string */
public string $Trans='',
/** @var string */
public string $otr='',
// @DataMember(Name="Age (Days)")
/** @var int|null */
public ?int $Age__Days_=null,
// @DataMember(Name="Current Offer")
/** @var string */
public string $Current_Offer='',
// @DataMember(Name="Offer To")
/** @var string */
public string $Offer_To='',
// @DataMember(Name="Active Offers")
/** @var array<string>|null */
public ?array $Active_Offers=null,
// @DataMember(Name="Ncl Modified")
/** @var string */
public string $Ncl_Modified='',
// @DataMember(Name="Net Price")
/** @var string */
public string $Net_Price='',
/** @var string */
public string $vin='',
// @DataMember(Name="Electric Range")
/** @var int */
public int $Electric_Range=0,
// @DataMember(Name="Electric Consumption")
/** @var int */
public int $Electric_Consumption=0,
// @DataMember(Name="Special Info")
/** @var int */
public int $Special_Info=0,
// @DataMember(Name="Personalised")
/** @var int */
public int $Personalised=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Comm'])) $this->Comm = $o['Comm'];
if (isset($o['retailer'])) $this->retailer = $o['retailer'];
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['Fuel_Type'])) $this->Fuel_Type = $o['Fuel_Type'];
if (isset($o['Trans'])) $this->Trans = $o['Trans'];
if (isset($o['otr'])) $this->otr = $o['otr'];
if (isset($o['Age__Days_'])) $this->Age__Days_ = $o['Age__Days_'];
if (isset($o['Current_Offer'])) $this->Current_Offer = $o['Current_Offer'];
if (isset($o['Offer_To'])) $this->Offer_To = $o['Offer_To'];
if (isset($o['Active_Offers'])) $this->Active_Offers = JsonConverters::fromArray('string', $o['Active_Offers']);
if (isset($o['Ncl_Modified'])) $this->Ncl_Modified = $o['Ncl_Modified'];
if (isset($o['Net_Price'])) $this->Net_Price = $o['Net_Price'];
if (isset($o['vin'])) $this->vin = $o['vin'];
if (isset($o['Electric_Range'])) $this->Electric_Range = $o['Electric_Range'];
if (isset($o['Electric_Consumption'])) $this->Electric_Consumption = $o['Electric_Consumption'];
if (isset($o['Special_Info'])) $this->Special_Info = $o['Special_Info'];
if (isset($o['Personalised'])) $this->Personalised = $o['Personalised'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Comm)) $o['Comm'] = $this->Comm;
if (isset($this->retailer)) $o['retailer'] = $this->retailer;
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->Fuel_Type)) $o['Fuel_Type'] = $this->Fuel_Type;
if (isset($this->Trans)) $o['Trans'] = $this->Trans;
if (isset($this->otr)) $o['otr'] = $this->otr;
if (isset($this->Age__Days_)) $o['Age__Days_'] = $this->Age__Days_;
if (isset($this->Current_Offer)) $o['Current_Offer'] = $this->Current_Offer;
if (isset($this->Offer_To)) $o['Offer_To'] = $this->Offer_To;
if (isset($this->Active_Offers)) $o['Active_Offers'] = JsonConverters::toArray('string', $this->Active_Offers);
if (isset($this->Ncl_Modified)) $o['Ncl_Modified'] = $this->Ncl_Modified;
if (isset($this->Net_Price)) $o['Net_Price'] = $this->Net_Price;
if (isset($this->vin)) $o['vin'] = $this->vin;
if (isset($this->Electric_Range)) $o['Electric_Range'] = $this->Electric_Range;
if (isset($this->Electric_Consumption)) $o['Electric_Consumption'] = $this->Electric_Consumption;
if (isset($this->Special_Info)) $o['Special_Info'] = $this->Special_Info;
if (isset($this->Personalised)) $o['Personalised'] = $this->Personalised;
return empty($o) ? new class(){} : $o;
}
}
class CentralStockResponse implements JsonSerializable
{
public function __construct(
/** @var array<CsvVehicleData>|null */
public ?array $vehicles=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['vehicles'])) $this->vehicles = JsonConverters::fromArray('CsvVehicleData', $o['vehicles']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->vehicles)) $o['vehicles'] = JsonConverters::toArray('CsvVehicleData', $this->vehicles);
return empty($o) ? new class(){} : $o;
}
}
class CentralVehiclesCsvRequest implements IPost, JsonSerializable
{
public function __construct(
/** @var int */
public int $min=0,
/** @var int */
public int $max=0,
/** @var bool|null */
public ?bool $noPortArrivalDate=null,
/** @var string */
public string $vehicleType=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['min'])) $this->min = $o['min'];
if (isset($o['max'])) $this->max = $o['max'];
if (isset($o['noPortArrivalDate'])) $this->noPortArrivalDate = $o['noPortArrivalDate'];
if (isset($o['vehicleType'])) $this->vehicleType = $o['vehicleType'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->min)) $o['min'] = $this->min;
if (isset($this->max)) $o['max'] = $this->max;
if (isset($this->noPortArrivalDate)) $o['noPortArrivalDate'] = $this->noPortArrivalDate;
if (isset($this->vehicleType)) $o['vehicleType'] = $this->vehicleType;
return empty($o) ? new class(){} : $o;
}
}
PHP CentralVehiclesCsvRequest 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.
POST /v1/{VehicleType}/Vehicle/CentralCsv HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
min: 0,
max: 0,
noPortArrivalDate: False,
vehicleType: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { }