implemented basic search function with Homebox provider
This commit is contained in:
@@ -2,12 +2,10 @@ package com.vaessl.app.connection;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public interface ConnectionProvider {
|
||||
public interface ConnectionProvider extends ServiceProvider {
|
||||
|
||||
void checkCredentials(ConnectionRequest request);
|
||||
|
||||
String getServiceType();
|
||||
|
||||
ConnectionResponse authenticate(ConnectionRequest request);
|
||||
|
||||
ConnectionEntity findUniqueConnectionEntry(ConnectionRequest request);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
public enum Endpoint {
|
||||
HOMEBOX_LOGIN("/api/v1/users/login"), LOGIN("/login"), CONNECTION_STATUS("/connections/status");
|
||||
HOMEBOX_LOGIN("/api/v1/users/login"), LOGIN("/login"), CONNECTION_STATUS(
|
||||
"/connections/status"), HOMEBOX_QUERY_ALL_ITEMS("/api/v1/items");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
||||
@@ -65,7 +65,11 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
||||
|
||||
attachmentToken.put("attachmentToken", hbResponse.attachmentToken());
|
||||
|
||||
return new ConnectionResponse(hbResponse.token(), hbResponse.expiresAt(), attachmentToken);
|
||||
String hbRawToken = hbResponse.token();
|
||||
|
||||
String token = hbRawToken.startsWith("Bearer ") ? hbRawToken.substring(7) : hbRawToken;
|
||||
|
||||
return new ConnectionResponse(token, hbResponse.expiresAt(), attachmentToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
public interface ServiceProvider {
|
||||
|
||||
/**
|
||||
* Returns the service type key used to look up this provider in a registry, e.g.
|
||||
* {@code "HOMEBOX"}.
|
||||
*/
|
||||
String getServiceType();
|
||||
}
|
||||
Reference in New Issue
Block a user