From 52edced855f4de2f02162d4a3c607652938d2721 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Tue, 11 Sep 2018 19:25:28 -0700 Subject: [PATCH] Updated Notifiers (markdown) --- Notifiers.md | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Notifiers.md b/Notifiers.md index 984dce3..e276f81 100644 --- a/Notifiers.md +++ b/Notifiers.md @@ -33,13 +33,37 @@ type BasicEvents interface { } ``` +## Notifier Struct +```go +var example = &Example{¬ifier.Notification{ + Method: "example", // unique method name + Host: "http://exmaplehost.com", // default 'host' field + Form: []notifier.NotificationForm{{ + Type: "text", // text, password, number, or email + Title: "Host", // The title of value in form + Placeholder: "Insert your Host here.", // Optional placeholder in input + DbField: "host", // An accepted DbField value (read below) + }}, +} +``` + ## Notifier Form Include a form with your notifier so other users can save API keys, username, passwords, and other values. -#### Accepted DbField Values +### Accepted DbField Values +The `notifier.NotificationForm` has a field called `DbField` which is the column to save the value into the database. Below are the acceptable DbField string names to include in your form. - `host` used for a URL or API endpoint -- `host` used for a URL or API endpoint -- `host` used for a URL or API endpoint -- `host` used for a URL or API endpoint -- `host` used for a URL or API endpoint -- `host` used for a URL or API endpoint \ No newline at end of file +- `username` used for a username +- `password` used for a password +- `port` used for a integer port number +- `api_key` used for some kind of API key +- `api_secret` used for some API secret +- `var1` used for any type of string +- `var2` used for any type of string (extra) + +### Form Elements +You can completely custom your notifications to include a detailed form. +- `Type` is a HTML input type for your field +- `Title` give your input element a title +- `Placeholder` optional field if you want a placeholder in input +- `DbField` required field to save variable into database (read above) \ No newline at end of file