| GET | /dashboard/info |
|---|
<?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 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;
}
}
enum AttendanceEventType : int
{
case ClockOut = 0;
case ClockIn = 1;
case StartLunch = 2;
case EndLunch = 3;
case StartBreak = 4;
case EndBreak = 5;
}
class GetDashboardInfoResponse 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 int */
public int $unreadNotificationCount=0,
/** @var string|null */
public ?string $nextMeetingDate=null,
/** @var int */
public int $totalMeetingsToday=0,
/** @var int */
public int $outstandingRatingsCount=0,
/** @var float */
public float $usersAverageRating=0.0,
/** @var bool|null */
public ?bool $hasSharedRatings=null,
/** @var bool|null */
public ?bool $isSalesPerson=null,
/** @var int */
public int $usersRatingTotalVotes=0,
/** @var int */
public int $usersRatingPosition=0,
/** @var array<int>|null */
public ?array $teamIds=null,
/** @var MeetingData|null */
public ?MeetingData $nextMeeting=null,
/** @var AttendanceEventType|null */
public ?AttendanceEventType $attendanceEventType=null,
/** @var int */
public int $outstandingDebriefsToReviewCount=0,
/** @var int */
public int $outstandingTemplateApprovalsCount=0
) {
parent::__construct($description,$heading,$wasSuccessful,$modelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['unreadNotificationCount'])) $this->unreadNotificationCount = $o['unreadNotificationCount'];
if (isset($o['nextMeetingDate'])) $this->nextMeetingDate = $o['nextMeetingDate'];
if (isset($o['totalMeetingsToday'])) $this->totalMeetingsToday = $o['totalMeetingsToday'];
if (isset($o['outstandingRatingsCount'])) $this->outstandingRatingsCount = $o['outstandingRatingsCount'];
if (isset($o['usersAverageRating'])) $this->usersAverageRating = $o['usersAverageRating'];
if (isset($o['hasSharedRatings'])) $this->hasSharedRatings = $o['hasSharedRatings'];
if (isset($o['isSalesPerson'])) $this->isSalesPerson = $o['isSalesPerson'];
if (isset($o['usersRatingTotalVotes'])) $this->usersRatingTotalVotes = $o['usersRatingTotalVotes'];
if (isset($o['usersRatingPosition'])) $this->usersRatingPosition = $o['usersRatingPosition'];
if (isset($o['teamIds'])) $this->teamIds = JsonConverters::fromArray('int', $o['teamIds']);
if (isset($o['nextMeeting'])) $this->nextMeeting = JsonConverters::from('MeetingData', $o['nextMeeting']);
if (isset($o['attendanceEventType'])) $this->attendanceEventType = JsonConverters::from('AttendanceEventType', $o['attendanceEventType']);
if (isset($o['outstandingDebriefsToReviewCount'])) $this->outstandingDebriefsToReviewCount = $o['outstandingDebriefsToReviewCount'];
if (isset($o['outstandingTemplateApprovalsCount'])) $this->outstandingTemplateApprovalsCount = $o['outstandingTemplateApprovalsCount'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->unreadNotificationCount)) $o['unreadNotificationCount'] = $this->unreadNotificationCount;
if (isset($this->nextMeetingDate)) $o['nextMeetingDate'] = $this->nextMeetingDate;
if (isset($this->totalMeetingsToday)) $o['totalMeetingsToday'] = $this->totalMeetingsToday;
if (isset($this->outstandingRatingsCount)) $o['outstandingRatingsCount'] = $this->outstandingRatingsCount;
if (isset($this->usersAverageRating)) $o['usersAverageRating'] = $this->usersAverageRating;
if (isset($this->hasSharedRatings)) $o['hasSharedRatings'] = $this->hasSharedRatings;
if (isset($this->isSalesPerson)) $o['isSalesPerson'] = $this->isSalesPerson;
if (isset($this->usersRatingTotalVotes)) $o['usersRatingTotalVotes'] = $this->usersRatingTotalVotes;
if (isset($this->usersRatingPosition)) $o['usersRatingPosition'] = $this->usersRatingPosition;
if (isset($this->teamIds)) $o['teamIds'] = JsonConverters::toArray('int', $this->teamIds);
if (isset($this->nextMeeting)) $o['nextMeeting'] = JsonConverters::to('MeetingData', $this->nextMeeting);
if (isset($this->attendanceEventType)) $o['attendanceEventType'] = JsonConverters::to('AttendanceEventType', $this->attendanceEventType);
if (isset($this->outstandingDebriefsToReviewCount)) $o['outstandingDebriefsToReviewCount'] = $this->outstandingDebriefsToReviewCount;
if (isset($this->outstandingTemplateApprovalsCount)) $o['outstandingTemplateApprovalsCount'] = $this->outstandingTemplateApprovalsCount;
return empty($o) ? new class(){} : $o;
}
}
class GetDashboardInfo 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
) {
parent::__construct($apiKey,$latitude,$longitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
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.
GET /dashboard/info HTTP/1.1 Host: cochraneplus-api-dev.happen.zone Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"unreadNotificationCount":0,"nextMeetingDate":"String","totalMeetingsToday":0,"outstandingRatingsCount":0,"usersAverageRating":0,"hasSharedRatings":false,"isSalesPerson":false,"usersRatingTotalVotes":0,"usersRatingPosition":0,"teamIds":[0],"nextMeeting":{"meetingId":0,"startTime":"String","arrivalTime":"String","leftTime":"String","duration":"String","showTimeFields":false,"arrivalStatus":"String","email":"String","hasEmail":true,"contactName":"String","latitude":0,"longitude":0,"location":"String","address":"String","subject":"String","description":"String","endTime":"String","company":"String","contactNumber":"String","hasContactNumber":true,"hasLocation":false,"setBy":"String","virtualOrInPerson":"String"},"attendanceEventType":0,"outstandingDebriefsToReviewCount":0,"outstandingTemplateApprovalsCount":0,"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}