| POST | /galaxy/vehicle/update | Update a user's vehicle license. |
|---|
<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, JsonSerializable
{
public function __construct(
/** @description The API Key required for authentication */
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
/** @var string */
public string $ApiKey=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
return empty($o) ? new class(){} : $o;
}
}
class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Heading=null,
/** @var bool|null */
public ?bool $WasSuccessful=null,
/** @var Object|null */
public ?Object $ModelState=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Heading'])) $this->Heading = $o['Heading'];
if (isset($o['WasSuccessful'])) $this->WasSuccessful = $o['WasSuccessful'];
if (isset($o['ModelState'])) $this->ModelState = JsonConverters::from('Object', $o['ModelState']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Heading)) $o['Heading'] = $this->Heading;
if (isset($this->WasSuccessful)) $o['WasSuccessful'] = $this->WasSuccessful;
if (isset($this->ModelState)) $o['ModelState'] = JsonConverters::to('Object', $this->ModelState);
return empty($o) ? new class(){} : $o;
}
}
class VehicleData implements JsonSerializable
{
public function __construct(
/** @description The ID of the vehicle. */
// @ApiMember(Description="The ID of the vehicle.")
/** @var int */
public int $Id=0,
/** @description Whether the vehicle has license disk information. */
// @ApiMember(Description="Whether the vehicle has license disk information.")
/** @var bool|null */
public ?bool $HasLicense=null,
/** @description The vehicle license number. */
// @ApiMember(Description="The vehicle license number.")
/** @var string|null */
public ?string $LicenseNumber=null,
/** @description The vehicle registration number. */
// @ApiMember(Description="The vehicle registration number.")
/** @var string|null */
public ?string $RegistrationNumber=null,
/** @description The vehicle VIN number. */
// @ApiMember(Description="The vehicle VIN number.")
/** @var string|null */
public ?string $Vin=null,
/** @description The vehicle make. */
// @ApiMember(Description="The vehicle make.")
/** @var string|null */
public ?string $Make=null,
/** @description The vehicle series. */
// @ApiMember(Description="The vehicle series.")
/** @var string|null */
public ?string $Series=null,
/** @description The vehicle colour. */
// @ApiMember(Description="The vehicle colour.")
/** @var string|null */
public ?string $Colour=null,
/** @description The vehicle license expiry date in ISO 8601 format. */
// @ApiMember(Description="The vehicle license expiry date in ISO 8601 format.")
/** @var string|null */
public ?string $Expiry=null,
/** @description True if this vehicle's licence expiring soon. */
// @ApiMember(Description="True if this vehicle's licence expiring soon.")
/** @var bool|null */
public ?bool $ExpiresSoon=null,
/** @description True if this vehicle's license expired. */
// @ApiMember(Description="True if this vehicle's license expired.")
/** @var bool|null */
public ?bool $Expired=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['HasLicense'])) $this->HasLicense = $o['HasLicense'];
if (isset($o['LicenseNumber'])) $this->LicenseNumber = $o['LicenseNumber'];
if (isset($o['RegistrationNumber'])) $this->RegistrationNumber = $o['RegistrationNumber'];
if (isset($o['Vin'])) $this->Vin = $o['Vin'];
if (isset($o['Make'])) $this->Make = $o['Make'];
if (isset($o['Series'])) $this->Series = $o['Series'];
if (isset($o['Colour'])) $this->Colour = $o['Colour'];
if (isset($o['Expiry'])) $this->Expiry = $o['Expiry'];
if (isset($o['ExpiresSoon'])) $this->ExpiresSoon = $o['ExpiresSoon'];
if (isset($o['Expired'])) $this->Expired = $o['Expired'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->HasLicense)) $o['HasLicense'] = $this->HasLicense;
if (isset($this->LicenseNumber)) $o['LicenseNumber'] = $this->LicenseNumber;
if (isset($this->RegistrationNumber)) $o['RegistrationNumber'] = $this->RegistrationNumber;
if (isset($this->Vin)) $o['Vin'] = $this->Vin;
if (isset($this->Make)) $o['Make'] = $this->Make;
if (isset($this->Series)) $o['Series'] = $this->Series;
if (isset($this->Colour)) $o['Colour'] = $this->Colour;
if (isset($this->Expiry)) $o['Expiry'] = $this->Expiry;
if (isset($this->ExpiresSoon)) $o['ExpiresSoon'] = $this->ExpiresSoon;
if (isset($this->Expired)) $o['Expired'] = $this->Expired;
return empty($o) ? new class(){} : $o;
}
}
class UpdateVehicleLicenseResponse extends ApiServiceResponse implements JsonSerializable
{
/**
* @param string|null $Description
* @param string|null $Heading
* @param bool|null $WasSuccessful
* @param Object|null $ModelState
*/
public function __construct(
?string $Description=null,
?string $Heading=null,
?bool $WasSuccessful=null,
?Object $ModelState=null,
/** @description The newly update vehicle information. */
// @ApiMember(Description="The newly update vehicle information.", IsRequired=true)
/** @var VehicleData|null */
public ?VehicleData $Vehicle=null
) {
parent::__construct($Description,$Heading,$WasSuccessful,$ModelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Vehicle'])) $this->Vehicle = JsonConverters::from('VehicleData', $o['Vehicle']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Vehicle)) $o['Vehicle'] = JsonConverters::to('VehicleData', $this->Vehicle);
return empty($o) ? new class(){} : $o;
}
}
class UpdateVehicleLicense extends ApiServiceRequest implements JsonSerializable
{
/**
* @param string $ApiKey
*/
public function __construct(
string $ApiKey='',
/** @description ID Number of the user making this request. */
// @ApiMember(Description="ID Number of the user making this request.", IsRequired=true)
/** @var string */
public string $IdNumber='',
/** @description The scanned vehicle license disk information. */
// @ApiMember(Description="The scanned vehicle license disk information.", IsRequired=true)
/** @var VehicleData|null */
public ?VehicleData $Vehicle=null
) {
parent::__construct($ApiKey);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['IdNumber'])) $this->IdNumber = $o['IdNumber'];
if (isset($o['Vehicle'])) $this->Vehicle = JsonConverters::from('VehicleData', $o['Vehicle']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->IdNumber)) $o['IdNumber'] = $this->IdNumber;
if (isset($this->Vehicle)) $o['Vehicle'] = JsonConverters::to('VehicleData', $this->Vehicle);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /galaxy/vehicle/update HTTP/1.1
Host: galaxymobile.api.client.prod.86degrees.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"IdNumber":"String","Vehicle":{"Id":0,"HasLicense":false,"LicenseNumber":"String","RegistrationNumber":"String","Vin":"String","Make":"String","Series":"String","Colour":"String","Expiry":"String","ExpiresSoon":false,"Expired":false},"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"Vehicle":{"Id":0,"HasLicense":false,"LicenseNumber":"String","RegistrationNumber":"String","Vin":"String","Make":"String","Series":"String","Colour":"String","Expiry":"String","ExpiresSoon":false,"Expired":false},"Description":"String","Heading":"String","WasSuccessful":false,"ModelState":{}}