diff --git a/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/DedupCaller.java b/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/DedupCaller.java index d48315a..a1ff015 100644 --- a/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/DedupCaller.java +++ b/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/DedupCaller.java @@ -73,6 +73,12 @@ public DedupCaller(InsightClient client, API.Dedup type) { this.type = type; } + @Nullable + @Override + public T call() throws IOException { + return call(emptyMap()); + } + @Nullable @Override public T call(Map parameters) throws IOException { @@ -94,6 +100,8 @@ public T call(Map parameters, Serializable payload) th return (T) handleRecalculateTuples(parameters); case DELETE: return (T) handleDelete(parameters); + case DROP: + return (T) handleDrop(); default: throw new InvalidEndpointException("No such endpoint " + this.type.name()); } @@ -166,6 +174,10 @@ private Boolean handleDelete(Map parameters) { return client.delete(this.type.toPath(DELETE, client.getProjectId(), parameters), "{}", Response::isSuccessful); } + private Boolean handleDrop() { + return client.delete(this.type.toPath(DELETE, client.getProjectId()), "{}", Response::isSuccessful); + } + protected ResponseHandler> handleResponse(String docId, String xpath) { return response -> { if (!response.isSuccessful()) { diff --git a/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/Resource.java b/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/Resource.java index 8fa6150..d3ad09d 100644 --- a/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/Resource.java +++ b/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/api/Resource.java @@ -30,6 +30,11 @@ */ public interface Resource { + @Nullable + default T call() throws IOException { + throw new UnsupportedOperationException(); + } + @Nullable T call(Map parameters) throws IOException; diff --git a/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/client/API.java b/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/client/API.java index de9856d..66aeca4 100644 --- a/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/client/API.java +++ b/insight-rest-client/src/main/java/org/nuxeo/ai/sdk/rest/client/API.java @@ -131,7 +131,7 @@ public String toPath(@Nonnull String project, @Nullable String id, @Nullable Str * Endpoints available for Deduplication */ public enum Dedup implements Endpoint { - INDEX, FIND, ALL, RECALCULATETUPLES, DELETE; + INDEX, FIND, ALL, RECALCULATETUPLES, DELETE, DROP; public static final String API_DEDUP = "ai/dedup/"; @@ -183,6 +183,8 @@ public String toPath(HttpMethod method, @Nonnull String project, Map