From 6f8b52056b953f488ebb63563381b4169c50d579 Mon Sep 17 00:00:00 2001 From: ShvaykaD Date: Tue, 16 Nov 2021 15:04:10 +0200 Subject: [PATCH] fixed widget type based methods in rest client --- .../org/thingsboard/rest/client/RestClient.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java index a64dd97cdc..ebc7df1f25 100644 --- a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java +++ b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java @@ -134,6 +134,7 @@ import org.thingsboard.server.common.data.security.model.SecuritySettings; import org.thingsboard.server.common.data.security.model.UserPasswordPolicy; import org.thingsboard.server.common.data.sms.config.TestSmsRequest; import org.thingsboard.server.common.data.widget.WidgetType; +import org.thingsboard.server.common.data.widget.WidgetTypeDetails; import org.thingsboard.server.common.data.widget.WidgetsBundle; import java.io.Closeable; @@ -2423,11 +2424,11 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { }).getBody(); } - public Optional getWidgetTypeById(WidgetTypeId widgetTypeId) { + public Optional getWidgetTypeById(WidgetTypeId widgetTypeId) { try { - ResponseEntity widgetType = - restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetType.class, widgetTypeId.getId()); - return Optional.ofNullable(widgetType.getBody()); + ResponseEntity widgetTypeDetails = + restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetTypeDetails.class, widgetTypeId.getId()); + return Optional.ofNullable(widgetTypeDetails.getBody()); } catch (HttpClientErrorException exception) { if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { return Optional.empty(); @@ -2437,8 +2438,8 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { } } - public WidgetType saveWidgetType(WidgetType widgetType) { - return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetType, WidgetType.class).getBody(); + public WidgetTypeDetails saveWidgetType(WidgetTypeDetails widgetTypeDetails) { + return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetTypeDetails, WidgetTypeDetails.class).getBody(); } public void deleteWidgetType(WidgetTypeId widgetTypeId) {