fixed widget type based methods in rest client
This commit is contained in:
parent
ba9ad04a90
commit
6f8b52056b
@ -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.security.model.UserPasswordPolicy;
|
||||||
import org.thingsboard.server.common.data.sms.config.TestSmsRequest;
|
import org.thingsboard.server.common.data.sms.config.TestSmsRequest;
|
||||||
import org.thingsboard.server.common.data.widget.WidgetType;
|
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 org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
@ -2423,11 +2424,11 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
|||||||
}).getBody();
|
}).getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<WidgetType> getWidgetTypeById(WidgetTypeId widgetTypeId) {
|
public Optional<WidgetTypeDetails> getWidgetTypeById(WidgetTypeId widgetTypeId) {
|
||||||
try {
|
try {
|
||||||
ResponseEntity<WidgetType> widgetType =
|
ResponseEntity<WidgetTypeDetails> widgetTypeDetails =
|
||||||
restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetType.class, widgetTypeId.getId());
|
restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetTypeDetails.class, widgetTypeId.getId());
|
||||||
return Optional.ofNullable(widgetType.getBody());
|
return Optional.ofNullable(widgetTypeDetails.getBody());
|
||||||
} catch (HttpClientErrorException exception) {
|
} catch (HttpClientErrorException exception) {
|
||||||
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@ -2437,8 +2438,8 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WidgetType saveWidgetType(WidgetType widgetType) {
|
public WidgetTypeDetails saveWidgetType(WidgetTypeDetails widgetTypeDetails) {
|
||||||
return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetType, WidgetType.class).getBody();
|
return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetTypeDetails, WidgetTypeDetails.class).getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteWidgetType(WidgetTypeId widgetTypeId) {
|
public void deleteWidgetType(WidgetTypeId widgetTypeId) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user