Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constants for alert contact types #23

Open
bitfield opened this issue May 24, 2020 · 4 comments
Open

Add constants for alert contact types #23

bitfield opened this issue May 24, 2020 · 4 comments

Comments

@bitfield
Copy link
Owner

No description provided.

@ItsTalha0
Copy link

Hey i would like to contribute to this project or rather help solve the issue can you please guide me.

@bitfield
Copy link
Owner Author

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:        "johndoe@gmail.com",
}

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.

@ItsTalha0
Copy link

ItsTalha0 commented Oct 24, 2020

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.

@ghost
Copy link

ghost commented Dec 27, 2020

Added in #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants