Notes/notification/ntfy.go

27 lines
388 B
Go
Raw Normal View History

2024-03-29 08:06:23 +01:00
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
}