PUT | /Alarm | ||
---|---|---|---|
PUT | /Alarm/{Id} | ||
GET POST | /UpdateAlarm | ||
GET POST | /UpdateAlarm/{Id} |
<?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};
// @DataContract
class UpdateAlarmResponse implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class TemperatureAlarmLimits implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var float|null */
public ?float $temperature1LowerLimit=null,
// @DataMember
/** @var float|null */
public ?float $temperature1UpperLimit=null,
// @DataMember
/** @var float|null */
public ?float $temperature2LowerLimit=null,
// @DataMember
/** @var float|null */
public ?float $temperature2UpperLimit=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['temperature1LowerLimit'])) $this->temperature1LowerLimit = $o['temperature1LowerLimit'];
if (isset($o['temperature1UpperLimit'])) $this->temperature1UpperLimit = $o['temperature1UpperLimit'];
if (isset($o['temperature2LowerLimit'])) $this->temperature2LowerLimit = $o['temperature2LowerLimit'];
if (isset($o['temperature2UpperLimit'])) $this->temperature2UpperLimit = $o['temperature2UpperLimit'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->temperature1LowerLimit)) $o['temperature1LowerLimit'] = $this->temperature1LowerLimit;
if (isset($this->temperature1UpperLimit)) $o['temperature1UpperLimit'] = $this->temperature1UpperLimit;
if (isset($this->temperature2LowerLimit)) $o['temperature2LowerLimit'] = $this->temperature2LowerLimit;
if (isset($this->temperature2UpperLimit)) $o['temperature2UpperLimit'] = $this->temperature2UpperLimit;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class ADVoltageAlarmLimits implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var float|null */
public ?float $adVoltageLowerLimit=null,
// @DataMember
/** @var float|null */
public ?float $adVoltageUpperLimit=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['adVoltageLowerLimit'])) $this->adVoltageLowerLimit = $o['adVoltageLowerLimit'];
if (isset($o['adVoltageUpperLimit'])) $this->adVoltageUpperLimit = $o['adVoltageUpperLimit'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->adVoltageLowerLimit)) $o['adVoltageLowerLimit'] = $this->adVoltageLowerLimit;
if (isset($this->adVoltageUpperLimit)) $o['adVoltageUpperLimit'] = $this->adVoltageUpperLimit;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class Location implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var float */
public float $latitude=0.0,
// @DataMember
/** @var float */
public float $longitude=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
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->latitude)) $o['latitude'] = $this->latitude;
if (isset($this->longitude)) $o['longitude'] = $this->longitude;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class TimeOfDay implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var int */
public int $hour=0,
// @DataMember
/** @var int */
public int $minute=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['hour'])) $this->hour = $o['hour'];
if (isset($o['minute'])) $this->minute = $o['minute'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->hour)) $o['hour'] = $this->hour;
if (isset($this->minute)) $o['minute'] = $this->minute;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class UpdateAlarm implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var string|null */
public ?string $id=null,
// @DataMember
/** @var string|null */
public ?string $name=null,
// @DataMember
/** @var bool|null */
public ?bool $enabled=null,
// @DataMember
/** @var bool|null */
public ?bool $allUnits=null,
// @DataMember
/** @var bool|null */
public ?bool $clearUnits=null,
// @DataMember
/** @var string[]|null */
public ?array $addUnits=null,
// @DataMember
/** @var string[]|null */
public ?array $removeUnits=null,
// @DataMember
/** @var bool|null */
public ?bool $clearGroups=null,
// @DataMember
/** @var string[]|null */
public ?array $addGroups=null,
// @DataMember
/** @var string[]|null */
public ?array $removeGroups=null,
// @DataMember
/** @var bool|null */
public ?bool $clearEmailRecipients=null,
// @DataMember
/** @var string[]|null */
public ?array $addEmailRecipients=null,
// @DataMember
/** @var string[]|null */
public ?array $removeEmailRecipients=null,
// @DataMember
/** @var bool|null */
public ?bool $clearSystemRecipients=null,
// @DataMember
/** @var string[]|null */
public ?array $addSystemRecipients=null,
// @DataMember
/** @var string[]|null */
public ?array $removeSystemRecipients=null,
// @DataMember
/** @var bool|null */
public ?bool $clearSmsRecipients=null,
// @DataMember
/** @var string[]|null */
public ?array $addSmsRecipients=null,
// @DataMember
/** @var string[]|null */
public ?array $removeSmsRecipients=null,
// @DataMember
/** @var TemperatureAlarmLimits|null */
public ?TemperatureAlarmLimits $temperatureLimits=null,
// @DataMember
/** @var ADVoltageAlarmLimits|null */
public ?ADVoltageAlarmLimits $adVoltageLimits=null,
// @DataMember
/** @var int|null */
public ?int $adVoltageInputIndex=null,
// @DataMember
/** @var float|null */
public ?float $threshold=null,
// @DataMember
/** @var float|null */
public ?float $batteryLevel=null,
// @DataMember
/** @var Location|null */
public ?Location $location=null,
// @DataMember
/** @var float|null */
public ?float $radius=null,
// @DataMember
/** @var int|null */
public ?int $inputIndex=null,
// @DataMember
/** @var float|null */
public ?float $interval=null,
// @DataMember
/** @var string|null */
public ?string $pointId=null,
// @DataMember
/** @var DateTime|null */
public ?DateTime $expectedArrivalTime=null,
// @DataMember
/** @var float|null */
public ?float $powerLevel=null,
// @DataMember
/** @var string[]|null */
public ?array $weekdays=null,
// @DataMember
/** @var TimeOfDay|null */
public ?TimeOfDay $timeStart=null,
// @DataMember
/** @var TimeOfDay|null */
public ?TimeOfDay $timeEnd=null,
// @DataMember
/** @var string|null */
public ?string $zoneId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['enabled'])) $this->enabled = $o['enabled'];
if (isset($o['allUnits'])) $this->allUnits = $o['allUnits'];
if (isset($o['clearUnits'])) $this->clearUnits = $o['clearUnits'];
if (isset($o['addUnits'])) $this->addUnits = JsonConverters::fromArray('string', $o['addUnits']);
if (isset($o['removeUnits'])) $this->removeUnits = JsonConverters::fromArray('string', $o['removeUnits']);
if (isset($o['clearGroups'])) $this->clearGroups = $o['clearGroups'];
if (isset($o['addGroups'])) $this->addGroups = JsonConverters::fromArray('string', $o['addGroups']);
if (isset($o['removeGroups'])) $this->removeGroups = JsonConverters::fromArray('string', $o['removeGroups']);
if (isset($o['clearEmailRecipients'])) $this->clearEmailRecipients = $o['clearEmailRecipients'];
if (isset($o['addEmailRecipients'])) $this->addEmailRecipients = JsonConverters::fromArray('string', $o['addEmailRecipients']);
if (isset($o['removeEmailRecipients'])) $this->removeEmailRecipients = JsonConverters::fromArray('string', $o['removeEmailRecipients']);
if (isset($o['clearSystemRecipients'])) $this->clearSystemRecipients = $o['clearSystemRecipients'];
if (isset($o['addSystemRecipients'])) $this->addSystemRecipients = JsonConverters::fromArray('string', $o['addSystemRecipients']);
if (isset($o['removeSystemRecipients'])) $this->removeSystemRecipients = JsonConverters::fromArray('string', $o['removeSystemRecipients']);
if (isset($o['clearSmsRecipients'])) $this->clearSmsRecipients = $o['clearSmsRecipients'];
if (isset($o['addSmsRecipients'])) $this->addSmsRecipients = JsonConverters::fromArray('string', $o['addSmsRecipients']);
if (isset($o['removeSmsRecipients'])) $this->removeSmsRecipients = JsonConverters::fromArray('string', $o['removeSmsRecipients']);
if (isset($o['temperatureLimits'])) $this->temperatureLimits = JsonConverters::from('TemperatureAlarmLimits', $o['temperatureLimits']);
if (isset($o['adVoltageLimits'])) $this->adVoltageLimits = JsonConverters::from('ADVoltageAlarmLimits', $o['adVoltageLimits']);
if (isset($o['adVoltageInputIndex'])) $this->adVoltageInputIndex = $o['adVoltageInputIndex'];
if (isset($o['threshold'])) $this->threshold = $o['threshold'];
if (isset($o['batteryLevel'])) $this->batteryLevel = $o['batteryLevel'];
if (isset($o['location'])) $this->location = JsonConverters::from('Location', $o['location']);
if (isset($o['radius'])) $this->radius = $o['radius'];
if (isset($o['inputIndex'])) $this->inputIndex = $o['inputIndex'];
if (isset($o['interval'])) $this->interval = $o['interval'];
if (isset($o['pointId'])) $this->pointId = $o['pointId'];
if (isset($o['expectedArrivalTime'])) $this->expectedArrivalTime = JsonConverters::from('DateTime', $o['expectedArrivalTime']);
if (isset($o['powerLevel'])) $this->powerLevel = $o['powerLevel'];
if (isset($o['weekdays'])) $this->weekdays = JsonConverters::fromArray('string', $o['weekdays']);
if (isset($o['timeStart'])) $this->timeStart = JsonConverters::from('TimeOfDay', $o['timeStart']);
if (isset($o['timeEnd'])) $this->timeEnd = JsonConverters::from('TimeOfDay', $o['timeEnd']);
if (isset($o['zoneId'])) $this->zoneId = $o['zoneId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->enabled)) $o['enabled'] = $this->enabled;
if (isset($this->allUnits)) $o['allUnits'] = $this->allUnits;
if (isset($this->clearUnits)) $o['clearUnits'] = $this->clearUnits;
if (isset($this->addUnits)) $o['addUnits'] = JsonConverters::toArray('string', $this->addUnits);
if (isset($this->removeUnits)) $o['removeUnits'] = JsonConverters::toArray('string', $this->removeUnits);
if (isset($this->clearGroups)) $o['clearGroups'] = $this->clearGroups;
if (isset($this->addGroups)) $o['addGroups'] = JsonConverters::toArray('string', $this->addGroups);
if (isset($this->removeGroups)) $o['removeGroups'] = JsonConverters::toArray('string', $this->removeGroups);
if (isset($this->clearEmailRecipients)) $o['clearEmailRecipients'] = $this->clearEmailRecipients;
if (isset($this->addEmailRecipients)) $o['addEmailRecipients'] = JsonConverters::toArray('string', $this->addEmailRecipients);
if (isset($this->removeEmailRecipients)) $o['removeEmailRecipients'] = JsonConverters::toArray('string', $this->removeEmailRecipients);
if (isset($this->clearSystemRecipients)) $o['clearSystemRecipients'] = $this->clearSystemRecipients;
if (isset($this->addSystemRecipients)) $o['addSystemRecipients'] = JsonConverters::toArray('string', $this->addSystemRecipients);
if (isset($this->removeSystemRecipients)) $o['removeSystemRecipients'] = JsonConverters::toArray('string', $this->removeSystemRecipients);
if (isset($this->clearSmsRecipients)) $o['clearSmsRecipients'] = $this->clearSmsRecipients;
if (isset($this->addSmsRecipients)) $o['addSmsRecipients'] = JsonConverters::toArray('string', $this->addSmsRecipients);
if (isset($this->removeSmsRecipients)) $o['removeSmsRecipients'] = JsonConverters::toArray('string', $this->removeSmsRecipients);
if (isset($this->temperatureLimits)) $o['temperatureLimits'] = JsonConverters::to('TemperatureAlarmLimits', $this->temperatureLimits);
if (isset($this->adVoltageLimits)) $o['adVoltageLimits'] = JsonConverters::to('ADVoltageAlarmLimits', $this->adVoltageLimits);
if (isset($this->adVoltageInputIndex)) $o['adVoltageInputIndex'] = $this->adVoltageInputIndex;
if (isset($this->threshold)) $o['threshold'] = $this->threshold;
if (isset($this->batteryLevel)) $o['batteryLevel'] = $this->batteryLevel;
if (isset($this->location)) $o['location'] = JsonConverters::to('Location', $this->location);
if (isset($this->radius)) $o['radius'] = $this->radius;
if (isset($this->inputIndex)) $o['inputIndex'] = $this->inputIndex;
if (isset($this->interval)) $o['interval'] = $this->interval;
if (isset($this->pointId)) $o['pointId'] = $this->pointId;
if (isset($this->expectedArrivalTime)) $o['expectedArrivalTime'] = JsonConverters::to('DateTime', $this->expectedArrivalTime);
if (isset($this->powerLevel)) $o['powerLevel'] = $this->powerLevel;
if (isset($this->weekdays)) $o['weekdays'] = JsonConverters::toArray('string', $this->weekdays);
if (isset($this->timeStart)) $o['timeStart'] = JsonConverters::to('TimeOfDay', $this->timeStart);
if (isset($this->timeEnd)) $o['timeEnd'] = JsonConverters::to('TimeOfDay', $this->timeEnd);
if (isset($this->zoneId)) $o['zoneId'] = $this->zoneId;
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.
POST /UpdateAlarm HTTP/1.1
Host: api.trackunit.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"id":"String","name":"String","enabled":false,"allUnits":false,"clearUnits":false,"addUnits":["String"],"removeUnits":["String"],"clearGroups":false,"addGroups":["String"],"removeGroups":["String"],"clearEmailRecipients":false,"addEmailRecipients":["String"],"removeEmailRecipients":["String"],"clearSystemRecipients":false,"addSystemRecipients":["String"],"removeSystemRecipients":["String"],"clearSmsRecipients":false,"addSmsRecipients":["String"],"removeSmsRecipients":["String"],"temperatureLimits":{"temperature1LowerLimit":0,"temperature1UpperLimit":0,"temperature2LowerLimit":0,"temperature2UpperLimit":0},"adVoltageLimits":{"adVoltageLowerLimit":0,"adVoltageUpperLimit":0},"adVoltageInputIndex":0,"threshold":0,"batteryLevel":0,"location":{"latitude":0,"longitude":0},"radius":0,"inputIndex":0,"interval":0,"pointId":"String","expectedArrivalTime":"0001-01-01T00:00:00.0000000Z","powerLevel":0,"weekdays":["String"],"timeStart":{"hour":0,"minute":0},"timeEnd":{"hour":0,"minute":0},"zoneId":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}