| PUT | /api/automation/notification/{AutomationId} | ||
|---|---|---|---|
| POST | /api/automation/notification |
<?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 AutomationModel implements JsonSerializable
{
public function __construct(
/** @description The unique automation Id */
// @ApiMember(Description="The unique automation Id", ParameterType="query")
/** @var string */
public string $AutomationId='',
/** @description The automation type Id */
// @ApiMember(Description="The automation type Id", ParameterType="query")
/** @var string */
public string $AutomationTypeId='',
/** @description The automation type */
// @ApiMember(Description="The automation type", ParameterType="query")
/** @var string|null */
public ?string $AutomationType=null,
/** @description The object this automation applies to */
// @ApiMember(Description="The object this automation applies to", ParameterType="query")
/** @var string */
public string $ObjectId='',
/** @description The object name this automation applies to */
// @ApiMember(Description="The object name this automation applies to", ParameterType="query")
/** @var string|null */
public ?string $ObjectName=null,
/** @description The Id of the object type that this automation applies to. */
// @ApiMember(Description="The Id of the object type that this automation applies to. ", ParameterType="query")
/** @var string */
public string $RmsTableCtxIdObject='',
/** @description The name of the object type that this automation applies to. */
// @ApiMember(Description="The name of the object type that this automation applies to.", ParameterType="query")
/** @var string|null */
public ?string $RmsTableCtxName=null,
/** @description A guid list containing the selected system action Id's that trigger this automation. */
// @ApiMember(Description="A guid list containing the selected system action Id's that trigger this automation.", ParameterType="query")
/** @var array<string>|null */
public ?array $ActionList=null,
/** @description A comma separated string of the selected system action names that trigger this automation. */
// @ApiMember(Description="A comma separated string of the selected system action names that trigger this automation.", ParameterType="query")
/** @var string|null */
public ?string $Actions=null,
/** @description Name of the automation. */
// @ApiMember(Description="Name of the automation.", ParameterType="query")
/** @var string|null */
public ?string $Name=null,
/** @description Description of the automation */
// @ApiMember(Description="Description of the automation", ParameterType="query")
/** @var string|null */
public ?string $Description=null,
/** @description Owner Contact Id */
// @ApiMember(Description="Owner Contact Id", ParameterType="query")
/** @var string */
public string $OwnerContactId='',
/** @description Record Status of the automation. */
// @ApiMember(Description="Record Status of the automation.", ParameterType="query")
/** @var string|null */
public ?string $RecordStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AutomationId'])) $this->AutomationId = $o['AutomationId'];
if (isset($o['AutomationTypeId'])) $this->AutomationTypeId = $o['AutomationTypeId'];
if (isset($o['AutomationType'])) $this->AutomationType = $o['AutomationType'];
if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
if (isset($o['ObjectName'])) $this->ObjectName = $o['ObjectName'];
if (isset($o['RmsTableCtxIdObject'])) $this->RmsTableCtxIdObject = $o['RmsTableCtxIdObject'];
if (isset($o['RmsTableCtxName'])) $this->RmsTableCtxName = $o['RmsTableCtxName'];
if (isset($o['ActionList'])) $this->ActionList = JsonConverters::fromArray('Guid', $o['ActionList']);
if (isset($o['Actions'])) $this->Actions = $o['Actions'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['OwnerContactId'])) $this->OwnerContactId = $o['OwnerContactId'];
if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AutomationId)) $o['AutomationId'] = $this->AutomationId;
if (isset($this->AutomationTypeId)) $o['AutomationTypeId'] = $this->AutomationTypeId;
if (isset($this->AutomationType)) $o['AutomationType'] = $this->AutomationType;
if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
if (isset($this->ObjectName)) $o['ObjectName'] = $this->ObjectName;
if (isset($this->RmsTableCtxIdObject)) $o['RmsTableCtxIdObject'] = $this->RmsTableCtxIdObject;
if (isset($this->RmsTableCtxName)) $o['RmsTableCtxName'] = $this->RmsTableCtxName;
if (isset($this->ActionList)) $o['ActionList'] = JsonConverters::toArray('Guid', $this->ActionList);
if (isset($this->Actions)) $o['Actions'] = $this->Actions;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
return empty($o) ? new class(){} : $o;
}
}
class AutoNotificationModel extends AutomationModel implements JsonSerializable
{
/**
* @param string $AutomationId
* @param string $AutomationTypeId
* @param string|null $AutomationType
* @param string $ObjectId
* @param string|null $ObjectName
* @param string $RmsTableCtxIdObject
* @param string|null $RmsTableCtxName
* @param array<string>|null $ActionList
* @param string|null $Actions
* @param string|null $Name
* @param string|null $Description
* @param string $OwnerContactId
* @param string|null $RecordStatus
*/
public function __construct(
string $AutomationId='',
string $AutomationTypeId='',
?string $AutomationType=null,
string $ObjectId='',
?string $ObjectName=null,
string $RmsTableCtxIdObject='',
?string $RmsTableCtxName=null,
?array $ActionList=null,
?string $Actions=null,
?string $Name=null,
?string $Description=null,
string $OwnerContactId='',
?string $RecordStatus=null,
/** @description Contact Id of the licensee this notification has been created for. */
// @ApiMember(Description="Contact Id of the licensee this notification has been created for.", ParameterType="query")
/** @var string */
public string $ContactIdLicensee='',
/** @description Contact Role Group Id. If the notification is setup for people in a specified contact role group. */
// @ApiMember(Description="Contact Role Group Id. If the notification is setup for people in a specified contact role group.", ParameterType="query")
/** @var string */
public string $ContactRoleGroupId='',
/** @description Contact Role Id. If the notification is setup for people in a specified role. */
// @ApiMember(Description="Contact Role Id. If the notification is setup for people in a specified role.", ParameterType="query")
/** @var string */
public string $ContactRoleId='',
/** @description Contact Role Name. If the notification is setup for people in a specified role. */
// @ApiMember(Description="Contact Role Name. If the notification is setup for people in a specified role.", ParameterType="query")
/** @var string|null */
public ?string $ContactRoleName=null,
/** @description Contact Id. If the notification is setup for a specific person. */
// @ApiMember(Description="Contact Id. If the notification is setup for a specific person.", ParameterType="query")
/** @var string */
public string $ContactId='',
/** @description If true, then only contacts who are connected to the relevant object are notified. */
// @ApiMember(Description="If true, then only contacts who are connected to the relevant object are notified.", ParameterType="query")
/** @var bool|null */
public ?bool $ObjectContactConnectionRequired=null,
/** @description Document Notification: If true, then the notification will include a link to download the document. */
// @ApiMember(Description="Document Notification: If true, then the notification will include a link to download the document.", ParameterType="query")
/** @var bool|null */
public ?bool $AllowDirectAccess=null,
/** @description If true, the notification is sent as soon as it can be processed */
// @ApiMember(Description="If true, the notification is sent as soon as it can be processed", ParameterType="query")
/** @var bool|null */
public ?bool $SendImmediately=null,
/** @description If true, the notification is flagged and sent out when subscription/batch emails are next sent. */
// @ApiMember(Description="If true, the notification is flagged and sent out when subscription/batch emails are next sent.", ParameterType="query")
/** @var bool|null */
public ?bool $Batched=null,
/** @description Document Notification: If true, the notification is sent when a document has a status of draft. */
// @ApiMember(Description="Document Notification: If true, the notification is sent when a document has a status of draft.", ParameterType="query")
/** @var bool|null */
public ?bool $DraftStatus=null,
/** @description Document Notification: If true, the notification is sent when a document has a status of final. */
// @ApiMember(Description="Document Notification: If true, the notification is sent when a document has a status of final.", ParameterType="query")
/** @var bool|null */
public ?bool $FinalStatus=null,
/** @description True if we want to include a report on an email notification. */
// @ApiMember(Description="True if we want to include a report on an email notification. ", ParameterType="query")
/** @var bool|null */
public ?bool $IncludeReport=null,
/** @description True if this notification is based on a template. */
// @ApiMember(Description="True if this notification is based on a template.", ParameterType="query")
/** @var bool|null */
public ?bool $IsTemplateNotification=null,
/** @description When Inserting a new notification we can have 1+ roles. They should be passed to this field when inserting. */
// @ApiMember(Description="When Inserting a new notification we can have 1+ roles. They should be passed to this field when inserting.", ParameterType="query")
/** @var array<string>|null */
public ?array $Roles=null,
/** @description Communication Type Id. */
// @ApiMember(Description="Communication Type Id.", ParameterType="query")
/** @var string */
public string $CommunicationTypeId='',
/** @description Communication Type. */
// @ApiMember(Description="Communication Type.", ParameterType="query")
/** @var string|null */
public ?string $CommunicationType=null,
/** @description If communication type is email, this is the subject of the email to be sent. */
// @ApiMember(Description="If communication type is email, this is the subject of the email to be sent.", ParameterType="query")
/** @var string|null */
public ?string $Subject=null,
/** @description This is the notification details to be sent. */
// @ApiMember(Description="This is the notification details to be sent.", ParameterType="query")
/** @var string|null */
public ?string $Body=null,
/** @description If true, we will include the relevant project URL in the notification. */
// @ApiMember(Description="If true, we will include the relevant project URL in the notification.", ParameterType="query")
/** @var bool|null */
public ?bool $IncludeURL=null,
/** @description The notification Id of a notification setup in Workflow Notification Management to use for the notification. */
// @ApiMember(Description="The notification Id of a notification setup in Workflow Notification Management to use for the notification.", ParameterType="query")
/** @var string */
public string $NotificationId='',
/** @description The notification nameof a notification setup in Workflow Notification Management to use for the notification. */
// @ApiMember(Description="The notification nameof a notification setup in Workflow Notification Management to use for the notification.", ParameterType="query")
/** @var string|null */
public ?string $NotificationName=null,
/** @description The suite id the notification is setup for */
// @ApiMember(Description="The suite id the notification is setup for", ParameterType="query")
/** @var string */
public string $SuiteId='',
/** @description The suite name the notification is setup for */
// @ApiMember(Description="The suite name the notification is setup for", ParameterType="query")
/** @var string|null */
public ?string $SuiteName=null
) {
parent::__construct($AutomationId,$AutomationTypeId,$AutomationType,$ObjectId,$ObjectName,$RmsTableCtxIdObject,$RmsTableCtxName,$ActionList,$Actions,$Name,$Description,$OwnerContactId,$RecordStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ContactIdLicensee'])) $this->ContactIdLicensee = $o['ContactIdLicensee'];
if (isset($o['ContactRoleGroupId'])) $this->ContactRoleGroupId = $o['ContactRoleGroupId'];
if (isset($o['ContactRoleId'])) $this->ContactRoleId = $o['ContactRoleId'];
if (isset($o['ContactRoleName'])) $this->ContactRoleName = $o['ContactRoleName'];
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['ObjectContactConnectionRequired'])) $this->ObjectContactConnectionRequired = $o['ObjectContactConnectionRequired'];
if (isset($o['AllowDirectAccess'])) $this->AllowDirectAccess = $o['AllowDirectAccess'];
if (isset($o['SendImmediately'])) $this->SendImmediately = $o['SendImmediately'];
if (isset($o['Batched'])) $this->Batched = $o['Batched'];
if (isset($o['DraftStatus'])) $this->DraftStatus = $o['DraftStatus'];
if (isset($o['FinalStatus'])) $this->FinalStatus = $o['FinalStatus'];
if (isset($o['IncludeReport'])) $this->IncludeReport = $o['IncludeReport'];
if (isset($o['IsTemplateNotification'])) $this->IsTemplateNotification = $o['IsTemplateNotification'];
if (isset($o['Roles'])) $this->Roles = JsonConverters::fromArray('Guid', $o['Roles']);
if (isset($o['CommunicationTypeId'])) $this->CommunicationTypeId = $o['CommunicationTypeId'];
if (isset($o['CommunicationType'])) $this->CommunicationType = $o['CommunicationType'];
if (isset($o['Subject'])) $this->Subject = $o['Subject'];
if (isset($o['Body'])) $this->Body = $o['Body'];
if (isset($o['IncludeURL'])) $this->IncludeURL = $o['IncludeURL'];
if (isset($o['NotificationId'])) $this->NotificationId = $o['NotificationId'];
if (isset($o['NotificationName'])) $this->NotificationName = $o['NotificationName'];
if (isset($o['SuiteId'])) $this->SuiteId = $o['SuiteId'];
if (isset($o['SuiteName'])) $this->SuiteName = $o['SuiteName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ContactIdLicensee)) $o['ContactIdLicensee'] = $this->ContactIdLicensee;
if (isset($this->ContactRoleGroupId)) $o['ContactRoleGroupId'] = $this->ContactRoleGroupId;
if (isset($this->ContactRoleId)) $o['ContactRoleId'] = $this->ContactRoleId;
if (isset($this->ContactRoleName)) $o['ContactRoleName'] = $this->ContactRoleName;
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->ObjectContactConnectionRequired)) $o['ObjectContactConnectionRequired'] = $this->ObjectContactConnectionRequired;
if (isset($this->AllowDirectAccess)) $o['AllowDirectAccess'] = $this->AllowDirectAccess;
if (isset($this->SendImmediately)) $o['SendImmediately'] = $this->SendImmediately;
if (isset($this->Batched)) $o['Batched'] = $this->Batched;
if (isset($this->DraftStatus)) $o['DraftStatus'] = $this->DraftStatus;
if (isset($this->FinalStatus)) $o['FinalStatus'] = $this->FinalStatus;
if (isset($this->IncludeReport)) $o['IncludeReport'] = $this->IncludeReport;
if (isset($this->IsTemplateNotification)) $o['IsTemplateNotification'] = $this->IsTemplateNotification;
if (isset($this->Roles)) $o['Roles'] = JsonConverters::toArray('Guid', $this->Roles);
if (isset($this->CommunicationTypeId)) $o['CommunicationTypeId'] = $this->CommunicationTypeId;
if (isset($this->CommunicationType)) $o['CommunicationType'] = $this->CommunicationType;
if (isset($this->Subject)) $o['Subject'] = $this->Subject;
if (isset($this->Body)) $o['Body'] = $this->Body;
if (isset($this->IncludeURL)) $o['IncludeURL'] = $this->IncludeURL;
if (isset($this->NotificationId)) $o['NotificationId'] = $this->NotificationId;
if (isset($this->NotificationName)) $o['NotificationName'] = $this->NotificationName;
if (isset($this->SuiteId)) $o['SuiteId'] = $this->SuiteId;
if (isset($this->SuiteName)) $o['SuiteName'] = $this->SuiteName;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="List of (automation) notifications that are setup for an object.")
class GetAutomationNotificationsForObjectResponse implements JsonSerializable
{
public function __construct(
/** @description List of (automation) notifications. */
// @ApiMember(Description="List of (automation) notifications.")
/** @var array<AutoNotificationModel>|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('AutoNotificationModel', $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('AutoNotificationModel', $this->Notifications);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Add or update an (automation) notification for an object */
// @Api(Description="Add or update an (automation) notification for an object")
class SaveAutoNotification implements JsonSerializable
{
public function __construct(
/** @description Details of the (automation) notification to be added or updated. */
// @ApiMember(Description="Details of the (automation) notification to be added or updated.", ParameterType="query")
/** @var AutoNotificationModel|null */
public ?AutoNotificationModel $Notification=null,
/** @description Id of the automation. */
// @ApiMember(Description="Id of the automation.", ParameterType="path")
/** @var string */
public string $AutomationId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Notification'])) $this->Notification = JsonConverters::from('AutoNotificationModel', $o['Notification']);
if (isset($o['AutomationId'])) $this->AutomationId = $o['AutomationId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Notification)) $o['Notification'] = JsonConverters::to('AutoNotificationModel', $this->Notification);
if (isset($this->AutomationId)) $o['AutomationId'] = $this->AutomationId;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/automation/notification HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Notification:
{
ContactRoleName: String,
ObjectContactConnectionRequired: False,
AllowDirectAccess: False,
SendImmediately: False,
Batched: False,
DraftStatus: False,
FinalStatus: False,
IncludeReport: False,
IsTemplateNotification: False,
Roles:
[
00000000-0000-0000-0000-000000000000
],
CommunicationType: String,
Subject: String,
Body: String,
IncludeURL: False,
NotificationName: String,
SuiteName: String,
AutomationType: String,
ObjectName: String,
RmsTableCtxName: String,
ActionList:
[
00000000-0000-0000-0000-000000000000
],
Actions: String,
Name: String,
Description: String,
RecordStatus: String
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Notifications:
[
{
ContactRoleName: String,
ObjectContactConnectionRequired: False,
AllowDirectAccess: False,
SendImmediately: False,
Batched: False,
DraftStatus: False,
FinalStatus: False,
IncludeReport: False,
IsTemplateNotification: False,
Roles:
[
00000000-0000-0000-0000-000000000000
],
CommunicationType: String,
Subject: String,
Body: String,
IncludeURL: False,
NotificationName: String,
SuiteName: String,
AutomationType: String,
ObjectName: String,
RmsTableCtxName: String,
ActionList:
[
00000000-0000-0000-0000-000000000000
],
Actions: String,
Name: String,
Description: String,
RecordStatus: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}