| POST | /journey/end |
|---|
<?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, IHasDeviceInfo, 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='',
/** @description Latitude of the user making this request */
// @ApiMember(DataType="double", Description="Latitude of the user making this request")
/** @var float */
public float $latitude=0.0,
/** @description Longitude of the user making this request */
// @ApiMember(DataType="double", Description="Longitude of the user making this request")
/** @var float */
public float $longitude=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['apiKey'])) $this->apiKey = $o['apiKey'];
if (isset($o['latitude'])) $this->latitude = $o['latitude'];
if (isset($o['longitude'])) $this->longitude = $o['longitude'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->apiKey)) $o['apiKey'] = $this->apiKey;
if (isset($this->latitude)) $o['latitude'] = $this->latitude;
if (isset($this->longitude)) $o['longitude'] = $this->longitude;
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 JourneyPointData implements JsonSerializable
{
public function __construct(
/** @var float */
public float $latitude=0.0,
/** @var float */
public float $longitude=0.0,
/** @var string|null */
public ?string $address=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['latitude'])) $this->latitude = $o['latitude'];
if (isset($o['longitude'])) $this->longitude = $o['longitude'];
if (isset($o['address'])) $this->address = $o['address'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->latitude)) $o['latitude'] = $this->latitude;
if (isset($this->longitude)) $o['longitude'] = $this->longitude;
if (isset($this->address)) $o['address'] = $this->address;
return empty($o) ? new class(){} : $o;
}
}
class MeetingData implements JsonSerializable
{
public function __construct(
/** @var int */
public int $meetingId=0,
/** @var string|null */
public ?string $startTime=null,
/** @var string|null */
public ?string $arrivalTime=null,
/** @var string|null */
public ?string $leftTime=null,
/** @var string|null */
public ?string $duration=null,
/** @var bool|null */
public ?bool $showTimeFields=null,
/** @var string|null */
public ?string $arrivalStatus=null,
/** @var string|null */
public ?string $email=null,
/** @var bool|null */
public ?bool $hasEmail=null,
/** @var string|null */
public ?string $contactName=null,
/** @var float */
public float $latitude=0.0,
/** @var float */
public float $longitude=0.0,
/** @var string|null */
public ?string $location=null,
/** @var string|null */
public ?string $address=null,
/** @var string|null */
public ?string $subject=null,
/** @var string|null */
public ?string $description=null,
/** @var string|null */
public ?string $endTime=null,
/** @var string|null */
public ?string $company=null,
/** @var string|null */
public ?string $contactNumber=null,
/** @var bool|null */
public ?bool $hasContactNumber=null,
/** @var bool|null */
public ?bool $hasLocation=null,
/** @var string|null */
public ?string $setBy=null,
/** @var string|null */
public ?string $virtualOrInPerson=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['meetingId'])) $this->meetingId = $o['meetingId'];
if (isset($o['startTime'])) $this->startTime = $o['startTime'];
if (isset($o['arrivalTime'])) $this->arrivalTime = $o['arrivalTime'];
if (isset($o['leftTime'])) $this->leftTime = $o['leftTime'];
if (isset($o['duration'])) $this->duration = $o['duration'];
if (isset($o['showTimeFields'])) $this->showTimeFields = $o['showTimeFields'];
if (isset($o['arrivalStatus'])) $this->arrivalStatus = $o['arrivalStatus'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['hasEmail'])) $this->hasEmail = $o['hasEmail'];
if (isset($o['contactName'])) $this->contactName = $o['contactName'];
if (isset($o['latitude'])) $this->latitude = $o['latitude'];
if (isset($o['longitude'])) $this->longitude = $o['longitude'];
if (isset($o['location'])) $this->location = $o['location'];
if (isset($o['address'])) $this->address = $o['address'];
if (isset($o['subject'])) $this->subject = $o['subject'];
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['endTime'])) $this->endTime = $o['endTime'];
if (isset($o['company'])) $this->company = $o['company'];
if (isset($o['contactNumber'])) $this->contactNumber = $o['contactNumber'];
if (isset($o['hasContactNumber'])) $this->hasContactNumber = $o['hasContactNumber'];
if (isset($o['hasLocation'])) $this->hasLocation = $o['hasLocation'];
if (isset($o['setBy'])) $this->setBy = $o['setBy'];
if (isset($o['virtualOrInPerson'])) $this->virtualOrInPerson = $o['virtualOrInPerson'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->meetingId)) $o['meetingId'] = $this->meetingId;
if (isset($this->startTime)) $o['startTime'] = $this->startTime;
if (isset($this->arrivalTime)) $o['arrivalTime'] = $this->arrivalTime;
if (isset($this->leftTime)) $o['leftTime'] = $this->leftTime;
if (isset($this->duration)) $o['duration'] = $this->duration;
if (isset($this->showTimeFields)) $o['showTimeFields'] = $this->showTimeFields;
if (isset($this->arrivalStatus)) $o['arrivalStatus'] = $this->arrivalStatus;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->hasEmail)) $o['hasEmail'] = $this->hasEmail;
if (isset($this->contactName)) $o['contactName'] = $this->contactName;
if (isset($this->latitude)) $o['latitude'] = $this->latitude;
if (isset($this->longitude)) $o['longitude'] = $this->longitude;
if (isset($this->location)) $o['location'] = $this->location;
if (isset($this->address)) $o['address'] = $this->address;
if (isset($this->subject)) $o['subject'] = $this->subject;
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->endTime)) $o['endTime'] = $this->endTime;
if (isset($this->company)) $o['company'] = $this->company;
if (isset($this->contactNumber)) $o['contactNumber'] = $this->contactNumber;
if (isset($this->hasContactNumber)) $o['hasContactNumber'] = $this->hasContactNumber;
if (isset($this->hasLocation)) $o['hasLocation'] = $this->hasLocation;
if (isset($this->setBy)) $o['setBy'] = $this->setBy;
if (isset($this->virtualOrInPerson)) $o['virtualOrInPerson'] = $this->virtualOrInPerson;
return empty($o) ? new class(){} : $o;
}
}
class JourneyNoteData implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $note=null,
/** @var string|null */
public ?string $date=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['note'])) $this->note = $o['note'];
if (isset($o['date'])) $this->date = $o['date'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->note)) $o['note'] = $this->note;
if (isset($this->date)) $o['date'] = $this->date;
return empty($o) ? new class(){} : $o;
}
}
class JourneyData implements JsonSerializable
{
public function __construct(
/** @var int */
public int $journeyId=0,
/** @var string|null */
public ?string $title=null,
/** @var string|null */
public ?string $startTime=null,
/** @var string|null */
public ?string $endTime=null,
/** @var float */
public float $distance=0.0,
/** @var string|null */
public ?string $distanceFormatted=null,
/** @var string|null */
public ?string $routePolyline=null,
/** @var JourneyPointData|null */
public ?JourneyPointData $startPoint=null,
/** @var JourneyPointData|null */
public ?JourneyPointData $endPoint=null,
/** @var MeetingData|null */
public ?MeetingData $meetingData=null,
/** @var array<JourneyNoteData>|null */
public ?array $journeyNotes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['journeyId'])) $this->journeyId = $o['journeyId'];
if (isset($o['title'])) $this->title = $o['title'];
if (isset($o['startTime'])) $this->startTime = $o['startTime'];
if (isset($o['endTime'])) $this->endTime = $o['endTime'];
if (isset($o['distance'])) $this->distance = $o['distance'];
if (isset($o['distanceFormatted'])) $this->distanceFormatted = $o['distanceFormatted'];
if (isset($o['routePolyline'])) $this->routePolyline = $o['routePolyline'];
if (isset($o['startPoint'])) $this->startPoint = JsonConverters::from('JourneyPointData', $o['startPoint']);
if (isset($o['endPoint'])) $this->endPoint = JsonConverters::from('JourneyPointData', $o['endPoint']);
if (isset($o['meetingData'])) $this->meetingData = JsonConverters::from('MeetingData', $o['meetingData']);
if (isset($o['journeyNotes'])) $this->journeyNotes = JsonConverters::fromArray('JourneyNoteData', $o['journeyNotes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->journeyId)) $o['journeyId'] = $this->journeyId;
if (isset($this->title)) $o['title'] = $this->title;
if (isset($this->startTime)) $o['startTime'] = $this->startTime;
if (isset($this->endTime)) $o['endTime'] = $this->endTime;
if (isset($this->distance)) $o['distance'] = $this->distance;
if (isset($this->distanceFormatted)) $o['distanceFormatted'] = $this->distanceFormatted;
if (isset($this->routePolyline)) $o['routePolyline'] = $this->routePolyline;
if (isset($this->startPoint)) $o['startPoint'] = JsonConverters::to('JourneyPointData', $this->startPoint);
if (isset($this->endPoint)) $o['endPoint'] = JsonConverters::to('JourneyPointData', $this->endPoint);
if (isset($this->meetingData)) $o['meetingData'] = JsonConverters::to('MeetingData', $this->meetingData);
if (isset($this->journeyNotes)) $o['journeyNotes'] = JsonConverters::toArray('JourneyNoteData', $this->journeyNotes);
return empty($o) ? new class(){} : $o;
}
}
class EndJourneyResponse 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,
/** @var JourneyData|null */
public ?JourneyData $journey=null
) {
parent::__construct($description,$heading,$wasSuccessful,$modelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['journey'])) $this->journey = JsonConverters::from('JourneyData', $o['journey']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->journey)) $o['journey'] = JsonConverters::to('JourneyData', $this->journey);
return empty($o) ? new class(){} : $o;
}
}
class EndJourney extends ApiServiceRequest implements JsonSerializable
{
/**
* @param string $apiKey
* @param float $latitude
* @param float $longitude
*/
public function __construct(
string $apiKey='',
float $latitude=0.0,
float $longitude=0.0,
/** @var int */
public int $journeyId=0
) {
parent::__construct($apiKey,$latitude,$longitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['journeyId'])) $this->journeyId = $o['journeyId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->journeyId)) $o['journeyId'] = $this->journeyId;
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 /journey/end HTTP/1.1
Host: cochraneplus-api-dev.happen.zone
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"journeyId":0,"apiKey":"String","latitude":0,"longitude":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}