github.com/bshelton229/agent@v3.5.4+incompatible/api/pings.go (about) 1 package api 2 3 // PingsService handles communication with the ping related methods of the 4 // Buildkite Agent API. 5 type PingsService struct { 6 client *Client 7 } 8 9 // Ping represents a Buildkite Agent API Ping 10 type Ping struct { 11 Action string `json:"action,omitempty"` 12 Message string `json:"message,omitempty"` 13 Job *Job `json:"job,omitempty"` 14 Endpoint string `json:"endpoint,omitempty"` 15 } 16 17 // Pings the API and returns any work the client needs to perform 18 func (ps *PingsService) Get() (*Ping, *Response, error) { 19 req, err := ps.client.NewRequest("GET", "ping", nil) 20 if err != nil { 21 return nil, nil, err 22 } 23 24 ping := new(Ping) 25 resp, err := ps.client.Do(req, ping) 26 if err != nil { 27 return nil, resp, err 28 } 29 30 return ping, resp, err 31 }