pull/78/head
Hunter Long 2018-10-07 02:27:43 -07:00
parent 112b50aae2
commit 15c6e02e46
1 changed files with 52 additions and 2 deletions

View File

@ -2,7 +2,8 @@
// //
// Example Notifier // Example Notifier
// //
// Below is an example of a Notifier with multiple Form values to custom your inputs. // Below is an example of a Notifier with multiple Form values to custom your inputs. Place your notifier go file
// into the /notifiers/ directory and follow the example below.
// //
// type ExampleNotifier struct { // type ExampleNotifier struct {
// *Notification // *Notification
@ -61,11 +62,60 @@
// }}, // }},
// }} // }}
// //
// Loading the Notifier into the Statup Notification system with the following // Load the Notifier
//
// Include the init() function with AddNotifier and your notification struct. This is ran on start of Statup
// and will automatically create a new row in the database so the end user can save their own values.
// //
// func init() { // func init() {
// AddNotifier(example) // AddNotifier(example)
// } // }
// //
// Required Methods for Notifier Interface
//
// Below are the required methods to have your notifier implement the Notifier interface. The Send method
// will be where you would include the logic for your notification.
//
// // REQUIRED
// func (n *ExampleNotifier) Send(msg interface{}) error {
// message := msg.(string)
// fmt.Printf("i received this string: %v\n", message)
// return nil
// }
//
// // REQUIRED
// func (n *ExampleNotifier) Select() *Notification {
// return n.Notification
// }
//
// // REQUIRED
// func (n *ExampleNotifier) OnSave() error {
// msg := fmt.Sprintf("received on save trigger")
// n.AddQueue(msg)
// return errors.New("onsave triggered")
// }
//
// Basic Events for Notifier
//
// You must include OnSuccess and OnFailure methods for your notifier. Anytime a service is online or offline
// these methods will be ran with the service corresponding to it.
//
// // REQUIRED - BASIC EVENT
// func (n *ExampleNotifier) OnSuccess(s *types.Service) {
// msg := fmt.Sprintf("received a count trigger for service: %v\n", s.Name)
// n.AddQueue(msg)
// }
//
// // REQUIRED - BASIC EVENT
// func (n *ExampleNotifier) OnFailure(s *types.Service, f *types.Failure) {
// msg := fmt.Sprintf("received a failure trigger for service: %v\n", s.Name)
// n.AddQueue(msg)
// }
//
// Additional Events
//
// You can implement your notifier to different types of events that are triggered. Checkout the wiki to
// see more details and examples of how to build your own notifier.
//
// More info on: https://github.com/hunterlong/statup/wiki/Notifiers // More info on: https://github.com/hunterlong/statup/wiki/Notifiers
package notifier package notifier