uptimerobot
uptimerobot copied to clipboard
Add constants for alert contact types
Hey i would like to contribute to this project or rather help solve the issue can you please guide me.
Hey @ItsTalha0, welcome aboard! I shall be delighted if you would like to work on this issue.
You'll see from the Uptime Robot API documentation that alert contacts (ways to notify people if a monitoring check fails) have a 'Type' which indicates what kind of contact they are:
1 - SMS 2 - E-mail 3 - Twitter DM 4 - Boxcar 5 - Web-Hook 6 - Pushbullet 7 - Zapier 9 - Pushover 10 - HipChat 11 - Slack
Right now we deal with contact types in the uptimerobot
package just by using that number directly:
AlertContact{
ID: "0993765",
FriendlyName: "John Doe",
Type: 2,
Status: 1,
Value: "[email protected]",
}
Instead, we would like to be able to use helpful names for these types, defined as constants. For example:
AlertContact{
...
Type: ContactEmail,
...
}
Here we've defined the constant ContactEmail
as the value 2, for example.
So much for creating alert contacts with the friendly names, but we would also like to be able to display them in some way. Right now when we print out an alert contact type it just shows 2
, but it would be nice to be able to print Email
instead.
Monitors also have types, defined by constants such as TypeHTTP
, and to print them out we have a method on the Monitor
type called FriendlyType
:
func (m Monitor) FriendlyType() string {
switch m.Type {
case TypeHTTP:
return "HTTP"
...
}
Do you think you could create something similar for alert contacts? Let me know if you'd like more help.
Thanks for considering, I will need to get aquinted with the project I m a newbie to foss so bear with me. If you can guide me around the project or assign me some newbie task only if you have time will be a lot helpfull,and will mean a lot to me.
Added in #26