| POST | /user/autologin |
|---|
<?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 SystemUserPermission implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $meeting=null,
/** @var bool|null */
public ?bool $journey=null,
/** @var bool|null */
public ?bool $attendance=null,
/** @var bool|null */
public ?bool $notificationCenter=null,
/** @var bool|null */
public ?bool $internalRating=null,
/** @var bool|null */
public ?bool $debrief=null,
/** @var bool|null */
public ?bool $thunderBoltActions=null,
/** @var bool|null */
public ?bool $onTheMove=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['meeting'])) $this->meeting = $o['meeting'];
if (isset($o['journey'])) $this->journey = $o['journey'];
if (isset($o['attendance'])) $this->attendance = $o['attendance'];
if (isset($o['notificationCenter'])) $this->notificationCenter = $o['notificationCenter'];
if (isset($o['internalRating'])) $this->internalRating = $o['internalRating'];
if (isset($o['debrief'])) $this->debrief = $o['debrief'];
if (isset($o['thunderBoltActions'])) $this->thunderBoltActions = $o['thunderBoltActions'];
if (isset($o['onTheMove'])) $this->onTheMove = $o['onTheMove'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->meeting)) $o['meeting'] = $this->meeting;
if (isset($this->journey)) $o['journey'] = $this->journey;
if (isset($this->attendance)) $o['attendance'] = $this->attendance;
if (isset($this->notificationCenter)) $o['notificationCenter'] = $this->notificationCenter;
if (isset($this->internalRating)) $o['internalRating'] = $this->internalRating;
if (isset($this->debrief)) $o['debrief'] = $this->debrief;
if (isset($this->thunderBoltActions)) $o['thunderBoltActions'] = $this->thunderBoltActions;
if (isset($this->onTheMove)) $o['onTheMove'] = $this->onTheMove;
return empty($o) ? new class(){} : $o;
}
}
class AppSettings implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $allowAbstainRatings=null,
/** @var bool|null */
public ?bool $showMoodIndicatorOnApp=null,
/** @var bool|null */
public ?bool $takePhotoForAnalysis=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['allowAbstainRatings'])) $this->allowAbstainRatings = $o['allowAbstainRatings'];
if (isset($o['showMoodIndicatorOnApp'])) $this->showMoodIndicatorOnApp = $o['showMoodIndicatorOnApp'];
if (isset($o['takePhotoForAnalysis'])) $this->takePhotoForAnalysis = $o['takePhotoForAnalysis'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->allowAbstainRatings)) $o['allowAbstainRatings'] = $this->allowAbstainRatings;
if (isset($this->showMoodIndicatorOnApp)) $o['showMoodIndicatorOnApp'] = $this->showMoodIndicatorOnApp;
if (isset($this->takePhotoForAnalysis)) $o['takePhotoForAnalysis'] = $this->takePhotoForAnalysis;
return empty($o) ? new class(){} : $o;
}
}
class UserLoginResponse 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 bool|null */
public ?bool $allowAttendanceOnLaptop=null,
/** @var string|null */
public ?string $profileImageUrl=null,
/** @var string|null */
public ?string $friendlyName=null,
/** @var int */
public int $systemUserId=0,
/** @var string|null */
public ?string $username=null,
/** @var SystemUserPermission|null */
public ?SystemUserPermission $permissions=null,
/** @var AppSettings|null */
public ?AppSettings $settings=null,
/** @var float */
public float $startLatitude=0.0,
/** @var float */
public float $startLongitude=0.0,
/** @var bool|null */
public ?bool $hasStartLocation=null,
/** @var float */
public float $endLatitude=0.0,
/** @var float */
public float $endLongitude=0.0,
/** @var bool|null */
public ?bool $hasEndLocation=null,
/** @var bool|null */
public ?bool $isSalesPerson=null,
/** @var string[]|null */
public ?array $feelingStatusMappings=null,
/** @var bool|null */
public ?bool $hasAiPermissions=null,
/** @var string|null */
public ?string $refreshToken=null,
/** @var bool|null */
public ?bool $isManagerOrPromotedTo=null,
/** @var bool|null */
public ?bool $isTemplateApprover=null,
/** @var int */
public int $outstandingApprovals=0
) {
parent::__construct($description,$heading,$wasSuccessful,$modelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['allowAttendanceOnLaptop'])) $this->allowAttendanceOnLaptop = $o['allowAttendanceOnLaptop'];
if (isset($o['profileImageUrl'])) $this->profileImageUrl = $o['profileImageUrl'];
if (isset($o['friendlyName'])) $this->friendlyName = $o['friendlyName'];
if (isset($o['systemUserId'])) $this->systemUserId = $o['systemUserId'];
if (isset($o['username'])) $this->username = $o['username'];
if (isset($o['permissions'])) $this->permissions = JsonConverters::from('SystemUserPermission', $o['permissions']);
if (isset($o['settings'])) $this->settings = JsonConverters::from('AppSettings', $o['settings']);
if (isset($o['startLatitude'])) $this->startLatitude = $o['startLatitude'];
if (isset($o['startLongitude'])) $this->startLongitude = $o['startLongitude'];
if (isset($o['hasStartLocation'])) $this->hasStartLocation = $o['hasStartLocation'];
if (isset($o['endLatitude'])) $this->endLatitude = $o['endLatitude'];
if (isset($o['endLongitude'])) $this->endLongitude = $o['endLongitude'];
if (isset($o['hasEndLocation'])) $this->hasEndLocation = $o['hasEndLocation'];
if (isset($o['isSalesPerson'])) $this->isSalesPerson = $o['isSalesPerson'];
if (isset($o['feelingStatusMappings'])) $this->feelingStatusMappings = JsonConverters::fromArray('string', $o['feelingStatusMappings']);
if (isset($o['hasAiPermissions'])) $this->hasAiPermissions = $o['hasAiPermissions'];
if (isset($o['refreshToken'])) $this->refreshToken = $o['refreshToken'];
if (isset($o['isManagerOrPromotedTo'])) $this->isManagerOrPromotedTo = $o['isManagerOrPromotedTo'];
if (isset($o['isTemplateApprover'])) $this->isTemplateApprover = $o['isTemplateApprover'];
if (isset($o['outstandingApprovals'])) $this->outstandingApprovals = $o['outstandingApprovals'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->allowAttendanceOnLaptop)) $o['allowAttendanceOnLaptop'] = $this->allowAttendanceOnLaptop;
if (isset($this->profileImageUrl)) $o['profileImageUrl'] = $this->profileImageUrl;
if (isset($this->friendlyName)) $o['friendlyName'] = $this->friendlyName;
if (isset($this->systemUserId)) $o['systemUserId'] = $this->systemUserId;
if (isset($this->username)) $o['username'] = $this->username;
if (isset($this->permissions)) $o['permissions'] = JsonConverters::to('SystemUserPermission', $this->permissions);
if (isset($this->settings)) $o['settings'] = JsonConverters::to('AppSettings', $this->settings);
if (isset($this->startLatitude)) $o['startLatitude'] = $this->startLatitude;
if (isset($this->startLongitude)) $o['startLongitude'] = $this->startLongitude;
if (isset($this->hasStartLocation)) $o['hasStartLocation'] = $this->hasStartLocation;
if (isset($this->endLatitude)) $o['endLatitude'] = $this->endLatitude;
if (isset($this->endLongitude)) $o['endLongitude'] = $this->endLongitude;
if (isset($this->hasEndLocation)) $o['hasEndLocation'] = $this->hasEndLocation;
if (isset($this->isSalesPerson)) $o['isSalesPerson'] = $this->isSalesPerson;
if (isset($this->feelingStatusMappings)) $o['feelingStatusMappings'] = JsonConverters::toArray('string', $this->feelingStatusMappings);
if (isset($this->hasAiPermissions)) $o['hasAiPermissions'] = $this->hasAiPermissions;
if (isset($this->refreshToken)) $o['refreshToken'] = $this->refreshToken;
if (isset($this->isManagerOrPromotedTo)) $o['isManagerOrPromotedTo'] = $this->isManagerOrPromotedTo;
if (isset($this->isTemplateApprover)) $o['isTemplateApprover'] = $this->isTemplateApprover;
if (isset($this->outstandingApprovals)) $o['outstandingApprovals'] = $this->outstandingApprovals;
return empty($o) ? new class(){} : $o;
}
}
class AutoLogin 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 $utcOffset=0,
/** @var int */
public int $systemUserId=0,
/** @var string|null */
public ?string $refreshToken=null
) {
parent::__construct($apiKey,$latitude,$longitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['utcOffset'])) $this->utcOffset = $o['utcOffset'];
if (isset($o['systemUserId'])) $this->systemUserId = $o['systemUserId'];
if (isset($o['refreshToken'])) $this->refreshToken = $o['refreshToken'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->utcOffset)) $o['utcOffset'] = $this->utcOffset;
if (isset($this->systemUserId)) $o['systemUserId'] = $this->systemUserId;
if (isset($this->refreshToken)) $o['refreshToken'] = $this->refreshToken;
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 /user/autologin HTTP/1.1
Host: cochraneplus-api-dev.happen.zone
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"utcOffset":0,"systemUserId":0,"refreshToken":"String","apiKey":"String","latitude":0,"longitude":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"allowAttendanceOnLaptop":false,"profileImageUrl":"String","friendlyName":"String","systemUserId":0,"username":"String","permissions":{"meeting":false,"journey":false,"attendance":false,"notificationCenter":false,"internalRating":false,"debrief":false,"thunderBoltActions":false,"onTheMove":false},"settings":{"allowAbstainRatings":false,"showMoodIndicatorOnApp":false,"takePhotoForAnalysis":false},"startLatitude":0,"startLongitude":0,"hasStartLocation":false,"endLatitude":0,"endLongitude":0,"hasEndLocation":false,"isSalesPerson":false,"feelingStatusMappings":["String"],"hasAiPermissions":false,"refreshToken":"String","isManagerOrPromotedTo":false,"isTemplateApprover":false,"outstandingApprovals":0,"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}