omaha: split request and response structures

Despite having common names between the request and response XML
structures the actual values which may appear in them are completely
disjoint. Splitting the types up makes the protocol easier to understand
when reading the code. When applicable, required fields like status are
passed to Add* methods.
This commit is contained in:
Michael Marineau 2015-07-25 16:44:18 -07:00
parent ec70842bdd
commit 75a1125f53
2 changed files with 101 additions and 61 deletions

View file

@ -83,10 +83,8 @@ func TestOmahaRequestUpdateCheck(t *testing.T) {
func ExampleNewResponse() {
response := NewResponse()
app := response.AddApp("{52F1B9BC-D31A-4D86-9276-CBC256AADF9A}", "ok")
p := app.AddPing()
p.Status = "ok"
u := app.AddUpdateCheck()
u.Status = "ok"
app.AddPing()
u := app.AddUpdateCheck(UpdateOK)
u.AddURL("http://localhost/updates")
m := u.AddManifest("9999.0.0")
k := m.AddPackage()