27 lines
388 B
Go
27 lines
388 B
Go
package notification
|
|
|
|
import (
|
|
// Standard
|
|
"bytes"
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
type NTFY struct {
|
|
URL string
|
|
}
|
|
|
|
func NewNTFY(config []byte) (instance NTFY, err error) {
|
|
err = json.Unmarshal(config, &instance)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return instance, nil
|
|
}
|
|
|
|
func (ntfy NTFY) Send(msg []byte) (err error) {
|
|
http.NewRequest("POST", ntfy.URL, bytes.NewReader(msg))
|
|
|
|
return
|
|
}
|