| GET | /template-approval/detail |
|---|
<?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 OnTheMoveMeetingListItem implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string|null */
public ?string $company=null,
/** @var string|null */
public ?string $subject=null,
/** @var string|null */
public ?string $startDate=null,
/** @var string|null */
public ?string $arrivedDate=null,
/** @var string|null */
public ?string $leftDate=null,
/** @var string|null */
public ?string $duration=null,
/** @var float */
public float $latitude=0.0,
/** @var float */
public float $longitude=0.0,
/** @var string|null */
public ?string $contactName=null,
/** @var string|null */
public ?string $virtualOrInPerson=null,
/** @var string|null */
public ?string $meetingSetBy=null,
/** @var string|null */
public ?string $zoomUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['company'])) $this->company = $o['company'];
if (isset($o['subject'])) $this->subject = $o['subject'];
if (isset($o['startDate'])) $this->startDate = $o['startDate'];
if (isset($o['arrivedDate'])) $this->arrivedDate = $o['arrivedDate'];
if (isset($o['leftDate'])) $this->leftDate = $o['leftDate'];
if (isset($o['duration'])) $this->duration = $o['duration'];
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['virtualOrInPerson'])) $this->virtualOrInPerson = $o['virtualOrInPerson'];
if (isset($o['meetingSetBy'])) $this->meetingSetBy = $o['meetingSetBy'];
if (isset($o['zoomUrl'])) $this->zoomUrl = $o['zoomUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->company)) $o['company'] = $this->company;
if (isset($this->subject)) $o['subject'] = $this->subject;
if (isset($this->startDate)) $o['startDate'] = $this->startDate;
if (isset($this->arrivedDate)) $o['arrivedDate'] = $this->arrivedDate;
if (isset($this->leftDate)) $o['leftDate'] = $this->leftDate;
if (isset($this->duration)) $o['duration'] = $this->duration;
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->virtualOrInPerson)) $o['virtualOrInPerson'] = $this->virtualOrInPerson;
if (isset($this->meetingSetBy)) $o['meetingSetBy'] = $this->meetingSetBy;
if (isset($this->zoomUrl)) $o['zoomUrl'] = $this->zoomUrl;
return empty($o) ? new class(){} : $o;
}
}
class JourneyPoints implements JsonSerializable
{
public function __construct(
/** @var float */
public float $latitude=0.0,
/** @var float */
public float $longitude=0.0,
/** @var string|null */
public ?string $time=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['time'])) $this->time = $o['time'];
}
/** @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->time)) $o['time'] = $this->time;
return empty($o) ? new class(){} : $o;
}
}
class OnTheMoveDetailResponse 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 string|null */
public ?string $systemUserName=null,
/** @var array<OnTheMoveMeetingListItem>|null */
public ?array $meetings=null,
/** @var array<JourneyPoints>|null */
public ?array $points=null
) {
parent::__construct($description,$heading,$wasSuccessful,$modelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['systemUserName'])) $this->systemUserName = $o['systemUserName'];
if (isset($o['meetings'])) $this->meetings = JsonConverters::fromArray('OnTheMoveMeetingListItem', $o['meetings']);
if (isset($o['points'])) $this->points = JsonConverters::fromArray('JourneyPoints', $o['points']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->systemUserName)) $o['systemUserName'] = $this->systemUserName;
if (isset($this->meetings)) $o['meetings'] = JsonConverters::toArray('OnTheMoveMeetingListItem', $this->meetings);
if (isset($this->points)) $o['points'] = JsonConverters::toArray('JourneyPoints', $this->points);
return empty($o) ? new class(){} : $o;
}
}
class OnTheMoveDetailRequest 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 $id=0,
/** @var DateTime */
public DateTime $date=new DateTime()
) {
parent::__construct($apiKey,$latitude,$longitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['date'])) $this->date = JsonConverters::from('DateTime', $o['date']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->date)) $o['date'] = JsonConverters::to('DateTime', $this->date);
return empty($o) ? new class(){} : $o;
}
}
PHP OnTheMoveDetailRequest 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.
GET /template-approval/detail HTTP/1.1 Host: cochraneplus-api-dev.happen.zone Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
systemUserName: String,
meetings:
[
{
}
],
points:
[
{
}
],
description: String,
heading: String,
wasSuccessful: False,
modelState: {}
}