File: ntfy_json.go

package info (click to toggle)
golang-github-nicholas-fedor-shoutrrr 0.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,680 kB
  • sloc: sh: 74; makefile: 58
file content (19 lines) | stat: -rw-r--r-- 342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package ntfy

import "fmt"

//nolint:errname
type apiResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"error"`
	Link    string `json:"link"`
}

func (e *apiResponse) Error() string {
	msg := fmt.Sprintf("server response: %v (%v)", e.Message, e.Code)
	if e.Link != "" {
		return msg + ", see: " + e.Link
	}

	return msg
}