netconf-client: unify filtering API between <get> and <get-config>
Change-Id: I2762cfbdc8d29b5adde5aee9ba14ea9bad6fef06
diff --git a/src/netconf-client.cpp b/src/netconf-client.cpp
index 8f0e2ec..3ced537 100644
--- a/src/netconf-client.cpp
+++ b/src/netconf-client.cpp
@@ -276,9 +276,9 @@
return res;
}
-std::shared_ptr<libyang::Data_Node> Session::get(const std::string& filter)
+std::shared_ptr<libyang::Data_Node> Session::get(const std::optional<std::string>& filter)
{
- auto rpc = impl::guarded(nc_rpc_get(filter.c_str(), NC_WD_ALL, NC_PARAMTYPE_CONST));
+ auto rpc = impl::guarded(nc_rpc_get(filter ? filter->c_str() : nullptr, NC_WD_ALL, NC_PARAMTYPE_CONST));
if (!rpc) {
throw std::runtime_error("Cannot create get RPC");
}