MCPcopy Create free account
hub / github.com/AGenUI/AGenUI / parseUpdateComponentsData

Method parseUpdateComponentsData

core/src/surface/agenui_message_parser.cpp:41–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41AGenUIExeCode AGenUIMessageParser::parseUpdateComponentsData(const std::string& jsonData, std::string& outSurfaceId, nlohmann::json& outComponentsJson) {
42 try {
43 auto json = nlohmann::json::parse(jsonData);
44 if (!json.contains("updateComponents")) {
45 AGENUI_LOG("missing updateComponents field");
46 return UpdateComponents_MissingKeyword;
47 }
48
49 auto updateComponentsJson = json["updateComponents"];
50 if (!updateComponentsJson.contains("surfaceId")) {
51 AGENUI_LOG("missing surfaceId");
52 return UpdateComponents_MissingSurfaceId;
53 }
54 outSurfaceId = updateComponentsJson["surfaceId"].get<std::string>();
55 if (outSurfaceId.empty()) {
56 return UpdateComponents_EmptySurfaceId;
57 }
58 outComponentsJson = updateComponentsJson;
59 } catch (const nlohmann::json::exception& e) {
60 return UpdateComponents_JsonError;
61 }
62 return Execute_Success;
63}
64
65AGenUIExeCode AGenUIMessageParser::parseUpdateDataModelData(const std::string& jsonData, std::string& outSurfaceId, nlohmann::json& outDataModelJson) {
66 try {

Callers

nothing calls this directly

Calls 2

containsMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected