Skip to content

Commit

Permalink
feat(clients): endpoint level timeout part 2 [skip-bc] (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4318

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Thomas Raffray <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
3 people committed Jan 13, 2025
1 parent 81715b7 commit e2932cd
Show file tree
Hide file tree
Showing 12 changed files with 946 additions and 644 deletions.
2 changes: 1 addition & 1 deletion algoliasearch/src/main/java/com/algolia/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;

/**
* Represents a base client for making API requests. The client uses a {@link Requester} for
Expand Down
92 changes: 55 additions & 37 deletions algoliasearch/src/main/java/com/algolia/api/AbtestingClient.java

Large diffs are not rendered by default.

240 changes: 138 additions & 102 deletions algoliasearch/src/main/java/com/algolia/api/AnalyticsClient.java

Large diffs are not rendered by default.

394 changes: 235 additions & 159 deletions algoliasearch/src/main/java/com/algolia/api/IngestionClient.java

Large diffs are not rendered by default.

56 changes: 34 additions & 22 deletions algoliasearch/src/main/java/com/algolia/api/InsightsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class InsightsClient extends ApiClient {

Expand Down Expand Up @@ -79,7 +80,7 @@ private static List<Host> getDefaultHosts(String region) throws AlgoliaRuntimeEx
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customDelete(@Nonnull String path, Map<String, Object> parameters, RequestOptions requestOptions)
public Object customDelete(@Nonnull String path, Map<String, Object> parameters, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(customDeleteAsync(path, parameters, requestOptions));
}
Expand All @@ -103,7 +104,7 @@ public Object customDelete(@Nonnull String path, Map<String, Object> parameters)
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customDelete(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public Object customDelete(@Nonnull String path, @Nullable RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.customDelete(path, null, requestOptions);
}

Expand All @@ -126,8 +127,11 @@ public Object customDelete(@Nonnull String path) throws AlgoliaRuntimeException
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Object> customDeleteAsync(@Nonnull String path, Map<String, Object> parameters, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
public CompletableFuture<Object> customDeleteAsync(
@Nonnull String path,
Map<String, Object> parameters,
@Nullable RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customDelete`.");

HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("DELETE").addQueryParameters(parameters).build();
Expand All @@ -153,7 +157,8 @@ public CompletableFuture<Object> customDeleteAsync(@Nonnull String path, Map<Str
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Object> customDeleteAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public CompletableFuture<Object> customDeleteAsync(@Nonnull String path, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.customDeleteAsync(path, null, requestOptions);
}

Expand All @@ -176,7 +181,7 @@ public CompletableFuture<Object> customDeleteAsync(@Nonnull String path) throws
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customGet(@Nonnull String path, Map<String, Object> parameters, RequestOptions requestOptions)
public Object customGet(@Nonnull String path, Map<String, Object> parameters, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(customGetAsync(path, parameters, requestOptions));
}
Expand All @@ -200,7 +205,7 @@ public Object customGet(@Nonnull String path, Map<String, Object> parameters) th
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customGet(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public Object customGet(@Nonnull String path, @Nullable RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.customGet(path, null, requestOptions);
}

Expand All @@ -223,8 +228,11 @@ public Object customGet(@Nonnull String path) throws AlgoliaRuntimeException {
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Object> customGetAsync(@Nonnull String path, Map<String, Object> parameters, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
public CompletableFuture<Object> customGetAsync(
@Nonnull String path,
Map<String, Object> parameters,
@Nullable RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customGet`.");

HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("GET").addQueryParameters(parameters).build();
Expand All @@ -250,7 +258,8 @@ public CompletableFuture<Object> customGetAsync(@Nonnull String path, Map<String
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Object> customGetAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public CompletableFuture<Object> customGetAsync(@Nonnull String path, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.customGetAsync(path, null, requestOptions);
}

Expand All @@ -274,7 +283,7 @@ public CompletableFuture<Object> customGetAsync(@Nonnull String path) throws Alg
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customPost(@Nonnull String path, Map<String, Object> parameters, Object body, RequestOptions requestOptions)
public Object customPost(@Nonnull String path, Map<String, Object> parameters, Object body, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(customPostAsync(path, parameters, body, requestOptions));
}
Expand All @@ -299,7 +308,7 @@ public Object customPost(@Nonnull String path, Map<String, Object> parameters, O
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customPost(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public Object customPost(@Nonnull String path, @Nullable RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.customPost(path, null, null, requestOptions);
}

Expand Down Expand Up @@ -327,7 +336,7 @@ public CompletableFuture<Object> customPostAsync(
@Nonnull String path,
Map<String, Object> parameters,
Object body,
RequestOptions requestOptions
@Nullable RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPost`.");

Expand Down Expand Up @@ -361,7 +370,8 @@ public CompletableFuture<Object> customPostAsync(@Nonnull String path, Map<Strin
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Object> customPostAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public CompletableFuture<Object> customPostAsync(@Nonnull String path, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.customPostAsync(path, null, null, requestOptions);
}

Expand All @@ -385,7 +395,7 @@ public CompletableFuture<Object> customPostAsync(@Nonnull String path) throws Al
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customPut(@Nonnull String path, Map<String, Object> parameters, Object body, RequestOptions requestOptions)
public Object customPut(@Nonnull String path, Map<String, Object> parameters, Object body, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(customPutAsync(path, parameters, body, requestOptions));
}
Expand All @@ -410,7 +420,7 @@ public Object customPut(@Nonnull String path, Map<String, Object> parameters, Ob
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object customPut(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public Object customPut(@Nonnull String path, @Nullable RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.customPut(path, null, null, requestOptions);
}

Expand Down Expand Up @@ -438,7 +448,7 @@ public CompletableFuture<Object> customPutAsync(
@Nonnull String path,
Map<String, Object> parameters,
Object body,
RequestOptions requestOptions
@Nullable RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPut`.");

Expand Down Expand Up @@ -472,7 +482,8 @@ public CompletableFuture<Object> customPutAsync(@Nonnull String path, Map<String
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Object> customPutAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public CompletableFuture<Object> customPutAsync(@Nonnull String path, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.customPutAsync(path, null, null, requestOptions);
}

Expand All @@ -496,7 +507,7 @@ public CompletableFuture<Object> customPutAsync(@Nonnull String path) throws Alg
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public void deleteUserToken(@Nonnull String userToken, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public void deleteUserToken(@Nonnull String userToken, @Nullable RequestOptions requestOptions) throws AlgoliaRuntimeException {
LaunderThrowable.await(deleteUserTokenAsync(userToken, requestOptions));
return;
}
Expand All @@ -523,7 +534,7 @@ public void deleteUserToken(@Nonnull String userToken) throws AlgoliaRuntimeExce
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Void> deleteUserTokenAsync(@Nonnull String userToken, RequestOptions requestOptions)
public CompletableFuture<Void> deleteUserTokenAsync(@Nonnull String userToken, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
Parameters.requireNonNull(userToken, "Parameter `userToken` is required when calling `deleteUserToken`.");

Expand Down Expand Up @@ -552,7 +563,8 @@ public CompletableFuture<Void> deleteUserTokenAsync(@Nonnull String userToken) t
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public EventsResponse pushEvents(@Nonnull InsightsEvents insightsEvents, RequestOptions requestOptions) throws AlgoliaRuntimeException {
public EventsResponse pushEvents(@Nonnull InsightsEvents insightsEvents, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(pushEventsAsync(insightsEvents, requestOptions));
}

Expand All @@ -576,7 +588,7 @@ public EventsResponse pushEvents(@Nonnull InsightsEvents insightsEvents) throws
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<EventsResponse> pushEventsAsync(@Nonnull InsightsEvents insightsEvents, RequestOptions requestOptions)
public CompletableFuture<EventsResponse> pushEventsAsync(@Nonnull InsightsEvents insightsEvents, @Nullable RequestOptions requestOptions)
throws AlgoliaRuntimeException {
Parameters.requireNonNull(insightsEvents, "Parameter `insightsEvents` is required when calling `pushEvents`.");

Expand Down
Loading

0 comments on commit e2932cd

Please sign in to comment.