| POST | /api/notification/update |
|---|
<?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 NotificationRole implements JsonSerializable
{
public function __construct(
/** @var string */
public string $RoleId='',
/** @var string|null */
public ?string $RoleName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['RoleId'])) $this->RoleId = $o['RoleId'];
if (isset($o['RoleName'])) $this->RoleName = $o['RoleName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->RoleId)) $o['RoleId'] = $this->RoleId;
if (isset($this->RoleName)) $o['RoleName'] = $this->RoleName;
return empty($o) ? new class(){} : $o;
}
}
class Notification implements JsonSerializable
{
public function __construct(
/** @var string */
public string $NotificationId='',
/** @var string */
public string $NotificationGroupId='',
/** @var string|null */
public ?string $NotificationGroupName=null,
/** @var string */
public string $SuiteId='',
/** @var string|null */
public ?string $SuiteName=null,
/** @var string */
public string $NotificationValueId='',
/** @var array<NotificationRole>|null */
public ?array $Roles=null,
/** @var string|null */
public ?string $RolesToDisplay=null,
/** @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 $IsAudit=null,
/** @var bool|null */
public ?bool $IsVisibleToRecipients=null,
/** @var bool|null */
public ?bool $IsSingleUse=null,
/** @var bool|null */
public ?bool $Email=null,
/** @var bool|null */
public ?bool $EmailDefault=null,
/** @var string */
public string $EmailTemplateId='',
/** @var string|null */
public ?string $EmailTemplateBody=null,
/** @var string|null */
public ?string $EmailSubject=null,
/** @var bool|null */
public ?bool $SMS=null,
/** @var bool|null */
public ?bool $SMSDefault=null,
/** @var string */
public string $SMSTemplateId='',
/** @var string|null */
public ?string $SMSTemplateBody=null,
/** @var bool|null */
public ?bool $UpdateNotification=null,
/** @var bool|null */
public ?bool $UpdateNotificationDefault=null,
/** @var string */
public string $UpdateTemplateId='',
/** @var string|null */
public ?string $UpdateTemplateBody=null,
/** @var string|null */
public ?string $UpdateSubject=null,
/** @var bool|null */
public ?bool $Push=null,
/** @var bool|null */
public ?bool $PushDefault=null,
/** @var bool|null */
public ?bool $Phone=null,
/** @var bool|null */
public ?bool $PhoneDefault=null,
/** @var string */
public string $ContactIdOwner='',
/** @var string|null */
public ?string $RecordStatus=null,
/** @var string */
public string $EmailTemplateDefinitionId='',
/** @var string */
public string $SMSTemplateDefinitionId='',
/** @var string */
public string $UpdateTemplateDefinitionId='',
/** @var int */
public int $Index=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['NotificationId'])) $this->NotificationId = $o['NotificationId'];
if (isset($o['NotificationGroupId'])) $this->NotificationGroupId = $o['NotificationGroupId'];
if (isset($o['NotificationGroupName'])) $this->NotificationGroupName = $o['NotificationGroupName'];
if (isset($o['SuiteId'])) $this->SuiteId = $o['SuiteId'];
if (isset($o['SuiteName'])) $this->SuiteName = $o['SuiteName'];
if (isset($o['NotificationValueId'])) $this->NotificationValueId = $o['NotificationValueId'];
if (isset($o['Roles'])) $this->Roles = JsonConverters::fromArray('NotificationRole', $o['Roles']);
if (isset($o['RolesToDisplay'])) $this->RolesToDisplay = $o['RolesToDisplay'];
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['IsAudit'])) $this->IsAudit = $o['IsAudit'];
if (isset($o['IsVisibleToRecipients'])) $this->IsVisibleToRecipients = $o['IsVisibleToRecipients'];
if (isset($o['IsSingleUse'])) $this->IsSingleUse = $o['IsSingleUse'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['EmailDefault'])) $this->EmailDefault = $o['EmailDefault'];
if (isset($o['EmailTemplateId'])) $this->EmailTemplateId = $o['EmailTemplateId'];
if (isset($o['EmailTemplateBody'])) $this->EmailTemplateBody = $o['EmailTemplateBody'];
if (isset($o['EmailSubject'])) $this->EmailSubject = $o['EmailSubject'];
if (isset($o['SMS'])) $this->SMS = $o['SMS'];
if (isset($o['SMSDefault'])) $this->SMSDefault = $o['SMSDefault'];
if (isset($o['SMSTemplateId'])) $this->SMSTemplateId = $o['SMSTemplateId'];
if (isset($o['SMSTemplateBody'])) $this->SMSTemplateBody = $o['SMSTemplateBody'];
if (isset($o['UpdateNotification'])) $this->UpdateNotification = $o['UpdateNotification'];
if (isset($o['UpdateNotificationDefault'])) $this->UpdateNotificationDefault = $o['UpdateNotificationDefault'];
if (isset($o['UpdateTemplateId'])) $this->UpdateTemplateId = $o['UpdateTemplateId'];
if (isset($o['UpdateTemplateBody'])) $this->UpdateTemplateBody = $o['UpdateTemplateBody'];
if (isset($o['UpdateSubject'])) $this->UpdateSubject = $o['UpdateSubject'];
if (isset($o['Push'])) $this->Push = $o['Push'];
if (isset($o['PushDefault'])) $this->PushDefault = $o['PushDefault'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['PhoneDefault'])) $this->PhoneDefault = $o['PhoneDefault'];
if (isset($o['ContactIdOwner'])) $this->ContactIdOwner = $o['ContactIdOwner'];
if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
if (isset($o['EmailTemplateDefinitionId'])) $this->EmailTemplateDefinitionId = $o['EmailTemplateDefinitionId'];
if (isset($o['SMSTemplateDefinitionId'])) $this->SMSTemplateDefinitionId = $o['SMSTemplateDefinitionId'];
if (isset($o['UpdateTemplateDefinitionId'])) $this->UpdateTemplateDefinitionId = $o['UpdateTemplateDefinitionId'];
if (isset($o['Index'])) $this->Index = $o['Index'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->NotificationId)) $o['NotificationId'] = $this->NotificationId;
if (isset($this->NotificationGroupId)) $o['NotificationGroupId'] = $this->NotificationGroupId;
if (isset($this->NotificationGroupName)) $o['NotificationGroupName'] = $this->NotificationGroupName;
if (isset($this->SuiteId)) $o['SuiteId'] = $this->SuiteId;
if (isset($this->SuiteName)) $o['SuiteName'] = $this->SuiteName;
if (isset($this->NotificationValueId)) $o['NotificationValueId'] = $this->NotificationValueId;
if (isset($this->Roles)) $o['Roles'] = JsonConverters::toArray('NotificationRole', $this->Roles);
if (isset($this->RolesToDisplay)) $o['RolesToDisplay'] = $this->RolesToDisplay;
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->IsAudit)) $o['IsAudit'] = $this->IsAudit;
if (isset($this->IsVisibleToRecipients)) $o['IsVisibleToRecipients'] = $this->IsVisibleToRecipients;
if (isset($this->IsSingleUse)) $o['IsSingleUse'] = $this->IsSingleUse;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->EmailDefault)) $o['EmailDefault'] = $this->EmailDefault;
if (isset($this->EmailTemplateId)) $o['EmailTemplateId'] = $this->EmailTemplateId;
if (isset($this->EmailTemplateBody)) $o['EmailTemplateBody'] = $this->EmailTemplateBody;
if (isset($this->EmailSubject)) $o['EmailSubject'] = $this->EmailSubject;
if (isset($this->SMS)) $o['SMS'] = $this->SMS;
if (isset($this->SMSDefault)) $o['SMSDefault'] = $this->SMSDefault;
if (isset($this->SMSTemplateId)) $o['SMSTemplateId'] = $this->SMSTemplateId;
if (isset($this->SMSTemplateBody)) $o['SMSTemplateBody'] = $this->SMSTemplateBody;
if (isset($this->UpdateNotification)) $o['UpdateNotification'] = $this->UpdateNotification;
if (isset($this->UpdateNotificationDefault)) $o['UpdateNotificationDefault'] = $this->UpdateNotificationDefault;
if (isset($this->UpdateTemplateId)) $o['UpdateTemplateId'] = $this->UpdateTemplateId;
if (isset($this->UpdateTemplateBody)) $o['UpdateTemplateBody'] = $this->UpdateTemplateBody;
if (isset($this->UpdateSubject)) $o['UpdateSubject'] = $this->UpdateSubject;
if (isset($this->Push)) $o['Push'] = $this->Push;
if (isset($this->PushDefault)) $o['PushDefault'] = $this->PushDefault;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->PhoneDefault)) $o['PhoneDefault'] = $this->PhoneDefault;
if (isset($this->ContactIdOwner)) $o['ContactIdOwner'] = $this->ContactIdOwner;
if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
if (isset($this->EmailTemplateDefinitionId)) $o['EmailTemplateDefinitionId'] = $this->EmailTemplateDefinitionId;
if (isset($this->SMSTemplateDefinitionId)) $o['SMSTemplateDefinitionId'] = $this->SMSTemplateDefinitionId;
if (isset($this->UpdateTemplateDefinitionId)) $o['UpdateTemplateDefinitionId'] = $this->UpdateTemplateDefinitionId;
if (isset($this->Index)) $o['Index'] = $this->Index;
return empty($o) ? new class(){} : $o;
}
}
/** @description Updates an existing notification */
// @Api(Description="Updates an existing notification")
class UpdateNotification implements JsonSerializable
{
public function __construct(
/** @var Notification|null */
public ?Notification $Notification=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Notification'])) $this->Notification = JsonConverters::from('Notification', $o['Notification']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Notification)) $o['Notification'] = JsonConverters::to('Notification', $this->Notification);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/notification/update HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateNotification xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Subtle.Canvara.WebAPIModel.ServiceModel">
<Notification xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eros.Causal.Common.Entity">
<d2p1:ContactIdOwner>00000000-0000-0000-0000-000000000000</d2p1:ContactIdOwner>
<d2p1:Description>String</d2p1:Description>
<d2p1:Email>false</d2p1:Email>
<d2p1:EmailDefault>false</d2p1:EmailDefault>
<d2p1:EmailSubject>String</d2p1:EmailSubject>
<d2p1:EmailTemplateBody>String</d2p1:EmailTemplateBody>
<d2p1:EmailTemplateDefinitionId>00000000-0000-0000-0000-000000000000</d2p1:EmailTemplateDefinitionId>
<d2p1:EmailTemplateId>00000000-0000-0000-0000-000000000000</d2p1:EmailTemplateId>
<d2p1:Index>0</d2p1:Index>
<d2p1:IsAudit>false</d2p1:IsAudit>
<d2p1:IsCardinality>false</d2p1:IsCardinality>
<d2p1:IsMandatory>false</d2p1:IsMandatory>
<d2p1:IsSingleUse>false</d2p1:IsSingleUse>
<d2p1:IsSystem>false</d2p1:IsSystem>
<d2p1:IsVisibleToRecipients>false</d2p1:IsVisibleToRecipients>
<d2p1:Name>String</d2p1:Name>
<d2p1:NotificationGroupId>00000000-0000-0000-0000-000000000000</d2p1:NotificationGroupId>
<d2p1:NotificationGroupName>String</d2p1:NotificationGroupName>
<d2p1:NotificationId>00000000-0000-0000-0000-000000000000</d2p1:NotificationId>
<d2p1:NotificationValueId>00000000-0000-0000-0000-000000000000</d2p1:NotificationValueId>
<d2p1:Phone>false</d2p1:Phone>
<d2p1:PhoneDefault>false</d2p1:PhoneDefault>
<d2p1:Push>false</d2p1:Push>
<d2p1:PushDefault>false</d2p1:PushDefault>
<d2p1:RecordStatus>String</d2p1:RecordStatus>
<d2p1:Roles>
<d2p1:NotificationRole>
<d2p1:RoleId>00000000-0000-0000-0000-000000000000</d2p1:RoleId>
<d2p1:RoleName>String</d2p1:RoleName>
</d2p1:NotificationRole>
</d2p1:Roles>
<d2p1:SMS>false</d2p1:SMS>
<d2p1:SMSDefault>false</d2p1:SMSDefault>
<d2p1:SMSTemplateBody>String</d2p1:SMSTemplateBody>
<d2p1:SMSTemplateDefinitionId>00000000-0000-0000-0000-000000000000</d2p1:SMSTemplateDefinitionId>
<d2p1:SMSTemplateId>00000000-0000-0000-0000-000000000000</d2p1:SMSTemplateId>
<d2p1:SuiteId>00000000-0000-0000-0000-000000000000</d2p1:SuiteId>
<d2p1:SuiteName>String</d2p1:SuiteName>
<d2p1:UpdateNotification>false</d2p1:UpdateNotification>
<d2p1:UpdateNotificationDefault>false</d2p1:UpdateNotificationDefault>
<d2p1:UpdateSubject>String</d2p1:UpdateSubject>
<d2p1:UpdateTemplateBody>String</d2p1:UpdateTemplateBody>
<d2p1:UpdateTemplateDefinitionId>00000000-0000-0000-0000-000000000000</d2p1:UpdateTemplateDefinitionId>
<d2p1:UpdateTemplateId>00000000-0000-0000-0000-000000000000</d2p1:UpdateTemplateId>
</Notification>
</UpdateNotification>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
<Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:KeyValueOfstringstring>
<d4p1:Key>String</d4p1:Key>
<d4p1:Value>String</d4p1:Value>
</d4p1:KeyValueOfstringstring>
</Meta>
</ResponseError>
</Errors>
<Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</Meta>
</ResponseStatus>