| POST | /quote/validatewaypoints | Validate the waypoints for a client. |
|---|
<?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(
/** @description Information about the response. */
// @ApiMember(Description="Information about the response.", IsRequired=true)
/** @var string */
public string $Description='',
/** @description Heading or summary of the response. */
// @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
/** @var string */
public string $Heading='',
/** @description Did the intended operation for this response complete successfully? */
// @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
/** @var bool|null */
public ?bool $WasSuccessful=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'];
}
/** @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;
return empty($o) ? new class(){} : $o;
}
}
class WaypointValidationInformation implements JsonSerializable
{
public function __construct(
/** @var int */
public int $WaypointNumber=0,
/** @var bool|null */
public ?bool $IsValid=null,
/** @var array<string>|null */
public ?array $ErrorMessages=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['WaypointNumber'])) $this->WaypointNumber = $o['WaypointNumber'];
if (isset($o['IsValid'])) $this->IsValid = $o['IsValid'];
if (isset($o['ErrorMessages'])) $this->ErrorMessages = JsonConverters::fromArray('string', $o['ErrorMessages']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->WaypointNumber)) $o['WaypointNumber'] = $this->WaypointNumber;
if (isset($this->IsValid)) $o['IsValid'] = $this->IsValid;
if (isset($this->ErrorMessages)) $o['ErrorMessages'] = JsonConverters::toArray('string', $this->ErrorMessages);
return empty($o) ? new class(){} : $o;
}
}
class LinkedWaypoint implements JsonSerializable
{
public function __construct(
/** @var int */
public int $FromWaypointNumber=0,
/** @var int */
public int $ToWaypointNumber=0,
/** @var float */
public float $FromLatitude=0.0,
/** @var float */
public float $FromLongitude=0.0,
/** @var float */
public float $ToLatitude=0.0,
/** @var float */
public float $ToLongitude=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['FromWaypointNumber'])) $this->FromWaypointNumber = $o['FromWaypointNumber'];
if (isset($o['ToWaypointNumber'])) $this->ToWaypointNumber = $o['ToWaypointNumber'];
if (isset($o['FromLatitude'])) $this->FromLatitude = $o['FromLatitude'];
if (isset($o['FromLongitude'])) $this->FromLongitude = $o['FromLongitude'];
if (isset($o['ToLatitude'])) $this->ToLatitude = $o['ToLatitude'];
if (isset($o['ToLongitude'])) $this->ToLongitude = $o['ToLongitude'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->FromWaypointNumber)) $o['FromWaypointNumber'] = $this->FromWaypointNumber;
if (isset($this->ToWaypointNumber)) $o['ToWaypointNumber'] = $this->ToWaypointNumber;
if (isset($this->FromLatitude)) $o['FromLatitude'] = $this->FromLatitude;
if (isset($this->FromLongitude)) $o['FromLongitude'] = $this->FromLongitude;
if (isset($this->ToLatitude)) $o['ToLatitude'] = $this->ToLatitude;
if (isset($this->ToLongitude)) $o['ToLongitude'] = $this->ToLongitude;
return empty($o) ? new class(){} : $o;
}
}
class WaypointQuoteInformation extends LinkedWaypoint implements JsonSerializable
{
/**
* @param int $FromWaypointNumber
* @param int $ToWaypointNumber
* @param float $FromLatitude
* @param float $FromLongitude
* @param float $ToLatitude
* @param float $ToLongitude
*/
public function __construct(
int $FromWaypointNumber=0,
int $ToWaypointNumber=0,
float $FromLatitude=0.0,
float $FromLongitude=0.0,
float $ToLatitude=0.0,
float $ToLongitude=0.0,
/** @description Distance between waypoints as a number */
// @ApiMember(Description="Distance between waypoints as a number")
/** @var float */
public float $Distance=0.0,
/** @description String formatted distance */
// @ApiMember(Description="String formatted distance")
/** @var string|null */
public ?string $DistanceValue=null,
/** @var bool|null */
public ?bool $WaypointValid=null,
/** @var string|null */
public ?string $Message=null,
/** @var array<string>|null */
public ?array $ErrorDetails=null,
/** @description Caculated price between waypoints excluding vat */
// @ApiMember(Description="Caculated price between waypoints excluding vat")
/** @var float */
public float $Price=0.0,
/** @description Price excluding vat formatted as a string rand value */
// @ApiMember(Description="Price excluding vat formatted as a string rand value")
/** @var string|null */
public ?string $PriceValue=null,
/** @description The price between waypoints including vat */
// @ApiMember(Description="The price between waypoints including vat")
/** @var float */
public float $PriceWithVAT=0.0,
/** @description The price including vat formatted as a rand value string */
// @ApiMember(Description="The price including vat formatted as a rand value string")
/** @var string|null */
public ?string $PriceValueWithVAT=null
) {
parent::__construct($FromWaypointNumber,$ToWaypointNumber,$FromLatitude,$FromLongitude,$ToLatitude,$ToLongitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Distance'])) $this->Distance = $o['Distance'];
if (isset($o['DistanceValue'])) $this->DistanceValue = $o['DistanceValue'];
if (isset($o['WaypointValid'])) $this->WaypointValid = $o['WaypointValid'];
if (isset($o['Message'])) $this->Message = $o['Message'];
if (isset($o['ErrorDetails'])) $this->ErrorDetails = JsonConverters::fromArray('string', $o['ErrorDetails']);
if (isset($o['Price'])) $this->Price = $o['Price'];
if (isset($o['PriceValue'])) $this->PriceValue = $o['PriceValue'];
if (isset($o['PriceWithVAT'])) $this->PriceWithVAT = $o['PriceWithVAT'];
if (isset($o['PriceValueWithVAT'])) $this->PriceValueWithVAT = $o['PriceValueWithVAT'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Distance)) $o['Distance'] = $this->Distance;
if (isset($this->DistanceValue)) $o['DistanceValue'] = $this->DistanceValue;
if (isset($this->WaypointValid)) $o['WaypointValid'] = $this->WaypointValid;
if (isset($this->Message)) $o['Message'] = $this->Message;
if (isset($this->ErrorDetails)) $o['ErrorDetails'] = JsonConverters::toArray('string', $this->ErrorDetails);
if (isset($this->Price)) $o['Price'] = $this->Price;
if (isset($this->PriceValue)) $o['PriceValue'] = $this->PriceValue;
if (isset($this->PriceWithVAT)) $o['PriceWithVAT'] = $this->PriceWithVAT;
if (isset($this->PriceValueWithVAT)) $o['PriceValueWithVAT'] = $this->PriceValueWithVAT;
return empty($o) ? new class(){} : $o;
}
}
class ValidateWaypointsResponse extends ApiServiceResponse implements JsonSerializable
{
/**
* @param string $Description
* @param string $Heading
* @param bool|null $WasSuccessful
*/
public function __construct(
string $Description='',
string $Heading='',
?bool $WasSuccessful=null,
/** @description List with validation information for each waypoint */
// @ApiMember(Description="List with validation information for each waypoint")
/** @var array<WaypointValidationInformation>|null */
public ?array $WaypointValidations=null,
/** @description The total distance for the order */
// @ApiMember(Description="The total distance for the order")
/** @var float */
public float $TotalDistance=0.0,
/** @description The total distance for the order, formatted as a string */
// @ApiMember(Description="The total distance for the order, formatted as a string")
/** @var string|null */
public ?string $TotalDistanceValue=null,
/** @description List of information for pricing etc between each waypoint */
// @ApiMember(Description="List of information for pricing etc between each waypoint")
/** @var array<WaypointQuoteInformation>|null */
public ?array $Waypoints=null,
/** @description Is there an issue for the waypoints details specified? */
// @ApiMember(Description="Is there an issue for the waypoints details specified?")
/** @var bool|null */
public ?bool $WaypointIssue=null
) {
parent::__construct($Description,$Heading,$WasSuccessful);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['WaypointValidations'])) $this->WaypointValidations = JsonConverters::fromArray('WaypointValidationInformation', $o['WaypointValidations']);
if (isset($o['TotalDistance'])) $this->TotalDistance = $o['TotalDistance'];
if (isset($o['TotalDistanceValue'])) $this->TotalDistanceValue = $o['TotalDistanceValue'];
if (isset($o['Waypoints'])) $this->Waypoints = JsonConverters::fromArray('WaypointQuoteInformation', $o['Waypoints']);
if (isset($o['WaypointIssue'])) $this->WaypointIssue = $o['WaypointIssue'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->WaypointValidations)) $o['WaypointValidations'] = JsonConverters::toArray('WaypointValidationInformation', $this->WaypointValidations);
if (isset($this->TotalDistance)) $o['TotalDistance'] = $this->TotalDistance;
if (isset($this->TotalDistanceValue)) $o['TotalDistanceValue'] = $this->TotalDistanceValue;
if (isset($this->Waypoints)) $o['Waypoints'] = JsonConverters::toArray('WaypointQuoteInformation', $this->Waypoints);
if (isset($this->WaypointIssue)) $o['WaypointIssue'] = $this->WaypointIssue;
return empty($o) ? new class(){} : $o;
}
}
class RequestQuoteWaypoint implements IRequestWaypoint, JsonSerializable
{
public function __construct(
/** @description Number of waypoint for ordering */
// @ApiMember(Description="Number of waypoint for ordering", IsRequired=true)
/** @var int */
public int $WaypointNumber=0,
/** @description Waypoint Latitude */
// @ApiMember(Description="Waypoint Latitude", IsRequired=true)
/** @var float */
public float $Latitude=0.0,
/** @description Waypoint Longitude */
// @ApiMember(Description="Waypoint Longitude", IsRequired=true)
/** @var float */
public float $Longitude=0.0,
/** @description Name of contact person at waypoint */
// @ApiMember(Description="Name of contact person at waypoint", IsRequired=true)
/** @var string */
public string $ContactName='',
/** @description Telephone number of contact person at waypoint */
// @ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)
/** @var string */
public string $ContactNumber='',
/** @description Instructions for driver to follow at waypoint */
// @ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)
/** @var string */
public string $DeliveryInstructions='',
/** @description Waypoint address */
// @ApiMember(Description="Waypoint address", IsRequired=true)
/** @var string */
public string $Address=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['WaypointNumber'])) $this->WaypointNumber = $o['WaypointNumber'];
if (isset($o['Latitude'])) $this->Latitude = $o['Latitude'];
if (isset($o['Longitude'])) $this->Longitude = $o['Longitude'];
if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
if (isset($o['ContactNumber'])) $this->ContactNumber = $o['ContactNumber'];
if (isset($o['DeliveryInstructions'])) $this->DeliveryInstructions = $o['DeliveryInstructions'];
if (isset($o['Address'])) $this->Address = $o['Address'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->WaypointNumber)) $o['WaypointNumber'] = $this->WaypointNumber;
if (isset($this->Latitude)) $o['Latitude'] = $this->Latitude;
if (isset($this->Longitude)) $o['Longitude'] = $this->Longitude;
if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
if (isset($this->ContactNumber)) $o['ContactNumber'] = $this->ContactNumber;
if (isset($this->DeliveryInstructions)) $o['DeliveryInstructions'] = $this->DeliveryInstructions;
if (isset($this->Address)) $o['Address'] = $this->Address;
return empty($o) ? new class(){} : $o;
}
}
class ValidateWaypoints extends ApiServiceRequest implements ILogRequest, JsonSerializable
{
/**
* @param string $ApiKey
*/
public function __construct(
string $ApiKey='',
/** @description Array of waypoints */
// @ApiMember(Description="Array of waypoints", IsRequired=true)
/** @var array<RequestQuoteWaypoint>|null */
public ?array $Waypoints=null,
/** @description Set this to true to prevent while testing the API. */
// @ApiMember(Description="Set this to true to prevent while testing the API.", IsRequired=true)
/** @var bool|null */
public ?bool $Test=null
) {
parent::__construct($ApiKey);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Waypoints'])) $this->Waypoints = JsonConverters::fromArray('RequestQuoteWaypoint', $o['Waypoints']);
if (isset($o['Test'])) $this->Test = $o['Test'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Waypoints)) $o['Waypoints'] = JsonConverters::toArray('RequestQuoteWaypoint', $this->Waypoints);
if (isset($this->Test)) $o['Test'] = $this->Test;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /quote/validatewaypoints HTTP/1.1
Host: 1fetch.api.client.prod.86degrees.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"Waypoints":[{"WaypointNumber":0,"Latitude":0,"Longitude":0,"ContactName":"String","ContactNumber":"String","DeliveryInstructions":"String","Address":"String"}],"Test":false,"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{Unable to show example output for type 'ValidateWaypointsResponse' using the custom 'other' filter}One or more errors occurred. (Object reference not set to an instance of an object.)