Skip to content

Commit

Permalink
chore: generated code for commit 379fbc50. [skip ci]
Browse files Browse the repository at this point in the history
algolia/api-clients-automation@379fbc5

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Morgan Leroi <morgan.leroi@gmail.com>
Co-authored-by: shortcuts <vannicattec@gmail.com>
  • Loading branch information
3 people committed Jan 23, 2024
1 parent cb288de commit 48a0168
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 66 deletions.
82 changes: 18 additions & 64 deletions algoliasearch/src/main/java/com/algolia/api/SearchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -5153,50 +5153,30 @@ public <T> CompletableFuture<SearchResponse<T>> searchSingleIndexAsync(@Nonnull
* get all synonyms, send an empty request body.
*
* @param indexName Index on which to perform the request. (required)
* @param type Search for specific [types of
* synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms).
* (optional)
* @param page Returns the requested page number (the first page is 0). Page size is set by
* `hitsPerPage`. When null, there's no pagination. (optional, default to 0)
* @param hitsPerPage Maximum number of hits per page. (optional, default to 100)
* @param searchSynonymsParams Body of the `searchSynonyms` operation. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public SearchSynonymsResponse searchSynonyms(
@Nonnull String indexName,
SynonymType type,
Integer page,
Integer hitsPerPage,
SearchSynonymsParams searchSynonymsParams,
RequestOptions requestOptions
) throws AlgoliaRuntimeException {
return LaunderThrowable.await(searchSynonymsAsync(indexName, type, page, hitsPerPage, searchSynonymsParams, requestOptions));
return LaunderThrowable.await(searchSynonymsAsync(indexName, searchSynonymsParams, requestOptions));
}

/**
* Search for synonyms in your index. You can control and filter the search with parameters. To
* get all synonyms, send an empty request body.
*
* @param indexName Index on which to perform the request. (required)
* @param type Search for specific [types of
* synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms).
* (optional)
* @param page Returns the requested page number (the first page is 0). Page size is set by
* `hitsPerPage`. When null, there's no pagination. (optional, default to 0)
* @param hitsPerPage Maximum number of hits per page. (optional, default to 100)
* @param searchSynonymsParams Body of the `searchSynonyms` operation. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public SearchSynonymsResponse searchSynonyms(
@Nonnull String indexName,
SynonymType type,
Integer page,
Integer hitsPerPage,
SearchSynonymsParams searchSynonymsParams
) throws AlgoliaRuntimeException {
return this.searchSynonyms(indexName, type, page, hitsPerPage, searchSynonymsParams, null);
public SearchSynonymsResponse searchSynonyms(@Nonnull String indexName, SearchSynonymsParams searchSynonymsParams)
throws AlgoliaRuntimeException {
return this.searchSynonyms(indexName, searchSynonymsParams, null);
}

/**
Expand All @@ -5209,7 +5189,7 @@ public SearchSynonymsResponse searchSynonyms(
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public SearchSynonymsResponse searchSynonyms(@Nonnull String indexName, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.searchSynonyms(indexName, null, null, null, null, requestOptions);
return this.searchSynonyms(indexName, null, requestOptions);
}

/**
Expand All @@ -5220,30 +5200,21 @@ public SearchSynonymsResponse searchSynonyms(@Nonnull String indexName, RequestO
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public SearchSynonymsResponse searchSynonyms(@Nonnull String indexName) throws AlgoliaRuntimeException {
return this.searchSynonyms(indexName, null, null, null, null, null);
return this.searchSynonyms(indexName, null, null);
}

/**
* (asynchronously) Search for synonyms in your index. You can control and filter the search with
* parameters. To get all synonyms, send an empty request body.
*
* @param indexName Index on which to perform the request. (required)
* @param type Search for specific [types of
* synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms).
* (optional)
* @param page Returns the requested page number (the first page is 0). Page size is set by
* `hitsPerPage`. When null, there's no pagination. (optional, default to 0)
* @param hitsPerPage Maximum number of hits per page. (optional, default to 100)
* @param searchSynonymsParams Body of the `searchSynonyms` operation. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(
@Nonnull String indexName,
SynonymType type,
Integer page,
Integer hitsPerPage,
SearchSynonymsParams searchSynonymsParams,
RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Expand All @@ -5255,9 +5226,6 @@ public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(
.setMethod("POST")
.setBody(searchSynonymsParams)
.setRead(true)
.addQueryParameter("type", type)
.addQueryParameter("page", page)
.addQueryParameter("hitsPerPage", hitsPerPage)
.build();
return executeAsync(request, requestOptions, new TypeReference<SearchSynonymsResponse>() {});
}
Expand All @@ -5267,23 +5235,14 @@ public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(
* parameters. To get all synonyms, send an empty request body.
*
* @param indexName Index on which to perform the request. (required)
* @param type Search for specific [types of
* synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms).
* (optional)
* @param page Returns the requested page number (the first page is 0). Page size is set by
* `hitsPerPage`. When null, there's no pagination. (optional, default to 0)
* @param hitsPerPage Maximum number of hits per page. (optional, default to 100)
* @param searchSynonymsParams Body of the `searchSynonyms` operation. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(
@Nonnull String indexName,
SynonymType type,
Integer page,
Integer hitsPerPage,
SearchSynonymsParams searchSynonymsParams
) throws AlgoliaRuntimeException {
return this.searchSynonymsAsync(indexName, type, page, hitsPerPage, searchSynonymsParams, null);
return this.searchSynonymsAsync(indexName, searchSynonymsParams, null);
}

/**
Expand All @@ -5297,7 +5256,7 @@ public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(
*/
public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(@Nonnull String indexName, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.searchSynonymsAsync(indexName, null, null, null, null, requestOptions);
return this.searchSynonymsAsync(indexName, null, requestOptions);
}

/**
Expand All @@ -5308,7 +5267,7 @@ public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(@Nonnull St
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<SearchSynonymsResponse> searchSynonymsAsync(@Nonnull String indexName) throws AlgoliaRuntimeException {
return this.searchSynonymsAsync(indexName, null, null, null, null, null);
return this.searchSynonymsAsync(indexName, null, null);
}

/**
Expand Down Expand Up @@ -5935,24 +5894,20 @@ public <T> Iterable<T> browseObjects(String indexName, BrowseParamsObject params
* Helper: Returns an iterator on top of the `searchSynonyms` method.
*
* @param indexName The index in which to perform the request.
* @param type The synonym type. (optional)
* @param params The `searchSynonyms` parameters. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions. (optional)
*/
public Iterable<SynonymHit> browseSynonyms(
String indexName,
SynonymType type,
SearchSynonymsParams params,
RequestOptions requestOptions
) {
public Iterable<SynonymHit> browseSynonyms(String indexName, SearchSynonymsParams params, RequestOptions requestOptions) {
final Holder<Integer> currentPage = new Holder<>(0);
final int hitsPerPage = 1000;

params.setPage(0);
params.setHitsPerPage(1000);

return AlgoliaIterableHelper.createIterable(
() -> {
SearchSynonymsResponse response = this.searchSynonyms(indexName, type, currentPage.value, hitsPerPage, params, requestOptions);
currentPage.value = response.getNbHits() < hitsPerPage ? null : currentPage.value + 1;
SearchSynonymsResponse response = this.searchSynonyms(indexName, params, requestOptions);
currentPage.value = response.getNbHits() < params.getHitsPerPage() ? null : currentPage.value + 1;
return response.getHits().iterator();
},
() -> currentPage.value != null
Expand All @@ -5963,11 +5918,10 @@ public Iterable<SynonymHit> browseSynonyms(
* Helper: Returns an iterator on top of the `searchSynonyms` method.
*
* @param indexName The index in which to perform the request.
* @param type The synonym type. (optional)
* @param params The `searchSynonyms` parameters .(optional)
*/
public Iterable<SynonymHit> browseSynonyms(String indexName, SynonymType type, SearchSynonymsParams params) {
return browseSynonyms(indexName, type, params, null);
public Iterable<SynonymHit> browseSynonyms(String indexName, SearchSynonymsParams params) {
return browseSynonyms(indexName, params, null);
}

/**
Expand All @@ -5976,7 +5930,7 @@ public Iterable<SynonymHit> browseSynonyms(String indexName, SynonymType type, S
* @param indexName The index in which to perform the request.
*/
public Iterable<SynonymHit> browseSynonyms(String indexName) {
return browseSynonyms(indexName, null, null, null);
return browseSynonyms(indexName, null, null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ public class SearchSynonymsParams {
@JsonProperty("query")
private String query;

@JsonProperty("type")
private SynonymType type;

@JsonProperty("page")
private Integer page;

@JsonProperty("hitsPerPage")
private Integer hitsPerPage;

public SearchSynonymsParams setQuery(String query) {
this.query = query;
return this;
Expand All @@ -24,6 +33,39 @@ public String getQuery() {
return query;
}

public SearchSynonymsParams setType(SynonymType type) {
this.type = type;
return this;
}

/** Get type */
@javax.annotation.Nullable
public SynonymType getType() {
return type;
}

public SearchSynonymsParams setPage(Integer page) {
this.page = page;
return this;
}

/** Page to retrieve (the first page is `0`, not `1`). */
@javax.annotation.Nullable
public Integer getPage() {
return page;
}

public SearchSynonymsParams setHitsPerPage(Integer hitsPerPage) {
this.hitsPerPage = hitsPerPage;
return this;
}

/** Number of hits per page. minimum: 1 maximum: 1000 */
@javax.annotation.Nullable
public Integer getHitsPerPage() {
return hitsPerPage;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -33,19 +75,27 @@ public boolean equals(Object o) {
return false;
}
SearchSynonymsParams searchSynonymsParams = (SearchSynonymsParams) o;
return Objects.equals(this.query, searchSynonymsParams.query);
return (
Objects.equals(this.query, searchSynonymsParams.query) &&
Objects.equals(this.type, searchSynonymsParams.type) &&
Objects.equals(this.page, searchSynonymsParams.page) &&
Objects.equals(this.hitsPerPage, searchSynonymsParams.hitsPerPage)
);
}

@Override
public int hashCode() {
return Objects.hash(query);
return Objects.hash(query, type, page, hitsPerPage);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SearchSynonymsParams {\n");
sb.append(" query: ").append(toIndentedString(query)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" page: ").append(toIndentedString(page)).append("\n");
sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down

0 comments on commit 48a0168

Please sign in to comment.