Skip to content

Commit 8c45208

Browse files
algolia-botmillotp
andcommitted
chore: generated code for commit 1ba6c86. [skip ci]
Co-authored-by: Pierre Millot <[email protected]>
1 parent 1ba6c86 commit 8c45208

File tree

1 file changed

+53
-0
lines changed
  • clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api

1 file changed

+53
-0
lines changed

clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/SearchClient.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.Map;
1818
import java.util.Random;
1919
import java.util.concurrent.CompletableFuture;
20+
import java.util.function.IntUnaryOperator;
2021
import java.util.stream.Collectors;
2122
import java.util.stream.Stream;
2223
import okhttp3.Call;
@@ -6119,4 +6120,56 @@ public CompletableFuture<UpdateApiKeyResponse> updateApiKeyAsync(
61196120
) throws AlgoliaRuntimeException {
61206121
return this.updateApiKeyAsync(key, apiKey, null);
61216122
}
6123+
6124+
public void waitForTask(
6125+
String indexName,
6126+
Long taskID,
6127+
RequestOptions requestOptions,
6128+
int maxTrial,
6129+
IntUnaryOperator timeout
6130+
) {
6131+
TaskUtils.retryUntil(
6132+
() -> {
6133+
return this.getTaskAsync(indexName, taskID, requestOptions);
6134+
},
6135+
(GetTaskResponse task) -> {
6136+
return task.getStatus() == TaskStatus.PUBLISHED;
6137+
},
6138+
maxTrial,
6139+
timeout
6140+
);
6141+
}
6142+
6143+
public void waitForTask(
6144+
String indexName,
6145+
Long taskID,
6146+
RequestOptions requestOptions
6147+
) {
6148+
this.waitForTask(
6149+
indexName,
6150+
taskID,
6151+
requestOptions,
6152+
TaskUtils.DEFAULT_MAX_TRIAL,
6153+
TaskUtils.DEFAULT_TIMEOUT
6154+
);
6155+
}
6156+
6157+
public void waitForTask(
6158+
String indexName,
6159+
Long taskID,
6160+
int maxTrial,
6161+
IntUnaryOperator timeout
6162+
) {
6163+
this.waitForTask(indexName, taskID, null, maxTrial, timeout);
6164+
}
6165+
6166+
public void waitForTask(String indexName, Long taskID) {
6167+
this.waitForTask(
6168+
indexName,
6169+
taskID,
6170+
null,
6171+
TaskUtils.DEFAULT_MAX_TRIAL,
6172+
TaskUtils.DEFAULT_TIMEOUT
6173+
);
6174+
}
61226175
}

0 commit comments

Comments
 (0)