Files
go-pushover-client/client.go
T
Amrit Panesar eb9ced212c use more strings
Signed-off-by: Amrit Panesar <amrit@station-app.com>
2015-09-02 12:23:13 -07:00

35 lines
612 B
Go

package go_pushover_client
import (
"net/http"
"net/url"
)
const (
pushoverURL = "https://api.pushover.net/1/messages.json"
)
type PushoverClient struct {
ApplicationToken string
}
func (p *PushoverClient) new(token string) {
p.ApplicationToken = token
}
func (p *PushoverClient) send(to string, message string, priority string) {
payload := url.Values{
"token": {p.ApplicationToken},
"user": {to},
"message": {message},
"priority": {priority},
}
http.PostForm(pushoverURL, payload)
}
func New(token string) *PushoverClient {
out := PushoverClient{}
out.new(token)
return &out
}