| GET | /thunderbolt/actions |
|---|
<?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 EnumOption implements JsonSerializable
{
public function __construct(
/** @var int */
public int $value=0,
/** @var string|null */
public ?string $label=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['value'])) $this->value = $o['value'];
if (isset($o['label'])) $this->label = $o['label'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->value)) $o['value'] = $this->value;
if (isset($this->label)) $o['label'] = $this->label;
return empty($o) ? new class(){} : $o;
}
}
class ThunderBoltActionData implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string|null */
public ?string $actionName=null,
/** @var string|null */
public ?string $color=null,
/** @var int */
public int $dailyActionCount=0,
/** @var bool|null */
public ?bool $showNumberInput=null,
/** @var bool|null */
public ?bool $showEmailInput=null,
/** @var bool|null */
public ?bool $showPlatformInput=null,
/** @var bool|null */
public ?bool $showDateTimeInput=null,
/** @var array<EnumOption>|null */
public ?array $contactInteractionPlatforms=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['actionName'])) $this->actionName = $o['actionName'];
if (isset($o['color'])) $this->color = $o['color'];
if (isset($o['dailyActionCount'])) $this->dailyActionCount = $o['dailyActionCount'];
if (isset($o['showNumberInput'])) $this->showNumberInput = $o['showNumberInput'];
if (isset($o['showEmailInput'])) $this->showEmailInput = $o['showEmailInput'];
if (isset($o['showPlatformInput'])) $this->showPlatformInput = $o['showPlatformInput'];
if (isset($o['showDateTimeInput'])) $this->showDateTimeInput = $o['showDateTimeInput'];
if (isset($o['contactInteractionPlatforms'])) $this->contactInteractionPlatforms = JsonConverters::fromArray('EnumOption', $o['contactInteractionPlatforms']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->actionName)) $o['actionName'] = $this->actionName;
if (isset($this->color)) $o['color'] = $this->color;
if (isset($this->dailyActionCount)) $o['dailyActionCount'] = $this->dailyActionCount;
if (isset($this->showNumberInput)) $o['showNumberInput'] = $this->showNumberInput;
if (isset($this->showEmailInput)) $o['showEmailInput'] = $this->showEmailInput;
if (isset($this->showPlatformInput)) $o['showPlatformInput'] = $this->showPlatformInput;
if (isset($this->showDateTimeInput)) $o['showDateTimeInput'] = $this->showDateTimeInput;
if (isset($this->contactInteractionPlatforms)) $o['contactInteractionPlatforms'] = JsonConverters::toArray('EnumOption', $this->contactInteractionPlatforms);
return empty($o) ? new class(){} : $o;
}
}
class ThunderBoltActionEventData implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string|null */
public ?string $createdDate=null,
/** @var int */
public int $actionId=0,
/** @var string|null */
public ?string $actionName=null,
/** @var string|null */
public ?string $color=null,
/** @var string|null */
public ?string $notes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['createdDate'])) $this->createdDate = $o['createdDate'];
if (isset($o['actionId'])) $this->actionId = $o['actionId'];
if (isset($o['actionName'])) $this->actionName = $o['actionName'];
if (isset($o['color'])) $this->color = $o['color'];
if (isset($o['notes'])) $this->notes = $o['notes'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->createdDate)) $o['createdDate'] = $this->createdDate;
if (isset($this->actionId)) $o['actionId'] = $this->actionId;
if (isset($this->actionName)) $o['actionName'] = $this->actionName;
if (isset($this->color)) $o['color'] = $this->color;
if (isset($this->notes)) $o['notes'] = $this->notes;
return empty($o) ? new class(){} : $o;
}
}
class ContactData implements JsonSerializable
{
public function __construct(
/** @var int */
public int $contactId=0,
/** @var string|null */
public ?string $contactName=null,
/** @var string|null */
public ?string $email=null,
/** @var string|null */
public ?string $phoneNumber=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['contactId'])) $this->contactId = $o['contactId'];
if (isset($o['contactName'])) $this->contactName = $o['contactName'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->contactId)) $o['contactId'] = $this->contactId;
if (isset($this->contactName)) $o['contactName'] = $this->contactName;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
return empty($o) ? new class(){} : $o;
}
}
class GetThunderBoltActionsResponse 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 $dailyActionsNumber=0,
/** @var int */
public int $supportingDocumentProbability=0,
/** @var array<ThunderBoltActionData>|null */
public ?array $thunderBoltActions=null,
/** @var array<ThunderBoltActionEventData>|null */
public ?array $thunderBoltActionEvents=null,
/** @var array<ContactData>|null */
public ?array $contacts=null
) {
parent::__construct($description,$heading,$wasSuccessful,$modelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['dailyActionsNumber'])) $this->dailyActionsNumber = $o['dailyActionsNumber'];
if (isset($o['supportingDocumentProbability'])) $this->supportingDocumentProbability = $o['supportingDocumentProbability'];
if (isset($o['thunderBoltActions'])) $this->thunderBoltActions = JsonConverters::fromArray('ThunderBoltActionData', $o['thunderBoltActions']);
if (isset($o['thunderBoltActionEvents'])) $this->thunderBoltActionEvents = JsonConverters::fromArray('ThunderBoltActionEventData', $o['thunderBoltActionEvents']);
if (isset($o['contacts'])) $this->contacts = JsonConverters::fromArray('ContactData', $o['contacts']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->dailyActionsNumber)) $o['dailyActionsNumber'] = $this->dailyActionsNumber;
if (isset($this->supportingDocumentProbability)) $o['supportingDocumentProbability'] = $this->supportingDocumentProbability;
if (isset($this->thunderBoltActions)) $o['thunderBoltActions'] = JsonConverters::toArray('ThunderBoltActionData', $this->thunderBoltActions);
if (isset($this->thunderBoltActionEvents)) $o['thunderBoltActionEvents'] = JsonConverters::toArray('ThunderBoltActionEventData', $this->thunderBoltActionEvents);
if (isset($this->contacts)) $o['contacts'] = JsonConverters::toArray('ContactData', $this->contacts);
return empty($o) ? new class(){} : $o;
}
}
class GetThunderBoltActions 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;
}
}
PHP GetThunderBoltActions DTOs
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 /thunderbolt/actions HTTP/1.1 Host: cochraneplus-api-dev.happen.zone Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"dailyActionsNumber":0,"supportingDocumentProbability":0,"thunderBoltActions":[{"id":0,"actionName":"String","color":"String","dailyActionCount":0,"showNumberInput":false,"showEmailInput":false,"showPlatformInput":false,"showDateTimeInput":false,"contactInteractionPlatforms":[{"value":0,"label":"String"}]}],"thunderBoltActionEvents":[{"id":0,"createdDate":"String","actionId":0,"actionName":"String","color":"String","notes":"String"}],"contacts":[{}],"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}