-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheartbeat.go
35 lines (31 loc) · 893 Bytes
/
heartbeat.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
package brewerydb
// HeartbeatService provides access to the BreweryDB Heartbeat API.
// Use Client.Heartbeat.
//
// See: http://www.brewerydb.com/developers/docs-endpoint/heartbeat_index
type HeartbeatService struct {
c *Client
}
// HeartbeatResponse represents a BreweryDB Heartbeat (essentially an "echo"
// of the Heartbeat request).
type HeartbeatResponse struct {
Status string
Data struct {
Format string
RequestMethod string
Key string
Timestamp int
}
Message string
}
// Heartbeat checks whether the BreweryDB API is currently active. It
// returns nil if the API is available and an error otherwise.
//
// See: http://www.brewerydb.com/developers/docs-endpoint/heartbeat_index#1
func (hs *HeartbeatService) Heartbeat() error {
req, err := hs.c.NewRequest("GET", "/heartbeat", nil)
if err != nil {
return err
}
return hs.c.Do(req, nil)
}