NSWDPC\Messaging\Mailgun\MailgunEvent
- Author: James Ellis
Synopsis
class MailgunEvent
extends DataObject
implements
PermissionProvider
{
- // constants
- const ACCEPTED = 'accepted';
- const REJECTED = 'rejected';
- const DELIVERED = 'delivered';
- const FAILED = 'failed';
- const OPENED = 'opened';
- const CLICKED = 'clicked';
- const UNSUBSCRIBED = 'unsubscribed';
- const COMPLAINED = 'complained';
- const STORED = 'stored';
- const TAG_RESUBMIT = 'resubmit';
- const FAILURE_TEMPORARY = 'temporary';
- const FAILURE_PERMANENT = 'permanent';
- const PERMISSIONS_VIEW = 'MAILGUNEVENT_VIEW';
- const PERMISSIONS_DELETE = 'MAILGUNEVENT_DELETE';
- // members
- private static string $default_sort = "Timestamp DESC";
- private static string $singular_name = "Event";
- private static string $plural_name = "Events";
- private static string $table_name = "MailgunEvent";
- private static array $db = ;
- private static array $summary_fields = ;
- private static array $searchable_fields = ;
- private static array $indexes = ;
- // methods
- public array providePermissions()
- public void requireDefaultRecords()
- private void createGroupsAndPermissions()
- public void getTitle()
- public void Age()
- public void canEdit()
- public void canDelete()
- public void canView()
- public void getCmsFields()
- public DataList getSiblingEvents()
- public string UTCDateTime()
- public string LocalDateTime()
- private string RecordDateTime()
- public static void UserActionStatus()
- public void IsFailed()
- public void IsFailure()
- public void IsRejected()
- public boolean IsFailedOrRejected()
- public boolean IsDelivered()
- public boolean IsAccepted()
- public boolean IsUserEvent()
- private static string CreateUTCDate()
- private static string CreateUTCDateTime()
- private static void GetByMessageDetails()
- private string getMessageHeader()
- private void saveDeliveryStatus()
- public MailgunEvent|boolean storeEvent()
- public void GetRecipientFailures()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Implements
- SilverStripe\Security\PermissionProvider
Constants
Name | Value |
---|---|
ACCEPTED | 'accepted' |
REJECTED | 'rejected' |
DELIVERED | 'delivered' |
FAILED | 'failed' |
OPENED | 'opened' |
CLICKED | 'clicked' |
UNSUBSCRIBED | 'unsubscribed' |
COMPLAINED | 'complained' |
STORED | 'stored' |
TAG_RESUBMIT | 'resubmit' |
FAILURE_TEMPORARY | 'temporary' |
FAILURE_PERMANENT | 'permanent' |
PERMISSIONS_VIEW | 'MAILGUNEVENT_VIEW' |
PERMISSIONS_DELETE | 'MAILGUNEVENT_DELETE' |
Members
private
- $db
- $default_sort
- $indexes
- $plural_name
- $searchable_fields
—
array
Defines a default list of filters for the search context - $singular_name
- $summary_fields
- $table_name
Methods
private
- CreateUTCDate() — Helper method to create a UTC Date from a timestamp
- CreateUTCDateTime() — Helper method to create a UTC DateTime from a timestamp
- GetByMessageDetails() — GetByMessageDetails - retrieve an event based on the message/timestamp/recipient/event type
- RecordDateTime() — Return RFC2822 formatted string of event timestamp
- createGroupsAndPermissions() — Set permission groups
- getMessageHeader() — Return message header from the {@link Mailgun\Model\Event\Event}
- saveDeliveryStatus() — Based on a delivery status returned from Mailgun, grab relevant details for this record
public
- Age() — Returns the age of the event, in seconds
- GetRecipientFailures() — Retrieve the number of failures for a particular recipient/message for this event's linked submission Failures are determined to be 'failed' or 'rejected' events
- IsAccepted()
- IsDelivered()
- IsFailed()
- IsFailedOrRejected() — Helper method to determin if event is failed || rejected
- IsFailure()
- IsRejected()
- IsUserEvent()
- LocalDateTime() — Local date/time based on Timestamp of this event
- UTCDateTime() — UTC date/time based on Timestamp of this event
- UserActionStatus() — Combining all event types that are related to a user action
- canDelete() — Apply permission check on deleting events
- canEdit() — Events can't be edited
- canView() — Allow viewing by members with this permission
- getCmsFields() — Most of the fields here are readonly
- getSiblingEvents() — Events that are sibling to this event (sharing the smae MessageId)
- getTitle() — Allow for easy visual matching between this and the Mailgun App Logs screen
- providePermissions()
- requireDefaultRecords() — Set up permissions, assign to group
- storeEvent() — Given a Mailgun\Model\Event\Event, store if possible