| PUT | /v1/VehicleSwap | Updates vehicle swap, order and back order records | This endpoint validates a swap vehicle and then calls an endpoint in the Agency API to update vehicle swap, order and back order and sends a message to OneAgent with the updated order vehicle and offers |
|---|
<?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 VehicleError implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Field='',
/** @var string */
public string $Message=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Field'])) $this->Field = $o['Field'];
if (isset($o['Message'])) $this->Message = $o['Message'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Field)) $o['Field'] = $this->Field;
if (isset($this->Message)) $o['Message'] = $this->Message;
return empty($o) ? new class(){} : $o;
}
}
class UpdateVehicleSwapResponse implements JsonSerializable
{
public function __construct(
/** @var array<VehicleError>|null */
public ?array $Errors=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Errors'])) $this->Errors = JsonConverters::fromArray('VehicleError', $o['Errors']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Errors)) $o['Errors'] = JsonConverters::toArray('VehicleError', $this->Errors);
return empty($o) ? new class(){} : $o;
}
}
class UpdateVehicleSwapRequest implements IPost, JsonSerializable
{
public function __construct(
/** @var string */
public string $VehicleSwapGuid='',
/** @var string */
public string $OrderGuid='',
/** @var string|null */
public ?string $BackOrderGuid=null,
/** @var string */
public string $GssnId='',
/** @var string */
public string $Agent='',
/** @var string */
public string $ExistingVin='',
/** @var string */
public string $SwapVin='',
/** @var int[]|null */
public ?array $PersonalisedItemOfferIds=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['VehicleSwapGuid'])) $this->VehicleSwapGuid = $o['VehicleSwapGuid'];
if (isset($o['OrderGuid'])) $this->OrderGuid = $o['OrderGuid'];
if (isset($o['BackOrderGuid'])) $this->BackOrderGuid = $o['BackOrderGuid'];
if (isset($o['GssnId'])) $this->GssnId = $o['GssnId'];
if (isset($o['Agent'])) $this->Agent = $o['Agent'];
if (isset($o['ExistingVin'])) $this->ExistingVin = $o['ExistingVin'];
if (isset($o['SwapVin'])) $this->SwapVin = $o['SwapVin'];
if (isset($o['PersonalisedItemOfferIds'])) $this->PersonalisedItemOfferIds = JsonConverters::fromArray('int', $o['PersonalisedItemOfferIds']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->VehicleSwapGuid)) $o['VehicleSwapGuid'] = $this->VehicleSwapGuid;
if (isset($this->OrderGuid)) $o['OrderGuid'] = $this->OrderGuid;
if (isset($this->BackOrderGuid)) $o['BackOrderGuid'] = $this->BackOrderGuid;
if (isset($this->GssnId)) $o['GssnId'] = $this->GssnId;
if (isset($this->Agent)) $o['Agent'] = $this->Agent;
if (isset($this->ExistingVin)) $o['ExistingVin'] = $this->ExistingVin;
if (isset($this->SwapVin)) $o['SwapVin'] = $this->SwapVin;
if (isset($this->PersonalisedItemOfferIds)) $o['PersonalisedItemOfferIds'] = JsonConverters::toArray('int', $this->PersonalisedItemOfferIds);
return empty($o) ? new class(){} : $o;
}
}
PHP UpdateVehicleSwapRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /v1/VehicleSwap HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/json
Content-Type: application/json
Content-Length: length
{"VehicleSwapGuid":"00000000000000000000000000000000","OrderGuid":"00000000000000000000000000000000","BackOrderGuid":"00000000000000000000000000000000","GssnId":"String","Agent":"String","ExistingVin":"String","SwapVin":"String","PersonalisedItemOfferIds":[0]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"Errors":[{"Field":"String","Message":"String"}]}