scouting: Add support for /requests/request/matches_for_team
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I00bf80f2a8ee45db896adf025290e4dad4ba4273
diff --git a/scouting/webserver/requests/debug/debug.go b/scouting/webserver/requests/debug/debug.go
index 5984c7a..6add662 100644
--- a/scouting/webserver/requests/debug/debug.go
+++ b/scouting/webserver/requests/debug/debug.go
@@ -10,12 +10,14 @@
"github.com/frc971/971-Robot-Code/scouting/webserver/requests/messages/error_response"
"github.com/frc971/971-Robot-Code/scouting/webserver/requests/messages/request_all_matches_response"
+ "github.com/frc971/971-Robot-Code/scouting/webserver/requests/messages/request_matches_for_team_response"
"github.com/frc971/971-Robot-Code/scouting/webserver/requests/messages/submit_data_scouting_response"
)
// Use aliases to make the rest of the code more readable.
type SubmitDataScoutingResponseT = submit_data_scouting_response.SubmitDataScoutingResponseT
type RequestAllMatchesResponseT = request_all_matches_response.RequestAllMatchesResponseT
+type RequestMatchesForTeamResponseT = request_matches_for_team_response.RequestMatchesForTeamResponseT
// A struct that can be used as an `error`. It contains information about the
// why the server was unhappy and what the corresponding request was.
@@ -99,3 +101,15 @@
response := request_all_matches_response.GetRootAsRequestAllMatchesResponse(responseBytes, 0)
return response.UnPack(), nil
}
+
+// Sends a `RequestMatchesForTeam` message to the server and returns the
+// deserialized response.
+func RequestMatchesForTeam(server string, requestBytes []byte) (*RequestMatchesForTeamResponseT, error) {
+ responseBytes, err := performPost(server+"/requests/request/matches_for_team", requestBytes)
+ if err != nil {
+ return nil, err
+ }
+ log.Printf("Parsing RequestMatchesForTeamResponse")
+ response := request_matches_for_team_response.GetRootAsRequestMatchesForTeamResponse(responseBytes, 0)
+ return response.UnPack(), nil
+}