Merge pull request #12164 from dashevchenko/activeTenantDevices

Active tenant devices filter for RestClient
This commit is contained in:
Andrew Shvayka 2024-12-02 17:11:15 +01:00 committed by GitHub
commit 43ec0ed467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1358,13 +1358,17 @@ public class RestClient implements Closeable {
}, params).getBody();
}
public PageData<DeviceInfo> getTenantDeviceInfos(String type, DeviceProfileId deviceProfileId, PageLink pageLink) {
public PageData<DeviceInfo> getTenantDeviceInfos(String type, Boolean active, DeviceProfileId deviceProfileId, PageLink pageLink) {
Map<String, String> params = new HashMap<>();
params.put("type", type);
params.put("deviceProfileId", deviceProfileId != null ? deviceProfileId.toString() : null);
if (active != null) {
params.put("active", active.toString());
}
addPageLinkToParam(params, pageLink);
return restTemplate.exchange(
baseURL + "/api/tenant/deviceInfos?type={type}&deviceProfileId={deviceProfileId}&" + getUrlParams(pageLink),
baseURL + "/api/tenant/deviceInfos?type={type}&deviceProfileId={deviceProfileId}&"
+ (active != null ? "active={active}&" : "") + getUrlParams(pageLink),
HttpMethod.GET, HttpEntity.EMPTY,
new ParameterizedTypeReference<PageData<DeviceInfo>>() {
}, params).getBody();