adding nonProvisioned parameter to GET devices API call

Signed-off-by: Bhavesh Patel <bhavesh.patel@kinarasystems.com>
This commit is contained in:
Bhavesh Patel
2024-02-20 14:19:17 -05:00
committed by Ivan Chvets
parent 5bee5b1372
commit fcdb7423ef
3 changed files with 47 additions and 16 deletions

View File

@@ -86,6 +86,7 @@ namespace OpenWifi {
auto serialOnly = GetBoolParameter(RESTAPI::Protocol::SERIALONLY, false);
auto deviceWithStatus = GetBoolParameter(RESTAPI::Protocol::DEVICEWITHSTATUS, false);
auto completeInfo = GetBoolParameter("completeInfo", false);
auto nonProvisioned = HasParameter("nonProvisioned", Arg);
if(!platform.empty() && (platform!="ap" && platform!="switch" && platform!="all")) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
@@ -131,7 +132,7 @@ namespace OpenWifi {
}
} else if (serialOnly) {
std::vector<std::string> SerialNumbers;
StorageService()->GetDeviceSerialNumbers(QB_.Offset, QB_.Limit, SerialNumbers, OrderBy, platform);
StorageService()->GetDeviceSerialNumbers(QB_.Offset, QB_.Limit, SerialNumbers, OrderBy, platform, nonProvisioned);
Poco::JSON::Array Objects;
for (const auto &i : SerialNumbers) {
Objects.add(i);
@@ -149,7 +150,7 @@ namespace OpenWifi {
RetObj.set("serialNumbers", Objects);
} else {
std::vector<GWObjects::Device> Devices;
StorageService()->GetDevices(QB_.Offset, QB_.Limit, Devices, OrderBy, platform);
StorageService()->GetDevices(QB_.Offset, QB_.Limit, Devices, OrderBy, platform, nonProvisioned);
Poco::JSON::Array Objects;
for (const auto &i : Devices) {
Poco::JSON::Object Obj;