scouting: Add support for /requests/request/data_scouting
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I6a53ed395a187f04c889af506ce6ecacd0a75916
diff --git a/scouting/webserver/requests/debug/debug.go b/scouting/webserver/requests/debug/debug.go
index 6add662..6515e81 100644
--- a/scouting/webserver/requests/debug/debug.go
+++ b/scouting/webserver/requests/debug/debug.go
@@ -10,6 +10,7 @@
"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_data_scouting_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"
)
@@ -18,6 +19,7 @@
type SubmitDataScoutingResponseT = submit_data_scouting_response.SubmitDataScoutingResponseT
type RequestAllMatchesResponseT = request_all_matches_response.RequestAllMatchesResponseT
type RequestMatchesForTeamResponseT = request_matches_for_team_response.RequestMatchesForTeamResponseT
+type RequestDataScoutingResponseT = request_data_scouting_response.RequestDataScoutingResponseT
// 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.
@@ -113,3 +115,15 @@
response := request_matches_for_team_response.GetRootAsRequestMatchesForTeamResponse(responseBytes, 0)
return response.UnPack(), nil
}
+
+// Sends a `RequestDataScouting` message to the server and returns the
+// deserialized response.
+func RequestDataScouting(server string, requestBytes []byte) (*RequestDataScoutingResponseT, error) {
+ responseBytes, err := performPost(server+"/requests/request/data_scouting", requestBytes)
+ if err != nil {
+ return nil, err
+ }
+ log.Printf("Parsing RequestDataScoutingResponse")
+ response := request_data_scouting_response.GetRootAsRequestDataScoutingResponse(responseBytes, 0)
+ return response.UnPack(), nil
+}