Add QA tests and expand serialization for API

This commit is contained in:
Jon Evans
2024-04-02 19:51:18 -04:00
parent 6bd02cae6d
commit 1dbe78c68b
106 changed files with 9643 additions and 736 deletions
+4 -17
View File
@@ -19,10 +19,14 @@
*/
#include <api/api_handler.h>
#include <wx/wx.h>
using kiapi::common::ApiRequest, kiapi::common::ApiResponse, kiapi::common::ApiResponseStatus;
const wxString API_HANDLER::m_defaultCommitMessage = _( "Modification from API" );
API_RESULT API_HANDLER::Handle( ApiRequest& aMsg )
{
ApiResponseStatus status;
@@ -55,20 +59,3 @@ API_RESULT API_HANDLER::Handle( ApiRequest& aMsg )
// This response is used internally; no need for an error message
return tl::unexpected( status );
}
std::optional<KICAD_T> API_HANDLER::TypeNameFromAny( const google::protobuf::Any& aMessage )
{
static const std::map<std::string, KICAD_T> s_types = {
{ "type.googleapis.com/kiapi.board.types.Track", PCB_TRACE_T },
{ "type.googleapis.com/kiapi.board.types.Arc", PCB_ARC_T },
{ "type.googleapis.com/kiapi.board.types.Via", PCB_VIA_T },
};
auto it = s_types.find( aMessage.type_url() );
if( it != s_types.end() )
return it->second;
return std::nullopt;
}