protocol: add GetApp helper methods

This commit is contained in:
Michael Marineau 2017-05-12 12:56:21 -07:00
parent 45e1ea6221
commit d8ad567e7f

View file

@ -79,6 +79,15 @@ func (r *Request) AddApp(id, version string) *AppRequest {
return a return a
} }
func (r *Request) GetApp(id string) *AppRequest {
for _, app := range r.Apps {
if app.ID == id {
return app
}
}
return nil
}
type AppRequest struct { type AppRequest struct {
Ping *PingRequest `xml:"ping"` Ping *PingRequest `xml:"ping"`
UpdateCheck *UpdateRequest `xml:"updatecheck"` UpdateCheck *UpdateRequest `xml:"updatecheck"`
@ -181,6 +190,15 @@ func (r *Response) AddApp(id string, status AppStatus) *AppResponse {
return a return a
} }
func (r *Response) GetApp(id string) *AppResponse {
for _, app := range r.Apps {
if app.ID == id {
return app
}
}
return nil
}
type AppResponse struct { type AppResponse struct {
Ping *PingResponse `xml:"ping"` Ping *PingResponse `xml:"ping"`
UpdateCheck *UpdateResponse `xml:"updatecheck"` UpdateCheck *UpdateResponse `xml:"updatecheck"`