forked from kovetskiy/zabbixctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
responses.go
67 lines (53 loc) · 1.05 KB
/
responses.go
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import "github.com/reconquest/hierr-go"
type Response interface {
Error() error
}
type ResponseRaw struct {
Err struct {
Data string `json:"data"`
Message string `json:"message"`
} `json:"error"`
Result interface{} `json:"result"`
}
func (response *ResponseRaw) Error() error {
if response.Err.Data != "" && response.Err.Message != "" {
return hierr.Push(
response.Err.Message,
response.Err.Data,
)
}
return nil
}
type ResponseLogin struct {
ResponseRaw
Token string `json:"result"`
}
type ResponseTriggers struct {
ResponseRaw
Data map[string]Trigger `json:"result"`
}
type ResponseItems struct {
ResponseRaw
Data []Item `json:"result"`
}
type ResponseHTTPTests struct {
ResponseRaw
Data []HTTPTest `json:"result"`
}
type ResponseHosts struct {
ResponseRaw
Data []Host `json:"result"`
}
type ResponseUserGroup struct {
ResponseRaw
Data []UserGroup `json:"result"`
}
type ResponseUsers struct {
ResponseRaw
Data []User `json:"result"`
}
type ResponseHistory struct {
ResponseRaw
Data []History `json:"result"`
}