From c65a247953d76a4ea93d7b915d67facc567a8a29 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Fri, 1 May 2020 05:44:51 -0700 Subject: [PATCH] Updated Notifiers (markdown) --- Notifiers.md | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/Notifiers.md b/Notifiers.md index 77a79c5..01f96e6 100644 --- a/Notifiers.md +++ b/Notifiers.md @@ -18,35 +18,15 @@ Statping has the `Notifier` interface which you'll need to include in your notif ```go // Notifier interface is required to create a new Notifier type Notifier interface { - OnSave() error // OnSave is triggered when the notifier is saved - Send(interface{}) error // OnSave is triggered when the notifier is saved - Select() *Notification // Select returns the *Notification for a notifier + // OnSuccess is triggered when a service is successful + OnSuccess(*services.Service) error + // OnFailure is triggered when a service is failing + OnFailure(*services.Service, *failures.Failure) error + // OnTest is triggered for testing + OnTest() (string, error) } ``` -### Basic Interface (required) -Include `OnSuccess` and `OnFailure` to receive events when a service is online or offline. -```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) -} -``` - -### Test Interface -The OnTest method will give the front end user the ability to test your notifier without saving, the OnTest method for your notifier run the functionality to test the user's submitted parameters and respond an error if notifier is not correctly setup. -```go -// Tester interface will include a function to Test users settings before saving -type Tester interface { - OnTest() error -} -``` -If your notifier includes this interface, the Test button will appear. - -## Notifier Struct ```go var example = &Example{¬ifier.Notification{ Method: "example", // unique method name