From 48a01688bdf1d05f8bf315d758b02b0d3a23fdee Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Tue, 23 Jan 2024 17:06:12 +0000 Subject: [PATCH] chore: generated code for commit 379fbc50. [skip ci] https://github.com/algolia/api-clients-automation/commit/379fbc5016ebdf3f3252ce1e6ed2334b96ef23a9 Co-authored-by: algolia-bot Co-authored-by: Morgan Leroi Co-authored-by: shortcuts --- .../java/com/algolia/api/SearchClient.java | 82 ++++--------------- .../model/search/SearchSynonymsParams.java | 54 +++++++++++- 2 files changed, 70 insertions(+), 66 deletions(-) diff --git a/algoliasearch/src/main/java/com/algolia/api/SearchClient.java b/algoliasearch/src/main/java/com/algolia/api/SearchClient.java index 39d2e6ebb..68231806e 100644 --- a/algoliasearch/src/main/java/com/algolia/api/SearchClient.java +++ b/algoliasearch/src/main/java/com/algolia/api/SearchClient.java @@ -5153,12 +5153,6 @@ public CompletableFuture> 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. @@ -5166,13 +5160,10 @@ public CompletableFuture> searchSingleIndexAsync(@Nonnull */ 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)); } /** @@ -5180,23 +5171,12 @@ public SearchSynonymsResponse searchSynonyms( * 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); } /** @@ -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); } /** @@ -5220,7 +5200,7 @@ 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); } /** @@ -5228,12 +5208,6 @@ public SearchSynonymsResponse searchSynonyms(@Nonnull String indexName) throws A * 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. @@ -5241,9 +5215,6 @@ public SearchSynonymsResponse searchSynonyms(@Nonnull String indexName) throws A */ public CompletableFuture searchSynonymsAsync( @Nonnull String indexName, - SynonymType type, - Integer page, - Integer hitsPerPage, SearchSynonymsParams searchSynonymsParams, RequestOptions requestOptions ) throws AlgoliaRuntimeException { @@ -5255,9 +5226,6 @@ public CompletableFuture searchSynonymsAsync( .setMethod("POST") .setBody(searchSynonymsParams) .setRead(true) - .addQueryParameter("type", type) - .addQueryParameter("page", page) - .addQueryParameter("hitsPerPage", hitsPerPage) .build(); return executeAsync(request, requestOptions, new TypeReference() {}); } @@ -5267,23 +5235,14 @@ public CompletableFuture 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 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); } /** @@ -5297,7 +5256,7 @@ public CompletableFuture searchSynonymsAsync( */ public CompletableFuture searchSynonymsAsync(@Nonnull String indexName, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.searchSynonymsAsync(indexName, null, null, null, null, requestOptions); + return this.searchSynonymsAsync(indexName, null, requestOptions); } /** @@ -5308,7 +5267,7 @@ public CompletableFuture searchSynonymsAsync(@Nonnull St * @throws AlgoliaRuntimeException If it fails to process the API call */ public CompletableFuture searchSynonymsAsync(@Nonnull String indexName) throws AlgoliaRuntimeException { - return this.searchSynonymsAsync(indexName, null, null, null, null, null); + return this.searchSynonymsAsync(indexName, null, null); } /** @@ -5935,24 +5894,20 @@ public Iterable 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 browseSynonyms( - String indexName, - SynonymType type, - SearchSynonymsParams params, - RequestOptions requestOptions - ) { + public Iterable browseSynonyms(String indexName, SearchSynonymsParams params, RequestOptions requestOptions) { final Holder 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 @@ -5963,11 +5918,10 @@ public Iterable 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 browseSynonyms(String indexName, SynonymType type, SearchSynonymsParams params) { - return browseSynonyms(indexName, type, params, null); + public Iterable browseSynonyms(String indexName, SearchSynonymsParams params) { + return browseSynonyms(indexName, params, null); } /** @@ -5976,7 +5930,7 @@ public Iterable browseSynonyms(String indexName, SynonymType type, S * @param indexName The index in which to perform the request. */ public Iterable browseSynonyms(String indexName) { - return browseSynonyms(indexName, null, null, null); + return browseSynonyms(indexName, null, null); } /** diff --git a/algoliasearch/src/main/java/com/algolia/model/search/SearchSynonymsParams.java b/algoliasearch/src/main/java/com/algolia/model/search/SearchSynonymsParams.java index 411f100b1..5b623ca01 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/SearchSynonymsParams.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/SearchSynonymsParams.java @@ -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; @@ -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) { @@ -33,12 +75,17 @@ 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 @@ -46,6 +93,9 @@ 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(); }