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..b990bbe5c3 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,8 @@ 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.WidgetTypeInfo; import org.thingsboard.server.common.data.widget.WidgetsBundle; import java.io.Closeable; @@ -2423,11 +2425,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 +2439,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) { @@ -2456,6 +2458,28 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { bundleAlias).getBody(); } + public List getBundleWidgetTypesDetails(boolean isSystem, String bundleAlias) { + return restTemplate.exchange( + baseURL + "/api/widgetTypesDetails?isSystem={isSystem}&bundleAlias={bundleAlias}", + HttpMethod.GET, + HttpEntity.EMPTY, + new ParameterizedTypeReference>() { + }, + isSystem, + bundleAlias).getBody(); + } + + public List getBundleWidgetTypesInfos(boolean isSystem, String bundleAlias) { + return restTemplate.exchange( + baseURL + "/api/widgetTypesInfos?isSystem={isSystem}&bundleAlias={bundleAlias}", + HttpMethod.GET, + HttpEntity.EMPTY, + new ParameterizedTypeReference>() { + }, + isSystem, + bundleAlias).getBody(); + } + public Optional getWidgetType(boolean isSystem, String bundleAlias, String alias) { try { ResponseEntity widgetType =