Documentation ¶
Index ¶
- func ApiAuthLogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiAuthLogout(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiIndexVersion(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiSettingsInterval(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiSettingsPassword(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsiteCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitePutNotifications(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsites(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesAdd(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesDelete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesDetailed(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesEdit(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesEnabled(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesGetNotifications(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesResults(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesStatus(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func ApiWebsitesVisibility(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func SendJsonMessage(w http.ResponseWriter, code int, success bool, message string)
- type BasicResponse
- type BasicWebsite
- type DetailedWebsite
- type DetailedWebsiteResponse
- type EnabledNotifications
- type Notifications
- type ResultsResponse
- type StatusResponse
- type WebsiteAvailability
- type WebsiteCheckResult
- type WebsiteData
- type WebsiteNotificationsResponse
- type WebsiteResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiAuthLogin ¶
func ApiAuthLogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Processes a login-request and sends an authentication-cookie to the browser.
func ApiAuthLogout ¶
func ApiAuthLogout(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Processes a logout-request and sends a termination-cookie to the browser.
func ApiIndexVersion ¶
func ApiIndexVersion(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Sends a simple welcome-message to the user.
func ApiSettingsInterval ¶
func ApiSettingsInterval(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Updates the application's check-interval in the database.
func ApiSettingsPassword ¶
func ApiSettingsPassword(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Updates the user's password in the database.
func ApiWebsiteCheck ¶
func ApiWebsiteCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Triggers a check of all enabled Websites.
func ApiWebsitePutNotifications ¶
func ApiWebsitePutNotifications(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Sets an existing Website's notification-preferences.
func ApiWebsites ¶
func ApiWebsites(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Returns a WebsiteResponse containing all publicly visible Websites as BasicWebsite.
func ApiWebsitesAdd ¶
func ApiWebsitesAdd(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Inserts a new Website into the database.
func ApiWebsitesDelete ¶
func ApiWebsitesDelete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Removes an existing Website from the database.
func ApiWebsitesDetailed ¶
func ApiWebsitesDetailed(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Returns a AdminWebsiteResponse containing all Websites as AdminWebsite.
func ApiWebsitesEdit ¶
func ApiWebsitesEdit(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Edits an existing Website in the database.
func ApiWebsitesEnabled ¶
func ApiWebsitesEnabled(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Enables / Disables an existing Website in the database.
func ApiWebsitesGetNotifications ¶
func ApiWebsitesGetNotifications(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Get an existing Website's notification-preferences.
func ApiWebsitesResults ¶
func ApiWebsitesResults(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Returns a ResultsResponse containing an array of WebsiteCheckResults.
func ApiWebsitesStatus ¶
func ApiWebsitesStatus(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Returns a StatusResponse containing all the Website's important data if the Website is enabled.
func ApiWebsitesVisibility ¶
func ApiWebsitesVisibility(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Sets an existing Website to visible / invisible in the database.
func SendJsonMessage ¶
func SendJsonMessage(w http.ResponseWriter, code int, success bool, message string)
Sends a simple Json-message. It contains a success-bool and a message, which may be empty.
Types ¶
type BasicResponse ¶
Contains a success-bool and a message, which may be empty.
type BasicWebsite ¶
type BasicWebsite struct { Name string `json:"name"` Protocol string `json:"protocol"` Url string `json:"url"` Status string `json:"status"` ResponseTime string `json:"responseTime"` }
Contains the Website's basic data such as name, protocol, url and current status.
type DetailedWebsite ¶
type DetailedWebsite struct { Id int `json:"id"` Name string `json:"name"` Enabled bool `json:"enabled"` Visible bool `json:"visible"` Protocol string `json:"protocol"` Url string `json:"url"` CheckMethod string `json:"checkMethod"` Status string `json:"status"` ResponseTime string `json:"responseTime"` Time string `json:"time"` EnabledNotifications EnabledNotifications `json:"notifications"` }
Contains the Website's data, which will be shown inside the admin-backend.
type DetailedWebsiteResponse ¶
type DetailedWebsiteResponse struct { Success bool `json:"requestSuccess"` Websites []DetailedWebsite `json:"websites"` }
Contains a success-bool and an array of AdminWebsites.
type EnabledNotifications ¶
type EnabledNotifications struct { Pushbullet bool `json:"pushbullet"` Email bool `json:"email"` Telegram bool `json:"telegram"` }
Contains whether a notification-type is enabled or not.
type Notifications ¶
type Notifications struct { PushbulletKey string `json:"pushbulletKey"` Email string `json:"email"` TelegramId string `json:"telegramId"` }
Contains all saved notification settings of a website.
type ResultsResponse ¶
type ResultsResponse struct { Success bool `json:"requestSuccess"` Websites []WebsiteCheckResult `json:"results"` }
Contains a success-bool and an array of WebsiteCheckResults.
type StatusResponse ¶
type StatusResponse struct { Success bool `json:"requestSuccess"` WebsiteData WebsiteData `json:"websiteData"` Availability WebsiteAvailability `json:"availability"` LastCheckResult WebsiteCheckResult `json:"lastCheckResult"` LastFailedCheckResult WebsiteCheckResult `json:"lastFailedCheckResult"` }
Contains a success-bool and the Website's details.
type WebsiteAvailability ¶
type WebsiteAvailability struct { Ups int `json:"ups"` Downs int `json:"downs"` Total int `json:"total"` Average string `json:"average"` }
Contains the Website's availability data like the amount of ups / downs, total checks and the average availability.
type WebsiteCheckResult ¶
type WebsiteCheckResult struct { Status string `json:"status"` ResponseTime string `json:"responseTime"` Time string `json:"time"` }
Contains the Website's latest check result.
type WebsiteData ¶
Contains the Website's basic data such as id, name and url.
type WebsiteNotificationsResponse ¶
type WebsiteNotificationsResponse struct { Success bool `json:"requestSuccess"` Notifications Notifications `json:"notifications"` }
Contains a success-bool and a notification-object.
type WebsiteResponse ¶
type WebsiteResponse struct { Success bool `json:"requestSuccess"` Websites []BasicWebsite `json:"websites"` }
Contains a success-bool and an array of BasicWebsites.