File: bark_json.go

package info (click to toggle)
golang-github-nicholas-fedor-shoutrrr 0.8.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,332 kB
  • sloc: sh: 61; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 896 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package bark

// PushPayload represents the notification payload for the Bark notification service.
type PushPayload struct {
	Body      string `json:"body"`
	DeviceKey string `json:"device_key"`
	Title     string `json:"title"`
	Sound     string `json:"sound,omitempty"`
	Badge     *int64 `json:"badge,omitempty"`
	Icon      string `json:"icon,omitempty"`
	Group     string `json:"group,omitempty"`
	URL       string `json:"url,omitempty"`
	Category  string `json:"category,omitempty"`
	Copy      string `json:"copy,omitempty"`
}

// APIResponse represents a response from the Bark API.
//
//nolint:errname
type APIResponse struct {
	Code      int64  `json:"code"`
	Message   string `json:"message"`
	Timestamp int64  `json:"timestamp"`
}

// Error returns the error message from the API response when applicable.
func (e *APIResponse) Error() string {
	return "server response: " + e.Message
}