Add QA tests and expand serialization for API
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user