protocol: add GetApp helper methods
This commit is contained in:
parent
45e1ea6221
commit
d8ad567e7f
1 changed files with 18 additions and 0 deletions
|
@ -79,6 +79,15 @@ func (r *Request) AddApp(id, version string) *AppRequest {
|
|||
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 {
|
||||
Ping *PingRequest `xml:"ping"`
|
||||
UpdateCheck *UpdateRequest `xml:"updatecheck"`
|
||||
|
@ -181,6 +190,15 @@ func (r *Response) AddApp(id string, status AppStatus) *AppResponse {
|
|||
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 {
|
||||
Ping *PingResponse `xml:"ping"`
|
||||
UpdateCheck *UpdateResponse `xml:"updatecheck"`
|
||||
|
|
Loading…
Reference in a new issue