| All Verbs | /api/contact/{ContactId}/notifications |
|---|
<?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 InputSwitch implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Id=null,
/** @var string|null */
public ?string $Name=null,
/** @var bool|null */
public ?bool $IsDisabled=null,
/** @var bool|null */
public ?bool $IsChecked=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['IsDisabled'])) $this->IsDisabled = $o['IsDisabled'];
if (isset($o['IsChecked'])) $this->IsChecked = $o['IsChecked'];
}
/** @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->IsDisabled)) $o['IsDisabled'] = $this->IsDisabled;
if (isset($this->IsChecked)) $o['IsChecked'] = $this->IsChecked;
return empty($o) ? new class(){} : $o;
}
}
class NotificationDetails implements JsonSerializable
{
public function __construct(
/** @var string */
public string $NotificationId='',
/** @var string|null */
public ?string $NotificationGroupName=null,
/** @var string */
public string $NotificationValueId='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Description=null,
/** @var bool|null */
public ?bool $IsMandatory=null,
/** @var bool|null */
public ?bool $IsCardinality=null,
/** @var bool|null */
public ?bool $IsSystem=null,
/** @var bool|null */
public ?bool $IsVisibleToRecipients=null,
/** @var int */
public int $Index=0,
/** @var InputSwitch|null */
public ?InputSwitch $Email=null,
/** @var InputSwitch|null */
public ?InputSwitch $SMS=null,
/** @var InputSwitch|null */
public ?InputSwitch $UpdateNotification=null,
/** @var InputSwitch|null */
public ?InputSwitch $Push=null,
/** @var InputSwitch|null */
public ?InputSwitch $Phone=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['NotificationId'])) $this->NotificationId = $o['NotificationId'];
if (isset($o['NotificationGroupName'])) $this->NotificationGroupName = $o['NotificationGroupName'];
if (isset($o['NotificationValueId'])) $this->NotificationValueId = $o['NotificationValueId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['IsMandatory'])) $this->IsMandatory = $o['IsMandatory'];
if (isset($o['IsCardinality'])) $this->IsCardinality = $o['IsCardinality'];
if (isset($o['IsSystem'])) $this->IsSystem = $o['IsSystem'];
if (isset($o['IsVisibleToRecipients'])) $this->IsVisibleToRecipients = $o['IsVisibleToRecipients'];
if (isset($o['Index'])) $this->Index = $o['Index'];
if (isset($o['Email'])) $this->Email = JsonConverters::from('InputSwitch', $o['Email']);
if (isset($o['SMS'])) $this->SMS = JsonConverters::from('InputSwitch', $o['SMS']);
if (isset($o['UpdateNotification'])) $this->UpdateNotification = JsonConverters::from('InputSwitch', $o['UpdateNotification']);
if (isset($o['Push'])) $this->Push = JsonConverters::from('InputSwitch', $o['Push']);
if (isset($o['Phone'])) $this->Phone = JsonConverters::from('InputSwitch', $o['Phone']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->NotificationId)) $o['NotificationId'] = $this->NotificationId;
if (isset($this->NotificationGroupName)) $o['NotificationGroupName'] = $this->NotificationGroupName;
if (isset($this->NotificationValueId)) $o['NotificationValueId'] = $this->NotificationValueId;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->IsMandatory)) $o['IsMandatory'] = $this->IsMandatory;
if (isset($this->IsCardinality)) $o['IsCardinality'] = $this->IsCardinality;
if (isset($this->IsSystem)) $o['IsSystem'] = $this->IsSystem;
if (isset($this->IsVisibleToRecipients)) $o['IsVisibleToRecipients'] = $this->IsVisibleToRecipients;
if (isset($this->Index)) $o['Index'] = $this->Index;
if (isset($this->Email)) $o['Email'] = JsonConverters::to('InputSwitch', $this->Email);
if (isset($this->SMS)) $o['SMS'] = JsonConverters::to('InputSwitch', $this->SMS);
if (isset($this->UpdateNotification)) $o['UpdateNotification'] = JsonConverters::to('InputSwitch', $this->UpdateNotification);
if (isset($this->Push)) $o['Push'] = JsonConverters::to('InputSwitch', $this->Push);
if (isset($this->Phone)) $o['Phone'] = JsonConverters::to('InputSwitch', $this->Phone);
return empty($o) ? new class(){} : $o;
}
}
class NotificationGroup implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $GroupName=null,
/** @var array<NotificationDetails>|null */
public ?array $Notifications=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['GroupName'])) $this->GroupName = $o['GroupName'];
if (isset($o['Notifications'])) $this->Notifications = JsonConverters::fromArray('NotificationDetails', $o['Notifications']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->GroupName)) $o['GroupName'] = $this->GroupName;
if (isset($this->Notifications)) $o['Notifications'] = JsonConverters::toArray('NotificationDetails', $this->Notifications);
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="List of contact notifications")
class GetContactNotificationsResponse implements JsonSerializable
{
public function __construct(
/** @var array<NotificationGroup>|null */
public ?array $Notifications=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Notifications'])) $this->Notifications = JsonConverters::fromArray('NotificationGroup', $o['Notifications']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Notifications)) $o['Notifications'] = JsonConverters::toArray('NotificationGroup', $this->Notifications);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Get notifications for the specified contact */
// @Api(Description="Get notifications for the specified contact")
class GetContactNotifications implements JsonSerializable
{
public function __construct(
/** @description Id of contact to get notifications for */
// @ApiMember(Description="Id of contact to get notifications for", IsRequired=true, Name="ContactId")
/** @var string */
public string $ContactId='',
/** @description Id of licensee to get notifications for */
// @ApiMember(Description="Id of licensee to get notifications for", IsRequired=true, Name="LicenseeId")
/** @var string */
public string $LicenseeId='',
/** @description Id of suite to get notifications for */
// @ApiMember(Description="Id of suite to get notifications for", IsRequired=true, Name="Suite")
/** @var string */
public string $SuiteId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['LicenseeId'])) $this->LicenseeId = $o['LicenseeId'];
if (isset($o['SuiteId'])) $this->SuiteId = $o['SuiteId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->LicenseeId)) $o['LicenseeId'] = $this->LicenseeId;
if (isset($this->SuiteId)) $o['SuiteId'] = $this->SuiteId;
return empty($o) ? new class(){} : $o;
}
}
PHP GetContactNotifications 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.
POST /api/contact/{ContactId}/notifications HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: application/json
Content-Type: application/json
Content-Length: length
{"ContactId":"00000000-0000-0000-0000-000000000000","LicenseeId":"00000000-0000-0000-0000-000000000000","SuiteId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"Notifications":[{"GroupName":"String","Notifications":[{"NotificationId":"00000000-0000-0000-0000-000000000000","NotificationGroupName":"String","NotificationValueId":"00000000-0000-0000-0000-000000000000","Name":"String","Description":"String","IsMandatory":false,"IsCardinality":false,"IsSystem":false,"IsVisibleToRecipients":false,"Index":0,"Email":{"Id":"String","Name":"String","IsDisabled":false,"IsChecked":false},"SMS":{"Id":"String","Name":"String","IsDisabled":false,"IsChecked":false},"UpdateNotification":{"Id":"String","Name":"String","IsDisabled":false,"IsChecked":false},"Push":{"Id":"String","Name":"String","IsDisabled":false,"IsChecked":false},"Phone":{"Id":"String","Name":"String","IsDisabled":false,"IsChecked":false}}]}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}