-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
general.go
61 lines (50 loc) · 1.52 KB
/
general.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
package cachet
// GeneralService contains REST endpoints that belongs no specific service.
type GeneralService struct {
client *Client
}
// PingResponse entity contains the Response of a /ping call.
type PingResponse struct {
Data string `json:"data,omitempty"`
}
// VersionResponse entity contains the Response of a /version call.
type VersionResponse struct {
Meta MetaVersion `json:"meta,omitempty"`
Data string `json:"data,omitempty"`
}
// StatusAPIResponse entity contains the Response of a /status call.
type StatusAPIResponse struct {
Data *Status `json:"data"`
}
// Status entity contains the contents of API Response of a /status call.
type Status struct {
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
}
// Ping calls the API test endpoint.
//
// Docs: https://docs.cachethq.io/reference#ping
func (s *GeneralService) Ping() (string, *Response, error) {
u := "api/v1/ping"
v := new(PingResponse)
resp, err := s.client.Call("GET", u, nil, v)
return v.Data, resp, err
}
// Version get Cachet version
//
// Docs: https://docs.cachethq.io/reference#version
func (s *GeneralService) Version() (*VersionResponse, *Response, error) {
u := "api/v1/version"
v := new(VersionResponse)
resp, err := s.client.Call("GET", u, nil, v)
return v, resp, err
}
// Status get Cachet status
//
// Docs: <none>
func (s *GeneralService) Status() (*Status, *Response, error) {
u := "api/v1/status"
v := new(StatusAPIResponse)
resp, err := s.client.Call("GET", u, nil, v)
return v.Data, resp, err
}