scouting: Add support /requests/request/all_matches
This patch adds a new endpoint that accepts the `RequestAllMatches`
message. It simply returns the full list of matches that the database
knows about.
I decided to change public `int` members in the `db` module to `int32`
so they match the flatbuffer definition. This makes comparison
simpler.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I9bb2eed020e2889644f5a122105a232a68f2f4bd
diff --git a/scouting/webserver/requests/debug/debug.go b/scouting/webserver/requests/debug/debug.go
index dd70c1b..5984c7a 100644
--- a/scouting/webserver/requests/debug/debug.go
+++ b/scouting/webserver/requests/debug/debug.go
@@ -9,11 +9,13 @@
"net/http"
"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/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
// 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.
@@ -85,3 +87,15 @@
response := submit_data_scouting_response.GetRootAsSubmitDataScoutingResponse(responseBytes, 0)
return response.UnPack(), nil
}
+
+// Sends a `RequestAllMatches` message to the server and returns the
+// deserialized response.
+func RequestAllMatches(server string, requestBytes []byte) (*RequestAllMatchesResponseT, error) {
+ responseBytes, err := performPost(server+"/requests/request/all_matches", requestBytes)
+ if err != nil {
+ return nil, err
+ }
+ log.Printf("Parsing RequestAllMatchesResponse")
+ response := request_all_matches_response.GetRootAsRequestAllMatchesResponse(responseBytes, 0)
+ return response.UnPack(), nil
+}