diff --git a/Notifier-Events.md b/Notifier-Events.md new file mode 100644 index 0000000..ea27c3a --- /dev/null +++ b/Notifier-Events.md @@ -0,0 +1,65 @@ +Events are handled by added interfaces for the elements you want to monitor. + +## Required Notifier Interface +```go +// Notifier interface is required to create a new Notifier +type Notifier interface { + // Run will trigger inside of the notifier when enabled + Run() error + // OnSave is triggered when the notifier is saved + OnSave() error + // Test will run a function inside the notifier to Test if it works + Test() error + // Select returns the *Notification for a notifier + Select() *Notification +} +``` + +## Basic Success/Failure Interface +```go +// BasicEvents includes the most minimal events, failing and successful service triggers +type BasicEvents interface { + // OnSuccess is triggered when a service is successful + OnSuccess(*types.Service) + // OnFailure is triggered when a service is failing + OnFailure(*types.Service, *types.Failure) +} +``` + + +## Service Events +```go +// ServiceEvents are events for Services +type ServiceEvents interface { + OnNewService(*types.Service) + OnUpdatedService(*types.Service) + OnDeletedService(*types.Service) +} +``` + +## User Events +```go +// UserEvents are events for Users +type UserEvents interface { + OnNewUser(*types.User) + OnUpdatedUser(*types.User) + OnDeletedUser(*types.User) +} +``` + +## Core Events +```go +// CoreEvents are events for the main Core app +type CoreEvents interface { + OnUpdatedCore(*types.Core) +} +``` + +## Notifier Events +```go +// NotifierEvents are events for other Notifiers +type NotifierEvents interface { + OnNewNotifier(*Notification) + OnUpdatedNotifier(*Notification) +} +``` \ No newline at end of file