MCPcopy Create free account
hub / github.com/MITK/MITK / ParsePropertyQueryParams

Method ParsePropertyQueryParams

Modules/RESTAPI/src/mitkDataStorageController.cpp:659–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659PropertyQueryParams DataStorageController::ParsePropertyQueryParams(const httplib::Request& req, PropertyScope defaultScope) const
660{
661 PropertyQueryParams params;
662 params.scope = defaultScope;
663
664 // Property scope (closed enum: "all", "node", "data" -- strict)
665 if (req.has_param("property_scope"))
666 {
667 const std::string scopeStr = req.get_param_value("property_scope");
668 if (scopeStr == "node")
669 {
670 params.scope = PropertyScope::Node;
671 }
672 else if (scopeStr == "data")
673 {
674 params.scope = PropertyScope::Data;
675 }
676 else if (scopeStr == "all")
677 {
678 params.scope = PropertyScope::All;
679 }
680 else
681 {
682 throw InvalidQueryParam{
683 "Invalid property_scope '" + scopeStr + "'. Must be 'all', 'node', or 'data'."};
684 }
685 }
686
687 // Context (for renderer-specific properties)
688 if (req.has_param("context"))
689 {
690 params.context = req.get_param_value("context");
691 }
692
693 // Content parameter (per API spec: content=true/false to include values)
694 if (req.has_param("content"))
695 {
696 std::string contentStr = req.get_param_value("content");
697 params.includeContent = (contentStr != "false" && contentStr != "0");
698 }
699
700 // Names - comma-separated list of specific property names to return
701 if (req.has_param("names"))
702 {
703 params.names = ParseCommaSeparatedList(req.get_param_value("names"));
704 }
705
706 return params;
707}
708
709void DataStorageController::SendJsonResponse(httplib::Response& res, int status, const nlohmann::json& body)
710{

Calls 1

ParseCommaSeparatedListFunction · 0.85

Tested by

no test coverage detected