2023-11-08 23:12:04 +00:00
|
|
|
package ntfy
|
|
|
|
|
2023-11-13 21:54:07 +00:00
|
|
|
import "encoding/json"
|
|
|
|
|
2023-11-08 23:12:04 +00:00
|
|
|
type Message struct {
|
|
|
|
Topic string `json:"topic"` // Required
|
|
|
|
Message string `json:"message,omitempty"`
|
|
|
|
Markdown bool `json:"markdown"`
|
|
|
|
Title string `json:"title"` // Required
|
|
|
|
Tags []string `json:"tags,omitempty"` // https://docs.ntfy.sh/publish/#tags-emojis
|
|
|
|
Priority int `json:"priority,omitempty"` // 1-5
|
|
|
|
Delay string `json:"delay,omitempty"` // Duration i.e. "5s"
|
|
|
|
Icon string `json:"icon,omitempty"` // URL
|
|
|
|
Attach string `json:"attach,omitempty"` // URL
|
|
|
|
Filename string `json:"filename,omitempty"`
|
|
|
|
Click string `json:"click,omitempty"` // URL
|
|
|
|
Actions []struct {
|
|
|
|
Action string `json:"action"` // "view", "broadcast", or "http"
|
|
|
|
Label string `json:"label"`
|
|
|
|
URL string `json:"url,omitempty"`
|
|
|
|
Method string `json:"method,omitempty"`
|
|
|
|
Headers string `json:"headers,omitempty"`
|
|
|
|
Body string `json:"body,omitempty"`
|
|
|
|
Intent string `json:"intent,omitempty"`
|
|
|
|
Clear bool `json:"clear,omitempty"`
|
|
|
|
Extras map[string]string `json:"extras,omitempty"`
|
|
|
|
} `json:"actions,omitempty"`
|
|
|
|
}
|
2023-11-13 21:54:07 +00:00
|
|
|
|
|
|
|
type RunOptions struct {
|
|
|
|
TaskName string `json:"taskName"`
|
|
|
|
Par1 string `json:"par1,omitempty"`
|
|
|
|
Par2 string `json:"par2,omitempty"`
|
|
|
|
Priority int `json:"priority,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type VarOptions struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type TaskerApi struct {
|
|
|
|
Run []RunOptions `json:"run,omitempty"`
|
|
|
|
Set []VarOptions `json:"set,omitempty"`
|
|
|
|
Enable []string `json:"enable,omitempty"`
|
|
|
|
Disable []string `json:"disable,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *TaskerApi) ToString() string {
|
|
|
|
b, _ := json.Marshal(t)
|
|
|
|
return string(b)
|
|
|
|
}
|