changed formatter
This commit is contained in:
@@ -23,7 +23,8 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
|||||||
|
|
||||||
private final ConnectionRepository cRepository;
|
private final ConnectionRepository cRepository;
|
||||||
|
|
||||||
public HomeboxConnectionProvider(RestClient.Builder restClientBuilder, ConnectionRepository cRepository) {
|
public HomeboxConnectionProvider(RestClient.Builder restClientBuilder,
|
||||||
|
ConnectionRepository cRepository) {
|
||||||
this.restClientBuilder = restClientBuilder;
|
this.restClientBuilder = restClientBuilder;
|
||||||
this.cRepository = cRepository;
|
this.cRepository = cRepository;
|
||||||
}
|
}
|
||||||
@@ -51,20 +52,16 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConnectionResponse authenticate(ConnectionRequest request) {
|
public ConnectionResponse authenticate(ConnectionRequest request) {
|
||||||
Map<String, Object> homeboxPayload = Map.of("username", request.username(),
|
Map<String, Object> homeboxPayload = Map.of("username", request.username(), "password",
|
||||||
"password", request.password(), "stayLoggedIn",
|
request.password(), "stayLoggedIn", request.stayLoggedIn());
|
||||||
request.stayLoggedIn());
|
|
||||||
|
|
||||||
HomeboxLoginResponse hbResponse = restClientBuilder.baseUrl(request.appUrl())
|
HomeboxLoginResponse hbResponse = restClientBuilder.baseUrl(request.appUrl()).build().post()
|
||||||
.build()
|
.uri(HOMEBOX_LOGIN.getValue()).body(homeboxPayload).retrieve()
|
||||||
.post()
|
|
||||||
.uri(HOMEBOX_LOGIN.getValue())
|
|
||||||
.body(homeboxPayload)
|
|
||||||
.retrieve()
|
|
||||||
.body(HomeboxLoginResponse.class);
|
.body(HomeboxLoginResponse.class);
|
||||||
|
|
||||||
if (hbResponse == null) {
|
if (hbResponse == null) {
|
||||||
throw new IllegalStateException("Remote API returned an empty body for " + request.appUrl());
|
throw new IllegalStateException(
|
||||||
|
"Remote API returned an empty body for " + request.appUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> attachmentToken = new HashMap<>();
|
Map<String, Object> attachmentToken = new HashMap<>();
|
||||||
@@ -81,7 +78,8 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConnectionEntity connectionToEntity(ConnectionRequest request, ConnectionResponse response) {
|
public ConnectionEntity connectionToEntity(ConnectionRequest request,
|
||||||
|
ConnectionResponse response) {
|
||||||
return HomeboxEntity.from(request, response);
|
return HomeboxEntity.from(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,5 +104,5 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
|||||||
private record HomeboxLoginResponse(String token, String attachmentToken, Instant expiresAt) {
|
private record HomeboxLoginResponse(String token, String attachmentToken, Instant expiresAt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user