From 1eeb72f04808953126b6f5b9c0c5d260ac269299 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Thu, 11 Jul 2024 15:27:33 +0000 Subject: [PATCH] chore: generated code for commit cfb17457dbf943513f8ccd0e8807e8741f83deb6. Co-authored-by: Pierre Millot --- .../Models/Recommend/BaseSearchResponse.cs | 50 +-- .../Recommend/RecommendationsResults.cs | 94 ++--- .../Models/Recommend/SearchPagination.cs | 129 +++++++ .../Models/Search/BaseSearchResponse.cs | 50 +-- .../Models/Search/BrowsePagination.cs | 116 ++++++ .../Models/Search/BrowseResponse.cs | 90 ++--- .../Models/Search/SearchPagination.cs | 129 +++++++ .../Models/Search/SearchResponse.cs | 94 ++--- .../algoliasearch/lib/algoliasearch_lite.dart | 2 + .../algoliasearch/lib/src/deserialize.dart | 8 + .../lib/src/model/base_search_response.dart | 35 -- .../lib/src/model/base_search_response.g.dart | 13 - .../lib/src/model/browse_pagination.dart | 59 +++ .../lib/src/model/browse_pagination.g.dart | 39 ++ .../lib/src/model/browse_response.dart | 62 +-- .../lib/src/model/browse_response.g.dart | 18 +- .../src/model/recommendations_results.dart | 62 +-- .../src/model/recommendations_results.g.dart | 18 +- .../lib/src/model/search_pagination.dart | 59 +++ .../lib/src/model/search_pagination.g.dart | 31 ++ .../lib/src/model/search_response.dart | 62 +-- .../lib/src/model/search_response.g.dart | 18 +- .../lib/algolia_client_recommend.dart | 1 + .../client_recommend/lib/src/deserialize.dart | 4 + .../lib/src/model/base_search_response.dart | 35 -- .../lib/src/model/base_search_response.g.dart | 13 - .../src/model/recommendations_results.dart | 62 +-- .../src/model/recommendations_results.g.dart | 18 +- .../lib/src/model/search_pagination.dart | 59 +++ .../lib/src/model/search_pagination.g.dart | 31 ++ .../lib/algolia_client_search.dart | 2 + .../client_search/lib/src/deserialize.dart | 8 + .../lib/src/model/base_search_response.dart | 35 -- .../lib/src/model/base_search_response.g.dart | 13 - .../lib/src/model/browse_pagination.dart | 59 +++ .../lib/src/model/browse_pagination.g.dart | 39 ++ .../lib/src/model/browse_response.dart | 62 +-- .../lib/src/model/browse_response.g.dart | 18 +- .../lib/src/model/search_pagination.dart | 59 +++ .../lib/src/model/search_pagination.g.dart | 31 ++ .../lib/src/model/search_response.dart | 62 +-- .../lib/src/model/search_response.g.dart | 18 +- .../recommend/model_base_search_response.go | 134 +------ .../model_recommendations_results.go | 260 ++++++------- .../recommend/model_search_pagination.go | 168 ++++++++ .../search/model_base_search_response.go | 134 +------ .../algolia/search/model_browse_pagination.go | 225 +++++++++++ .../algolia/search/model_browse_response.go | 310 ++++++++------- .../algolia/search/model_search_pagination.go | 168 ++++++++ .../algolia/search/model_search_response.go | 264 ++++++------- .../model/recommend/BaseSearchResponse.java | 68 ---- .../recommend/RecommendationsResults.java | 136 +++---- .../model/recommend/SearchPagination.java | 112 ++++++ .../model/search/BaseSearchResponse.java | 68 ---- .../model/search/BrowsePagination.java | 112 ++++++ .../algolia/model/search/BrowseResponse.java | 136 +++---- .../model/search/SearchPagination.java | 112 ++++++ .../algolia/model/search/SearchResponse.java | 136 +++---- .../packages/algoliasearch/builds/models.ts | 2 + .../lite/model/baseSearchResponse.ts | 20 - .../lite/model/browsePagination.ts | 23 ++ .../lite/model/browseResponse.ts | 2 + .../algoliasearch/lite/model/index.ts | 2 + .../lite/model/recommendationsResults.ts | 5 +- .../lite/model/searchPagination.ts | 23 ++ .../lite/model/searchResponse.ts | 4 +- .../client-search/model/baseSearchResponse.ts | 20 - .../client-search/model/browsePagination.ts | 23 ++ .../client-search/model/browseResponse.ts | 2 + .../packages/client-search/model/index.ts | 2 + .../client-search/model/searchPagination.ts | 23 ++ .../client-search/model/searchResponse.ts | 4 +- .../recommend/model/baseSearchResponse.ts | 20 - .../packages/recommend/model/index.ts | 1 + .../recommend/model/recommendationsResults.ts | 5 +- .../recommend/model/searchPagination.ts | 23 ++ .../model/recommend/BaseSearchResponse.kt | 28 -- .../model/recommend/RecommendationsResults.kt | 20 +- .../model/recommend/SearchPagination.kt | 29 ++ .../client/model/search/BaseSearchResponse.kt | 28 -- .../client/model/search/BrowsePagination.kt | 29 ++ .../client/model/search/BrowseResponse.kt | 32 +- .../client/model/search/SearchPagination.kt | 29 ++ .../client/model/search/SearchResponse.kt | 38 +- .../Model/Recommend/BaseSearchResponse.php | 163 -------- .../Recommend/RecommendationsResults.php | 304 +++++++-------- .../lib/Model/Recommend/SearchPagination.php | 358 ++++++++++++++++++ .../lib/Model/Search/BaseSearchResponse.php | 163 -------- .../lib/Model/Search/BrowsePagination.php | 346 +++++++++++++++++ .../lib/Model/Search/BrowseResponse.php | 306 +++++++-------- .../lib/Model/Search/SearchPagination.php | 358 ++++++++++++++++++ .../lib/Model/Search/SearchResponse.php | 304 +++++++-------- .../lib/Model/Search/SearchResult.php | 304 +++++++-------- .../recommend/models/base_search_response.py | 18 - .../models/recommendations_results.py | 28 +- .../recommend/models/search_pagination.py | 77 ++++ .../search/models/base_search_response.py | 18 - .../search/models/browse_pagination.py | 79 ++++ .../search/models/browse_response.py | 30 +- .../search/models/search_pagination.py | 77 ++++ .../search/models/search_response.py | 36 +- .../models/recommend/base_search_response.rb | 84 ---- .../recommend/recommendations_results.rb | 135 +++---- .../models/recommend/search_pagination.rb | 282 ++++++++++++++ .../models/search/base_search_response.rb | 84 ---- .../models/search/browse_pagination.rb | 274 ++++++++++++++ .../algolia/models/search/browse_response.rb | 125 +++--- .../models/search/search_pagination.rb | 282 ++++++++++++++ .../algolia/models/search/search_response.rb | 135 +++---- .../recommend/BaseSearchResponse.scala | 16 - .../recommend/RecommendationsResults.scala | 24 +- .../recommend/SearchPagination.scala | 48 +++ .../search/BaseSearchResponse.scala | 16 - .../search/BrowsePagination.scala | 52 +++ .../algoliasearch/search/BrowseResponse.scala | 24 +- .../search/SearchPagination.scala | 52 +++ .../algoliasearch/search/SearchResponse.scala | 24 +- .../Models/RecommendBaseSearchResponse.swift | 64 +--- .../Models/RecommendSearchPagination.swift | 60 +++ .../Models/RecommendationsResults.swift | 64 ++-- .../Search/Models/BrowsePagination.swift | 60 +++ .../Search/Models/BrowseResponse.swift | 64 ++-- .../Models/SearchBaseSearchResponse.swift | 64 +--- .../Search/Models/SearchResponse.swift | 120 +++--- .../Models/SearchSearchPagination.swift | 60 +++ specs/bundled/algoliasearch.yml | 60 ++- specs/bundled/recommend.doc.yml | 46 ++- specs/bundled/recommend.yml | 46 ++- specs/bundled/search.doc.yml | 59 ++- specs/bundled/search.yml | 59 ++- 130 files changed, 6709 insertions(+), 3590 deletions(-) create mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/SearchPagination.cs create mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowsePagination.cs create mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchPagination.cs create mode 100644 clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.dart create mode 100644 clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.g.dart create mode 100644 clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.dart create mode 100644 clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.g.dart create mode 100644 clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.dart create mode 100644 clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.g.dart create mode 100644 clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.dart create mode 100644 clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.g.dart create mode 100644 clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.dart create mode 100644 clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.g.dart create mode 100644 clients/algoliasearch-client-go/algolia/recommend/model_search_pagination.go create mode 100644 clients/algoliasearch-client-go/algolia/search/model_browse_pagination.go create mode 100644 clients/algoliasearch-client-go/algolia/search/model_search_pagination.go create mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/SearchPagination.java create mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowsePagination.java create mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchPagination.java create mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browsePagination.ts create mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchPagination.ts create mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/browsePagination.ts create mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchPagination.ts create mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/searchPagination.ts create mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/SearchPagination.kt create mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowsePagination.kt create mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchPagination.kt create mode 100644 clients/algoliasearch-client-php/lib/Model/Recommend/SearchPagination.php create mode 100644 clients/algoliasearch-client-php/lib/Model/Search/BrowsePagination.php create mode 100644 clients/algoliasearch-client-php/lib/Model/Search/SearchPagination.php create mode 100644 clients/algoliasearch-client-python/algoliasearch/recommend/models/search_pagination.py create mode 100644 clients/algoliasearch-client-python/algoliasearch/search/models/browse_pagination.py create mode 100644 clients/algoliasearch-client-python/algoliasearch/search/models/search_pagination.py create mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/recommend/search_pagination.rb create mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_pagination.rb create mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/search/search_pagination.rb create mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/SearchPagination.scala create mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowsePagination.scala create mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchPagination.scala create mode 100644 clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendSearchPagination.swift create mode 100644 clients/algoliasearch-client-swift/Sources/Search/Models/BrowsePagination.swift create mode 100644 clients/algoliasearch-client-swift/Sources/Search/Models/SearchSearchPagination.swift diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/BaseSearchResponse.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/BaseSearchResponse.cs index d290c6202ec..ed618c1feaf 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/BaseSearchResponse.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/BaseSearchResponse.cs @@ -27,17 +27,9 @@ public BaseSearchResponse() /// /// Initializes a new instance of the BaseSearchResponse class. /// - /// Number of hits per page. (required) (default to 20). - /// Number of results (hits). (required). - /// Number of pages of results. (required). - /// Page of search results to retrieve. (required) (default to 0). /// Time the server took to process the request, in milliseconds. (required). - public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int processingTimeMS) + public BaseSearchResponse(int processingTimeMS) { - HitsPerPage = hitsPerPage; - NbHits = nbHits; - NbPages = nbPages; - Page = page; ProcessingTimeMS = processingTimeMS; AdditionalProperties = new Dictionary(); } @@ -114,13 +106,6 @@ public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, in [JsonPropertyName("facets_stats")] public Dictionary FacetsStats { get; set; } - /// - /// Number of hits per page. - /// - /// Number of hits per page. - [JsonPropertyName("hitsPerPage")] - public int HitsPerPage { get; set; } - /// /// Index name used for the query. /// @@ -142,20 +127,6 @@ public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, in [JsonPropertyName("message")] public string Message { get; set; } - /// - /// Number of results (hits). - /// - /// Number of results (hits). - [JsonPropertyName("nbHits")] - public int NbHits { get; set; } - - /// - /// Number of pages of results. - /// - /// Number of pages of results. - [JsonPropertyName("nbPages")] - public int NbPages { get; set; } - /// /// Number of hits selected and sorted by the relevant sort algorithm. /// @@ -163,13 +134,6 @@ public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, in [JsonPropertyName("nbSortedHits")] public int? NbSortedHits { get; set; } - /// - /// Page of search results to retrieve. - /// - /// Page of search results to retrieve. - [JsonPropertyName("page")] - public int Page { get; set; } - /// /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. /// @@ -262,14 +226,10 @@ public override string ToString() sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); sb.Append(" Facets: ").Append(Facets).Append("\n"); sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); - sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Index: ").Append(Index).Append("\n"); sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" NbHits: ").Append(NbHits).Append("\n"); - sb.Append(" NbPages: ").Append(NbPages).Append("\n"); sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); - sb.Append(" Page: ").Append(Page).Append("\n"); sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); @@ -317,14 +277,10 @@ public override bool Equals(object obj) (ExhaustiveTypo == input.ExhaustiveTypo || ExhaustiveTypo.Equals(input.ExhaustiveTypo)) && (Facets == input.Facets || Facets != null && input.Facets != null && Facets.SequenceEqual(input.Facets)) && (FacetsStats == input.FacetsStats || FacetsStats != null && input.FacetsStats != null && FacetsStats.SequenceEqual(input.FacetsStats)) && - (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Index == input.Index || (Index != null && Index.Equals(input.Index))) && (IndexUsed == input.IndexUsed || (IndexUsed != null && IndexUsed.Equals(input.IndexUsed))) && (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && - (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && (NbSortedHits == input.NbSortedHits || NbSortedHits.Equals(input.NbSortedHits)) && - (Page == input.Page || Page.Equals(input.Page)) && (ParsedQuery == input.ParsedQuery || (ParsedQuery != null && ParsedQuery.Equals(input.ParsedQuery))) && (ProcessingTimeMS == input.ProcessingTimeMS || ProcessingTimeMS.Equals(input.ProcessingTimeMS)) && (ProcessingTimingsMS == input.ProcessingTimingsMS || (ProcessingTimingsMS != null && ProcessingTimingsMS.Equals(input.ProcessingTimingsMS))) && @@ -372,7 +328,6 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + FacetsStats.GetHashCode(); } - hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Index != null) { hashCode = (hashCode * 59) + Index.GetHashCode(); @@ -385,10 +340,7 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + Message.GetHashCode(); } - hashCode = (hashCode * 59) + NbHits.GetHashCode(); - hashCode = (hashCode * 59) + NbPages.GetHashCode(); hashCode = (hashCode * 59) + NbSortedHits.GetHashCode(); - hashCode = (hashCode * 59) + Page.GetHashCode(); if (ParsedQuery != null) { hashCode = (hashCode * 59) + ParsedQuery.GetHashCode(); diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/RecommendationsResults.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/RecommendationsResults.cs index 49a5a9914b6..bef4a24343d 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/RecommendationsResults.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/RecommendationsResults.cs @@ -24,19 +24,19 @@ public RecommendationsResults() { } /// /// Initializes a new instance of the RecommendationsResults class. /// - /// Number of hits per page. (required) (default to 20). + /// Time the server took to process the request, in milliseconds. (required). + /// Page of search results to retrieve. (required) (default to 0). /// Number of results (hits). (required). /// Number of pages of results. (required). - /// Page of search results to retrieve. (required) (default to 0). - /// Time the server took to process the request, in milliseconds. (required). + /// Number of hits per page. (required) (default to 20). /// hits (required). - public RecommendationsResults(int hitsPerPage, int nbHits, int nbPages, int page, int processingTimeMS, List hits) + public RecommendationsResults(int processingTimeMS, int page, int nbHits, int nbPages, int hitsPerPage, List hits) { - HitsPerPage = hitsPerPage; + ProcessingTimeMS = processingTimeMS; + Page = page; NbHits = nbHits; NbPages = nbPages; - Page = page; - ProcessingTimeMS = processingTimeMS; + HitsPerPage = hitsPerPage; Hits = hits ?? throw new ArgumentNullException(nameof(hits)); } @@ -112,13 +112,6 @@ public RecommendationsResults(int hitsPerPage, int nbHits, int nbPages, int page [JsonPropertyName("facets_stats")] public Dictionary FacetsStats { get; set; } - /// - /// Number of hits per page. - /// - /// Number of hits per page. - [JsonPropertyName("hitsPerPage")] - public int HitsPerPage { get; set; } - /// /// Index name used for the query. /// @@ -140,20 +133,6 @@ public RecommendationsResults(int hitsPerPage, int nbHits, int nbPages, int page [JsonPropertyName("message")] public string Message { get; set; } - /// - /// Number of results (hits). - /// - /// Number of results (hits). - [JsonPropertyName("nbHits")] - public int NbHits { get; set; } - - /// - /// Number of pages of results. - /// - /// Number of pages of results. - [JsonPropertyName("nbPages")] - public int NbPages { get; set; } - /// /// Number of hits selected and sorted by the relevant sort algorithm. /// @@ -161,13 +140,6 @@ public RecommendationsResults(int hitsPerPage, int nbHits, int nbPages, int page [JsonPropertyName("nbSortedHits")] public int? NbSortedHits { get; set; } - /// - /// Page of search results to retrieve. - /// - /// Page of search results to retrieve. - [JsonPropertyName("page")] - public int Page { get; set; } - /// /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. /// @@ -236,6 +208,34 @@ public RecommendationsResults(int hitsPerPage, int nbHits, int nbPages, int page [JsonPropertyName("queryID")] public string QueryID { get; set; } + /// + /// Page of search results to retrieve. + /// + /// Page of search results to retrieve. + [JsonPropertyName("page")] + public int Page { get; set; } + + /// + /// Number of results (hits). + /// + /// Number of results (hits). + [JsonPropertyName("nbHits")] + public int NbHits { get; set; } + + /// + /// Number of pages of results. + /// + /// Number of pages of results. + [JsonPropertyName("nbPages")] + public int NbPages { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [JsonPropertyName("hitsPerPage")] + public int HitsPerPage { get; set; } + /// /// Gets or Sets Hits /// @@ -260,14 +260,10 @@ public override string ToString() sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); sb.Append(" Facets: ").Append(Facets).Append("\n"); sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); - sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Index: ").Append(Index).Append("\n"); sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" NbHits: ").Append(NbHits).Append("\n"); - sb.Append(" NbPages: ").Append(NbPages).Append("\n"); sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); - sb.Append(" Page: ").Append(Page).Append("\n"); sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); @@ -278,6 +274,10 @@ public override string ToString() sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); sb.Append(" UserData: ").Append(UserData).Append("\n"); sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Hits: ").Append(Hits).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -315,14 +315,10 @@ public override bool Equals(object obj) (ExhaustiveTypo == input.ExhaustiveTypo || ExhaustiveTypo.Equals(input.ExhaustiveTypo)) && (Facets == input.Facets || Facets != null && input.Facets != null && Facets.SequenceEqual(input.Facets)) && (FacetsStats == input.FacetsStats || FacetsStats != null && input.FacetsStats != null && FacetsStats.SequenceEqual(input.FacetsStats)) && - (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Index == input.Index || (Index != null && Index.Equals(input.Index))) && (IndexUsed == input.IndexUsed || (IndexUsed != null && IndexUsed.Equals(input.IndexUsed))) && (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && - (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && (NbSortedHits == input.NbSortedHits || NbSortedHits.Equals(input.NbSortedHits)) && - (Page == input.Page || Page.Equals(input.Page)) && (ParsedQuery == input.ParsedQuery || (ParsedQuery != null && ParsedQuery.Equals(input.ParsedQuery))) && (ProcessingTimeMS == input.ProcessingTimeMS || ProcessingTimeMS.Equals(input.ProcessingTimeMS)) && (ProcessingTimingsMS == input.ProcessingTimingsMS || (ProcessingTimingsMS != null && ProcessingTimingsMS.Equals(input.ProcessingTimingsMS))) && @@ -333,6 +329,10 @@ public override bool Equals(object obj) (ServerUsed == input.ServerUsed || (ServerUsed != null && ServerUsed.Equals(input.ServerUsed))) && (UserData == input.UserData || (UserData != null && UserData.Equals(input.UserData))) && (QueryID == input.QueryID || (QueryID != null && QueryID.Equals(input.QueryID))) && + (Page == input.Page || Page.Equals(input.Page)) && + (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && + (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && + (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Hits == input.Hits || Hits != null && input.Hits != null && Hits.SequenceEqual(input.Hits)); } @@ -370,7 +370,6 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + FacetsStats.GetHashCode(); } - hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Index != null) { hashCode = (hashCode * 59) + Index.GetHashCode(); @@ -383,10 +382,7 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + Message.GetHashCode(); } - hashCode = (hashCode * 59) + NbHits.GetHashCode(); - hashCode = (hashCode * 59) + NbPages.GetHashCode(); hashCode = (hashCode * 59) + NbSortedHits.GetHashCode(); - hashCode = (hashCode * 59) + Page.GetHashCode(); if (ParsedQuery != null) { hashCode = (hashCode * 59) + ParsedQuery.GetHashCode(); @@ -421,6 +417,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + QueryID.GetHashCode(); } + hashCode = (hashCode * 59) + Page.GetHashCode(); + hashCode = (hashCode * 59) + NbHits.GetHashCode(); + hashCode = (hashCode * 59) + NbPages.GetHashCode(); + hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Hits != null) { hashCode = (hashCode * 59) + Hits.GetHashCode(); diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/SearchPagination.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/SearchPagination.cs new file mode 100644 index 00000000000..0490a17e870 --- /dev/null +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/SearchPagination.cs @@ -0,0 +1,129 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Text; +using System.Linq; +using System.Text.Json.Serialization; +using System.Collections.Generic; +using Algolia.Search.Serializer; +using System.Text.Json; + +namespace Algolia.Search.Models.Recommend; + +/// +/// SearchPagination +/// +public partial class SearchPagination +{ + /// + /// Initializes a new instance of the SearchPagination class. + /// + [JsonConstructor] + public SearchPagination() { } + /// + /// Initializes a new instance of the SearchPagination class. + /// + /// Page of search results to retrieve. (required) (default to 0). + /// Number of results (hits). (required). + /// Number of pages of results. (required). + /// Number of hits per page. (required) (default to 20). + public SearchPagination(int page, int nbHits, int nbPages, int hitsPerPage) + { + Page = page; + NbHits = nbHits; + NbPages = nbPages; + HitsPerPage = hitsPerPage; + } + + /// + /// Page of search results to retrieve. + /// + /// Page of search results to retrieve. + [JsonPropertyName("page")] + public int Page { get; set; } + + /// + /// Number of results (hits). + /// + /// Number of results (hits). + [JsonPropertyName("nbHits")] + public int NbHits { get; set; } + + /// + /// Number of pages of results. + /// + /// Number of pages of results. + [JsonPropertyName("nbPages")] + public int NbPages { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [JsonPropertyName("hitsPerPage")] + public int HitsPerPage { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchPagination {\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonSerializer.Serialize(this, JsonConfig.Options); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + if (obj is not SearchPagination input) + { + return false; + } + + return + (Page == input.Page || Page.Equals(input.Page)) && + (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && + (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && + (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + Page.GetHashCode(); + hashCode = (hashCode * 59) + NbHits.GetHashCode(); + hashCode = (hashCode * 59) + NbPages.GetHashCode(); + hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); + return hashCode; + } + } + +} + diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BaseSearchResponse.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BaseSearchResponse.cs index 897cf1c5207..24ba57d5aee 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BaseSearchResponse.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BaseSearchResponse.cs @@ -27,17 +27,9 @@ public BaseSearchResponse() /// /// Initializes a new instance of the BaseSearchResponse class. /// - /// Number of hits per page. (required) (default to 20). - /// Number of results (hits). (required). - /// Number of pages of results. (required). - /// Page of search results to retrieve. (required) (default to 0). /// Time the server took to process the request, in milliseconds. (required). - public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int processingTimeMS) + public BaseSearchResponse(int processingTimeMS) { - HitsPerPage = hitsPerPage; - NbHits = nbHits; - NbPages = nbPages; - Page = page; ProcessingTimeMS = processingTimeMS; AdditionalProperties = new Dictionary(); } @@ -114,13 +106,6 @@ public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, in [JsonPropertyName("facets_stats")] public Dictionary FacetsStats { get; set; } - /// - /// Number of hits per page. - /// - /// Number of hits per page. - [JsonPropertyName("hitsPerPage")] - public int HitsPerPage { get; set; } - /// /// Index name used for the query. /// @@ -142,20 +127,6 @@ public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, in [JsonPropertyName("message")] public string Message { get; set; } - /// - /// Number of results (hits). - /// - /// Number of results (hits). - [JsonPropertyName("nbHits")] - public int NbHits { get; set; } - - /// - /// Number of pages of results. - /// - /// Number of pages of results. - [JsonPropertyName("nbPages")] - public int NbPages { get; set; } - /// /// Number of hits selected and sorted by the relevant sort algorithm. /// @@ -163,13 +134,6 @@ public BaseSearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, in [JsonPropertyName("nbSortedHits")] public int? NbSortedHits { get; set; } - /// - /// Page of search results to retrieve. - /// - /// Page of search results to retrieve. - [JsonPropertyName("page")] - public int Page { get; set; } - /// /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. /// @@ -262,14 +226,10 @@ public override string ToString() sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); sb.Append(" Facets: ").Append(Facets).Append("\n"); sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); - sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Index: ").Append(Index).Append("\n"); sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" NbHits: ").Append(NbHits).Append("\n"); - sb.Append(" NbPages: ").Append(NbPages).Append("\n"); sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); - sb.Append(" Page: ").Append(Page).Append("\n"); sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); @@ -317,14 +277,10 @@ public override bool Equals(object obj) (ExhaustiveTypo == input.ExhaustiveTypo || ExhaustiveTypo.Equals(input.ExhaustiveTypo)) && (Facets == input.Facets || Facets != null && input.Facets != null && Facets.SequenceEqual(input.Facets)) && (FacetsStats == input.FacetsStats || FacetsStats != null && input.FacetsStats != null && FacetsStats.SequenceEqual(input.FacetsStats)) && - (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Index == input.Index || (Index != null && Index.Equals(input.Index))) && (IndexUsed == input.IndexUsed || (IndexUsed != null && IndexUsed.Equals(input.IndexUsed))) && (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && - (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && (NbSortedHits == input.NbSortedHits || NbSortedHits.Equals(input.NbSortedHits)) && - (Page == input.Page || Page.Equals(input.Page)) && (ParsedQuery == input.ParsedQuery || (ParsedQuery != null && ParsedQuery.Equals(input.ParsedQuery))) && (ProcessingTimeMS == input.ProcessingTimeMS || ProcessingTimeMS.Equals(input.ProcessingTimeMS)) && (ProcessingTimingsMS == input.ProcessingTimingsMS || (ProcessingTimingsMS != null && ProcessingTimingsMS.Equals(input.ProcessingTimingsMS))) && @@ -372,7 +328,6 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + FacetsStats.GetHashCode(); } - hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Index != null) { hashCode = (hashCode * 59) + Index.GetHashCode(); @@ -385,10 +340,7 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + Message.GetHashCode(); } - hashCode = (hashCode * 59) + NbHits.GetHashCode(); - hashCode = (hashCode * 59) + NbPages.GetHashCode(); hashCode = (hashCode * 59) + NbSortedHits.GetHashCode(); - hashCode = (hashCode * 59) + Page.GetHashCode(); if (ParsedQuery != null) { hashCode = (hashCode * 59) + ParsedQuery.GetHashCode(); diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowsePagination.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowsePagination.cs new file mode 100644 index 00000000000..2fe75226782 --- /dev/null +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowsePagination.cs @@ -0,0 +1,116 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Text; +using System.Linq; +using System.Text.Json.Serialization; +using System.Collections.Generic; +using Algolia.Search.Serializer; +using System.Text.Json; + +namespace Algolia.Search.Models.Search; + +/// +/// BrowsePagination +/// +public partial class BrowsePagination +{ + /// + /// Initializes a new instance of the BrowsePagination class. + /// + public BrowsePagination() + { + } + + /// + /// Page of search results to retrieve. + /// + /// Page of search results to retrieve. + [JsonPropertyName("page")] + public int? Page { get; set; } + + /// + /// Number of results (hits). + /// + /// Number of results (hits). + [JsonPropertyName("nbHits")] + public int? NbHits { get; set; } + + /// + /// Number of pages of results. + /// + /// Number of pages of results. + [JsonPropertyName("nbPages")] + public int? NbPages { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [JsonPropertyName("hitsPerPage")] + public int? HitsPerPage { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BrowsePagination {\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonSerializer.Serialize(this, JsonConfig.Options); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + if (obj is not BrowsePagination input) + { + return false; + } + + return + (Page == input.Page || Page.Equals(input.Page)) && + (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && + (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && + (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + Page.GetHashCode(); + hashCode = (hashCode * 59) + NbHits.GetHashCode(); + hashCode = (hashCode * 59) + NbPages.GetHashCode(); + hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); + return hashCode; + } + } + +} + diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowseResponse.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowseResponse.cs index 79aeae90fc7..3cc845f9852 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowseResponse.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/BrowseResponse.cs @@ -24,20 +24,12 @@ public BrowseResponse() { } /// /// Initializes a new instance of the BrowseResponse class. /// - /// Number of hits per page. (required) (default to 20). - /// Number of results (hits). (required). - /// Number of pages of results. (required). - /// Page of search results to retrieve. (required) (default to 0). /// Time the server took to process the request, in milliseconds. (required). /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. (required). /// Search query. (required) (default to ""). /// URL-encoded string of all search parameters. (required). - public BrowseResponse(int hitsPerPage, int nbHits, int nbPages, int page, int processingTimeMS, List hits, string query, string varParams) + public BrowseResponse(int processingTimeMS, List hits, string query, string varParams) { - HitsPerPage = hitsPerPage; - NbHits = nbHits; - NbPages = nbPages; - Page = page; ProcessingTimeMS = processingTimeMS; Hits = hits ?? throw new ArgumentNullException(nameof(hits)); Query = query ?? throw new ArgumentNullException(nameof(query)); @@ -116,13 +108,6 @@ public BrowseResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("facets_stats")] public Dictionary FacetsStats { get; set; } - /// - /// Number of hits per page. - /// - /// Number of hits per page. - [JsonPropertyName("hitsPerPage")] - public int HitsPerPage { get; set; } - /// /// Index name used for the query. /// @@ -144,20 +129,6 @@ public BrowseResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("message")] public string Message { get; set; } - /// - /// Number of results (hits). - /// - /// Number of results (hits). - [JsonPropertyName("nbHits")] - public int NbHits { get; set; } - - /// - /// Number of pages of results. - /// - /// Number of pages of results. - [JsonPropertyName("nbPages")] - public int NbPages { get; set; } - /// /// Number of hits selected and sorted by the relevant sort algorithm. /// @@ -165,13 +136,6 @@ public BrowseResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("nbSortedHits")] public int? NbSortedHits { get; set; } - /// - /// Page of search results to retrieve. - /// - /// Page of search results to retrieve. - [JsonPropertyName("page")] - public int Page { get; set; } - /// /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. /// @@ -240,6 +204,34 @@ public BrowseResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("queryID")] public string QueryID { get; set; } + /// + /// Page of search results to retrieve. + /// + /// Page of search results to retrieve. + [JsonPropertyName("page")] + public int? Page { get; set; } + + /// + /// Number of results (hits). + /// + /// Number of results (hits). + [JsonPropertyName("nbHits")] + public int? NbHits { get; set; } + + /// + /// Number of pages of results. + /// + /// Number of pages of results. + [JsonPropertyName("nbPages")] + public int? NbPages { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [JsonPropertyName("hitsPerPage")] + public int? HitsPerPage { get; set; } + /// /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. /// @@ -286,14 +278,10 @@ public override string ToString() sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); sb.Append(" Facets: ").Append(Facets).Append("\n"); sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); - sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Index: ").Append(Index).Append("\n"); sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" NbHits: ").Append(NbHits).Append("\n"); - sb.Append(" NbPages: ").Append(NbPages).Append("\n"); sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); - sb.Append(" Page: ").Append(Page).Append("\n"); sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); @@ -304,6 +292,10 @@ public override string ToString() sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); sb.Append(" UserData: ").Append(UserData).Append("\n"); sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Hits: ").Append(Hits).Append("\n"); sb.Append(" Query: ").Append(Query).Append("\n"); sb.Append(" Params: ").Append(Params).Append("\n"); @@ -344,14 +336,10 @@ public override bool Equals(object obj) (ExhaustiveTypo == input.ExhaustiveTypo || ExhaustiveTypo.Equals(input.ExhaustiveTypo)) && (Facets == input.Facets || Facets != null && input.Facets != null && Facets.SequenceEqual(input.Facets)) && (FacetsStats == input.FacetsStats || FacetsStats != null && input.FacetsStats != null && FacetsStats.SequenceEqual(input.FacetsStats)) && - (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Index == input.Index || (Index != null && Index.Equals(input.Index))) && (IndexUsed == input.IndexUsed || (IndexUsed != null && IndexUsed.Equals(input.IndexUsed))) && (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && - (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && (NbSortedHits == input.NbSortedHits || NbSortedHits.Equals(input.NbSortedHits)) && - (Page == input.Page || Page.Equals(input.Page)) && (ParsedQuery == input.ParsedQuery || (ParsedQuery != null && ParsedQuery.Equals(input.ParsedQuery))) && (ProcessingTimeMS == input.ProcessingTimeMS || ProcessingTimeMS.Equals(input.ProcessingTimeMS)) && (ProcessingTimingsMS == input.ProcessingTimingsMS || (ProcessingTimingsMS != null && ProcessingTimingsMS.Equals(input.ProcessingTimingsMS))) && @@ -362,6 +350,10 @@ public override bool Equals(object obj) (ServerUsed == input.ServerUsed || (ServerUsed != null && ServerUsed.Equals(input.ServerUsed))) && (UserData == input.UserData || (UserData != null && UserData.Equals(input.UserData))) && (QueryID == input.QueryID || (QueryID != null && QueryID.Equals(input.QueryID))) && + (Page == input.Page || Page.Equals(input.Page)) && + (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && + (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && + (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Hits == input.Hits || Hits != null && input.Hits != null && Hits.SequenceEqual(input.Hits)) && (Query == input.Query || (Query != null && Query.Equals(input.Query))) && (Params == input.Params || (Params != null && Params.Equals(input.Params))) && @@ -402,7 +394,6 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + FacetsStats.GetHashCode(); } - hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Index != null) { hashCode = (hashCode * 59) + Index.GetHashCode(); @@ -415,10 +406,7 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + Message.GetHashCode(); } - hashCode = (hashCode * 59) + NbHits.GetHashCode(); - hashCode = (hashCode * 59) + NbPages.GetHashCode(); hashCode = (hashCode * 59) + NbSortedHits.GetHashCode(); - hashCode = (hashCode * 59) + Page.GetHashCode(); if (ParsedQuery != null) { hashCode = (hashCode * 59) + ParsedQuery.GetHashCode(); @@ -453,6 +441,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + QueryID.GetHashCode(); } + hashCode = (hashCode * 59) + Page.GetHashCode(); + hashCode = (hashCode * 59) + NbHits.GetHashCode(); + hashCode = (hashCode * 59) + NbPages.GetHashCode(); + hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Hits != null) { hashCode = (hashCode * 59) + Hits.GetHashCode(); diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchPagination.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchPagination.cs new file mode 100644 index 00000000000..5d04f7d3914 --- /dev/null +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchPagination.cs @@ -0,0 +1,129 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Text; +using System.Linq; +using System.Text.Json.Serialization; +using System.Collections.Generic; +using Algolia.Search.Serializer; +using System.Text.Json; + +namespace Algolia.Search.Models.Search; + +/// +/// SearchPagination +/// +public partial class SearchPagination +{ + /// + /// Initializes a new instance of the SearchPagination class. + /// + [JsonConstructor] + public SearchPagination() { } + /// + /// Initializes a new instance of the SearchPagination class. + /// + /// Page of search results to retrieve. (required) (default to 0). + /// Number of results (hits). (required). + /// Number of pages of results. (required). + /// Number of hits per page. (required) (default to 20). + public SearchPagination(int page, int nbHits, int nbPages, int hitsPerPage) + { + Page = page; + NbHits = nbHits; + NbPages = nbPages; + HitsPerPage = hitsPerPage; + } + + /// + /// Page of search results to retrieve. + /// + /// Page of search results to retrieve. + [JsonPropertyName("page")] + public int Page { get; set; } + + /// + /// Number of results (hits). + /// + /// Number of results (hits). + [JsonPropertyName("nbHits")] + public int NbHits { get; set; } + + /// + /// Number of pages of results. + /// + /// Number of pages of results. + [JsonPropertyName("nbPages")] + public int NbPages { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [JsonPropertyName("hitsPerPage")] + public int HitsPerPage { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchPagination {\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonSerializer.Serialize(this, JsonConfig.Options); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + if (obj is not SearchPagination input) + { + return false; + } + + return + (Page == input.Page || Page.Equals(input.Page)) && + (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && + (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && + (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + Page.GetHashCode(); + hashCode = (hashCode * 59) + NbHits.GetHashCode(); + hashCode = (hashCode * 59) + NbPages.GetHashCode(); + hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); + return hashCode; + } + } + +} + diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchResponse.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchResponse.cs index 58a3135f4ed..2c3c6237c48 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchResponse.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/SearchResponse.cs @@ -27,21 +27,21 @@ public SearchResponse() /// /// Initializes a new instance of the SearchResponse class. /// - /// Number of hits per page. (required) (default to 20). + /// Time the server took to process the request, in milliseconds. (required). + /// Page of search results to retrieve. (required) (default to 0). /// Number of results (hits). (required). /// Number of pages of results. (required). - /// Page of search results to retrieve. (required) (default to 0). - /// Time the server took to process the request, in milliseconds. (required). + /// Number of hits per page. (required) (default to 20). /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. (required). /// Search query. (required) (default to ""). /// URL-encoded string of all search parameters. (required). - public SearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int processingTimeMS, List hits, string query, string varParams) + public SearchResponse(int processingTimeMS, int page, int nbHits, int nbPages, int hitsPerPage, List hits, string query, string varParams) { - HitsPerPage = hitsPerPage; + ProcessingTimeMS = processingTimeMS; + Page = page; NbHits = nbHits; NbPages = nbPages; - Page = page; - ProcessingTimeMS = processingTimeMS; + HitsPerPage = hitsPerPage; Hits = hits ?? throw new ArgumentNullException(nameof(hits)); Query = query ?? throw new ArgumentNullException(nameof(query)); Params = varParams ?? throw new ArgumentNullException(nameof(varParams)); @@ -120,13 +120,6 @@ public SearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("facets_stats")] public Dictionary FacetsStats { get; set; } - /// - /// Number of hits per page. - /// - /// Number of hits per page. - [JsonPropertyName("hitsPerPage")] - public int HitsPerPage { get; set; } - /// /// Index name used for the query. /// @@ -148,20 +141,6 @@ public SearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("message")] public string Message { get; set; } - /// - /// Number of results (hits). - /// - /// Number of results (hits). - [JsonPropertyName("nbHits")] - public int NbHits { get; set; } - - /// - /// Number of pages of results. - /// - /// Number of pages of results. - [JsonPropertyName("nbPages")] - public int NbPages { get; set; } - /// /// Number of hits selected and sorted by the relevant sort algorithm. /// @@ -169,13 +148,6 @@ public SearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("nbSortedHits")] public int? NbSortedHits { get; set; } - /// - /// Page of search results to retrieve. - /// - /// Page of search results to retrieve. - [JsonPropertyName("page")] - public int Page { get; set; } - /// /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. /// @@ -244,6 +216,34 @@ public SearchResponse(int hitsPerPage, int nbHits, int nbPages, int page, int pr [JsonPropertyName("queryID")] public string QueryID { get; set; } + /// + /// Page of search results to retrieve. + /// + /// Page of search results to retrieve. + [JsonPropertyName("page")] + public int Page { get; set; } + + /// + /// Number of results (hits). + /// + /// Number of results (hits). + [JsonPropertyName("nbHits")] + public int NbHits { get; set; } + + /// + /// Number of pages of results. + /// + /// Number of pages of results. + [JsonPropertyName("nbPages")] + public int NbPages { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [JsonPropertyName("hitsPerPage")] + public int HitsPerPage { get; set; } + /// /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. /// @@ -289,14 +289,10 @@ public override string ToString() sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); sb.Append(" Facets: ").Append(Facets).Append("\n"); sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); - sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Index: ").Append(Index).Append("\n"); sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" NbHits: ").Append(NbHits).Append("\n"); - sb.Append(" NbPages: ").Append(NbPages).Append("\n"); sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); - sb.Append(" Page: ").Append(Page).Append("\n"); sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); @@ -307,6 +303,10 @@ public override string ToString() sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); sb.Append(" UserData: ").Append(UserData).Append("\n"); sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); sb.Append(" Hits: ").Append(Hits).Append("\n"); sb.Append(" Query: ").Append(Query).Append("\n"); sb.Append(" Params: ").Append(Params).Append("\n"); @@ -347,14 +347,10 @@ public override bool Equals(object obj) (ExhaustiveTypo == input.ExhaustiveTypo || ExhaustiveTypo.Equals(input.ExhaustiveTypo)) && (Facets == input.Facets || Facets != null && input.Facets != null && Facets.SequenceEqual(input.Facets)) && (FacetsStats == input.FacetsStats || FacetsStats != null && input.FacetsStats != null && FacetsStats.SequenceEqual(input.FacetsStats)) && - (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Index == input.Index || (Index != null && Index.Equals(input.Index))) && (IndexUsed == input.IndexUsed || (IndexUsed != null && IndexUsed.Equals(input.IndexUsed))) && (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && - (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && (NbSortedHits == input.NbSortedHits || NbSortedHits.Equals(input.NbSortedHits)) && - (Page == input.Page || Page.Equals(input.Page)) && (ParsedQuery == input.ParsedQuery || (ParsedQuery != null && ParsedQuery.Equals(input.ParsedQuery))) && (ProcessingTimeMS == input.ProcessingTimeMS || ProcessingTimeMS.Equals(input.ProcessingTimeMS)) && (ProcessingTimingsMS == input.ProcessingTimingsMS || (ProcessingTimingsMS != null && ProcessingTimingsMS.Equals(input.ProcessingTimingsMS))) && @@ -365,6 +361,10 @@ public override bool Equals(object obj) (ServerUsed == input.ServerUsed || (ServerUsed != null && ServerUsed.Equals(input.ServerUsed))) && (UserData == input.UserData || (UserData != null && UserData.Equals(input.UserData))) && (QueryID == input.QueryID || (QueryID != null && QueryID.Equals(input.QueryID))) && + (Page == input.Page || Page.Equals(input.Page)) && + (NbHits == input.NbHits || NbHits.Equals(input.NbHits)) && + (NbPages == input.NbPages || NbPages.Equals(input.NbPages)) && + (HitsPerPage == input.HitsPerPage || HitsPerPage.Equals(input.HitsPerPage)) && (Hits == input.Hits || Hits != null && input.Hits != null && Hits.SequenceEqual(input.Hits)) && (Query == input.Query || (Query != null && Query.Equals(input.Query))) && (Params == input.Params || (Params != null && Params.Equals(input.Params))) @@ -405,7 +405,6 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + FacetsStats.GetHashCode(); } - hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Index != null) { hashCode = (hashCode * 59) + Index.GetHashCode(); @@ -418,10 +417,7 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + Message.GetHashCode(); } - hashCode = (hashCode * 59) + NbHits.GetHashCode(); - hashCode = (hashCode * 59) + NbPages.GetHashCode(); hashCode = (hashCode * 59) + NbSortedHits.GetHashCode(); - hashCode = (hashCode * 59) + Page.GetHashCode(); if (ParsedQuery != null) { hashCode = (hashCode * 59) + ParsedQuery.GetHashCode(); @@ -456,6 +452,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + QueryID.GetHashCode(); } + hashCode = (hashCode * 59) + Page.GetHashCode(); + hashCode = (hashCode * 59) + NbHits.GetHashCode(); + hashCode = (hashCode * 59) + NbPages.GetHashCode(); + hashCode = (hashCode * 59) + HitsPerPage.GetHashCode(); if (Hits != null) { hashCode = (hashCode * 59) + Hits.GetHashCode(); diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch_lite.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch_lite.dart index 1708e4eaeec..32344ba3712 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch_lite.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch_lite.dart @@ -19,6 +19,7 @@ export 'src/model/base_search_params.dart'; export 'src/model/base_search_params_without_query.dart'; export 'src/model/base_search_response.dart'; export 'src/model/bought_together_query.dart'; +export 'src/model/browse_pagination.dart'; export 'src/model/browse_params_object.dart'; export 'src/model/browse_response.dart'; export 'src/model/consequence_params.dart'; @@ -75,6 +76,7 @@ export 'src/model/search_for_hits.dart'; export 'src/model/search_for_hits_options.dart'; export 'src/model/search_hits.dart'; export 'src/model/search_method_params.dart'; +export 'src/model/search_pagination.dart'; export 'src/model/search_params.dart'; export 'src/model/search_params_object.dart'; export 'src/model/search_params_query.dart'; diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/deserialize.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/deserialize.dart index c0cdf44e887..6db5bf0e675 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/deserialize.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/deserialize.dart @@ -12,6 +12,7 @@ import 'package:algoliasearch/src/model/base_search_params.dart'; import 'package:algoliasearch/src/model/base_search_params_without_query.dart'; import 'package:algoliasearch/src/model/base_search_response.dart'; import 'package:algoliasearch/src/model/bought_together_query.dart'; +import 'package:algoliasearch/src/model/browse_pagination.dart'; import 'package:algoliasearch/src/model/browse_params_object.dart'; import 'package:algoliasearch/src/model/browse_response.dart'; import 'package:algoliasearch/src/model/consequence_params.dart'; @@ -68,6 +69,7 @@ import 'package:algoliasearch/src/model/search_for_hits.dart'; import 'package:algoliasearch/src/model/search_for_hits_options.dart'; import 'package:algoliasearch/src/model/search_hits.dart'; import 'package:algoliasearch/src/model/search_method_params.dart'; +import 'package:algoliasearch/src/model/search_pagination.dart'; import 'package:algoliasearch/src/model/search_params.dart'; import 'package:algoliasearch/src/model/search_params_object.dart'; import 'package:algoliasearch/src/model/search_params_query.dart'; @@ -146,6 +148,9 @@ ReturnType deserialize(dynamic value, String targetType, case 'BoughtTogetherQuery': return BoughtTogetherQuery.fromJson(value as Map) as ReturnType; + case 'BrowsePagination': + return BrowsePagination.fromJson(value as Map) + as ReturnType; case 'BrowseParamsObject': return BrowseParamsObject.fromJson(value as Map) as ReturnType; @@ -289,6 +294,9 @@ ReturnType deserialize(dynamic value, String targetType, case 'SearchMethodParams': return SearchMethodParams.fromJson(value as Map) as ReturnType; + case 'SearchPagination': + return SearchPagination.fromJson(value as Map) + as ReturnType; case 'SearchParams': return SearchParams.fromJson(value as Map) as ReturnType; case 'SearchParamsObject': diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.dart index 05ef40b001a..898d5464599 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.dart @@ -24,14 +24,10 @@ final class BaseSearchResponse extends DelegatingMap { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -88,12 +84,6 @@ final class BaseSearchResponse extends DelegatingMap { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -106,23 +96,10 @@ final class BaseSearchResponse extends DelegatingMap { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -175,14 +152,10 @@ final class BaseSearchResponse extends DelegatingMap { other.exhaustiveTypo == exhaustiveTypo && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -207,14 +180,10 @@ final class BaseSearchResponse extends DelegatingMap { exhaustiveTypo.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -243,14 +212,10 @@ final class BaseSearchResponse extends DelegatingMap { exhaustiveTypo: instance.exhaustiveTypo, facets: instance.facets, facetsStats: instance.facetsStats, - hitsPerPage: instance.hitsPerPage, index: instance.index, indexUsed: instance.indexUsed, message: instance.message, - nbHits: instance.nbHits, - nbPages: instance.nbPages, nbSortedHits: instance.nbSortedHits, - page: instance.page, parsedQuery: instance.parsedQuery, processingTimeMS: instance.processingTimeMS, processingTimingsMS: instance.processingTimingsMS, diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.g.dart index 657347835fd..33b2c436dc8 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response.g.dart @@ -39,16 +39,11 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -87,14 +82,10 @@ const _$BaseSearchResponseFieldMap = { 'exhaustiveTypo': 'exhaustiveTypo', 'facets': 'facets', 'facetsStats': 'facets_stats', - 'hitsPerPage': 'hitsPerPage', 'index': 'index', 'indexUsed': 'indexUsed', 'message': 'message', - 'nbHits': 'nbHits', - 'nbPages': 'nbPages', 'nbSortedHits': 'nbSortedHits', - 'page': 'page', 'parsedQuery': 'parsedQuery', 'processingTimeMS': 'processingTimeMS', 'processingTimingsMS': 'processingTimingsMS', @@ -127,14 +118,10 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.dart new file mode 100644 index 00000000000..74e7de64d98 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.dart @@ -0,0 +1,59 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// ignore_for_file: unused_element + +import 'package:json_annotation/json_annotation.dart'; + +part 'browse_pagination.g.dart'; + +@JsonSerializable() +final class BrowsePagination { + /// Returns a new [BrowsePagination] instance. + const BrowsePagination({ + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, + }); + + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int? page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int? nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int? nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int? hitsPerPage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BrowsePagination && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage; + + @override + int get hashCode => + page.hashCode + nbHits.hashCode + nbPages.hashCode + hitsPerPage.hashCode; + + factory BrowsePagination.fromJson(Map json) => + _$BrowsePaginationFromJson(json); + + Map toJson() => _$BrowsePaginationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.g.dart new file mode 100644 index 00000000000..991ff30f445 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_pagination.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'browse_pagination.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BrowsePagination _$BrowsePaginationFromJson(Map json) => + $checkedCreate( + 'BrowsePagination', + json, + ($checkedConvert) { + final val = BrowsePagination( + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), + ); + return val; + }, + ); + +Map _$BrowsePaginationToJson(BrowsePagination instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); + return val; +} diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.dart index 332b85bc778..1bf62ea1a43 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.dart @@ -24,14 +24,10 @@ final class BrowseResponse { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -42,6 +38,10 @@ final class BrowseResponse { this.serverUsed, this.userData, this.queryID, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, required this.hits, required this.query, required this.params, @@ -91,12 +91,6 @@ final class BrowseResponse { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -109,23 +103,10 @@ final class BrowseResponse { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -164,6 +145,25 @@ final class BrowseResponse { @JsonKey(name: r'queryID') final String? queryID; + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int? page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int? nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int? nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int? hitsPerPage; + /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. @JsonKey(name: r'hits') final List hits; @@ -191,14 +191,10 @@ final class BrowseResponse { other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -209,6 +205,10 @@ final class BrowseResponse { other.serverUsed == serverUsed && other.userData == userData && other.queryID == queryID && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage && other.hits == hits && other.query == query && other.params == params && @@ -223,14 +223,10 @@ final class BrowseResponse { exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -241,6 +237,10 @@ final class BrowseResponse { serverUsed.hashCode + userData.hashCode + queryID.hashCode + + page.hashCode + + nbHits.hashCode + + nbPages.hashCode + + hitsPerPage.hashCode + hits.hashCode + query.hashCode + params.hashCode + diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.g.dart index 54af032855e..568902444bc 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_response.g.dart @@ -39,16 +39,11 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -70,6 +65,11 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => serverUsed: $checkedConvert('serverUsed', (v) => v as String?), userData: $checkedConvert('userData', (v) => v), queryID: $checkedConvert('queryID', (v) => v as String?), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -104,14 +104,10 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); @@ -122,6 +118,10 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); val['hits'] = instance.hits.map((e) => e.toJson()).toList(); val['query'] = instance.query; val['params'] = instance.params; diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.dart index d5573db47f1..3514c4e611a 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.dart @@ -23,14 +23,10 @@ final class RecommendationsResults { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -41,6 +37,10 @@ final class RecommendationsResults { this.serverUsed, this.userData, this.queryID, + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, required this.hits, }); @@ -87,12 +87,6 @@ final class RecommendationsResults { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -105,23 +99,10 @@ final class RecommendationsResults { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -160,6 +141,25 @@ final class RecommendationsResults { @JsonKey(name: r'queryID') final String? queryID; + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + /// One of types: /// - [RecommendHit] /// - [TrendingFacetHit] @@ -177,14 +177,10 @@ final class RecommendationsResults { other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -195,6 +191,10 @@ final class RecommendationsResults { other.serverUsed == serverUsed && other.userData == userData && other.queryID == queryID && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage && other.hits == hits; @override @@ -206,14 +206,10 @@ final class RecommendationsResults { exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -224,6 +220,10 @@ final class RecommendationsResults { serverUsed.hashCode + userData.hashCode + queryID.hashCode + + page.hashCode + + nbHits.hashCode + + nbPages.hashCode + + hitsPerPage.hashCode + hits.hashCode; factory RecommendationsResults.fromJson(Map json) => diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.g.dart index 7ff2b385430..556bd01f452 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.g.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/recommendations_results.g.dart @@ -40,16 +40,11 @@ RecommendationsResults _$RecommendationsResultsFromJson( (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -71,6 +66,11 @@ RecommendationsResults _$RecommendationsResultsFromJson( serverUsed: $checkedConvert('serverUsed', (v) => v as String?), userData: $checkedConvert('userData', (v) => v), queryID: $checkedConvert('queryID', (v) => v as String?), + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), hits: $checkedConvert('hits', (v) => v as List), ); return val; @@ -99,14 +99,10 @@ Map _$RecommendationsResultsToJson( writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); @@ -117,6 +113,10 @@ Map _$RecommendationsResultsToJson( writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); + val['page'] = instance.page; + val['nbHits'] = instance.nbHits; + val['nbPages'] = instance.nbPages; + val['hitsPerPage'] = instance.hitsPerPage; val['hits'] = instance.hits.toList(); return val; } diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.dart new file mode 100644 index 00000000000..4c7eb08ca97 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.dart @@ -0,0 +1,59 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// ignore_for_file: unused_element + +import 'package:json_annotation/json_annotation.dart'; + +part 'search_pagination.g.dart'; + +@JsonSerializable() +final class SearchPagination { + /// Returns a new [SearchPagination] instance. + const SearchPagination({ + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, + }); + + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SearchPagination && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage; + + @override + int get hashCode => + page.hashCode + nbHits.hashCode + nbPages.hashCode + hitsPerPage.hashCode; + + factory SearchPagination.fromJson(Map json) => + _$SearchPaginationFromJson(json); + + Map toJson() => _$SearchPaginationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.g.dart new file mode 100644 index 00000000000..b58a96cf74d --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_pagination.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_pagination.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchPagination _$SearchPaginationFromJson(Map json) => + $checkedCreate( + 'SearchPagination', + json, + ($checkedConvert) { + final val = SearchPagination( + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + ); + return val; + }, + ); + +Map _$SearchPaginationToJson(SearchPagination instance) => + { + 'page': instance.page, + 'nbHits': instance.nbHits, + 'nbPages': instance.nbPages, + 'hitsPerPage': instance.hitsPerPage, + }; diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.dart index 64b6aa1165e..ea634589c9a 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.dart @@ -24,14 +24,10 @@ final class SearchResponse { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -42,6 +38,10 @@ final class SearchResponse { this.serverUsed, this.userData, this.queryID, + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, required this.hits, required this.query, required this.params, @@ -90,12 +90,6 @@ final class SearchResponse { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -108,23 +102,10 @@ final class SearchResponse { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -163,6 +144,25 @@ final class SearchResponse { @JsonKey(name: r'queryID') final String? queryID; + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. @JsonKey(name: r'hits') final List hits; @@ -186,14 +186,10 @@ final class SearchResponse { other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -204,6 +200,10 @@ final class SearchResponse { other.serverUsed == serverUsed && other.userData == userData && other.queryID == queryID && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage && other.hits == hits && other.query == query && other.params == params; @@ -217,14 +217,10 @@ final class SearchResponse { exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -235,6 +231,10 @@ final class SearchResponse { serverUsed.hashCode + userData.hashCode + queryID.hashCode + + page.hashCode + + nbHits.hashCode + + nbPages.hashCode + + hitsPerPage.hashCode + hits.hashCode + query.hashCode + params.hashCode; diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.g.dart index adb07d65d4a..fdde087e610 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_response.g.dart @@ -39,16 +39,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -70,6 +65,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => serverUsed: $checkedConvert('serverUsed', (v) => v as String?), userData: $checkedConvert('userData', (v) => v), queryID: $checkedConvert('queryID', (v) => v as String?), + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -103,14 +103,10 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); @@ -121,6 +117,10 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); + val['page'] = instance.page; + val['nbHits'] = instance.nbHits; + val['nbPages'] = instance.nbPages; + val['hitsPerPage'] = instance.hitsPerPage; val['hits'] = instance.hits.map((e) => e.toJson()).toList(); val['query'] = instance.query; val['params'] = instance.params; diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/algolia_client_recommend.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/algolia_client_recommend.dart index 3a7295b57b9..53141f935fc 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/algolia_client_recommend.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/algolia_client_recommend.dart @@ -62,6 +62,7 @@ export 'src/model/related_products.dart'; export 'src/model/related_query.dart'; export 'src/model/remove_words_if_no_results.dart'; export 'src/model/rendering_content.dart'; +export 'src/model/search_pagination.dart'; export 'src/model/search_params.dart'; export 'src/model/search_params_object.dart'; export 'src/model/search_params_query.dart'; diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/deserialize.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/deserialize.dart index 74d636ee910..54ab8bb6f27 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/deserialize.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/deserialize.dart @@ -55,6 +55,7 @@ import 'package:algolia_client_recommend/src/model/related_products.dart'; import 'package:algolia_client_recommend/src/model/related_query.dart'; import 'package:algolia_client_recommend/src/model/remove_words_if_no_results.dart'; import 'package:algolia_client_recommend/src/model/rendering_content.dart'; +import 'package:algolia_client_recommend/src/model/search_pagination.dart'; import 'package:algolia_client_recommend/src/model/search_params.dart'; import 'package:algolia_client_recommend/src/model/search_params_object.dart'; import 'package:algolia_client_recommend/src/model/search_params_query.dart'; @@ -241,6 +242,9 @@ ReturnType deserialize(dynamic value, String targetType, case 'RenderingContent': return RenderingContent.fromJson(value as Map) as ReturnType; + case 'SearchPagination': + return SearchPagination.fromJson(value as Map) + as ReturnType; case 'SearchParams': return SearchParams.fromJson(value as Map) as ReturnType; case 'SearchParamsObject': diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.dart index 29bff16084a..5e3a48cc63d 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.dart @@ -24,14 +24,10 @@ final class BaseSearchResponse extends DelegatingMap { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -88,12 +84,6 @@ final class BaseSearchResponse extends DelegatingMap { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -106,23 +96,10 @@ final class BaseSearchResponse extends DelegatingMap { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -175,14 +152,10 @@ final class BaseSearchResponse extends DelegatingMap { other.exhaustiveTypo == exhaustiveTypo && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -207,14 +180,10 @@ final class BaseSearchResponse extends DelegatingMap { exhaustiveTypo.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -243,14 +212,10 @@ final class BaseSearchResponse extends DelegatingMap { exhaustiveTypo: instance.exhaustiveTypo, facets: instance.facets, facetsStats: instance.facetsStats, - hitsPerPage: instance.hitsPerPage, index: instance.index, indexUsed: instance.indexUsed, message: instance.message, - nbHits: instance.nbHits, - nbPages: instance.nbPages, nbSortedHits: instance.nbSortedHits, - page: instance.page, parsedQuery: instance.parsedQuery, processingTimeMS: instance.processingTimeMS, processingTimingsMS: instance.processingTimingsMS, diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.g.dart index 657347835fd..33b2c436dc8 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response.g.dart @@ -39,16 +39,11 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -87,14 +82,10 @@ const _$BaseSearchResponseFieldMap = { 'exhaustiveTypo': 'exhaustiveTypo', 'facets': 'facets', 'facetsStats': 'facets_stats', - 'hitsPerPage': 'hitsPerPage', 'index': 'index', 'indexUsed': 'indexUsed', 'message': 'message', - 'nbHits': 'nbHits', - 'nbPages': 'nbPages', 'nbSortedHits': 'nbSortedHits', - 'page': 'page', 'parsedQuery': 'parsedQuery', 'processingTimeMS': 'processingTimeMS', 'processingTimingsMS': 'processingTimingsMS', @@ -127,14 +118,10 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.dart index 14fe6aff2a5..edfa63af5bf 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.dart @@ -23,14 +23,10 @@ final class RecommendationsResults { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -41,6 +37,10 @@ final class RecommendationsResults { this.serverUsed, this.userData, this.queryID, + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, required this.hits, }); @@ -87,12 +87,6 @@ final class RecommendationsResults { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -105,23 +99,10 @@ final class RecommendationsResults { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -160,6 +141,25 @@ final class RecommendationsResults { @JsonKey(name: r'queryID') final String? queryID; + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + /// One of types: /// - [RecommendHit] /// - [TrendingFacetHit] @@ -177,14 +177,10 @@ final class RecommendationsResults { other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -195,6 +191,10 @@ final class RecommendationsResults { other.serverUsed == serverUsed && other.userData == userData && other.queryID == queryID && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage && other.hits == hits; @override @@ -206,14 +206,10 @@ final class RecommendationsResults { exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -224,6 +220,10 @@ final class RecommendationsResults { serverUsed.hashCode + userData.hashCode + queryID.hashCode + + page.hashCode + + nbHits.hashCode + + nbPages.hashCode + + hitsPerPage.hashCode + hits.hashCode; factory RecommendationsResults.fromJson(Map json) => diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.g.dart index 7ff2b385430..556bd01f452 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_results.g.dart @@ -40,16 +40,11 @@ RecommendationsResults _$RecommendationsResultsFromJson( (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -71,6 +66,11 @@ RecommendationsResults _$RecommendationsResultsFromJson( serverUsed: $checkedConvert('serverUsed', (v) => v as String?), userData: $checkedConvert('userData', (v) => v), queryID: $checkedConvert('queryID', (v) => v as String?), + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), hits: $checkedConvert('hits', (v) => v as List), ); return val; @@ -99,14 +99,10 @@ Map _$RecommendationsResultsToJson( writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); @@ -117,6 +113,10 @@ Map _$RecommendationsResultsToJson( writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); + val['page'] = instance.page; + val['nbHits'] = instance.nbHits; + val['nbPages'] = instance.nbPages; + val['hitsPerPage'] = instance.hitsPerPage; val['hits'] = instance.hits.toList(); return val; } diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.dart new file mode 100644 index 00000000000..4c7eb08ca97 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.dart @@ -0,0 +1,59 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// ignore_for_file: unused_element + +import 'package:json_annotation/json_annotation.dart'; + +part 'search_pagination.g.dart'; + +@JsonSerializable() +final class SearchPagination { + /// Returns a new [SearchPagination] instance. + const SearchPagination({ + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, + }); + + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SearchPagination && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage; + + @override + int get hashCode => + page.hashCode + nbHits.hashCode + nbPages.hashCode + hitsPerPage.hashCode; + + factory SearchPagination.fromJson(Map json) => + _$SearchPaginationFromJson(json); + + Map toJson() => _$SearchPaginationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.g.dart new file mode 100644 index 00000000000..b58a96cf74d --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/search_pagination.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_pagination.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchPagination _$SearchPaginationFromJson(Map json) => + $checkedCreate( + 'SearchPagination', + json, + ($checkedConvert) { + final val = SearchPagination( + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + ); + return val; + }, + ); + +Map _$SearchPaginationToJson(SearchPagination instance) => + { + 'page': instance.page, + 'nbHits': instance.nbHits, + 'nbPages': instance.nbPages, + 'hitsPerPage': instance.hitsPerPage, + }; diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/algolia_client_search.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/algolia_client_search.dart index 83eed24d60e..8eb75039590 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/algolia_client_search.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/algolia_client_search.dart @@ -29,6 +29,7 @@ export 'src/model/batch_params.dart'; export 'src/model/batch_request.dart'; export 'src/model/batch_response.dart'; export 'src/model/batch_write_params.dart'; +export 'src/model/browse_pagination.dart'; export 'src/model/browse_params_object.dart'; export 'src/model/browse_response.dart'; export 'src/model/built_in_operation.dart'; @@ -117,6 +118,7 @@ export 'src/model/search_for_hits.dart'; export 'src/model/search_for_hits_options.dart'; export 'src/model/search_hits.dart'; export 'src/model/search_method_params.dart'; +export 'src/model/search_pagination.dart'; export 'src/model/search_params_object.dart'; export 'src/model/search_params_query.dart'; export 'src/model/search_params_string.dart'; diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/deserialize.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/deserialize.dart index a0f7a54a304..3c56d4ecdef 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/deserialize.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/deserialize.dart @@ -22,6 +22,7 @@ import 'package:algolia_client_search/src/model/batch_params.dart'; import 'package:algolia_client_search/src/model/batch_request.dart'; import 'package:algolia_client_search/src/model/batch_response.dart'; import 'package:algolia_client_search/src/model/batch_write_params.dart'; +import 'package:algolia_client_search/src/model/browse_pagination.dart'; import 'package:algolia_client_search/src/model/browse_params_object.dart'; import 'package:algolia_client_search/src/model/browse_response.dart'; import 'package:algolia_client_search/src/model/built_in_operation.dart'; @@ -110,6 +111,7 @@ import 'package:algolia_client_search/src/model/search_for_hits.dart'; import 'package:algolia_client_search/src/model/search_for_hits_options.dart'; import 'package:algolia_client_search/src/model/search_hits.dart'; import 'package:algolia_client_search/src/model/search_method_params.dart'; +import 'package:algolia_client_search/src/model/search_pagination.dart'; import 'package:algolia_client_search/src/model/search_params_object.dart'; import 'package:algolia_client_search/src/model/search_params_query.dart'; import 'package:algolia_client_search/src/model/search_params_string.dart'; @@ -226,6 +228,9 @@ ReturnType deserialize(dynamic value, String targetType, case 'BatchWriteParams': return BatchWriteParams.fromJson(value as Map) as ReturnType; + case 'BrowsePagination': + return BrowsePagination.fromJson(value as Map) + as ReturnType; case 'BrowseParamsObject': return BrowseParamsObject.fromJson(value as Map) as ReturnType; @@ -457,6 +462,9 @@ ReturnType deserialize(dynamic value, String targetType, case 'SearchMethodParams': return SearchMethodParams.fromJson(value as Map) as ReturnType; + case 'SearchPagination': + return SearchPagination.fromJson(value as Map) + as ReturnType; case 'SearchParamsObject': return SearchParamsObject.fromJson(value as Map) as ReturnType; diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.dart index 4bba5a6ebdf..1797cd06dea 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.dart @@ -24,14 +24,10 @@ final class BaseSearchResponse extends DelegatingMap { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -88,12 +84,6 @@ final class BaseSearchResponse extends DelegatingMap { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -106,23 +96,10 @@ final class BaseSearchResponse extends DelegatingMap { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -175,14 +152,10 @@ final class BaseSearchResponse extends DelegatingMap { other.exhaustiveTypo == exhaustiveTypo && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -207,14 +180,10 @@ final class BaseSearchResponse extends DelegatingMap { exhaustiveTypo.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -243,14 +212,10 @@ final class BaseSearchResponse extends DelegatingMap { exhaustiveTypo: instance.exhaustiveTypo, facets: instance.facets, facetsStats: instance.facetsStats, - hitsPerPage: instance.hitsPerPage, index: instance.index, indexUsed: instance.indexUsed, message: instance.message, - nbHits: instance.nbHits, - nbPages: instance.nbPages, nbSortedHits: instance.nbSortedHits, - page: instance.page, parsedQuery: instance.parsedQuery, processingTimeMS: instance.processingTimeMS, processingTimingsMS: instance.processingTimingsMS, diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.g.dart index 657347835fd..33b2c436dc8 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response.g.dart @@ -39,16 +39,11 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -87,14 +82,10 @@ const _$BaseSearchResponseFieldMap = { 'exhaustiveTypo': 'exhaustiveTypo', 'facets': 'facets', 'facetsStats': 'facets_stats', - 'hitsPerPage': 'hitsPerPage', 'index': 'index', 'indexUsed': 'indexUsed', 'message': 'message', - 'nbHits': 'nbHits', - 'nbPages': 'nbPages', 'nbSortedHits': 'nbSortedHits', - 'page': 'page', 'parsedQuery': 'parsedQuery', 'processingTimeMS': 'processingTimeMS', 'processingTimingsMS': 'processingTimingsMS', @@ -127,14 +118,10 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.dart new file mode 100644 index 00000000000..74e7de64d98 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.dart @@ -0,0 +1,59 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// ignore_for_file: unused_element + +import 'package:json_annotation/json_annotation.dart'; + +part 'browse_pagination.g.dart'; + +@JsonSerializable() +final class BrowsePagination { + /// Returns a new [BrowsePagination] instance. + const BrowsePagination({ + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, + }); + + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int? page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int? nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int? nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int? hitsPerPage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BrowsePagination && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage; + + @override + int get hashCode => + page.hashCode + nbHits.hashCode + nbPages.hashCode + hitsPerPage.hashCode; + + factory BrowsePagination.fromJson(Map json) => + _$BrowsePaginationFromJson(json); + + Map toJson() => _$BrowsePaginationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.g.dart new file mode 100644 index 00000000000..991ff30f445 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_pagination.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'browse_pagination.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BrowsePagination _$BrowsePaginationFromJson(Map json) => + $checkedCreate( + 'BrowsePagination', + json, + ($checkedConvert) { + final val = BrowsePagination( + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), + ); + return val; + }, + ); + +Map _$BrowsePaginationToJson(BrowsePagination instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); + return val; +} diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.dart index 3b4d3fc1fdb..63f35e0b00f 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.dart @@ -24,14 +24,10 @@ final class BrowseResponse { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -42,6 +38,10 @@ final class BrowseResponse { this.serverUsed, this.userData, this.queryID, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, required this.hits, required this.query, required this.params, @@ -91,12 +91,6 @@ final class BrowseResponse { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -109,23 +103,10 @@ final class BrowseResponse { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -164,6 +145,25 @@ final class BrowseResponse { @JsonKey(name: r'queryID') final String? queryID; + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int? page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int? nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int? nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int? hitsPerPage; + /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. @JsonKey(name: r'hits') final List hits; @@ -191,14 +191,10 @@ final class BrowseResponse { other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -209,6 +205,10 @@ final class BrowseResponse { other.serverUsed == serverUsed && other.userData == userData && other.queryID == queryID && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage && other.hits == hits && other.query == query && other.params == params && @@ -223,14 +223,10 @@ final class BrowseResponse { exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -241,6 +237,10 @@ final class BrowseResponse { serverUsed.hashCode + userData.hashCode + queryID.hashCode + + page.hashCode + + nbHits.hashCode + + nbPages.hashCode + + hitsPerPage.hashCode + hits.hashCode + query.hashCode + params.hashCode + diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.g.dart index 54af032855e..568902444bc 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/browse_response.g.dart @@ -39,16 +39,11 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -70,6 +65,11 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => serverUsed: $checkedConvert('serverUsed', (v) => v as String?), userData: $checkedConvert('userData', (v) => v), queryID: $checkedConvert('queryID', (v) => v as String?), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -104,14 +104,10 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); @@ -122,6 +118,10 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); val['hits'] = instance.hits.map((e) => e.toJson()).toList(); val['query'] = instance.query; val['params'] = instance.params; diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.dart new file mode 100644 index 00000000000..4c7eb08ca97 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.dart @@ -0,0 +1,59 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// ignore_for_file: unused_element + +import 'package:json_annotation/json_annotation.dart'; + +part 'search_pagination.g.dart'; + +@JsonSerializable() +final class SearchPagination { + /// Returns a new [SearchPagination] instance. + const SearchPagination({ + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, + }); + + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SearchPagination && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage; + + @override + int get hashCode => + page.hashCode + nbHits.hashCode + nbPages.hashCode + hitsPerPage.hashCode; + + factory SearchPagination.fromJson(Map json) => + _$SearchPaginationFromJson(json); + + Map toJson() => _$SearchPaginationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.g.dart new file mode 100644 index 00000000000..b58a96cf74d --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_pagination.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_pagination.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchPagination _$SearchPaginationFromJson(Map json) => + $checkedCreate( + 'SearchPagination', + json, + ($checkedConvert) { + final val = SearchPagination( + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + ); + return val; + }, + ); + +Map _$SearchPaginationToJson(SearchPagination instance) => + { + 'page': instance.page, + 'nbHits': instance.nbHits, + 'nbPages': instance.nbPages, + 'hitsPerPage': instance.hitsPerPage, + }; diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.dart index db2836ef74e..ba753fb5a71 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.dart @@ -24,14 +24,10 @@ final class SearchResponse { this.exhaustiveTypo, this.facets, this.facetsStats, - required this.hitsPerPage, this.index, this.indexUsed, this.message, - required this.nbHits, - required this.nbPages, this.nbSortedHits, - required this.page, this.parsedQuery, required this.processingTimeMS, this.processingTimingsMS, @@ -42,6 +38,10 @@ final class SearchResponse { this.serverUsed, this.userData, this.queryID, + required this.page, + required this.nbHits, + required this.nbPages, + required this.hitsPerPage, required this.hits, required this.query, required this.params, @@ -90,12 +90,6 @@ final class SearchResponse { @JsonKey(name: r'facets_stats') final Map? facetsStats; - /// Number of hits per page. - // minimum: 1 - // maximum: 1000 - @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; - /// Index name used for the query. @JsonKey(name: r'index') final String? index; @@ -108,23 +102,10 @@ final class SearchResponse { @JsonKey(name: r'message') final String? message; - /// Number of results (hits). - @JsonKey(name: r'nbHits') - final int nbHits; - - /// Number of pages of results. - @JsonKey(name: r'nbPages') - final int nbPages; - /// Number of hits selected and sorted by the relevant sort algorithm. @JsonKey(name: r'nbSortedHits') final int? nbSortedHits; - /// Page of search results to retrieve. - // minimum: 0 - @JsonKey(name: r'page') - final int page; - /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. @JsonKey(name: r'parsedQuery') final String? parsedQuery; @@ -163,6 +144,25 @@ final class SearchResponse { @JsonKey(name: r'queryID') final String? queryID; + /// Page of search results to retrieve. + // minimum: 0 + @JsonKey(name: r'page') + final int page; + + /// Number of results (hits). + @JsonKey(name: r'nbHits') + final int nbHits; + + /// Number of pages of results. + @JsonKey(name: r'nbPages') + final int nbPages; + + /// Number of hits per page. + // minimum: 1 + // maximum: 1000 + @JsonKey(name: r'hitsPerPage') + final int hitsPerPage; + /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. @JsonKey(name: r'hits') final List hits; @@ -186,14 +186,10 @@ final class SearchResponse { other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && - other.hitsPerPage == hitsPerPage && other.index == index && other.indexUsed == indexUsed && other.message == message && - other.nbHits == nbHits && - other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && - other.page == page && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && other.processingTimingsMS == processingTimingsMS && @@ -204,6 +200,10 @@ final class SearchResponse { other.serverUsed == serverUsed && other.userData == userData && other.queryID == queryID && + other.page == page && + other.nbHits == nbHits && + other.nbPages == nbPages && + other.hitsPerPage == hitsPerPage && other.hits == hits && other.query == query && other.params == params; @@ -217,14 +217,10 @@ final class SearchResponse { exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + - hitsPerPage.hashCode + index.hashCode + indexUsed.hashCode + message.hashCode + - nbHits.hashCode + - nbPages.hashCode + nbSortedHits.hashCode + - page.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + processingTimingsMS.hashCode + @@ -235,6 +231,10 @@ final class SearchResponse { serverUsed.hashCode + userData.hashCode + queryID.hashCode + + page.hashCode + + nbHits.hashCode + + nbPages.hashCode + + hitsPerPage.hashCode + hits.hashCode + query.hashCode + params.hashCode; diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.g.dart index adb07d65d4a..fdde087e610 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_response.g.dart @@ -39,16 +39,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => (k, e) => MapEntry( k, FacetsStats.fromJson(e as Map)), )), - hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), index: $checkedConvert('index', (v) => v as String?), indexUsed: $checkedConvert('indexUsed', (v) => v as String?), message: $checkedConvert('message', (v) => v as String?), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), nbSortedHits: $checkedConvert('nbSortedHits', (v) => (v as num?)?.toInt()), - page: $checkedConvert('page', (v) => (v as num).toInt()), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => (v as num).toInt()), @@ -70,6 +65,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => serverUsed: $checkedConvert('serverUsed', (v) => v as String?), userData: $checkedConvert('userData', (v) => v), queryID: $checkedConvert('queryID', (v) => v as String?), + page: $checkedConvert('page', (v) => (v as num).toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + hitsPerPage: + $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -103,14 +103,10 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('facets', instance.facets); writeNotNull('facets_stats', instance.facetsStats?.map((k, e) => MapEntry(k, e.toJson()))); - val['hitsPerPage'] = instance.hitsPerPage; writeNotNull('index', instance.index); writeNotNull('indexUsed', instance.indexUsed); writeNotNull('message', instance.message); - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); - val['page'] = instance.page; writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; writeNotNull('processingTimingsMS', instance.processingTimingsMS); @@ -121,6 +117,10 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); + val['page'] = instance.page; + val['nbHits'] = instance.nbHits; + val['nbPages'] = instance.nbPages; + val['hitsPerPage'] = instance.hitsPerPage; val['hits'] = instance.hits.map((e) => e.toJson()).toList(); val['query'] = instance.query; val['params'] = instance.params; diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response.go index 19d1c77ca88..ee34a07757d 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response.go @@ -30,22 +30,14 @@ type BaseSearchResponse struct { Facets *map[string]map[string]int32 `json:"facets,omitempty"` // Statistics for numerical facets. FacetsStats *map[string]FacetsStats `json:"facets_stats,omitempty"` - // Number of hits per page. - HitsPerPage int32 `json:"hitsPerPage"` // Index name used for the query. Index *string `json:"index,omitempty"` // Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. IndexUsed *string `json:"indexUsed,omitempty"` // Warnings about the query. Message *string `json:"message,omitempty"` - // Number of results (hits). - NbHits int32 `json:"nbHits"` - // Number of pages of results. - NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` - // Page of search results to retrieve. - Page int32 `json:"page"` // Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. ParsedQuery *string `json:"parsedQuery,omitempty"` // Time the server took to process the request, in milliseconds. @@ -213,12 +205,8 @@ func WithBaseSearchResponseQueryID(val string) BaseSearchResponseOption { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewBaseSearchResponse(hitsPerPage int32, nbHits int32, nbPages int32, page int32, processingTimeMS int32, opts ...BaseSearchResponseOption) *BaseSearchResponse { +func NewBaseSearchResponse(processingTimeMS int32, opts ...BaseSearchResponseOption) *BaseSearchResponse { this := &BaseSearchResponse{} - this.HitsPerPage = hitsPerPage - this.NbHits = nbHits - this.NbPages = nbPages - this.Page = page this.ProcessingTimeMS = processingTimeMS for _, opt := range opts { opt(this) @@ -570,31 +558,6 @@ func (o *BaseSearchResponse) SetFacetsStats(v map[string]FacetsStats) *BaseSearc return o } -// GetHitsPerPage returns the HitsPerPage field value. -func (o *BaseSearchResponse) GetHitsPerPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.HitsPerPage -} - -// GetHitsPerPageOk returns a tuple with the HitsPerPage field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetHitsPerPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.HitsPerPage, true -} - -// SetHitsPerPage sets field value. -func (o *BaseSearchResponse) SetHitsPerPage(v int32) *BaseSearchResponse { - o.HitsPerPage = v - return o -} - // GetIndex returns the Index field value if set, zero value otherwise. func (o *BaseSearchResponse) GetIndex() string { if o == nil || o.Index == nil { @@ -694,56 +657,6 @@ func (o *BaseSearchResponse) SetMessage(v string) *BaseSearchResponse { return o } -// GetNbHits returns the NbHits field value. -func (o *BaseSearchResponse) GetNbHits() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbHits -} - -// GetNbHitsOk returns a tuple with the NbHits field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetNbHitsOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbHits, true -} - -// SetNbHits sets field value. -func (o *BaseSearchResponse) SetNbHits(v int32) *BaseSearchResponse { - o.NbHits = v - return o -} - -// GetNbPages returns the NbPages field value. -func (o *BaseSearchResponse) GetNbPages() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbPages -} - -// GetNbPagesOk returns a tuple with the NbPages field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetNbPagesOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbPages, true -} - -// SetNbPages sets field value. -func (o *BaseSearchResponse) SetNbPages(v int32) *BaseSearchResponse { - o.NbPages = v - return o -} - // GetNbSortedHits returns the NbSortedHits field value if set, zero value otherwise. func (o *BaseSearchResponse) GetNbSortedHits() int32 { if o == nil || o.NbSortedHits == nil { @@ -777,31 +690,6 @@ func (o *BaseSearchResponse) SetNbSortedHits(v int32) *BaseSearchResponse { return o } -// GetPage returns the Page field value. -func (o *BaseSearchResponse) GetPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Page -} - -// GetPageOk returns a tuple with the Page field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Page, true -} - -// SetPage sets field value. -func (o *BaseSearchResponse) SetPage(v int32) *BaseSearchResponse { - o.Page = v - return o -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *BaseSearchResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -1166,9 +1054,6 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if o.FacetsStats != nil { toSerialize["facets_stats"] = o.FacetsStats } - if true { - toSerialize["hitsPerPage"] = o.HitsPerPage - } if o.Index != nil { toSerialize["index"] = o.Index } @@ -1178,18 +1063,9 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if o.Message != nil { toSerialize["message"] = o.Message } - if true { - toSerialize["nbHits"] = o.NbHits - } - if true { - toSerialize["nbPages"] = o.NbPages - } if o.NbSortedHits != nil { toSerialize["nbSortedHits"] = o.NbSortedHits } - if true { - toSerialize["page"] = o.Page - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } @@ -1260,14 +1136,10 @@ func (o *BaseSearchResponse) UnmarshalJSON(bytes []byte) error { delete(additionalProperties, "exhaustiveTypo") delete(additionalProperties, "facets") delete(additionalProperties, "facets_stats") - delete(additionalProperties, "hitsPerPage") delete(additionalProperties, "index") delete(additionalProperties, "indexUsed") delete(additionalProperties, "message") - delete(additionalProperties, "nbHits") - delete(additionalProperties, "nbPages") delete(additionalProperties, "nbSortedHits") - delete(additionalProperties, "page") delete(additionalProperties, "parsedQuery") delete(additionalProperties, "processingTimeMS") delete(additionalProperties, "processingTimingsMS") @@ -1295,14 +1167,10 @@ func (o BaseSearchResponse) String() string { out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) out += fmt.Sprintf(" facets=%v\n", o.Facets) out += fmt.Sprintf(" facets_stats=%v\n", o.FacetsStats) - out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" index=%v\n", o.Index) out += fmt.Sprintf(" indexUsed=%v\n", o.IndexUsed) out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) - out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) out += fmt.Sprintf(" nbSortedHits=%v\n", o.NbSortedHits) - out += fmt.Sprintf(" page=%v\n", o.Page) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_results.go b/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_results.go index 1181f307226..40edab39829 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_results.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_results.go @@ -30,22 +30,14 @@ type RecommendationsResults struct { Facets *map[string]map[string]int32 `json:"facets,omitempty"` // Statistics for numerical facets. FacetsStats *map[string]FacetsStats `json:"facets_stats,omitempty"` - // Number of hits per page. - HitsPerPage int32 `json:"hitsPerPage"` // Index name used for the query. Index *string `json:"index,omitempty"` // Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. IndexUsed *string `json:"indexUsed,omitempty"` // Warnings about the query. Message *string `json:"message,omitempty"` - // Number of results (hits). - NbHits int32 `json:"nbHits"` - // Number of pages of results. - NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` - // Page of search results to retrieve. - Page int32 `json:"page"` // Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. ParsedQuery *string `json:"parsedQuery,omitempty"` // Time the server took to process the request, in milliseconds. @@ -63,8 +55,16 @@ type RecommendationsResults struct { // An object with custom data. You can store up to 32kB as custom data. UserData map[string]any `json:"userData,omitempty"` // Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). - QueryID *string `json:"queryID,omitempty"` - Hits []RecommendationsHit `json:"hits"` + QueryID *string `json:"queryID,omitempty"` + // Page of search results to retrieve. + Page int32 `json:"page"` + // Number of results (hits). + NbHits int32 `json:"nbHits"` + // Number of pages of results. + NbPages int32 `json:"nbPages"` + // Number of hits per page. + HitsPerPage int32 `json:"hitsPerPage"` + Hits []RecommendationsHit `json:"hits"` } type RecommendationsResultsOption func(f *RecommendationsResults) @@ -211,13 +211,13 @@ func WithRecommendationsResultsQueryID(val string) RecommendationsResultsOption // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewRecommendationsResults(hitsPerPage int32, nbHits int32, nbPages int32, page int32, processingTimeMS int32, hits []RecommendationsHit, opts ...RecommendationsResultsOption) *RecommendationsResults { +func NewRecommendationsResults(processingTimeMS int32, page int32, nbHits int32, nbPages int32, hitsPerPage int32, hits []RecommendationsHit, opts ...RecommendationsResultsOption) *RecommendationsResults { this := &RecommendationsResults{} - this.HitsPerPage = hitsPerPage + this.ProcessingTimeMS = processingTimeMS + this.Page = page this.NbHits = nbHits this.NbPages = nbPages - this.Page = page - this.ProcessingTimeMS = processingTimeMS + this.HitsPerPage = hitsPerPage this.Hits = hits for _, opt := range opts { opt(this) @@ -569,31 +569,6 @@ func (o *RecommendationsResults) SetFacetsStats(v map[string]FacetsStats) *Recom return o } -// GetHitsPerPage returns the HitsPerPage field value. -func (o *RecommendationsResults) GetHitsPerPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.HitsPerPage -} - -// GetHitsPerPageOk returns a tuple with the HitsPerPage field value -// and a boolean to check if the value has been set. -func (o *RecommendationsResults) GetHitsPerPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.HitsPerPage, true -} - -// SetHitsPerPage sets field value. -func (o *RecommendationsResults) SetHitsPerPage(v int32) *RecommendationsResults { - o.HitsPerPage = v - return o -} - // GetIndex returns the Index field value if set, zero value otherwise. func (o *RecommendationsResults) GetIndex() string { if o == nil || o.Index == nil { @@ -693,56 +668,6 @@ func (o *RecommendationsResults) SetMessage(v string) *RecommendationsResults { return o } -// GetNbHits returns the NbHits field value. -func (o *RecommendationsResults) GetNbHits() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbHits -} - -// GetNbHitsOk returns a tuple with the NbHits field value -// and a boolean to check if the value has been set. -func (o *RecommendationsResults) GetNbHitsOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbHits, true -} - -// SetNbHits sets field value. -func (o *RecommendationsResults) SetNbHits(v int32) *RecommendationsResults { - o.NbHits = v - return o -} - -// GetNbPages returns the NbPages field value. -func (o *RecommendationsResults) GetNbPages() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbPages -} - -// GetNbPagesOk returns a tuple with the NbPages field value -// and a boolean to check if the value has been set. -func (o *RecommendationsResults) GetNbPagesOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbPages, true -} - -// SetNbPages sets field value. -func (o *RecommendationsResults) SetNbPages(v int32) *RecommendationsResults { - o.NbPages = v - return o -} - // GetNbSortedHits returns the NbSortedHits field value if set, zero value otherwise. func (o *RecommendationsResults) GetNbSortedHits() int32 { if o == nil || o.NbSortedHits == nil { @@ -776,31 +701,6 @@ func (o *RecommendationsResults) SetNbSortedHits(v int32) *RecommendationsResult return o } -// GetPage returns the Page field value. -func (o *RecommendationsResults) GetPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Page -} - -// GetPageOk returns a tuple with the Page field value -// and a boolean to check if the value has been set. -func (o *RecommendationsResults) GetPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Page, true -} - -// SetPage sets field value. -func (o *RecommendationsResults) SetPage(v int32) *RecommendationsResults { - o.Page = v - return o -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *RecommendationsResults) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -1123,6 +1023,106 @@ func (o *RecommendationsResults) SetQueryID(v string) *RecommendationsResults { return o } +// GetPage returns the Page field value. +func (o *RecommendationsResults) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *RecommendationsResults) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value. +func (o *RecommendationsResults) SetPage(v int32) *RecommendationsResults { + o.Page = v + return o +} + +// GetNbHits returns the NbHits field value. +func (o *RecommendationsResults) GetNbHits() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbHits +} + +// GetNbHitsOk returns a tuple with the NbHits field value +// and a boolean to check if the value has been set. +func (o *RecommendationsResults) GetNbHitsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbHits, true +} + +// SetNbHits sets field value. +func (o *RecommendationsResults) SetNbHits(v int32) *RecommendationsResults { + o.NbHits = v + return o +} + +// GetNbPages returns the NbPages field value. +func (o *RecommendationsResults) GetNbPages() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbPages +} + +// GetNbPagesOk returns a tuple with the NbPages field value +// and a boolean to check if the value has been set. +func (o *RecommendationsResults) GetNbPagesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbPages, true +} + +// SetNbPages sets field value. +func (o *RecommendationsResults) SetNbPages(v int32) *RecommendationsResults { + o.NbPages = v + return o +} + +// GetHitsPerPage returns the HitsPerPage field value. +func (o *RecommendationsResults) GetHitsPerPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HitsPerPage +} + +// GetHitsPerPageOk returns a tuple with the HitsPerPage field value +// and a boolean to check if the value has been set. +func (o *RecommendationsResults) GetHitsPerPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HitsPerPage, true +} + +// SetHitsPerPage sets field value. +func (o *RecommendationsResults) SetHitsPerPage(v int32) *RecommendationsResults { + o.HitsPerPage = v + return o +} + // GetHits returns the Hits field value. func (o *RecommendationsResults) GetHits() []RecommendationsHit { if o == nil { @@ -1180,9 +1180,6 @@ func (o RecommendationsResults) MarshalJSON() ([]byte, error) { if o.FacetsStats != nil { toSerialize["facets_stats"] = o.FacetsStats } - if true { - toSerialize["hitsPerPage"] = o.HitsPerPage - } if o.Index != nil { toSerialize["index"] = o.Index } @@ -1192,18 +1189,9 @@ func (o RecommendationsResults) MarshalJSON() ([]byte, error) { if o.Message != nil { toSerialize["message"] = o.Message } - if true { - toSerialize["nbHits"] = o.NbHits - } - if true { - toSerialize["nbPages"] = o.NbPages - } if o.NbSortedHits != nil { toSerialize["nbSortedHits"] = o.NbSortedHits } - if true { - toSerialize["page"] = o.Page - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } @@ -1234,6 +1222,18 @@ func (o RecommendationsResults) MarshalJSON() ([]byte, error) { if o.QueryID != nil { toSerialize["queryID"] = o.QueryID } + if true { + toSerialize["page"] = o.Page + } + if true { + toSerialize["nbHits"] = o.NbHits + } + if true { + toSerialize["nbPages"] = o.NbPages + } + if true { + toSerialize["hitsPerPage"] = o.HitsPerPage + } if true { toSerialize["hits"] = o.Hits } @@ -1257,14 +1257,10 @@ func (o RecommendationsResults) String() string { out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) out += fmt.Sprintf(" facets=%v\n", o.Facets) out += fmt.Sprintf(" facets_stats=%v\n", o.FacetsStats) - out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" index=%v\n", o.Index) out += fmt.Sprintf(" indexUsed=%v\n", o.IndexUsed) out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) - out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) out += fmt.Sprintf(" nbSortedHits=%v\n", o.NbSortedHits) - out += fmt.Sprintf(" page=%v\n", o.Page) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) @@ -1275,6 +1271,10 @@ func (o RecommendationsResults) String() string { out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) out += fmt.Sprintf(" queryID=%v\n", o.QueryID) + out += fmt.Sprintf(" page=%v\n", o.Page) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) + out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" hits=%v\n", o.Hits) return fmt.Sprintf("RecommendationsResults {\n%s}", out) } diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_search_pagination.go b/clients/algoliasearch-client-go/algolia/recommend/model_search_pagination.go new file mode 100644 index 00000000000..1e6aaff8c6a --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/recommend/model_search_pagination.go @@ -0,0 +1,168 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +package recommend + +import ( + "encoding/json" + "fmt" +) + +// SearchPagination struct for SearchPagination. +type SearchPagination struct { + // Page of search results to retrieve. + Page int32 `json:"page"` + // Number of results (hits). + NbHits int32 `json:"nbHits"` + // Number of pages of results. + NbPages int32 `json:"nbPages"` + // Number of hits per page. + HitsPerPage int32 `json:"hitsPerPage"` +} + +// NewSearchPagination instantiates a new SearchPagination object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSearchPagination(page int32, nbHits int32, nbPages int32, hitsPerPage int32) *SearchPagination { + this := &SearchPagination{} + this.Page = page + this.NbHits = nbHits + this.NbPages = nbPages + this.HitsPerPage = hitsPerPage + return this +} + +// NewEmptySearchPagination return a pointer to an empty SearchPagination object. +func NewEmptySearchPagination() *SearchPagination { + return &SearchPagination{} +} + +// GetPage returns the Page field value. +func (o *SearchPagination) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value. +func (o *SearchPagination) SetPage(v int32) *SearchPagination { + o.Page = v + return o +} + +// GetNbHits returns the NbHits field value. +func (o *SearchPagination) GetNbHits() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbHits +} + +// GetNbHitsOk returns a tuple with the NbHits field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetNbHitsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbHits, true +} + +// SetNbHits sets field value. +func (o *SearchPagination) SetNbHits(v int32) *SearchPagination { + o.NbHits = v + return o +} + +// GetNbPages returns the NbPages field value. +func (o *SearchPagination) GetNbPages() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbPages +} + +// GetNbPagesOk returns a tuple with the NbPages field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetNbPagesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbPages, true +} + +// SetNbPages sets field value. +func (o *SearchPagination) SetNbPages(v int32) *SearchPagination { + o.NbPages = v + return o +} + +// GetHitsPerPage returns the HitsPerPage field value. +func (o *SearchPagination) GetHitsPerPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HitsPerPage +} + +// GetHitsPerPageOk returns a tuple with the HitsPerPage field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetHitsPerPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HitsPerPage, true +} + +// SetHitsPerPage sets field value. +func (o *SearchPagination) SetHitsPerPage(v int32) *SearchPagination { + o.HitsPerPage = v + return o +} + +func (o SearchPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if true { + toSerialize["page"] = o.Page + } + if true { + toSerialize["nbHits"] = o.NbHits + } + if true { + toSerialize["nbPages"] = o.NbPages + } + if true { + toSerialize["hitsPerPage"] = o.HitsPerPage + } + serialized, err := json.Marshal(toSerialize) + if err != nil { + return nil, fmt.Errorf("failed to marshal SearchPagination: %w", err) + } + + return serialized, nil +} + +func (o SearchPagination) String() string { + out := "" + out += fmt.Sprintf(" page=%v\n", o.Page) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) + out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) + return fmt.Sprintf("SearchPagination {\n%s}", out) +} diff --git a/clients/algoliasearch-client-go/algolia/search/model_base_search_response.go b/clients/algoliasearch-client-go/algolia/search/model_base_search_response.go index 14d6f0e13ee..b031fa61a55 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_base_search_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_base_search_response.go @@ -30,22 +30,14 @@ type BaseSearchResponse struct { Facets *map[string]map[string]int32 `json:"facets,omitempty"` // Statistics for numerical facets. FacetsStats *map[string]FacetsStats `json:"facets_stats,omitempty"` - // Number of hits per page. - HitsPerPage int32 `json:"hitsPerPage"` // Index name used for the query. Index *string `json:"index,omitempty"` // Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. IndexUsed *string `json:"indexUsed,omitempty"` // Warnings about the query. Message *string `json:"message,omitempty"` - // Number of results (hits). - NbHits int32 `json:"nbHits"` - // Number of pages of results. - NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` - // Page of search results to retrieve. - Page int32 `json:"page"` // Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. ParsedQuery *string `json:"parsedQuery,omitempty"` // Time the server took to process the request, in milliseconds. @@ -213,12 +205,8 @@ func WithBaseSearchResponseQueryID(val string) BaseSearchResponseOption { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewBaseSearchResponse(hitsPerPage int32, nbHits int32, nbPages int32, page int32, processingTimeMS int32, opts ...BaseSearchResponseOption) *BaseSearchResponse { +func NewBaseSearchResponse(processingTimeMS int32, opts ...BaseSearchResponseOption) *BaseSearchResponse { this := &BaseSearchResponse{} - this.HitsPerPage = hitsPerPage - this.NbHits = nbHits - this.NbPages = nbPages - this.Page = page this.ProcessingTimeMS = processingTimeMS for _, opt := range opts { opt(this) @@ -570,31 +558,6 @@ func (o *BaseSearchResponse) SetFacetsStats(v map[string]FacetsStats) *BaseSearc return o } -// GetHitsPerPage returns the HitsPerPage field value. -func (o *BaseSearchResponse) GetHitsPerPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.HitsPerPage -} - -// GetHitsPerPageOk returns a tuple with the HitsPerPage field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetHitsPerPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.HitsPerPage, true -} - -// SetHitsPerPage sets field value. -func (o *BaseSearchResponse) SetHitsPerPage(v int32) *BaseSearchResponse { - o.HitsPerPage = v - return o -} - // GetIndex returns the Index field value if set, zero value otherwise. func (o *BaseSearchResponse) GetIndex() string { if o == nil || o.Index == nil { @@ -694,56 +657,6 @@ func (o *BaseSearchResponse) SetMessage(v string) *BaseSearchResponse { return o } -// GetNbHits returns the NbHits field value. -func (o *BaseSearchResponse) GetNbHits() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbHits -} - -// GetNbHitsOk returns a tuple with the NbHits field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetNbHitsOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbHits, true -} - -// SetNbHits sets field value. -func (o *BaseSearchResponse) SetNbHits(v int32) *BaseSearchResponse { - o.NbHits = v - return o -} - -// GetNbPages returns the NbPages field value. -func (o *BaseSearchResponse) GetNbPages() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbPages -} - -// GetNbPagesOk returns a tuple with the NbPages field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetNbPagesOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbPages, true -} - -// SetNbPages sets field value. -func (o *BaseSearchResponse) SetNbPages(v int32) *BaseSearchResponse { - o.NbPages = v - return o -} - // GetNbSortedHits returns the NbSortedHits field value if set, zero value otherwise. func (o *BaseSearchResponse) GetNbSortedHits() int32 { if o == nil || o.NbSortedHits == nil { @@ -777,31 +690,6 @@ func (o *BaseSearchResponse) SetNbSortedHits(v int32) *BaseSearchResponse { return o } -// GetPage returns the Page field value. -func (o *BaseSearchResponse) GetPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Page -} - -// GetPageOk returns a tuple with the Page field value -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Page, true -} - -// SetPage sets field value. -func (o *BaseSearchResponse) SetPage(v int32) *BaseSearchResponse { - o.Page = v - return o -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *BaseSearchResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -1166,9 +1054,6 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if o.FacetsStats != nil { toSerialize["facets_stats"] = o.FacetsStats } - if true { - toSerialize["hitsPerPage"] = o.HitsPerPage - } if o.Index != nil { toSerialize["index"] = o.Index } @@ -1178,18 +1063,9 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if o.Message != nil { toSerialize["message"] = o.Message } - if true { - toSerialize["nbHits"] = o.NbHits - } - if true { - toSerialize["nbPages"] = o.NbPages - } if o.NbSortedHits != nil { toSerialize["nbSortedHits"] = o.NbSortedHits } - if true { - toSerialize["page"] = o.Page - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } @@ -1260,14 +1136,10 @@ func (o *BaseSearchResponse) UnmarshalJSON(bytes []byte) error { delete(additionalProperties, "exhaustiveTypo") delete(additionalProperties, "facets") delete(additionalProperties, "facets_stats") - delete(additionalProperties, "hitsPerPage") delete(additionalProperties, "index") delete(additionalProperties, "indexUsed") delete(additionalProperties, "message") - delete(additionalProperties, "nbHits") - delete(additionalProperties, "nbPages") delete(additionalProperties, "nbSortedHits") - delete(additionalProperties, "page") delete(additionalProperties, "parsedQuery") delete(additionalProperties, "processingTimeMS") delete(additionalProperties, "processingTimingsMS") @@ -1295,14 +1167,10 @@ func (o BaseSearchResponse) String() string { out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) out += fmt.Sprintf(" facets=%v\n", o.Facets) out += fmt.Sprintf(" facets_stats=%v\n", o.FacetsStats) - out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" index=%v\n", o.Index) out += fmt.Sprintf(" indexUsed=%v\n", o.IndexUsed) out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) - out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) out += fmt.Sprintf(" nbSortedHits=%v\n", o.NbSortedHits) - out += fmt.Sprintf(" page=%v\n", o.Page) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) diff --git a/clients/algoliasearch-client-go/algolia/search/model_browse_pagination.go b/clients/algoliasearch-client-go/algolia/search/model_browse_pagination.go new file mode 100644 index 00000000000..3c6e9ac8565 --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/search/model_browse_pagination.go @@ -0,0 +1,225 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +package search + +import ( + "encoding/json" + "fmt" +) + +// BrowsePagination struct for BrowsePagination. +type BrowsePagination struct { + // Page of search results to retrieve. + Page *int32 `json:"page,omitempty"` + // Number of results (hits). + NbHits *int32 `json:"nbHits,omitempty"` + // Number of pages of results. + NbPages *int32 `json:"nbPages,omitempty"` + // Number of hits per page. + HitsPerPage *int32 `json:"hitsPerPage,omitempty"` +} + +type BrowsePaginationOption func(f *BrowsePagination) + +func WithBrowsePaginationPage(val int32) BrowsePaginationOption { + return func(f *BrowsePagination) { + f.Page = &val + } +} + +func WithBrowsePaginationNbHits(val int32) BrowsePaginationOption { + return func(f *BrowsePagination) { + f.NbHits = &val + } +} + +func WithBrowsePaginationNbPages(val int32) BrowsePaginationOption { + return func(f *BrowsePagination) { + f.NbPages = &val + } +} + +func WithBrowsePaginationHitsPerPage(val int32) BrowsePaginationOption { + return func(f *BrowsePagination) { + f.HitsPerPage = &val + } +} + +// NewBrowsePagination instantiates a new BrowsePagination object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewBrowsePagination(opts ...BrowsePaginationOption) *BrowsePagination { + this := &BrowsePagination{} + for _, opt := range opts { + opt(this) + } + return this +} + +// NewEmptyBrowsePagination return a pointer to an empty BrowsePagination object. +func NewEmptyBrowsePagination() *BrowsePagination { + return &BrowsePagination{} +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *BrowsePagination) GetPage() int32 { + if o == nil || o.Page == nil { + var ret int32 + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowsePagination) GetPageOk() (*int32, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *BrowsePagination) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given int32 and assigns it to the Page field. +func (o *BrowsePagination) SetPage(v int32) *BrowsePagination { + o.Page = &v + return o +} + +// GetNbHits returns the NbHits field value if set, zero value otherwise. +func (o *BrowsePagination) GetNbHits() int32 { + if o == nil || o.NbHits == nil { + var ret int32 + return ret + } + return *o.NbHits +} + +// GetNbHitsOk returns a tuple with the NbHits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowsePagination) GetNbHitsOk() (*int32, bool) { + if o == nil || o.NbHits == nil { + return nil, false + } + return o.NbHits, true +} + +// HasNbHits returns a boolean if a field has been set. +func (o *BrowsePagination) HasNbHits() bool { + if o != nil && o.NbHits != nil { + return true + } + + return false +} + +// SetNbHits gets a reference to the given int32 and assigns it to the NbHits field. +func (o *BrowsePagination) SetNbHits(v int32) *BrowsePagination { + o.NbHits = &v + return o +} + +// GetNbPages returns the NbPages field value if set, zero value otherwise. +func (o *BrowsePagination) GetNbPages() int32 { + if o == nil || o.NbPages == nil { + var ret int32 + return ret + } + return *o.NbPages +} + +// GetNbPagesOk returns a tuple with the NbPages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowsePagination) GetNbPagesOk() (*int32, bool) { + if o == nil || o.NbPages == nil { + return nil, false + } + return o.NbPages, true +} + +// HasNbPages returns a boolean if a field has been set. +func (o *BrowsePagination) HasNbPages() bool { + if o != nil && o.NbPages != nil { + return true + } + + return false +} + +// SetNbPages gets a reference to the given int32 and assigns it to the NbPages field. +func (o *BrowsePagination) SetNbPages(v int32) *BrowsePagination { + o.NbPages = &v + return o +} + +// GetHitsPerPage returns the HitsPerPage field value if set, zero value otherwise. +func (o *BrowsePagination) GetHitsPerPage() int32 { + if o == nil || o.HitsPerPage == nil { + var ret int32 + return ret + } + return *o.HitsPerPage +} + +// GetHitsPerPageOk returns a tuple with the HitsPerPage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowsePagination) GetHitsPerPageOk() (*int32, bool) { + if o == nil || o.HitsPerPage == nil { + return nil, false + } + return o.HitsPerPage, true +} + +// HasHitsPerPage returns a boolean if a field has been set. +func (o *BrowsePagination) HasHitsPerPage() bool { + if o != nil && o.HitsPerPage != nil { + return true + } + + return false +} + +// SetHitsPerPage gets a reference to the given int32 and assigns it to the HitsPerPage field. +func (o *BrowsePagination) SetHitsPerPage(v int32) *BrowsePagination { + o.HitsPerPage = &v + return o +} + +func (o BrowsePagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.NbHits != nil { + toSerialize["nbHits"] = o.NbHits + } + if o.NbPages != nil { + toSerialize["nbPages"] = o.NbPages + } + if o.HitsPerPage != nil { + toSerialize["hitsPerPage"] = o.HitsPerPage + } + serialized, err := json.Marshal(toSerialize) + if err != nil { + return nil, fmt.Errorf("failed to marshal BrowsePagination: %w", err) + } + + return serialized, nil +} + +func (o BrowsePagination) String() string { + out := "" + out += fmt.Sprintf(" page=%v\n", o.Page) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) + out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) + return fmt.Sprintf("BrowsePagination {\n%s}", out) +} diff --git a/clients/algoliasearch-client-go/algolia/search/model_browse_response.go b/clients/algoliasearch-client-go/algolia/search/model_browse_response.go index 59e35a208cf..3380e72b510 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_browse_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_browse_response.go @@ -30,22 +30,14 @@ type BrowseResponse struct { Facets *map[string]map[string]int32 `json:"facets,omitempty"` // Statistics for numerical facets. FacetsStats *map[string]FacetsStats `json:"facets_stats,omitempty"` - // Number of hits per page. - HitsPerPage int32 `json:"hitsPerPage"` // Index name used for the query. Index *string `json:"index,omitempty"` // Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. IndexUsed *string `json:"indexUsed,omitempty"` // Warnings about the query. Message *string `json:"message,omitempty"` - // Number of results (hits). - NbHits int32 `json:"nbHits"` - // Number of pages of results. - NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` - // Page of search results to retrieve. - Page int32 `json:"page"` // Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. ParsedQuery *string `json:"parsedQuery,omitempty"` // Time the server took to process the request, in milliseconds. @@ -64,6 +56,14 @@ type BrowseResponse struct { UserData map[string]any `json:"userData,omitempty"` // Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). QueryID *string `json:"queryID,omitempty"` + // Page of search results to retrieve. + Page *int32 `json:"page,omitempty"` + // Number of results (hits). + NbHits *int32 `json:"nbHits,omitempty"` + // Number of pages of results. + NbPages *int32 `json:"nbPages,omitempty"` + // Number of hits per page. + HitsPerPage *int32 `json:"hitsPerPage,omitempty"` // Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. Hits []Hit `json:"hits"` // Search query. @@ -214,6 +214,30 @@ func WithBrowseResponseQueryID(val string) BrowseResponseOption { } } +func WithBrowseResponsePage(val int32) BrowseResponseOption { + return func(f *BrowseResponse) { + f.Page = &val + } +} + +func WithBrowseResponseNbHits(val int32) BrowseResponseOption { + return func(f *BrowseResponse) { + f.NbHits = &val + } +} + +func WithBrowseResponseNbPages(val int32) BrowseResponseOption { + return func(f *BrowseResponse) { + f.NbPages = &val + } +} + +func WithBrowseResponseHitsPerPage(val int32) BrowseResponseOption { + return func(f *BrowseResponse) { + f.HitsPerPage = &val + } +} + func WithBrowseResponseCursor(val string) BrowseResponseOption { return func(f *BrowseResponse) { f.Cursor = &val @@ -224,12 +248,8 @@ func WithBrowseResponseCursor(val string) BrowseResponseOption { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewBrowseResponse(hitsPerPage int32, nbHits int32, nbPages int32, page int32, processingTimeMS int32, hits []Hit, query string, params string, opts ...BrowseResponseOption) *BrowseResponse { +func NewBrowseResponse(processingTimeMS int32, hits []Hit, query string, params string, opts ...BrowseResponseOption) *BrowseResponse { this := &BrowseResponse{} - this.HitsPerPage = hitsPerPage - this.NbHits = nbHits - this.NbPages = nbPages - this.Page = page this.ProcessingTimeMS = processingTimeMS this.Hits = hits this.Query = query @@ -584,31 +604,6 @@ func (o *BrowseResponse) SetFacetsStats(v map[string]FacetsStats) *BrowseRespons return o } -// GetHitsPerPage returns the HitsPerPage field value. -func (o *BrowseResponse) GetHitsPerPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.HitsPerPage -} - -// GetHitsPerPageOk returns a tuple with the HitsPerPage field value -// and a boolean to check if the value has been set. -func (o *BrowseResponse) GetHitsPerPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.HitsPerPage, true -} - -// SetHitsPerPage sets field value. -func (o *BrowseResponse) SetHitsPerPage(v int32) *BrowseResponse { - o.HitsPerPage = v - return o -} - // GetIndex returns the Index field value if set, zero value otherwise. func (o *BrowseResponse) GetIndex() string { if o == nil || o.Index == nil { @@ -708,56 +703,6 @@ func (o *BrowseResponse) SetMessage(v string) *BrowseResponse { return o } -// GetNbHits returns the NbHits field value. -func (o *BrowseResponse) GetNbHits() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbHits -} - -// GetNbHitsOk returns a tuple with the NbHits field value -// and a boolean to check if the value has been set. -func (o *BrowseResponse) GetNbHitsOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbHits, true -} - -// SetNbHits sets field value. -func (o *BrowseResponse) SetNbHits(v int32) *BrowseResponse { - o.NbHits = v - return o -} - -// GetNbPages returns the NbPages field value. -func (o *BrowseResponse) GetNbPages() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbPages -} - -// GetNbPagesOk returns a tuple with the NbPages field value -// and a boolean to check if the value has been set. -func (o *BrowseResponse) GetNbPagesOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbPages, true -} - -// SetNbPages sets field value. -func (o *BrowseResponse) SetNbPages(v int32) *BrowseResponse { - o.NbPages = v - return o -} - // GetNbSortedHits returns the NbSortedHits field value if set, zero value otherwise. func (o *BrowseResponse) GetNbSortedHits() int32 { if o == nil || o.NbSortedHits == nil { @@ -791,31 +736,6 @@ func (o *BrowseResponse) SetNbSortedHits(v int32) *BrowseResponse { return o } -// GetPage returns the Page field value. -func (o *BrowseResponse) GetPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Page -} - -// GetPageOk returns a tuple with the Page field value -// and a boolean to check if the value has been set. -func (o *BrowseResponse) GetPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Page, true -} - -// SetPage sets field value. -func (o *BrowseResponse) SetPage(v int32) *BrowseResponse { - o.Page = v - return o -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *BrowseResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -1138,6 +1058,138 @@ func (o *BrowseResponse) SetQueryID(v string) *BrowseResponse { return o } +// GetPage returns the Page field value if set, zero value otherwise. +func (o *BrowseResponse) GetPage() int32 { + if o == nil || o.Page == nil { + var ret int32 + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetPageOk() (*int32, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *BrowseResponse) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given int32 and assigns it to the Page field. +func (o *BrowseResponse) SetPage(v int32) *BrowseResponse { + o.Page = &v + return o +} + +// GetNbHits returns the NbHits field value if set, zero value otherwise. +func (o *BrowseResponse) GetNbHits() int32 { + if o == nil || o.NbHits == nil { + var ret int32 + return ret + } + return *o.NbHits +} + +// GetNbHitsOk returns a tuple with the NbHits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetNbHitsOk() (*int32, bool) { + if o == nil || o.NbHits == nil { + return nil, false + } + return o.NbHits, true +} + +// HasNbHits returns a boolean if a field has been set. +func (o *BrowseResponse) HasNbHits() bool { + if o != nil && o.NbHits != nil { + return true + } + + return false +} + +// SetNbHits gets a reference to the given int32 and assigns it to the NbHits field. +func (o *BrowseResponse) SetNbHits(v int32) *BrowseResponse { + o.NbHits = &v + return o +} + +// GetNbPages returns the NbPages field value if set, zero value otherwise. +func (o *BrowseResponse) GetNbPages() int32 { + if o == nil || o.NbPages == nil { + var ret int32 + return ret + } + return *o.NbPages +} + +// GetNbPagesOk returns a tuple with the NbPages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetNbPagesOk() (*int32, bool) { + if o == nil || o.NbPages == nil { + return nil, false + } + return o.NbPages, true +} + +// HasNbPages returns a boolean if a field has been set. +func (o *BrowseResponse) HasNbPages() bool { + if o != nil && o.NbPages != nil { + return true + } + + return false +} + +// SetNbPages gets a reference to the given int32 and assigns it to the NbPages field. +func (o *BrowseResponse) SetNbPages(v int32) *BrowseResponse { + o.NbPages = &v + return o +} + +// GetHitsPerPage returns the HitsPerPage field value if set, zero value otherwise. +func (o *BrowseResponse) GetHitsPerPage() int32 { + if o == nil || o.HitsPerPage == nil { + var ret int32 + return ret + } + return *o.HitsPerPage +} + +// GetHitsPerPageOk returns a tuple with the HitsPerPage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetHitsPerPageOk() (*int32, bool) { + if o == nil || o.HitsPerPage == nil { + return nil, false + } + return o.HitsPerPage, true +} + +// HasHitsPerPage returns a boolean if a field has been set. +func (o *BrowseResponse) HasHitsPerPage() bool { + if o != nil && o.HitsPerPage != nil { + return true + } + + return false +} + +// SetHitsPerPage gets a reference to the given int32 and assigns it to the HitsPerPage field. +func (o *BrowseResponse) SetHitsPerPage(v int32) *BrowseResponse { + o.HitsPerPage = &v + return o +} + // GetHits returns the Hits field value. func (o *BrowseResponse) GetHits() []Hit { if o == nil { @@ -1278,9 +1330,6 @@ func (o BrowseResponse) MarshalJSON() ([]byte, error) { if o.FacetsStats != nil { toSerialize["facets_stats"] = o.FacetsStats } - if true { - toSerialize["hitsPerPage"] = o.HitsPerPage - } if o.Index != nil { toSerialize["index"] = o.Index } @@ -1290,18 +1339,9 @@ func (o BrowseResponse) MarshalJSON() ([]byte, error) { if o.Message != nil { toSerialize["message"] = o.Message } - if true { - toSerialize["nbHits"] = o.NbHits - } - if true { - toSerialize["nbPages"] = o.NbPages - } if o.NbSortedHits != nil { toSerialize["nbSortedHits"] = o.NbSortedHits } - if true { - toSerialize["page"] = o.Page - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } @@ -1332,6 +1372,18 @@ func (o BrowseResponse) MarshalJSON() ([]byte, error) { if o.QueryID != nil { toSerialize["queryID"] = o.QueryID } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.NbHits != nil { + toSerialize["nbHits"] = o.NbHits + } + if o.NbPages != nil { + toSerialize["nbPages"] = o.NbPages + } + if o.HitsPerPage != nil { + toSerialize["hitsPerPage"] = o.HitsPerPage + } if true { toSerialize["hits"] = o.Hits } @@ -1364,14 +1416,10 @@ func (o BrowseResponse) String() string { out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) out += fmt.Sprintf(" facets=%v\n", o.Facets) out += fmt.Sprintf(" facets_stats=%v\n", o.FacetsStats) - out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" index=%v\n", o.Index) out += fmt.Sprintf(" indexUsed=%v\n", o.IndexUsed) out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) - out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) out += fmt.Sprintf(" nbSortedHits=%v\n", o.NbSortedHits) - out += fmt.Sprintf(" page=%v\n", o.Page) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) @@ -1382,6 +1430,10 @@ func (o BrowseResponse) String() string { out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) out += fmt.Sprintf(" queryID=%v\n", o.QueryID) + out += fmt.Sprintf(" page=%v\n", o.Page) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) + out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" hits=%v\n", o.Hits) out += fmt.Sprintf(" query=%v\n", o.Query) out += fmt.Sprintf(" params=%v\n", o.Params) diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_pagination.go b/clients/algoliasearch-client-go/algolia/search/model_search_pagination.go new file mode 100644 index 00000000000..df808b13eda --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/search/model_search_pagination.go @@ -0,0 +1,168 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +package search + +import ( + "encoding/json" + "fmt" +) + +// SearchPagination struct for SearchPagination. +type SearchPagination struct { + // Page of search results to retrieve. + Page int32 `json:"page"` + // Number of results (hits). + NbHits int32 `json:"nbHits"` + // Number of pages of results. + NbPages int32 `json:"nbPages"` + // Number of hits per page. + HitsPerPage int32 `json:"hitsPerPage"` +} + +// NewSearchPagination instantiates a new SearchPagination object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSearchPagination(page int32, nbHits int32, nbPages int32, hitsPerPage int32) *SearchPagination { + this := &SearchPagination{} + this.Page = page + this.NbHits = nbHits + this.NbPages = nbPages + this.HitsPerPage = hitsPerPage + return this +} + +// NewEmptySearchPagination return a pointer to an empty SearchPagination object. +func NewEmptySearchPagination() *SearchPagination { + return &SearchPagination{} +} + +// GetPage returns the Page field value. +func (o *SearchPagination) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value. +func (o *SearchPagination) SetPage(v int32) *SearchPagination { + o.Page = v + return o +} + +// GetNbHits returns the NbHits field value. +func (o *SearchPagination) GetNbHits() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbHits +} + +// GetNbHitsOk returns a tuple with the NbHits field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetNbHitsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbHits, true +} + +// SetNbHits sets field value. +func (o *SearchPagination) SetNbHits(v int32) *SearchPagination { + o.NbHits = v + return o +} + +// GetNbPages returns the NbPages field value. +func (o *SearchPagination) GetNbPages() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbPages +} + +// GetNbPagesOk returns a tuple with the NbPages field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetNbPagesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbPages, true +} + +// SetNbPages sets field value. +func (o *SearchPagination) SetNbPages(v int32) *SearchPagination { + o.NbPages = v + return o +} + +// GetHitsPerPage returns the HitsPerPage field value. +func (o *SearchPagination) GetHitsPerPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HitsPerPage +} + +// GetHitsPerPageOk returns a tuple with the HitsPerPage field value +// and a boolean to check if the value has been set. +func (o *SearchPagination) GetHitsPerPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HitsPerPage, true +} + +// SetHitsPerPage sets field value. +func (o *SearchPagination) SetHitsPerPage(v int32) *SearchPagination { + o.HitsPerPage = v + return o +} + +func (o SearchPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if true { + toSerialize["page"] = o.Page + } + if true { + toSerialize["nbHits"] = o.NbHits + } + if true { + toSerialize["nbPages"] = o.NbPages + } + if true { + toSerialize["hitsPerPage"] = o.HitsPerPage + } + serialized, err := json.Marshal(toSerialize) + if err != nil { + return nil, fmt.Errorf("failed to marshal SearchPagination: %w", err) + } + + return serialized, nil +} + +func (o SearchPagination) String() string { + out := "" + out += fmt.Sprintf(" page=%v\n", o.Page) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) + out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) + return fmt.Sprintf("SearchPagination {\n%s}", out) +} diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_response.go b/clients/algoliasearch-client-go/algolia/search/model_search_response.go index 3da1b5a75ad..18bdacf8eff 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_response.go @@ -30,22 +30,14 @@ type SearchResponse struct { Facets *map[string]map[string]int32 `json:"facets,omitempty"` // Statistics for numerical facets. FacetsStats *map[string]FacetsStats `json:"facets_stats,omitempty"` - // Number of hits per page. - HitsPerPage int32 `json:"hitsPerPage"` // Index name used for the query. Index *string `json:"index,omitempty"` // Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. IndexUsed *string `json:"indexUsed,omitempty"` // Warnings about the query. Message *string `json:"message,omitempty"` - // Number of results (hits). - NbHits int32 `json:"nbHits"` - // Number of pages of results. - NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` - // Page of search results to retrieve. - Page int32 `json:"page"` // Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. ParsedQuery *string `json:"parsedQuery,omitempty"` // Time the server took to process the request, in milliseconds. @@ -64,6 +56,14 @@ type SearchResponse struct { UserData map[string]any `json:"userData,omitempty"` // Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). QueryID *string `json:"queryID,omitempty"` + // Page of search results to retrieve. + Page int32 `json:"page"` + // Number of results (hits). + NbHits int32 `json:"nbHits"` + // Number of pages of results. + NbPages int32 `json:"nbPages"` + // Number of hits per page. + HitsPerPage int32 `json:"hitsPerPage"` // Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. Hits []Hit `json:"hits"` // Search query. @@ -219,13 +219,13 @@ func WithSearchResponseQueryID(val string) SearchResponseOption { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSearchResponse(hitsPerPage int32, nbHits int32, nbPages int32, page int32, processingTimeMS int32, hits []Hit, query string, params string, opts ...SearchResponseOption) *SearchResponse { +func NewSearchResponse(processingTimeMS int32, page int32, nbHits int32, nbPages int32, hitsPerPage int32, hits []Hit, query string, params string, opts ...SearchResponseOption) *SearchResponse { this := &SearchResponse{} - this.HitsPerPage = hitsPerPage + this.ProcessingTimeMS = processingTimeMS + this.Page = page this.NbHits = nbHits this.NbPages = nbPages - this.Page = page - this.ProcessingTimeMS = processingTimeMS + this.HitsPerPage = hitsPerPage this.Hits = hits this.Query = query this.Params = params @@ -579,31 +579,6 @@ func (o *SearchResponse) SetFacetsStats(v map[string]FacetsStats) *SearchRespons return o } -// GetHitsPerPage returns the HitsPerPage field value. -func (o *SearchResponse) GetHitsPerPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.HitsPerPage -} - -// GetHitsPerPageOk returns a tuple with the HitsPerPage field value -// and a boolean to check if the value has been set. -func (o *SearchResponse) GetHitsPerPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.HitsPerPage, true -} - -// SetHitsPerPage sets field value. -func (o *SearchResponse) SetHitsPerPage(v int32) *SearchResponse { - o.HitsPerPage = v - return o -} - // GetIndex returns the Index field value if set, zero value otherwise. func (o *SearchResponse) GetIndex() string { if o == nil || o.Index == nil { @@ -703,56 +678,6 @@ func (o *SearchResponse) SetMessage(v string) *SearchResponse { return o } -// GetNbHits returns the NbHits field value. -func (o *SearchResponse) GetNbHits() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbHits -} - -// GetNbHitsOk returns a tuple with the NbHits field value -// and a boolean to check if the value has been set. -func (o *SearchResponse) GetNbHitsOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbHits, true -} - -// SetNbHits sets field value. -func (o *SearchResponse) SetNbHits(v int32) *SearchResponse { - o.NbHits = v - return o -} - -// GetNbPages returns the NbPages field value. -func (o *SearchResponse) GetNbPages() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.NbPages -} - -// GetNbPagesOk returns a tuple with the NbPages field value -// and a boolean to check if the value has been set. -func (o *SearchResponse) GetNbPagesOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.NbPages, true -} - -// SetNbPages sets field value. -func (o *SearchResponse) SetNbPages(v int32) *SearchResponse { - o.NbPages = v - return o -} - // GetNbSortedHits returns the NbSortedHits field value if set, zero value otherwise. func (o *SearchResponse) GetNbSortedHits() int32 { if o == nil || o.NbSortedHits == nil { @@ -786,31 +711,6 @@ func (o *SearchResponse) SetNbSortedHits(v int32) *SearchResponse { return o } -// GetPage returns the Page field value. -func (o *SearchResponse) GetPage() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Page -} - -// GetPageOk returns a tuple with the Page field value -// and a boolean to check if the value has been set. -func (o *SearchResponse) GetPageOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Page, true -} - -// SetPage sets field value. -func (o *SearchResponse) SetPage(v int32) *SearchResponse { - o.Page = v - return o -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *SearchResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -1133,6 +1033,106 @@ func (o *SearchResponse) SetQueryID(v string) *SearchResponse { return o } +// GetPage returns the Page field value. +func (o *SearchResponse) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value. +func (o *SearchResponse) SetPage(v int32) *SearchResponse { + o.Page = v + return o +} + +// GetNbHits returns the NbHits field value. +func (o *SearchResponse) GetNbHits() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbHits +} + +// GetNbHitsOk returns a tuple with the NbHits field value +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetNbHitsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbHits, true +} + +// SetNbHits sets field value. +func (o *SearchResponse) SetNbHits(v int32) *SearchResponse { + o.NbHits = v + return o +} + +// GetNbPages returns the NbPages field value. +func (o *SearchResponse) GetNbPages() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NbPages +} + +// GetNbPagesOk returns a tuple with the NbPages field value +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetNbPagesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NbPages, true +} + +// SetNbPages sets field value. +func (o *SearchResponse) SetNbPages(v int32) *SearchResponse { + o.NbPages = v + return o +} + +// GetHitsPerPage returns the HitsPerPage field value. +func (o *SearchResponse) GetHitsPerPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HitsPerPage +} + +// GetHitsPerPageOk returns a tuple with the HitsPerPage field value +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetHitsPerPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HitsPerPage, true +} + +// SetHitsPerPage sets field value. +func (o *SearchResponse) SetHitsPerPage(v int32) *SearchResponse { + o.HitsPerPage = v + return o +} + // GetHits returns the Hits field value. func (o *SearchResponse) GetHits() []Hit { if o == nil { @@ -1250,9 +1250,6 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if o.FacetsStats != nil { toSerialize["facets_stats"] = o.FacetsStats } - if true { - toSerialize["hitsPerPage"] = o.HitsPerPage - } if o.Index != nil { toSerialize["index"] = o.Index } @@ -1262,18 +1259,9 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if o.Message != nil { toSerialize["message"] = o.Message } - if true { - toSerialize["nbHits"] = o.NbHits - } - if true { - toSerialize["nbPages"] = o.NbPages - } if o.NbSortedHits != nil { toSerialize["nbSortedHits"] = o.NbSortedHits } - if true { - toSerialize["page"] = o.Page - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } @@ -1304,6 +1292,18 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if o.QueryID != nil { toSerialize["queryID"] = o.QueryID } + if true { + toSerialize["page"] = o.Page + } + if true { + toSerialize["nbHits"] = o.NbHits + } + if true { + toSerialize["nbPages"] = o.NbPages + } + if true { + toSerialize["hitsPerPage"] = o.HitsPerPage + } if true { toSerialize["hits"] = o.Hits } @@ -1353,14 +1353,10 @@ func (o *SearchResponse) UnmarshalJSON(bytes []byte) error { delete(additionalProperties, "exhaustiveTypo") delete(additionalProperties, "facets") delete(additionalProperties, "facets_stats") - delete(additionalProperties, "hitsPerPage") delete(additionalProperties, "index") delete(additionalProperties, "indexUsed") delete(additionalProperties, "message") - delete(additionalProperties, "nbHits") - delete(additionalProperties, "nbPages") delete(additionalProperties, "nbSortedHits") - delete(additionalProperties, "page") delete(additionalProperties, "parsedQuery") delete(additionalProperties, "processingTimeMS") delete(additionalProperties, "processingTimingsMS") @@ -1371,6 +1367,10 @@ func (o *SearchResponse) UnmarshalJSON(bytes []byte) error { delete(additionalProperties, "serverUsed") delete(additionalProperties, "userData") delete(additionalProperties, "queryID") + delete(additionalProperties, "page") + delete(additionalProperties, "nbHits") + delete(additionalProperties, "nbPages") + delete(additionalProperties, "hitsPerPage") delete(additionalProperties, "hits") delete(additionalProperties, "query") delete(additionalProperties, "params") @@ -1391,14 +1391,10 @@ func (o SearchResponse) String() string { out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) out += fmt.Sprintf(" facets=%v\n", o.Facets) out += fmt.Sprintf(" facets_stats=%v\n", o.FacetsStats) - out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" index=%v\n", o.Index) out += fmt.Sprintf(" indexUsed=%v\n", o.IndexUsed) out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) - out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) out += fmt.Sprintf(" nbSortedHits=%v\n", o.NbSortedHits) - out += fmt.Sprintf(" page=%v\n", o.Page) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) @@ -1409,6 +1405,10 @@ func (o SearchResponse) String() string { out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) out += fmt.Sprintf(" queryID=%v\n", o.QueryID) + out += fmt.Sprintf(" page=%v\n", o.Page) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" nbPages=%v\n", o.NbPages) + out += fmt.Sprintf(" hitsPerPage=%v\n", o.HitsPerPage) out += fmt.Sprintf(" hits=%v\n", o.Hits) out += fmt.Sprintf(" query=%v\n", o.Query) out += fmt.Sprintf(" params=%v\n", o.Params) diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/BaseSearchResponse.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/BaseSearchResponse.java index 67dcfc4fda6..26e3f61daf1 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/BaseSearchResponse.java @@ -42,9 +42,6 @@ public class BaseSearchResponse { @JsonProperty("facets_stats") private Map facetsStats; - @JsonProperty("hitsPerPage") - private Integer hitsPerPage; - @JsonProperty("index") private String index; @@ -54,18 +51,9 @@ public class BaseSearchResponse { @JsonProperty("message") private String message; - @JsonProperty("nbHits") - private Integer nbHits; - - @JsonProperty("nbPages") - private Integer nbPages; - @JsonProperty("nbSortedHits") private Integer nbSortedHits; - @JsonProperty("page") - private Integer page; - @JsonProperty("parsedQuery") private String parsedQuery; @@ -255,17 +243,6 @@ public Map getFacetsStats() { return facetsStats; } - public BaseSearchResponse setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** Number of hits per page. minimum: 1 maximum: 1000 */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - public BaseSearchResponse setIndex(String index) { this.index = index; return this; @@ -302,28 +279,6 @@ public String getMessage() { return message; } - public BaseSearchResponse setNbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** Number of results (hits). */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public BaseSearchResponse setNbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** Number of pages of results. */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - public BaseSearchResponse setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; return this; @@ -335,17 +290,6 @@ public Integer getNbSortedHits() { return nbSortedHits; } - public BaseSearchResponse setPage(Integer page) { - this.page = page; - return this; - } - - /** Page of search results to retrieve. minimum: 0 */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - public BaseSearchResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -488,14 +432,10 @@ public boolean equals(Object o) { Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && Objects.equals(this.facets, baseSearchResponse.facets) && Objects.equals(this.facetsStats, baseSearchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, baseSearchResponse.hitsPerPage) && Objects.equals(this.index, baseSearchResponse.index) && Objects.equals(this.indexUsed, baseSearchResponse.indexUsed) && Objects.equals(this.message, baseSearchResponse.message) && - Objects.equals(this.nbHits, baseSearchResponse.nbHits) && - Objects.equals(this.nbPages, baseSearchResponse.nbPages) && Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && - Objects.equals(this.page, baseSearchResponse.page) && Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && Objects.equals(this.processingTimeMS, baseSearchResponse.processingTimeMS) && Objects.equals(this.processingTimingsMS, baseSearchResponse.processingTimingsMS) && @@ -523,14 +463,10 @@ public int hashCode() { exhaustiveTypo, facets, facetsStats, - hitsPerPage, index, indexUsed, message, - nbHits, - nbPages, nbSortedHits, - page, parsedQuery, processingTimeMS, processingTimingsMS, @@ -560,14 +496,10 @@ public String toString() { sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); sb.append(" processingTimingsMS: ").append(toIndentedString(processingTimingsMS)).append("\n"); diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendationsResults.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendationsResults.java index 56a46e4e994..bc4fd457dde 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendationsResults.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendationsResults.java @@ -44,9 +44,6 @@ public class RecommendationsResults { @JsonProperty("facets_stats") private Map facetsStats; - @JsonProperty("hitsPerPage") - private Integer hitsPerPage; - @JsonProperty("index") private String index; @@ -56,18 +53,9 @@ public class RecommendationsResults { @JsonProperty("message") private String message; - @JsonProperty("nbHits") - private Integer nbHits; - - @JsonProperty("nbPages") - private Integer nbPages; - @JsonProperty("nbSortedHits") private Integer nbSortedHits; - @JsonProperty("page") - private Integer page; - @JsonProperty("parsedQuery") private String parsedQuery; @@ -98,6 +86,18 @@ public class RecommendationsResults { @JsonProperty("queryID") private String queryID; + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + @JsonProperty("hits") private List hits = new ArrayList<>(); @@ -247,17 +247,6 @@ public Map getFacetsStats() { return facetsStats; } - public RecommendationsResults setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** Number of hits per page. minimum: 1 maximum: 1000 */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - public RecommendationsResults setIndex(String index) { this.index = index; return this; @@ -294,28 +283,6 @@ public String getMessage() { return message; } - public RecommendationsResults setNbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** Number of results (hits). */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public RecommendationsResults setNbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** Number of pages of results. */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - public RecommendationsResults setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; return this; @@ -327,17 +294,6 @@ public Integer getNbSortedHits() { return nbSortedHits; } - public RecommendationsResults setPage(Integer page) { - this.page = page; - return this; - } - - /** Page of search results to retrieve. minimum: 0 */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - public RecommendationsResults setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -460,6 +416,50 @@ public String getQueryID() { return queryID; } + public RecommendationsResults setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getPage() { + return page; + } + + public RecommendationsResults setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nonnull + public Integer getNbHits() { + return nbHits; + } + + public RecommendationsResults setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nonnull + public Integer getNbPages() { + return nbPages; + } + + public RecommendationsResults setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** Number of hits per page. minimum: 1 maximum: 1000 */ + @javax.annotation.Nonnull + public Integer getHitsPerPage() { + return hitsPerPage; + } + public RecommendationsResults setHits(List hits) { this.hits = hits; return this; @@ -496,14 +496,10 @@ public boolean equals(Object o) { Objects.equals(this.exhaustiveTypo, recommendationsResults.exhaustiveTypo) && Objects.equals(this.facets, recommendationsResults.facets) && Objects.equals(this.facetsStats, recommendationsResults.facetsStats) && - Objects.equals(this.hitsPerPage, recommendationsResults.hitsPerPage) && Objects.equals(this.index, recommendationsResults.index) && Objects.equals(this.indexUsed, recommendationsResults.indexUsed) && Objects.equals(this.message, recommendationsResults.message) && - Objects.equals(this.nbHits, recommendationsResults.nbHits) && - Objects.equals(this.nbPages, recommendationsResults.nbPages) && Objects.equals(this.nbSortedHits, recommendationsResults.nbSortedHits) && - Objects.equals(this.page, recommendationsResults.page) && Objects.equals(this.parsedQuery, recommendationsResults.parsedQuery) && Objects.equals(this.processingTimeMS, recommendationsResults.processingTimeMS) && Objects.equals(this.processingTimingsMS, recommendationsResults.processingTimingsMS) && @@ -514,6 +510,10 @@ public boolean equals(Object o) { Objects.equals(this.serverUsed, recommendationsResults.serverUsed) && Objects.equals(this.userData, recommendationsResults.userData) && Objects.equals(this.queryID, recommendationsResults.queryID) && + Objects.equals(this.page, recommendationsResults.page) && + Objects.equals(this.nbHits, recommendationsResults.nbHits) && + Objects.equals(this.nbPages, recommendationsResults.nbPages) && + Objects.equals(this.hitsPerPage, recommendationsResults.hitsPerPage) && Objects.equals(this.hits, recommendationsResults.hits) ); } @@ -531,14 +531,10 @@ public int hashCode() { exhaustiveTypo, facets, facetsStats, - hitsPerPage, index, indexUsed, message, - nbHits, - nbPages, nbSortedHits, - page, parsedQuery, processingTimeMS, processingTimingsMS, @@ -549,6 +545,10 @@ public int hashCode() { serverUsed, userData, queryID, + page, + nbHits, + nbPages, + hitsPerPage, hits ); } @@ -567,14 +567,10 @@ public String toString() { sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); sb.append(" processingTimingsMS: ").append(toIndentedString(processingTimingsMS)).append("\n"); @@ -585,6 +581,10 @@ public String toString() { sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" queryID: ").append(toIndentedString(queryID)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/SearchPagination.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/SearchPagination.java new file mode 100644 index 00000000000..8b66d56af0c --- /dev/null +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/SearchPagination.java @@ -0,0 +1,112 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.recommend; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** SearchPagination */ +public class SearchPagination { + + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + + public SearchPagination setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getPage() { + return page; + } + + public SearchPagination setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nonnull + public Integer getNbHits() { + return nbHits; + } + + public SearchPagination setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nonnull + public Integer getNbPages() { + return nbPages; + } + + public SearchPagination setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** Number of hits per page. minimum: 1 maximum: 1000 */ + @javax.annotation.Nonnull + public Integer getHitsPerPage() { + return hitsPerPage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchPagination searchPagination = (SearchPagination) o; + return ( + Objects.equals(this.page, searchPagination.page) && + Objects.equals(this.nbHits, searchPagination.nbHits) && + Objects.equals(this.nbPages, searchPagination.nbPages) && + Objects.equals(this.hitsPerPage, searchPagination.hitsPerPage) + ); + } + + @Override + public int hashCode() { + return Objects.hash(page, nbHits, nbPages, hitsPerPage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchPagination {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BaseSearchResponse.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BaseSearchResponse.java index 2167a7a0292..02c23f14212 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BaseSearchResponse.java @@ -42,9 +42,6 @@ public class BaseSearchResponse { @JsonProperty("facets_stats") private Map facetsStats; - @JsonProperty("hitsPerPage") - private Integer hitsPerPage; - @JsonProperty("index") private String index; @@ -54,18 +51,9 @@ public class BaseSearchResponse { @JsonProperty("message") private String message; - @JsonProperty("nbHits") - private Integer nbHits; - - @JsonProperty("nbPages") - private Integer nbPages; - @JsonProperty("nbSortedHits") private Integer nbSortedHits; - @JsonProperty("page") - private Integer page; - @JsonProperty("parsedQuery") private String parsedQuery; @@ -255,17 +243,6 @@ public Map getFacetsStats() { return facetsStats; } - public BaseSearchResponse setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** Number of hits per page. minimum: 1 maximum: 1000 */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - public BaseSearchResponse setIndex(String index) { this.index = index; return this; @@ -302,28 +279,6 @@ public String getMessage() { return message; } - public BaseSearchResponse setNbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** Number of results (hits). */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public BaseSearchResponse setNbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** Number of pages of results. */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - public BaseSearchResponse setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; return this; @@ -335,17 +290,6 @@ public Integer getNbSortedHits() { return nbSortedHits; } - public BaseSearchResponse setPage(Integer page) { - this.page = page; - return this; - } - - /** Page of search results to retrieve. minimum: 0 */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - public BaseSearchResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -488,14 +432,10 @@ public boolean equals(Object o) { Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && Objects.equals(this.facets, baseSearchResponse.facets) && Objects.equals(this.facetsStats, baseSearchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, baseSearchResponse.hitsPerPage) && Objects.equals(this.index, baseSearchResponse.index) && Objects.equals(this.indexUsed, baseSearchResponse.indexUsed) && Objects.equals(this.message, baseSearchResponse.message) && - Objects.equals(this.nbHits, baseSearchResponse.nbHits) && - Objects.equals(this.nbPages, baseSearchResponse.nbPages) && Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && - Objects.equals(this.page, baseSearchResponse.page) && Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && Objects.equals(this.processingTimeMS, baseSearchResponse.processingTimeMS) && Objects.equals(this.processingTimingsMS, baseSearchResponse.processingTimingsMS) && @@ -523,14 +463,10 @@ public int hashCode() { exhaustiveTypo, facets, facetsStats, - hitsPerPage, index, indexUsed, message, - nbHits, - nbPages, nbSortedHits, - page, parsedQuery, processingTimeMS, processingTimingsMS, @@ -560,14 +496,10 @@ public String toString() { sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); sb.append(" processingTimingsMS: ").append(toIndentedString(processingTimingsMS)).append("\n"); diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowsePagination.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowsePagination.java new file mode 100644 index 00000000000..da2571ce750 --- /dev/null +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowsePagination.java @@ -0,0 +1,112 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.search; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** BrowsePagination */ +public class BrowsePagination { + + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + + public BrowsePagination setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nullable + public Integer getPage() { + return page; + } + + public BrowsePagination setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nullable + public Integer getNbHits() { + return nbHits; + } + + public BrowsePagination setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nullable + public Integer getNbPages() { + return nbPages; + } + + public BrowsePagination 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) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrowsePagination browsePagination = (BrowsePagination) o; + return ( + Objects.equals(this.page, browsePagination.page) && + Objects.equals(this.nbHits, browsePagination.nbHits) && + Objects.equals(this.nbPages, browsePagination.nbPages) && + Objects.equals(this.hitsPerPage, browsePagination.hitsPerPage) + ); + } + + @Override + public int hashCode() { + return Objects.hash(page, nbHits, nbPages, hitsPerPage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrowsePagination {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowseResponse.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowseResponse.java index e35f6db7dd5..b998d585ad6 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowseResponse.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BrowseResponse.java @@ -44,9 +44,6 @@ public class BrowseResponse { @JsonProperty("facets_stats") private Map facetsStats; - @JsonProperty("hitsPerPage") - private Integer hitsPerPage; - @JsonProperty("index") private String index; @@ -56,18 +53,9 @@ public class BrowseResponse { @JsonProperty("message") private String message; - @JsonProperty("nbHits") - private Integer nbHits; - - @JsonProperty("nbPages") - private Integer nbPages; - @JsonProperty("nbSortedHits") private Integer nbSortedHits; - @JsonProperty("page") - private Integer page; - @JsonProperty("parsedQuery") private String parsedQuery; @@ -98,6 +86,18 @@ public class BrowseResponse { @JsonProperty("queryID") private String queryID; + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + @JsonProperty("hits") private List hits = new ArrayList<>(); @@ -256,17 +256,6 @@ public Map getFacetsStats() { return facetsStats; } - public BrowseResponse setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** Number of hits per page. minimum: 1 maximum: 1000 */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - public BrowseResponse setIndex(String index) { this.index = index; return this; @@ -303,28 +292,6 @@ public String getMessage() { return message; } - public BrowseResponse setNbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** Number of results (hits). */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public BrowseResponse setNbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** Number of pages of results. */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - public BrowseResponse setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; return this; @@ -336,17 +303,6 @@ public Integer getNbSortedHits() { return nbSortedHits; } - public BrowseResponse setPage(Integer page) { - this.page = page; - return this; - } - - /** Page of search results to retrieve. minimum: 0 */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - public BrowseResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -469,6 +425,50 @@ public String getQueryID() { return queryID; } + public BrowseResponse setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nullable + public Integer getPage() { + return page; + } + + public BrowseResponse setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nullable + public Integer getNbHits() { + return nbHits; + } + + public BrowseResponse setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nullable + public Integer getNbPages() { + return nbPages; + } + + public BrowseResponse 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; + } + public BrowseResponse setHits(List hits) { this.hits = hits; return this; @@ -545,14 +545,10 @@ public boolean equals(Object o) { Objects.equals(this.exhaustiveTypo, browseResponse.exhaustiveTypo) && Objects.equals(this.facets, browseResponse.facets) && Objects.equals(this.facetsStats, browseResponse.facetsStats) && - Objects.equals(this.hitsPerPage, browseResponse.hitsPerPage) && Objects.equals(this.index, browseResponse.index) && Objects.equals(this.indexUsed, browseResponse.indexUsed) && Objects.equals(this.message, browseResponse.message) && - Objects.equals(this.nbHits, browseResponse.nbHits) && - Objects.equals(this.nbPages, browseResponse.nbPages) && Objects.equals(this.nbSortedHits, browseResponse.nbSortedHits) && - Objects.equals(this.page, browseResponse.page) && Objects.equals(this.parsedQuery, browseResponse.parsedQuery) && Objects.equals(this.processingTimeMS, browseResponse.processingTimeMS) && Objects.equals(this.processingTimingsMS, browseResponse.processingTimingsMS) && @@ -563,6 +559,10 @@ public boolean equals(Object o) { Objects.equals(this.serverUsed, browseResponse.serverUsed) && Objects.equals(this.userData, browseResponse.userData) && Objects.equals(this.queryID, browseResponse.queryID) && + Objects.equals(this.page, browseResponse.page) && + Objects.equals(this.nbHits, browseResponse.nbHits) && + Objects.equals(this.nbPages, browseResponse.nbPages) && + Objects.equals(this.hitsPerPage, browseResponse.hitsPerPage) && Objects.equals(this.hits, browseResponse.hits) && Objects.equals(this.query, browseResponse.query) && Objects.equals(this.params, browseResponse.params) && @@ -583,14 +583,10 @@ public int hashCode() { exhaustiveTypo, facets, facetsStats, - hitsPerPage, index, indexUsed, message, - nbHits, - nbPages, nbSortedHits, - page, parsedQuery, processingTimeMS, processingTimingsMS, @@ -601,6 +597,10 @@ public int hashCode() { serverUsed, userData, queryID, + page, + nbHits, + nbPages, + hitsPerPage, hits, query, params, @@ -622,14 +622,10 @@ public String toString() { sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); sb.append(" processingTimingsMS: ").append(toIndentedString(processingTimingsMS)).append("\n"); @@ -640,6 +636,10 @@ public String toString() { sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" queryID: ").append(toIndentedString(queryID)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchPagination.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchPagination.java new file mode 100644 index 00000000000..98af9e0fb49 --- /dev/null +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchPagination.java @@ -0,0 +1,112 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.search; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** SearchPagination */ +public class SearchPagination { + + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + + public SearchPagination setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getPage() { + return page; + } + + public SearchPagination setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nonnull + public Integer getNbHits() { + return nbHits; + } + + public SearchPagination setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nonnull + public Integer getNbPages() { + return nbPages; + } + + public SearchPagination setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** Number of hits per page. minimum: 1 maximum: 1000 */ + @javax.annotation.Nonnull + public Integer getHitsPerPage() { + return hitsPerPage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchPagination searchPagination = (SearchPagination) o; + return ( + Objects.equals(this.page, searchPagination.page) && + Objects.equals(this.nbHits, searchPagination.nbHits) && + Objects.equals(this.nbPages, searchPagination.nbPages) && + Objects.equals(this.hitsPerPage, searchPagination.hitsPerPage) + ); + } + + @Override + public int hashCode() { + return Objects.hash(page, nbHits, nbPages, hitsPerPage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchPagination {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchResponse.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchResponse.java index 81f82ac82c0..9dc924e2406 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchResponse.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchResponse.java @@ -45,9 +45,6 @@ public class SearchResponse implements SearchResult { @JsonProperty("facets_stats") private Map facetsStats; - @JsonProperty("hitsPerPage") - private Integer hitsPerPage; - @JsonProperty("index") private String index; @@ -57,18 +54,9 @@ public class SearchResponse implements SearchResult { @JsonProperty("message") private String message; - @JsonProperty("nbHits") - private Integer nbHits; - - @JsonProperty("nbPages") - private Integer nbPages; - @JsonProperty("nbSortedHits") private Integer nbSortedHits; - @JsonProperty("page") - private Integer page; - @JsonProperty("parsedQuery") private String parsedQuery; @@ -99,6 +87,18 @@ public class SearchResponse implements SearchResult { @JsonProperty("queryID") private String queryID; + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + @JsonProperty("hits") private List hits = new ArrayList<>(); @@ -267,17 +267,6 @@ public Map getFacetsStats() { return facetsStats; } - public SearchResponse setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** Number of hits per page. minimum: 1 maximum: 1000 */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - public SearchResponse setIndex(String index) { this.index = index; return this; @@ -314,28 +303,6 @@ public String getMessage() { return message; } - public SearchResponse setNbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** Number of results (hits). */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public SearchResponse setNbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** Number of pages of results. */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - public SearchResponse setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; return this; @@ -347,17 +314,6 @@ public Integer getNbSortedHits() { return nbSortedHits; } - public SearchResponse setPage(Integer page) { - this.page = page; - return this; - } - - /** Page of search results to retrieve. minimum: 0 */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - public SearchResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -480,6 +436,50 @@ public String getQueryID() { return queryID; } + public SearchResponse setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getPage() { + return page; + } + + public SearchResponse setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nonnull + public Integer getNbHits() { + return nbHits; + } + + public SearchResponse setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nonnull + public Integer getNbPages() { + return nbPages; + } + + public SearchResponse setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** Number of hits per page. minimum: 1 maximum: 1000 */ + @javax.annotation.Nonnull + public Integer getHitsPerPage() { + return hitsPerPage; + } + public SearchResponse setHits(List hits) { this.hits = hits; return this; @@ -541,14 +541,10 @@ public boolean equals(Object o) { Objects.equals(this.exhaustiveTypo, searchResponse.exhaustiveTypo) && Objects.equals(this.facets, searchResponse.facets) && Objects.equals(this.facetsStats, searchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, searchResponse.hitsPerPage) && Objects.equals(this.index, searchResponse.index) && Objects.equals(this.indexUsed, searchResponse.indexUsed) && Objects.equals(this.message, searchResponse.message) && - Objects.equals(this.nbHits, searchResponse.nbHits) && - Objects.equals(this.nbPages, searchResponse.nbPages) && Objects.equals(this.nbSortedHits, searchResponse.nbSortedHits) && - Objects.equals(this.page, searchResponse.page) && Objects.equals(this.parsedQuery, searchResponse.parsedQuery) && Objects.equals(this.processingTimeMS, searchResponse.processingTimeMS) && Objects.equals(this.processingTimingsMS, searchResponse.processingTimingsMS) && @@ -559,6 +555,10 @@ public boolean equals(Object o) { Objects.equals(this.serverUsed, searchResponse.serverUsed) && Objects.equals(this.userData, searchResponse.userData) && Objects.equals(this.queryID, searchResponse.queryID) && + Objects.equals(this.page, searchResponse.page) && + Objects.equals(this.nbHits, searchResponse.nbHits) && + Objects.equals(this.nbPages, searchResponse.nbPages) && + Objects.equals(this.hitsPerPage, searchResponse.hitsPerPage) && Objects.equals(this.hits, searchResponse.hits) && Objects.equals(this.query, searchResponse.query) && Objects.equals(this.params, searchResponse.params) && @@ -579,14 +579,10 @@ public int hashCode() { exhaustiveTypo, facets, facetsStats, - hitsPerPage, index, indexUsed, message, - nbHits, - nbPages, nbSortedHits, - page, parsedQuery, processingTimeMS, processingTimingsMS, @@ -597,6 +593,10 @@ public int hashCode() { serverUsed, userData, queryID, + page, + nbHits, + nbPages, + hitsPerPage, hits, query, params, @@ -619,14 +619,10 @@ public String toString() { sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); sb.append(" processingTimingsMS: ").append(toIndentedString(processingTimingsMS)).append("\n"); @@ -637,6 +633,10 @@ public String toString() { sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" queryID: ").append(toIndentedString(queryID)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/models.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/models.ts index a4708f88082..cbc1bda4a82 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/models.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/models.ts @@ -59,6 +59,7 @@ import { RemoveStopWords, RemoveWordsIfNoResults, RenderingContent, + SearchPagination, SearchParams, SearchParamsObject, SearchParamsQuery, @@ -148,6 +149,7 @@ export { SearchParamsObject, SearchParamsQuery, SemanticSearch, + SearchPagination, SnippetResult, SnippetResultOption, SortRemainingBy, diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts index 36d94a46f96..227c5fb37f6 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts @@ -53,11 +53,6 @@ export type BaseSearchResponse = Record & { */ facets_stats?: Record; - /** - * Number of hits per page. - */ - hitsPerPage: number; - /** * Index name used for the query. */ @@ -73,26 +68,11 @@ export type BaseSearchResponse = Record & { */ message?: string; - /** - * Number of results (hits). - */ - nbHits: number; - - /** - * Number of pages of results. - */ - nbPages: number; - /** * Number of hits selected and sorted by the relevant sort algorithm. */ nbSortedHits?: number; - /** - * Page of search results to retrieve. - */ - page: number; - /** * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. */ diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browsePagination.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browsePagination.ts new file mode 100644 index 00000000000..3a9bb25eb3a --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browsePagination.ts @@ -0,0 +1,23 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +export type BrowsePagination = { + /** + * Page of search results to retrieve. + */ + page?: number; + + /** + * Number of results (hits). + */ + nbHits?: number; + + /** + * Number of pages of results. + */ + nbPages?: number; + + /** + * Number of hits per page. + */ + hitsPerPage?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browseResponse.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browseResponse.ts index b05c2d49553..ec2bed56a9d 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browseResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/browseResponse.ts @@ -1,9 +1,11 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. import type { BaseSearchResponse } from './baseSearchResponse'; +import type { BrowsePagination } from './browsePagination'; import type { Cursor } from './cursor'; import type { SearchHits } from './searchHits'; export type BrowseResponse> = BaseSearchResponse & + BrowsePagination & Cursor & SearchHits; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/index.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/index.ts index 44579c9168f..57a2fd4c66f 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/index.ts @@ -17,6 +17,7 @@ export * from './baseSearchParams'; export * from './baseSearchParamsWithoutQuery'; export * from './baseSearchResponse'; export * from './boughtTogetherQuery'; +export * from './browsePagination'; export * from './browseParamsObject'; export * from './browseResponse'; export * from './consequenceParams'; @@ -84,6 +85,7 @@ export * from './searchForHits'; export * from './searchForHitsOptions'; export * from './searchHits'; export * from './searchMethodParams'; +export * from './searchPagination'; export * from './searchParams'; export * from './searchParamsObject'; export * from './searchParamsQuery'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/recommendationsResults.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/recommendationsResults.ts index e58e371c417..3688fc364c1 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/recommendationsResults.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/recommendationsResults.ts @@ -2,5 +2,8 @@ import type { BaseSearchResponse } from './baseSearchResponse'; import type { RecommendationsHits } from './recommendationsHits'; +import type { SearchPagination } from './searchPagination'; -export type RecommendationsResults = BaseSearchResponse & RecommendationsHits; +export type RecommendationsResults = BaseSearchResponse & + RecommendationsHits & + SearchPagination; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchPagination.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchPagination.ts new file mode 100644 index 00000000000..d5420c6286d --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchPagination.ts @@ -0,0 +1,23 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +export type SearchPagination = { + /** + * Page of search results to retrieve. + */ + page: number; + + /** + * Number of results (hits). + */ + nbHits: number; + + /** + * Number of pages of results. + */ + nbPages: number; + + /** + * Number of hits per page. + */ + hitsPerPage: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchResponse.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchResponse.ts index fdde5aa89c7..e785a3e5d12 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchResponse.ts @@ -2,6 +2,8 @@ import type { BaseSearchResponse } from './baseSearchResponse'; import type { SearchHits } from './searchHits'; +import type { SearchPagination } from './searchPagination'; export type SearchResponse> = BaseSearchResponse & - SearchHits; + SearchHits & + SearchPagination; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts index 36d94a46f96..227c5fb37f6 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts @@ -53,11 +53,6 @@ export type BaseSearchResponse = Record & { */ facets_stats?: Record; - /** - * Number of hits per page. - */ - hitsPerPage: number; - /** * Index name used for the query. */ @@ -73,26 +68,11 @@ export type BaseSearchResponse = Record & { */ message?: string; - /** - * Number of results (hits). - */ - nbHits: number; - - /** - * Number of pages of results. - */ - nbPages: number; - /** * Number of hits selected and sorted by the relevant sort algorithm. */ nbSortedHits?: number; - /** - * Page of search results to retrieve. - */ - page: number; - /** * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. */ diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/browsePagination.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/browsePagination.ts new file mode 100644 index 00000000000..3a9bb25eb3a --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/browsePagination.ts @@ -0,0 +1,23 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +export type BrowsePagination = { + /** + * Page of search results to retrieve. + */ + page?: number; + + /** + * Number of results (hits). + */ + nbHits?: number; + + /** + * Number of pages of results. + */ + nbPages?: number; + + /** + * Number of hits per page. + */ + hitsPerPage?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts index b05c2d49553..ec2bed56a9d 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts @@ -1,9 +1,11 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. import type { BaseSearchResponse } from './baseSearchResponse'; +import type { BrowsePagination } from './browsePagination'; import type { Cursor } from './cursor'; import type { SearchHits } from './searchHits'; export type BrowseResponse> = BaseSearchResponse & + BrowsePagination & Cursor & SearchHits; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts index e838c500233..b7f0f409992 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts @@ -28,6 +28,7 @@ export * from './batchParams'; export * from './batchRequest'; export * from './batchResponse'; export * from './batchWriteParams'; +export * from './browsePagination'; export * from './browseParams'; export * from './browseParamsObject'; export * from './browseResponse'; @@ -127,6 +128,7 @@ export * from './searchForHits'; export * from './searchForHitsOptions'; export * from './searchHits'; export * from './searchMethodParams'; +export * from './searchPagination'; export * from './searchParams'; export * from './searchParamsObject'; export * from './searchParamsQuery'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchPagination.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchPagination.ts new file mode 100644 index 00000000000..d5420c6286d --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/searchPagination.ts @@ -0,0 +1,23 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +export type SearchPagination = { + /** + * Page of search results to retrieve. + */ + page: number; + + /** + * Number of results (hits). + */ + nbHits: number; + + /** + * Number of pages of results. + */ + nbPages: number; + + /** + * Number of hits per page. + */ + hitsPerPage: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts index fdde5aa89c7..e785a3e5d12 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts @@ -2,6 +2,8 @@ import type { BaseSearchResponse } from './baseSearchResponse'; import type { SearchHits } from './searchHits'; +import type { SearchPagination } from './searchPagination'; export type SearchResponse> = BaseSearchResponse & - SearchHits; + SearchHits & + SearchPagination; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts index 36d94a46f96..227c5fb37f6 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts @@ -53,11 +53,6 @@ export type BaseSearchResponse = Record & { */ facets_stats?: Record; - /** - * Number of hits per page. - */ - hitsPerPage: number; - /** * Index name used for the query. */ @@ -73,26 +68,11 @@ export type BaseSearchResponse = Record & { */ message?: string; - /** - * Number of results (hits). - */ - nbHits: number; - - /** - * Number of pages of results. - */ - nbPages: number; - /** * Number of hits selected and sorted by the relevant sort algorithm. */ nbSortedHits?: number; - /** - * Page of search results to retrieve. - */ - page: number; - /** * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. */ diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts index 72dc4071df0..1cfa4fa0b47 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts @@ -69,6 +69,7 @@ export * from './relatedQuery'; export * from './removeStopWords'; export * from './removeWordsIfNoResults'; export * from './renderingContent'; +export * from './searchPagination'; export * from './searchParams'; export * from './searchParamsObject'; export * from './searchParamsQuery'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResults.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResults.ts index e58e371c417..3688fc364c1 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResults.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResults.ts @@ -2,5 +2,8 @@ import type { BaseSearchResponse } from './baseSearchResponse'; import type { RecommendationsHits } from './recommendationsHits'; +import type { SearchPagination } from './searchPagination'; -export type RecommendationsResults = BaseSearchResponse & RecommendationsHits; +export type RecommendationsResults = BaseSearchResponse & + RecommendationsHits & + SearchPagination; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/searchPagination.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/searchPagination.ts new file mode 100644 index 00000000000..d5420c6286d --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/searchPagination.ts @@ -0,0 +1,23 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +export type SearchPagination = { + /** + * Page of search results to retrieve. + */ + page: number; + + /** + * Number of results (hits). + */ + nbHits: number; + + /** + * Number of pages of results. + */ + nbPages: number; + + /** + * Number of hits per page. + */ + hitsPerPage: number; +}; diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/BaseSearchResponse.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/BaseSearchResponse.kt index 3b6e34831da..701effa8eef 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/BaseSearchResponse.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/BaseSearchResponse.kt @@ -10,10 +10,6 @@ import kotlinx.serialization.json.* /** * BaseSearchResponse * - * @param hitsPerPage Number of hits per page. - * @param nbHits Number of results (hits). - * @param nbPages Number of pages of results. - * @param page Page of search results to retrieve. * @param processingTimeMS Time the server took to process the request, in milliseconds. * @param abTestID A/B test ID. This is only included in the response for indices that are part of an A/B test. * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. @@ -42,18 +38,6 @@ import kotlinx.serialization.json.* @Serializable(BaseSearchResponseSerializer::class) public data class BaseSearchResponse( - /** Number of hits per page. */ - val hitsPerPage: Int, - - /** Number of results (hits). */ - val nbHits: Int, - - /** Number of pages of results. */ - val nbPages: Int, - - /** Page of search results to retrieve. */ - val page: Int, - /** Time the server took to process the request, in milliseconds. */ val processingTimeMS: Int, @@ -132,10 +116,6 @@ public data class BaseSearchResponse( internal object BaseSearchResponseSerializer : KSerializer { override val descriptor: SerialDescriptor = buildClassSerialDescriptor("BaseSearchResponse") { - element("hitsPerPage") - element("nbHits") - element("nbPages") - element("page") element("processingTimeMS") element("abTestID", isOptional = true) element("abTestVariantID", isOptional = true) @@ -166,10 +146,6 @@ internal object BaseSearchResponseSerializer : KSerializer { val input = decoder.asJsonDecoder() val tree = input.decodeJsonObject() return BaseSearchResponse( - hitsPerPage = tree.getValue("hitsPerPage").let { input.json.decodeFromJsonElement(it) }, - nbHits = tree.getValue("nbHits").let { input.json.decodeFromJsonElement(it) }, - nbPages = tree.getValue("nbPages").let { input.json.decodeFromJsonElement(it) }, - page = tree.getValue("page").let { input.json.decodeFromJsonElement(it) }, processingTimeMS = tree.getValue("processingTimeMS").let { input.json.decodeFromJsonElement(it) }, abTestID = tree["abTestID"]?.let { input.json.decodeFromJsonElement(it) }, abTestVariantID = tree["abTestVariantID"]?.let { input.json.decodeFromJsonElement(it) }, @@ -201,10 +177,6 @@ internal object BaseSearchResponseSerializer : KSerializer { override fun serialize(encoder: Encoder, value: BaseSearchResponse) { val output = encoder.asJsonEncoder() val json = buildJsonObject { - put("hitsPerPage", output.json.encodeToJsonElement(value.hitsPerPage)) - put("nbHits", output.json.encodeToJsonElement(value.nbHits)) - put("nbPages", output.json.encodeToJsonElement(value.nbPages)) - put("page", output.json.encodeToJsonElement(value.page)) put("processingTimeMS", output.json.encodeToJsonElement(value.processingTimeMS)) value.abTestID?.let { put("abTestID", output.json.encodeToJsonElement(it)) } value.abTestVariantID?.let { put("abTestVariantID", output.json.encodeToJsonElement(it)) } diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/RecommendationsResults.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/RecommendationsResults.kt index 36332749718..9bb210ab11f 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/RecommendationsResults.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/RecommendationsResults.kt @@ -7,11 +7,11 @@ import kotlinx.serialization.json.* /** * RecommendationsResults * - * @param hitsPerPage Number of hits per page. + * @param processingTimeMS Time the server took to process the request, in milliseconds. + * @param page Page of search results to retrieve. * @param nbHits Number of results (hits). * @param nbPages Number of pages of results. - * @param page Page of search results to retrieve. - * @param processingTimeMS Time the server took to process the request, in milliseconds. + * @param hitsPerPage Number of hits per page. * @param hits * @param abTestID A/B test ID. This is only included in the response for indices that are part of an A/B test. * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. @@ -40,8 +40,11 @@ import kotlinx.serialization.json.* @Serializable public data class RecommendationsResults( - /** Number of hits per page. */ - @SerialName(value = "hitsPerPage") val hitsPerPage: Int, + /** Time the server took to process the request, in milliseconds. */ + @SerialName(value = "processingTimeMS") val processingTimeMS: Int, + + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int, /** Number of results (hits). */ @SerialName(value = "nbHits") val nbHits: Int, @@ -49,11 +52,8 @@ public data class RecommendationsResults( /** Number of pages of results. */ @SerialName(value = "nbPages") val nbPages: Int, - /** Page of search results to retrieve. */ - @SerialName(value = "page") val page: Int, - - /** Time the server took to process the request, in milliseconds. */ - @SerialName(value = "processingTimeMS") val processingTimeMS: Int, + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int, @SerialName(value = "hits") val hits: List, diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/SearchPagination.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/SearchPagination.kt new file mode 100644 index 00000000000..9c54391a855 --- /dev/null +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/SearchPagination.kt @@ -0,0 +1,29 @@ +/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */ +package com.algolia.client.model.recommend + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchPagination + * + * @param page Page of search results to retrieve. + * @param nbHits Number of results (hits). + * @param nbPages Number of pages of results. + * @param hitsPerPage Number of hits per page. + */ +@Serializable +public data class SearchPagination( + + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int, + + /** Number of results (hits). */ + @SerialName(value = "nbHits") val nbHits: Int, + + /** Number of pages of results. */ + @SerialName(value = "nbPages") val nbPages: Int, + + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int, +) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponse.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponse.kt index e17a141e1b0..d24fccb6055 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponse.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponse.kt @@ -10,10 +10,6 @@ import kotlinx.serialization.json.* /** * BaseSearchResponse * - * @param hitsPerPage Number of hits per page. - * @param nbHits Number of results (hits). - * @param nbPages Number of pages of results. - * @param page Page of search results to retrieve. * @param processingTimeMS Time the server took to process the request, in milliseconds. * @param abTestID A/B test ID. This is only included in the response for indices that are part of an A/B test. * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. @@ -42,18 +38,6 @@ import kotlinx.serialization.json.* @Serializable(BaseSearchResponseSerializer::class) public data class BaseSearchResponse( - /** Number of hits per page. */ - val hitsPerPage: Int, - - /** Number of results (hits). */ - val nbHits: Int, - - /** Number of pages of results. */ - val nbPages: Int, - - /** Page of search results to retrieve. */ - val page: Int, - /** Time the server took to process the request, in milliseconds. */ val processingTimeMS: Int, @@ -132,10 +116,6 @@ public data class BaseSearchResponse( internal object BaseSearchResponseSerializer : KSerializer { override val descriptor: SerialDescriptor = buildClassSerialDescriptor("BaseSearchResponse") { - element("hitsPerPage") - element("nbHits") - element("nbPages") - element("page") element("processingTimeMS") element("abTestID", isOptional = true) element("abTestVariantID", isOptional = true) @@ -166,10 +146,6 @@ internal object BaseSearchResponseSerializer : KSerializer { val input = decoder.asJsonDecoder() val tree = input.decodeJsonObject() return BaseSearchResponse( - hitsPerPage = tree.getValue("hitsPerPage").let { input.json.decodeFromJsonElement(it) }, - nbHits = tree.getValue("nbHits").let { input.json.decodeFromJsonElement(it) }, - nbPages = tree.getValue("nbPages").let { input.json.decodeFromJsonElement(it) }, - page = tree.getValue("page").let { input.json.decodeFromJsonElement(it) }, processingTimeMS = tree.getValue("processingTimeMS").let { input.json.decodeFromJsonElement(it) }, abTestID = tree["abTestID"]?.let { input.json.decodeFromJsonElement(it) }, abTestVariantID = tree["abTestVariantID"]?.let { input.json.decodeFromJsonElement(it) }, @@ -201,10 +177,6 @@ internal object BaseSearchResponseSerializer : KSerializer { override fun serialize(encoder: Encoder, value: BaseSearchResponse) { val output = encoder.asJsonEncoder() val json = buildJsonObject { - put("hitsPerPage", output.json.encodeToJsonElement(value.hitsPerPage)) - put("nbHits", output.json.encodeToJsonElement(value.nbHits)) - put("nbPages", output.json.encodeToJsonElement(value.nbPages)) - put("page", output.json.encodeToJsonElement(value.page)) put("processingTimeMS", output.json.encodeToJsonElement(value.processingTimeMS)) value.abTestID?.let { put("abTestID", output.json.encodeToJsonElement(it)) } value.abTestVariantID?.let { put("abTestVariantID", output.json.encodeToJsonElement(it)) } diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowsePagination.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowsePagination.kt new file mode 100644 index 00000000000..990494dbae8 --- /dev/null +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowsePagination.kt @@ -0,0 +1,29 @@ +/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */ +package com.algolia.client.model.search + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * BrowsePagination + * + * @param page Page of search results to retrieve. + * @param nbHits Number of results (hits). + * @param nbPages Number of pages of results. + * @param hitsPerPage Number of hits per page. + */ +@Serializable +public data class BrowsePagination( + + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int? = null, + + /** Number of results (hits). */ + @SerialName(value = "nbHits") val nbHits: Int? = null, + + /** Number of pages of results. */ + @SerialName(value = "nbPages") val nbPages: Int? = null, + + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int? = null, +) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowseResponse.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowseResponse.kt index e68d2240883..bc6a06f5823 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowseResponse.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BrowseResponse.kt @@ -7,10 +7,6 @@ import kotlinx.serialization.json.* /** * BrowseResponse * - * @param hitsPerPage Number of hits per page. - * @param nbHits Number of results (hits). - * @param nbPages Number of pages of results. - * @param page Page of search results to retrieve. * @param processingTimeMS Time the server took to process the request, in milliseconds. * @param hits Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. * @param query Search query. @@ -38,23 +34,15 @@ import kotlinx.serialization.json.* * @param serverUsed Host name of the server that processed the request. * @param userData An object with custom data. You can store up to 32kB as custom data. * @param queryID Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). + * @param page Page of search results to retrieve. + * @param nbHits Number of results (hits). + * @param nbPages Number of pages of results. + * @param hitsPerPage Number of hits per page. * @param cursor Cursor to get the next page of the response. The parameter must match the value returned in the response of a previous request. The last page of the response does not return a `cursor` attribute. */ @Serializable public data class BrowseResponse( - /** Number of hits per page. */ - @SerialName(value = "hitsPerPage") val hitsPerPage: Int, - - /** Number of results (hits). */ - @SerialName(value = "nbHits") val nbHits: Int, - - /** Number of pages of results. */ - @SerialName(value = "nbPages") val nbPages: Int, - - /** Page of search results to retrieve. */ - @SerialName(value = "page") val page: Int, - /** Time the server took to process the request, in milliseconds. */ @SerialName(value = "processingTimeMS") val processingTimeMS: Int, @@ -136,6 +124,18 @@ public data class BrowseResponse( /** Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). */ @SerialName(value = "queryID") val queryID: String? = null, + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int? = null, + + /** Number of results (hits). */ + @SerialName(value = "nbHits") val nbHits: Int? = null, + + /** Number of pages of results. */ + @SerialName(value = "nbPages") val nbPages: Int? = null, + + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int? = null, + /** Cursor to get the next page of the response. The parameter must match the value returned in the response of a previous request. The last page of the response does not return a `cursor` attribute. */ @SerialName(value = "cursor") val cursor: String? = null, ) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchPagination.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchPagination.kt new file mode 100644 index 00000000000..4a5e0f50a60 --- /dev/null +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchPagination.kt @@ -0,0 +1,29 @@ +/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */ +package com.algolia.client.model.search + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchPagination + * + * @param page Page of search results to retrieve. + * @param nbHits Number of results (hits). + * @param nbPages Number of pages of results. + * @param hitsPerPage Number of hits per page. + */ +@Serializable +public data class SearchPagination( + + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int, + + /** Number of results (hits). */ + @SerialName(value = "nbHits") val nbHits: Int, + + /** Number of pages of results. */ + @SerialName(value = "nbPages") val nbPages: Int, + + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int, +) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchResponse.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchResponse.kt index 64a96d73677..333a745c119 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchResponse.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchResponse.kt @@ -10,11 +10,11 @@ import kotlinx.serialization.json.* /** * SearchResponse * - * @param hitsPerPage Number of hits per page. + * @param processingTimeMS Time the server took to process the request, in milliseconds. + * @param page Page of search results to retrieve. * @param nbHits Number of results (hits). * @param nbPages Number of pages of results. - * @param page Page of search results to retrieve. - * @param processingTimeMS Time the server took to process the request, in milliseconds. + * @param hitsPerPage Number of hits per page. * @param hits Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. * @param query Search query. * @param params URL-encoded string of all search parameters. @@ -45,8 +45,11 @@ import kotlinx.serialization.json.* @Serializable(SearchResponseSerializer::class) public data class SearchResponse( - /** Number of hits per page. */ - val hitsPerPage: Int, + /** Time the server took to process the request, in milliseconds. */ + val processingTimeMS: Int, + + /** Page of search results to retrieve. */ + val page: Int, /** Number of results (hits). */ val nbHits: Int, @@ -54,11 +57,8 @@ public data class SearchResponse( /** Number of pages of results. */ val nbPages: Int, - /** Page of search results to retrieve. */ - val page: Int, - - /** Time the server took to process the request, in milliseconds. */ - val processingTimeMS: Int, + /** Number of hits per page. */ + val hitsPerPage: Int, /** Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. */ val hits: List, @@ -144,11 +144,11 @@ public data class SearchResponse( internal object SearchResponseSerializer : KSerializer { override val descriptor: SerialDescriptor = buildClassSerialDescriptor("SearchResponse") { - element("hitsPerPage") + element("processingTimeMS") + element("page") element("nbHits") element("nbPages") - element("page") - element("processingTimeMS") + element("hitsPerPage") element>("hits") element("query") element("params") @@ -181,11 +181,11 @@ internal object SearchResponseSerializer : KSerializer { val input = decoder.asJsonDecoder() val tree = input.decodeJsonObject() return SearchResponse( - hitsPerPage = tree.getValue("hitsPerPage").let { input.json.decodeFromJsonElement(it) }, + processingTimeMS = tree.getValue("processingTimeMS").let { input.json.decodeFromJsonElement(it) }, + page = tree.getValue("page").let { input.json.decodeFromJsonElement(it) }, nbHits = tree.getValue("nbHits").let { input.json.decodeFromJsonElement(it) }, nbPages = tree.getValue("nbPages").let { input.json.decodeFromJsonElement(it) }, - page = tree.getValue("page").let { input.json.decodeFromJsonElement(it) }, - processingTimeMS = tree.getValue("processingTimeMS").let { input.json.decodeFromJsonElement(it) }, + hitsPerPage = tree.getValue("hitsPerPage").let { input.json.decodeFromJsonElement(it) }, hits = tree.getValue("hits").let { input.json.decodeFromJsonElement(it) }, query = tree.getValue("query").let { input.json.decodeFromJsonElement(it) }, params = tree.getValue("params").let { input.json.decodeFromJsonElement(it) }, @@ -219,11 +219,11 @@ internal object SearchResponseSerializer : KSerializer { override fun serialize(encoder: Encoder, value: SearchResponse) { val output = encoder.asJsonEncoder() val json = buildJsonObject { - put("hitsPerPage", output.json.encodeToJsonElement(value.hitsPerPage)) + put("processingTimeMS", output.json.encodeToJsonElement(value.processingTimeMS)) + put("page", output.json.encodeToJsonElement(value.page)) put("nbHits", output.json.encodeToJsonElement(value.nbHits)) put("nbPages", output.json.encodeToJsonElement(value.nbPages)) - put("page", output.json.encodeToJsonElement(value.page)) - put("processingTimeMS", output.json.encodeToJsonElement(value.processingTimeMS)) + put("hitsPerPage", output.json.encodeToJsonElement(value.hitsPerPage)) put("hits", output.json.encodeToJsonElement(value.hits)) put("query", output.json.encodeToJsonElement(value.query)) put("params", output.json.encodeToJsonElement(value.params)) diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponse.php index fe349d197e7..f27b247851b 100644 --- a/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponse.php @@ -29,14 +29,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'bool', 'facets' => 'array>', 'facetsStats' => 'array', - 'hitsPerPage' => 'int', 'index' => 'string', 'indexUsed' => 'string', 'message' => 'string', - 'nbHits' => 'int', - 'nbPages' => 'int', 'nbSortedHits' => 'int', - 'page' => 'int', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', 'processingTimingsMS' => 'object', @@ -65,14 +61,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => null, 'facets' => null, 'facetsStats' => null, - 'hitsPerPage' => null, 'index' => null, 'indexUsed' => null, 'message' => null, - 'nbHits' => null, - 'nbPages' => null, 'nbSortedHits' => null, - 'page' => null, 'parsedQuery' => null, 'processingTimeMS' => null, 'processingTimingsMS' => null, @@ -102,14 +94,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'exhaustiveTypo', 'facets' => 'facets', 'facetsStats' => 'facets_stats', - 'hitsPerPage' => 'hitsPerPage', 'index' => 'index', 'indexUsed' => 'indexUsed', 'message' => 'message', - 'nbHits' => 'nbHits', - 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', - 'page' => 'page', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', 'processingTimingsMS' => 'processingTimingsMS', @@ -138,14 +126,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'setExhaustiveTypo', 'facets' => 'setFacets', 'facetsStats' => 'setFacetsStats', - 'hitsPerPage' => 'setHitsPerPage', 'index' => 'setIndex', 'indexUsed' => 'setIndexUsed', 'message' => 'setMessage', - 'nbHits' => 'setNbHits', - 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', - 'page' => 'setPage', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', 'processingTimingsMS' => 'setProcessingTimingsMS', @@ -174,14 +158,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'getExhaustiveTypo', 'facets' => 'getFacets', 'facetsStats' => 'getFacetsStats', - 'hitsPerPage' => 'getHitsPerPage', 'index' => 'getIndex', 'indexUsed' => 'getIndexUsed', 'message' => 'getMessage', - 'nbHits' => 'getNbHits', - 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', - 'page' => 'getPage', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', 'processingTimingsMS' => 'getProcessingTimingsMS', @@ -238,9 +218,6 @@ public function __construct(?array $data = null) if (isset($data['facetsStats'])) { $this->container['facetsStats'] = $data['facetsStats']; } - if (isset($data['hitsPerPage'])) { - $this->container['hitsPerPage'] = $data['hitsPerPage']; - } if (isset($data['index'])) { $this->container['index'] = $data['index']; } @@ -250,18 +227,9 @@ public function __construct(?array $data = null) if (isset($data['message'])) { $this->container['message'] = $data['message']; } - if (isset($data['nbHits'])) { - $this->container['nbHits'] = $data['nbHits']; - } - if (isset($data['nbPages'])) { - $this->container['nbPages'] = $data['nbPages']; - } if (isset($data['nbSortedHits'])) { $this->container['nbSortedHits'] = $data['nbSortedHits']; } - if (isset($data['page'])) { - $this->container['page'] = $data['page']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } @@ -362,30 +330,6 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'aroundLatLng', must be conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."; } - if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { - $invalidProperties[] = "'hitsPerPage' can't be null"; - } - if ($this->container['hitsPerPage'] > 1000) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; - } - - if ($this->container['hitsPerPage'] < 1) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; - } - - if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { - $invalidProperties[] = "'nbHits' can't be null"; - } - if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { - $invalidProperties[] = "'nbPages' can't be null"; - } - if (!isset($this->container['page']) || null === $this->container['page']) { - $invalidProperties[] = "'page' can't be null"; - } - if ($this->container['page'] < 0) { - $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; - } - if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { $invalidProperties[] = "'processingTimeMS' can't be null"; } @@ -664,37 +608,6 @@ public function setFacetsStats($facetsStats) return $this; } - /** - * Gets hitsPerPage. - * - * @return int - */ - public function getHitsPerPage() - { - return $this->container['hitsPerPage'] ?? null; - } - - /** - * Sets hitsPerPage. - * - * @param int $hitsPerPage number of hits per page - * - * @return self - */ - public function setHitsPerPage($hitsPerPage) - { - if ($hitsPerPage > 1000) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BaseSearchResponse., must be smaller than or equal to 1000.'); - } - if ($hitsPerPage < 1) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BaseSearchResponse., must be bigger than or equal to 1.'); - } - - $this->container['hitsPerPage'] = $hitsPerPage; - - return $this; - } - /** * Gets index. * @@ -767,54 +680,6 @@ public function setMessage($message) return $this; } - /** - * Gets nbHits. - * - * @return int - */ - public function getNbHits() - { - return $this->container['nbHits'] ?? null; - } - - /** - * Sets nbHits. - * - * @param int $nbHits number of results (hits) - * - * @return self - */ - public function setNbHits($nbHits) - { - $this->container['nbHits'] = $nbHits; - - return $this; - } - - /** - * Gets nbPages. - * - * @return int - */ - public function getNbPages() - { - return $this->container['nbPages'] ?? null; - } - - /** - * Sets nbPages. - * - * @param int $nbPages number of pages of results - * - * @return self - */ - public function setNbPages($nbPages) - { - $this->container['nbPages'] = $nbPages; - - return $this; - } - /** * Gets nbSortedHits. * @@ -839,34 +704,6 @@ public function setNbSortedHits($nbSortedHits) return $this; } - /** - * Gets page. - * - * @return int - */ - public function getPage() - { - return $this->container['page'] ?? null; - } - - /** - * Sets page. - * - * @param int $page page of search results to retrieve - * - * @return self - */ - public function setPage($page) - { - if ($page < 0) { - throw new \InvalidArgumentException('invalid value for $page when calling BaseSearchResponse., must be bigger than or equal to 0.'); - } - - $this->container['page'] = $page; - - return $this; - } - /** * Gets parsedQuery. * diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendationsResults.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendationsResults.php index 21437941eb1..ea615d3c017 100644 --- a/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendationsResults.php +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendationsResults.php @@ -29,14 +29,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'exhaustiveTypo' => 'bool', 'facets' => 'array>', 'facetsStats' => 'array', - 'hitsPerPage' => 'int', 'index' => 'string', 'indexUsed' => 'string', 'message' => 'string', - 'nbHits' => 'int', - 'nbPages' => 'int', 'nbSortedHits' => 'int', - 'page' => 'int', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', 'processingTimingsMS' => 'object', @@ -47,6 +43,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'serverUsed' => 'string', 'userData' => 'object', 'queryID' => 'string', + 'page' => 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', 'hits' => '\Algolia\AlgoliaSearch\Model\Recommend\RecommendationsHit[]', ]; @@ -66,14 +66,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'exhaustiveTypo' => null, 'facets' => null, 'facetsStats' => null, - 'hitsPerPage' => null, 'index' => null, 'indexUsed' => null, 'message' => null, - 'nbHits' => null, - 'nbPages' => null, 'nbSortedHits' => null, - 'page' => null, 'parsedQuery' => null, 'processingTimeMS' => null, 'processingTimingsMS' => null, @@ -84,6 +80,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'serverUsed' => null, 'userData' => null, 'queryID' => null, + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, 'hits' => null, ]; @@ -104,14 +104,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'exhaustiveTypo' => 'exhaustiveTypo', 'facets' => 'facets', 'facetsStats' => 'facets_stats', - 'hitsPerPage' => 'hitsPerPage', 'index' => 'index', 'indexUsed' => 'indexUsed', 'message' => 'message', - 'nbHits' => 'nbHits', - 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', - 'page' => 'page', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', 'processingTimingsMS' => 'processingTimingsMS', @@ -122,6 +118,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'serverUsed' => 'serverUsed', 'userData' => 'userData', 'queryID' => 'queryID', + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', 'hits' => 'hits', ]; @@ -141,14 +141,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'exhaustiveTypo' => 'setExhaustiveTypo', 'facets' => 'setFacets', 'facetsStats' => 'setFacetsStats', - 'hitsPerPage' => 'setHitsPerPage', 'index' => 'setIndex', 'indexUsed' => 'setIndexUsed', 'message' => 'setMessage', - 'nbHits' => 'setNbHits', - 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', - 'page' => 'setPage', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', 'processingTimingsMS' => 'setProcessingTimingsMS', @@ -159,6 +155,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', 'queryID' => 'setQueryID', + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', 'hits' => 'setHits', ]; @@ -178,14 +178,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'exhaustiveTypo' => 'getExhaustiveTypo', 'facets' => 'getFacets', 'facetsStats' => 'getFacetsStats', - 'hitsPerPage' => 'getHitsPerPage', 'index' => 'getIndex', 'indexUsed' => 'getIndexUsed', 'message' => 'getMessage', - 'nbHits' => 'getNbHits', - 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', - 'page' => 'getPage', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', 'processingTimingsMS' => 'getProcessingTimingsMS', @@ -196,6 +192,10 @@ class RecommendationsResults extends AbstractModel implements ModelInterface, \A 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', 'queryID' => 'getQueryID', + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', 'hits' => 'getHits', ]; @@ -243,9 +243,6 @@ public function __construct(?array $data = null) if (isset($data['facetsStats'])) { $this->container['facetsStats'] = $data['facetsStats']; } - if (isset($data['hitsPerPage'])) { - $this->container['hitsPerPage'] = $data['hitsPerPage']; - } if (isset($data['index'])) { $this->container['index'] = $data['index']; } @@ -255,18 +252,9 @@ public function __construct(?array $data = null) if (isset($data['message'])) { $this->container['message'] = $data['message']; } - if (isset($data['nbHits'])) { - $this->container['nbHits'] = $data['nbHits']; - } - if (isset($data['nbPages'])) { - $this->container['nbPages'] = $data['nbPages']; - } if (isset($data['nbSortedHits'])) { $this->container['nbSortedHits'] = $data['nbSortedHits']; } - if (isset($data['page'])) { - $this->container['page'] = $data['page']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } @@ -297,6 +285,18 @@ public function __construct(?array $data = null) if (isset($data['queryID'])) { $this->container['queryID'] = $data['queryID']; } + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -370,15 +370,14 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'aroundLatLng', must be conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."; } - if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { - $invalidProperties[] = "'hitsPerPage' can't be null"; + if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { + $invalidProperties[] = "'processingTimeMS' can't be null"; } - if ($this->container['hitsPerPage'] > 1000) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + if (!isset($this->container['page']) || null === $this->container['page']) { + $invalidProperties[] = "'page' can't be null"; } - - if ($this->container['hitsPerPage'] < 1) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + if ($this->container['page'] < 0) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; } if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { @@ -387,16 +386,17 @@ public function listInvalidProperties() if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { $invalidProperties[] = "'nbPages' can't be null"; } - if (!isset($this->container['page']) || null === $this->container['page']) { - $invalidProperties[] = "'page' can't be null"; + if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { + $invalidProperties[] = "'hitsPerPage' can't be null"; } - if ($this->container['page'] < 0) { - $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + if ($this->container['hitsPerPage'] > 1000) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; } - if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { - $invalidProperties[] = "'processingTimeMS' can't be null"; + if ($this->container['hitsPerPage'] < 1) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; } + if (!isset($this->container['hits']) || null === $this->container['hits']) { $invalidProperties[] = "'hits' can't be null"; } @@ -675,37 +675,6 @@ public function setFacetsStats($facetsStats) return $this; } - /** - * Gets hitsPerPage. - * - * @return int - */ - public function getHitsPerPage() - { - return $this->container['hitsPerPage'] ?? null; - } - - /** - * Sets hitsPerPage. - * - * @param int $hitsPerPage number of hits per page - * - * @return self - */ - public function setHitsPerPage($hitsPerPage) - { - if ($hitsPerPage > 1000) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling RecommendationsResults., must be smaller than or equal to 1000.'); - } - if ($hitsPerPage < 1) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling RecommendationsResults., must be bigger than or equal to 1.'); - } - - $this->container['hitsPerPage'] = $hitsPerPage; - - return $this; - } - /** * Gets index. * @@ -778,54 +747,6 @@ public function setMessage($message) return $this; } - /** - * Gets nbHits. - * - * @return int - */ - public function getNbHits() - { - return $this->container['nbHits'] ?? null; - } - - /** - * Sets nbHits. - * - * @param int $nbHits number of results (hits) - * - * @return self - */ - public function setNbHits($nbHits) - { - $this->container['nbHits'] = $nbHits; - - return $this; - } - - /** - * Gets nbPages. - * - * @return int - */ - public function getNbPages() - { - return $this->container['nbPages'] ?? null; - } - - /** - * Sets nbPages. - * - * @param int $nbPages number of pages of results - * - * @return self - */ - public function setNbPages($nbPages) - { - $this->container['nbPages'] = $nbPages; - - return $this; - } - /** * Gets nbSortedHits. * @@ -850,34 +771,6 @@ public function setNbSortedHits($nbSortedHits) return $this; } - /** - * Gets page. - * - * @return int - */ - public function getPage() - { - return $this->container['page'] ?? null; - } - - /** - * Sets page. - * - * @param int $page page of search results to retrieve - * - * @return self - */ - public function setPage($page) - { - if ($page < 0) { - throw new \InvalidArgumentException('invalid value for $page when calling RecommendationsResults., must be bigger than or equal to 0.'); - } - - $this->container['page'] = $page; - - return $this; - } - /** * Gets parsedQuery. * @@ -1118,6 +1011,113 @@ public function setQueryID($queryID) return $this; } + /** + * Gets page. + * + * @return int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if ($page < 0) { + throw new \InvalidArgumentException('invalid value for $page when calling RecommendationsResults., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if ($hitsPerPage > 1000) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling RecommendationsResults., must be smaller than or equal to 1000.'); + } + if ($hitsPerPage < 1) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling RecommendationsResults., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + /** * Gets hits. * diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/SearchPagination.php b/clients/algoliasearch-client-php/lib/Model/Recommend/SearchPagination.php new file mode 100644 index 00000000000..caffdcf928f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/SearchPagination.php @@ -0,0 +1,358 @@ + 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @var string[] + */ + protected static $modelFormats = [ + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @var string[] + */ + protected static $attributeMap = [ + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @var string[] + */ + protected static $setters = [ + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @var string[] + */ + protected static $getters = [ + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', + ]; + + /** + * Associative array for storing property values. + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor. + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(?array $data = null) + { + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of property to type mappings. Used for (de)serialization. + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!isset($this->container['page']) || null === $this->container['page']) { + $invalidProperties[] = "'page' can't be null"; + } + if ($this->container['page'] < 0) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + } + + if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { + $invalidProperties[] = "'nbHits' can't be null"; + } + if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { + $invalidProperties[] = "'nbPages' can't be null"; + } + if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { + $invalidProperties[] = "'hitsPerPage' can't be null"; + } + if ($this->container['hitsPerPage'] > 1000) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + } + + if ($this->container['hitsPerPage'] < 1) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed. + * + * @return bool True if all properties are valid + */ + public function valid() + { + return 0 === count($this->listInvalidProperties()); + } + + /** + * Gets page. + * + * @return int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if ($page < 0) { + throw new \InvalidArgumentException('invalid value for $page when calling SearchPagination., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if ($hitsPerPage > 1000) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchPagination., must be smaller than or equal to 1000.'); + } + if ($hitsPerPage < 1) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchPagination., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return null|mixed + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param null|int $offset Offset + * @param mixed $value Value to be set + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php index 0b0e49dbed4..f21803568c7 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php @@ -29,14 +29,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'bool', 'facets' => 'array>', 'facetsStats' => 'array', - 'hitsPerPage' => 'int', 'index' => 'string', 'indexUsed' => 'string', 'message' => 'string', - 'nbHits' => 'int', - 'nbPages' => 'int', 'nbSortedHits' => 'int', - 'page' => 'int', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', 'processingTimingsMS' => 'object', @@ -65,14 +61,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => null, 'facets' => null, 'facetsStats' => null, - 'hitsPerPage' => null, 'index' => null, 'indexUsed' => null, 'message' => null, - 'nbHits' => null, - 'nbPages' => null, 'nbSortedHits' => null, - 'page' => null, 'parsedQuery' => null, 'processingTimeMS' => null, 'processingTimingsMS' => null, @@ -102,14 +94,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'exhaustiveTypo', 'facets' => 'facets', 'facetsStats' => 'facets_stats', - 'hitsPerPage' => 'hitsPerPage', 'index' => 'index', 'indexUsed' => 'indexUsed', 'message' => 'message', - 'nbHits' => 'nbHits', - 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', - 'page' => 'page', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', 'processingTimingsMS' => 'processingTimingsMS', @@ -138,14 +126,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'setExhaustiveTypo', 'facets' => 'setFacets', 'facetsStats' => 'setFacetsStats', - 'hitsPerPage' => 'setHitsPerPage', 'index' => 'setIndex', 'indexUsed' => 'setIndexUsed', 'message' => 'setMessage', - 'nbHits' => 'setNbHits', - 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', - 'page' => 'setPage', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', 'processingTimingsMS' => 'setProcessingTimingsMS', @@ -174,14 +158,10 @@ class BaseSearchResponse extends AbstractModel implements ModelInterface, \Array 'exhaustiveTypo' => 'getExhaustiveTypo', 'facets' => 'getFacets', 'facetsStats' => 'getFacetsStats', - 'hitsPerPage' => 'getHitsPerPage', 'index' => 'getIndex', 'indexUsed' => 'getIndexUsed', 'message' => 'getMessage', - 'nbHits' => 'getNbHits', - 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', - 'page' => 'getPage', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', 'processingTimingsMS' => 'getProcessingTimingsMS', @@ -238,9 +218,6 @@ public function __construct(?array $data = null) if (isset($data['facetsStats'])) { $this->container['facetsStats'] = $data['facetsStats']; } - if (isset($data['hitsPerPage'])) { - $this->container['hitsPerPage'] = $data['hitsPerPage']; - } if (isset($data['index'])) { $this->container['index'] = $data['index']; } @@ -250,18 +227,9 @@ public function __construct(?array $data = null) if (isset($data['message'])) { $this->container['message'] = $data['message']; } - if (isset($data['nbHits'])) { - $this->container['nbHits'] = $data['nbHits']; - } - if (isset($data['nbPages'])) { - $this->container['nbPages'] = $data['nbPages']; - } if (isset($data['nbSortedHits'])) { $this->container['nbSortedHits'] = $data['nbSortedHits']; } - if (isset($data['page'])) { - $this->container['page'] = $data['page']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } @@ -362,30 +330,6 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'aroundLatLng', must be conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."; } - if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { - $invalidProperties[] = "'hitsPerPage' can't be null"; - } - if ($this->container['hitsPerPage'] > 1000) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; - } - - if ($this->container['hitsPerPage'] < 1) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; - } - - if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { - $invalidProperties[] = "'nbHits' can't be null"; - } - if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { - $invalidProperties[] = "'nbPages' can't be null"; - } - if (!isset($this->container['page']) || null === $this->container['page']) { - $invalidProperties[] = "'page' can't be null"; - } - if ($this->container['page'] < 0) { - $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; - } - if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { $invalidProperties[] = "'processingTimeMS' can't be null"; } @@ -664,37 +608,6 @@ public function setFacetsStats($facetsStats) return $this; } - /** - * Gets hitsPerPage. - * - * @return int - */ - public function getHitsPerPage() - { - return $this->container['hitsPerPage'] ?? null; - } - - /** - * Sets hitsPerPage. - * - * @param int $hitsPerPage number of hits per page - * - * @return self - */ - public function setHitsPerPage($hitsPerPage) - { - if ($hitsPerPage > 1000) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BaseSearchResponse., must be smaller than or equal to 1000.'); - } - if ($hitsPerPage < 1) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BaseSearchResponse., must be bigger than or equal to 1.'); - } - - $this->container['hitsPerPage'] = $hitsPerPage; - - return $this; - } - /** * Gets index. * @@ -767,54 +680,6 @@ public function setMessage($message) return $this; } - /** - * Gets nbHits. - * - * @return int - */ - public function getNbHits() - { - return $this->container['nbHits'] ?? null; - } - - /** - * Sets nbHits. - * - * @param int $nbHits number of results (hits) - * - * @return self - */ - public function setNbHits($nbHits) - { - $this->container['nbHits'] = $nbHits; - - return $this; - } - - /** - * Gets nbPages. - * - * @return int - */ - public function getNbPages() - { - return $this->container['nbPages'] ?? null; - } - - /** - * Sets nbPages. - * - * @param int $nbPages number of pages of results - * - * @return self - */ - public function setNbPages($nbPages) - { - $this->container['nbPages'] = $nbPages; - - return $this; - } - /** * Gets nbSortedHits. * @@ -839,34 +704,6 @@ public function setNbSortedHits($nbSortedHits) return $this; } - /** - * Gets page. - * - * @return int - */ - public function getPage() - { - return $this->container['page'] ?? null; - } - - /** - * Sets page. - * - * @param int $page page of search results to retrieve - * - * @return self - */ - public function setPage($page) - { - if ($page < 0) { - throw new \InvalidArgumentException('invalid value for $page when calling BaseSearchResponse., must be bigger than or equal to 0.'); - } - - $this->container['page'] = $page; - - return $this; - } - /** * Gets parsedQuery. * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/BrowsePagination.php b/clients/algoliasearch-client-php/lib/Model/Search/BrowsePagination.php new file mode 100644 index 00000000000..0e8f380173c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BrowsePagination.php @@ -0,0 +1,346 @@ + 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @var string[] + */ + protected static $modelFormats = [ + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @var string[] + */ + protected static $attributeMap = [ + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @var string[] + */ + protected static $setters = [ + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @var string[] + */ + protected static $getters = [ + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', + ]; + + /** + * Associative array for storing property values. + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor. + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(?array $data = null) + { + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of property to type mappings. Used for (de)serialization. + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (isset($this->container['page']) && ($this->container['page'] < 0)) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + } + + if (isset($this->container['hitsPerPage']) && ($this->container['hitsPerPage'] > 1000)) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + } + + if (isset($this->container['hitsPerPage']) && ($this->container['hitsPerPage'] < 1)) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed. + * + * @return bool True if all properties are valid + */ + public function valid() + { + return 0 === count($this->listInvalidProperties()); + } + + /** + * Gets page. + * + * @return null|int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param null|int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if (!is_null($page) && ($page < 0)) { + throw new \InvalidArgumentException('invalid value for $page when calling BrowsePagination., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return null|int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param null|int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return null|int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param null|int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return null|int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param null|int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if (!is_null($hitsPerPage) && ($hitsPerPage > 1000)) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BrowsePagination., must be smaller than or equal to 1000.'); + } + if (!is_null($hitsPerPage) && ($hitsPerPage < 1)) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BrowsePagination., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return null|mixed + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param null|int $offset Offset + * @param mixed $value Value to be set + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php index dec76517511..8ba63655d17 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php @@ -29,14 +29,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'bool', 'facets' => 'array>', 'facetsStats' => 'array', - 'hitsPerPage' => 'int', 'index' => 'string', 'indexUsed' => 'string', 'message' => 'string', - 'nbHits' => 'int', - 'nbPages' => 'int', 'nbSortedHits' => 'int', - 'page' => 'int', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', 'processingTimingsMS' => 'object', @@ -47,6 +43,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'string', 'userData' => 'object', 'queryID' => 'string', + 'page' => 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', 'query' => 'string', 'params' => 'string', @@ -69,14 +69,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => null, 'facets' => null, 'facetsStats' => null, - 'hitsPerPage' => null, 'index' => null, 'indexUsed' => null, 'message' => null, - 'nbHits' => null, - 'nbPages' => null, 'nbSortedHits' => null, - 'page' => null, 'parsedQuery' => null, 'processingTimeMS' => null, 'processingTimingsMS' => null, @@ -87,6 +83,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => null, 'userData' => null, 'queryID' => null, + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, 'hits' => null, 'query' => null, 'params' => null, @@ -110,14 +110,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'exhaustiveTypo', 'facets' => 'facets', 'facetsStats' => 'facets_stats', - 'hitsPerPage' => 'hitsPerPage', 'index' => 'index', 'indexUsed' => 'indexUsed', 'message' => 'message', - 'nbHits' => 'nbHits', - 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', - 'page' => 'page', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', 'processingTimingsMS' => 'processingTimingsMS', @@ -128,6 +124,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'serverUsed', 'userData' => 'userData', 'queryID' => 'queryID', + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', 'hits' => 'hits', 'query' => 'query', 'params' => 'params', @@ -150,14 +150,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'setExhaustiveTypo', 'facets' => 'setFacets', 'facetsStats' => 'setFacetsStats', - 'hitsPerPage' => 'setHitsPerPage', 'index' => 'setIndex', 'indexUsed' => 'setIndexUsed', 'message' => 'setMessage', - 'nbHits' => 'setNbHits', - 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', - 'page' => 'setPage', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', 'processingTimingsMS' => 'setProcessingTimingsMS', @@ -168,6 +164,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', 'queryID' => 'setQueryID', + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', 'hits' => 'setHits', 'query' => 'setQuery', 'params' => 'setParams', @@ -190,14 +190,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'getExhaustiveTypo', 'facets' => 'getFacets', 'facetsStats' => 'getFacetsStats', - 'hitsPerPage' => 'getHitsPerPage', 'index' => 'getIndex', 'indexUsed' => 'getIndexUsed', 'message' => 'getMessage', - 'nbHits' => 'getNbHits', - 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', - 'page' => 'getPage', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', 'processingTimingsMS' => 'getProcessingTimingsMS', @@ -208,6 +204,10 @@ class BrowseResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', 'queryID' => 'getQueryID', + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', 'hits' => 'getHits', 'query' => 'getQuery', 'params' => 'getParams', @@ -258,9 +258,6 @@ public function __construct(?array $data = null) if (isset($data['facetsStats'])) { $this->container['facetsStats'] = $data['facetsStats']; } - if (isset($data['hitsPerPage'])) { - $this->container['hitsPerPage'] = $data['hitsPerPage']; - } if (isset($data['index'])) { $this->container['index'] = $data['index']; } @@ -270,18 +267,9 @@ public function __construct(?array $data = null) if (isset($data['message'])) { $this->container['message'] = $data['message']; } - if (isset($data['nbHits'])) { - $this->container['nbHits'] = $data['nbHits']; - } - if (isset($data['nbPages'])) { - $this->container['nbPages'] = $data['nbPages']; - } if (isset($data['nbSortedHits'])) { $this->container['nbSortedHits'] = $data['nbSortedHits']; } - if (isset($data['page'])) { - $this->container['page'] = $data['page']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } @@ -312,6 +300,18 @@ public function __construct(?array $data = null) if (isset($data['queryID'])) { $this->container['queryID'] = $data['queryID']; } + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -394,33 +394,21 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'aroundLatLng', must be conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."; } - if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { - $invalidProperties[] = "'hitsPerPage' can't be null"; + if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { + $invalidProperties[] = "'processingTimeMS' can't be null"; } - if ($this->container['hitsPerPage'] > 1000) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + if (isset($this->container['page']) && ($this->container['page'] < 0)) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; } - if ($this->container['hitsPerPage'] < 1) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + if (isset($this->container['hitsPerPage']) && ($this->container['hitsPerPage'] > 1000)) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; } - if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { - $invalidProperties[] = "'nbHits' can't be null"; - } - if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { - $invalidProperties[] = "'nbPages' can't be null"; - } - if (!isset($this->container['page']) || null === $this->container['page']) { - $invalidProperties[] = "'page' can't be null"; - } - if ($this->container['page'] < 0) { - $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + if (isset($this->container['hitsPerPage']) && ($this->container['hitsPerPage'] < 1)) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; } - if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { - $invalidProperties[] = "'processingTimeMS' can't be null"; - } if (!isset($this->container['hits']) || null === $this->container['hits']) { $invalidProperties[] = "'hits' can't be null"; } @@ -705,37 +693,6 @@ public function setFacetsStats($facetsStats) return $this; } - /** - * Gets hitsPerPage. - * - * @return int - */ - public function getHitsPerPage() - { - return $this->container['hitsPerPage'] ?? null; - } - - /** - * Sets hitsPerPage. - * - * @param int $hitsPerPage number of hits per page - * - * @return self - */ - public function setHitsPerPage($hitsPerPage) - { - if ($hitsPerPage > 1000) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BrowseResponse., must be smaller than or equal to 1000.'); - } - if ($hitsPerPage < 1) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BrowseResponse., must be bigger than or equal to 1.'); - } - - $this->container['hitsPerPage'] = $hitsPerPage; - - return $this; - } - /** * Gets index. * @@ -808,54 +765,6 @@ public function setMessage($message) return $this; } - /** - * Gets nbHits. - * - * @return int - */ - public function getNbHits() - { - return $this->container['nbHits'] ?? null; - } - - /** - * Sets nbHits. - * - * @param int $nbHits number of results (hits) - * - * @return self - */ - public function setNbHits($nbHits) - { - $this->container['nbHits'] = $nbHits; - - return $this; - } - - /** - * Gets nbPages. - * - * @return int - */ - public function getNbPages() - { - return $this->container['nbPages'] ?? null; - } - - /** - * Sets nbPages. - * - * @param int $nbPages number of pages of results - * - * @return self - */ - public function setNbPages($nbPages) - { - $this->container['nbPages'] = $nbPages; - - return $this; - } - /** * Gets nbSortedHits. * @@ -880,34 +789,6 @@ public function setNbSortedHits($nbSortedHits) return $this; } - /** - * Gets page. - * - * @return int - */ - public function getPage() - { - return $this->container['page'] ?? null; - } - - /** - * Sets page. - * - * @param int $page page of search results to retrieve - * - * @return self - */ - public function setPage($page) - { - if ($page < 0) { - throw new \InvalidArgumentException('invalid value for $page when calling BrowseResponse., must be bigger than or equal to 0.'); - } - - $this->container['page'] = $page; - - return $this; - } - /** * Gets parsedQuery. * @@ -1148,6 +1029,113 @@ public function setQueryID($queryID) return $this; } + /** + * Gets page. + * + * @return null|int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param null|int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if (!is_null($page) && ($page < 0)) { + throw new \InvalidArgumentException('invalid value for $page when calling BrowseResponse., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return null|int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param null|int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return null|int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param null|int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return null|int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param null|int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if (!is_null($hitsPerPage) && ($hitsPerPage > 1000)) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BrowseResponse., must be smaller than or equal to 1000.'); + } + if (!is_null($hitsPerPage) && ($hitsPerPage < 1)) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling BrowseResponse., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + /** * Gets hits. * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/SearchPagination.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchPagination.php new file mode 100644 index 00000000000..d2e28373d1f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchPagination.php @@ -0,0 +1,358 @@ + 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @var string[] + */ + protected static $modelFormats = [ + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @var string[] + */ + protected static $attributeMap = [ + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @var string[] + */ + protected static $setters = [ + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @var string[] + */ + protected static $getters = [ + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', + ]; + + /** + * Associative array for storing property values. + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor. + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(?array $data = null) + { + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of property to type mappings. Used for (de)serialization. + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!isset($this->container['page']) || null === $this->container['page']) { + $invalidProperties[] = "'page' can't be null"; + } + if ($this->container['page'] < 0) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + } + + if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { + $invalidProperties[] = "'nbHits' can't be null"; + } + if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { + $invalidProperties[] = "'nbPages' can't be null"; + } + if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { + $invalidProperties[] = "'hitsPerPage' can't be null"; + } + if ($this->container['hitsPerPage'] > 1000) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + } + + if ($this->container['hitsPerPage'] < 1) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed. + * + * @return bool True if all properties are valid + */ + public function valid() + { + return 0 === count($this->listInvalidProperties()); + } + + /** + * Gets page. + * + * @return int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if ($page < 0) { + throw new \InvalidArgumentException('invalid value for $page when calling SearchPagination., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if ($hitsPerPage > 1000) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchPagination., must be smaller than or equal to 1000.'); + } + if ($hitsPerPage < 1) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchPagination., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return null|mixed + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param null|int $offset Offset + * @param mixed $value Value to be set + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php index 960bee838ac..81644f9df28 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php @@ -29,14 +29,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'bool', 'facets' => 'array>', 'facetsStats' => 'array', - 'hitsPerPage' => 'int', 'index' => 'string', 'indexUsed' => 'string', 'message' => 'string', - 'nbHits' => 'int', - 'nbPages' => 'int', 'nbSortedHits' => 'int', - 'page' => 'int', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', 'processingTimingsMS' => 'object', @@ -47,6 +43,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'string', 'userData' => 'object', 'queryID' => 'string', + 'page' => 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', 'query' => 'string', 'params' => 'string', @@ -68,14 +68,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => null, 'facets' => null, 'facetsStats' => null, - 'hitsPerPage' => null, 'index' => null, 'indexUsed' => null, 'message' => null, - 'nbHits' => null, - 'nbPages' => null, 'nbSortedHits' => null, - 'page' => null, 'parsedQuery' => null, 'processingTimeMS' => null, 'processingTimingsMS' => null, @@ -86,6 +82,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => null, 'userData' => null, 'queryID' => null, + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, 'hits' => null, 'query' => null, 'params' => null, @@ -108,14 +108,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'exhaustiveTypo', 'facets' => 'facets', 'facetsStats' => 'facets_stats', - 'hitsPerPage' => 'hitsPerPage', 'index' => 'index', 'indexUsed' => 'indexUsed', 'message' => 'message', - 'nbHits' => 'nbHits', - 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', - 'page' => 'page', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', 'processingTimingsMS' => 'processingTimingsMS', @@ -126,6 +122,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'serverUsed', 'userData' => 'userData', 'queryID' => 'queryID', + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', 'hits' => 'hits', 'query' => 'query', 'params' => 'params', @@ -147,14 +147,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'setExhaustiveTypo', 'facets' => 'setFacets', 'facetsStats' => 'setFacetsStats', - 'hitsPerPage' => 'setHitsPerPage', 'index' => 'setIndex', 'indexUsed' => 'setIndexUsed', 'message' => 'setMessage', - 'nbHits' => 'setNbHits', - 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', - 'page' => 'setPage', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', 'processingTimingsMS' => 'setProcessingTimingsMS', @@ -165,6 +161,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', 'queryID' => 'setQueryID', + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', 'hits' => 'setHits', 'query' => 'setQuery', 'params' => 'setParams', @@ -186,14 +186,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'exhaustiveTypo' => 'getExhaustiveTypo', 'facets' => 'getFacets', 'facetsStats' => 'getFacetsStats', - 'hitsPerPage' => 'getHitsPerPage', 'index' => 'getIndex', 'indexUsed' => 'getIndexUsed', 'message' => 'getMessage', - 'nbHits' => 'getNbHits', - 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', - 'page' => 'getPage', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', 'processingTimingsMS' => 'getProcessingTimingsMS', @@ -204,6 +200,10 @@ class SearchResponse extends AbstractModel implements ModelInterface, \ArrayAcce 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', 'queryID' => 'getQueryID', + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', 'hits' => 'getHits', 'query' => 'getQuery', 'params' => 'getParams', @@ -253,9 +253,6 @@ public function __construct(?array $data = null) if (isset($data['facetsStats'])) { $this->container['facetsStats'] = $data['facetsStats']; } - if (isset($data['hitsPerPage'])) { - $this->container['hitsPerPage'] = $data['hitsPerPage']; - } if (isset($data['index'])) { $this->container['index'] = $data['index']; } @@ -265,18 +262,9 @@ public function __construct(?array $data = null) if (isset($data['message'])) { $this->container['message'] = $data['message']; } - if (isset($data['nbHits'])) { - $this->container['nbHits'] = $data['nbHits']; - } - if (isset($data['nbPages'])) { - $this->container['nbPages'] = $data['nbPages']; - } if (isset($data['nbSortedHits'])) { $this->container['nbSortedHits'] = $data['nbSortedHits']; } - if (isset($data['page'])) { - $this->container['page'] = $data['page']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } @@ -307,6 +295,18 @@ public function __construct(?array $data = null) if (isset($data['queryID'])) { $this->container['queryID'] = $data['queryID']; } + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -386,15 +386,14 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'aroundLatLng', must be conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."; } - if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { - $invalidProperties[] = "'hitsPerPage' can't be null"; + if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { + $invalidProperties[] = "'processingTimeMS' can't be null"; } - if ($this->container['hitsPerPage'] > 1000) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + if (!isset($this->container['page']) || null === $this->container['page']) { + $invalidProperties[] = "'page' can't be null"; } - - if ($this->container['hitsPerPage'] < 1) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + if ($this->container['page'] < 0) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; } if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { @@ -403,16 +402,17 @@ public function listInvalidProperties() if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { $invalidProperties[] = "'nbPages' can't be null"; } - if (!isset($this->container['page']) || null === $this->container['page']) { - $invalidProperties[] = "'page' can't be null"; + if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { + $invalidProperties[] = "'hitsPerPage' can't be null"; } - if ($this->container['page'] < 0) { - $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + if ($this->container['hitsPerPage'] > 1000) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; } - if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { - $invalidProperties[] = "'processingTimeMS' can't be null"; + if ($this->container['hitsPerPage'] < 1) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; } + if (!isset($this->container['hits']) || null === $this->container['hits']) { $invalidProperties[] = "'hits' can't be null"; } @@ -697,37 +697,6 @@ public function setFacetsStats($facetsStats) return $this; } - /** - * Gets hitsPerPage. - * - * @return int - */ - public function getHitsPerPage() - { - return $this->container['hitsPerPage'] ?? null; - } - - /** - * Sets hitsPerPage. - * - * @param int $hitsPerPage number of hits per page - * - * @return self - */ - public function setHitsPerPage($hitsPerPage) - { - if ($hitsPerPage > 1000) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResponse., must be smaller than or equal to 1000.'); - } - if ($hitsPerPage < 1) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResponse., must be bigger than or equal to 1.'); - } - - $this->container['hitsPerPage'] = $hitsPerPage; - - return $this; - } - /** * Gets index. * @@ -800,54 +769,6 @@ public function setMessage($message) return $this; } - /** - * Gets nbHits. - * - * @return int - */ - public function getNbHits() - { - return $this->container['nbHits'] ?? null; - } - - /** - * Sets nbHits. - * - * @param int $nbHits number of results (hits) - * - * @return self - */ - public function setNbHits($nbHits) - { - $this->container['nbHits'] = $nbHits; - - return $this; - } - - /** - * Gets nbPages. - * - * @return int - */ - public function getNbPages() - { - return $this->container['nbPages'] ?? null; - } - - /** - * Sets nbPages. - * - * @param int $nbPages number of pages of results - * - * @return self - */ - public function setNbPages($nbPages) - { - $this->container['nbPages'] = $nbPages; - - return $this; - } - /** * Gets nbSortedHits. * @@ -872,34 +793,6 @@ public function setNbSortedHits($nbSortedHits) return $this; } - /** - * Gets page. - * - * @return int - */ - public function getPage() - { - return $this->container['page'] ?? null; - } - - /** - * Sets page. - * - * @param int $page page of search results to retrieve - * - * @return self - */ - public function setPage($page) - { - if ($page < 0) { - throw new \InvalidArgumentException('invalid value for $page when calling SearchResponse., must be bigger than or equal to 0.'); - } - - $this->container['page'] = $page; - - return $this; - } - /** * Gets parsedQuery. * @@ -1140,6 +1033,113 @@ public function setQueryID($queryID) return $this; } + /** + * Gets page. + * + * @return int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if ($page < 0) { + throw new \InvalidArgumentException('invalid value for $page when calling SearchResponse., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if ($hitsPerPage > 1000) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResponse., must be smaller than or equal to 1000.'); + } + if ($hitsPerPage < 1) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResponse., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + /** * Gets hits. * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/SearchResult.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchResult.php index d48753b6aed..f47dc96a024 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/SearchResult.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchResult.php @@ -29,14 +29,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'exhaustiveTypo' => 'bool', 'facets' => 'array>', 'facetsStats' => 'array', - 'hitsPerPage' => 'int', 'index' => 'string', 'indexUsed' => 'string', 'message' => 'string', - 'nbHits' => 'int', - 'nbPages' => 'int', 'nbSortedHits' => 'int', - 'page' => 'int', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', 'processingTimingsMS' => 'object', @@ -47,6 +43,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'serverUsed' => 'string', 'userData' => 'object', 'queryID' => 'string', + 'page' => 'int', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'hitsPerPage' => 'int', 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', 'query' => 'string', 'params' => 'string', @@ -69,14 +69,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'exhaustiveTypo' => null, 'facets' => null, 'facetsStats' => null, - 'hitsPerPage' => null, 'index' => null, 'indexUsed' => null, 'message' => null, - 'nbHits' => null, - 'nbPages' => null, 'nbSortedHits' => null, - 'page' => null, 'parsedQuery' => null, 'processingTimeMS' => null, 'processingTimingsMS' => null, @@ -87,6 +83,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'serverUsed' => null, 'userData' => null, 'queryID' => null, + 'page' => null, + 'nbHits' => null, + 'nbPages' => null, + 'hitsPerPage' => null, 'hits' => null, 'query' => null, 'params' => null, @@ -110,14 +110,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'exhaustiveTypo' => 'exhaustiveTypo', 'facets' => 'facets', 'facetsStats' => 'facets_stats', - 'hitsPerPage' => 'hitsPerPage', 'index' => 'index', 'indexUsed' => 'indexUsed', 'message' => 'message', - 'nbHits' => 'nbHits', - 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', - 'page' => 'page', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', 'processingTimingsMS' => 'processingTimingsMS', @@ -128,6 +124,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'serverUsed' => 'serverUsed', 'userData' => 'userData', 'queryID' => 'queryID', + 'page' => 'page', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'hitsPerPage' => 'hitsPerPage', 'hits' => 'hits', 'query' => 'query', 'params' => 'params', @@ -150,14 +150,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'exhaustiveTypo' => 'setExhaustiveTypo', 'facets' => 'setFacets', 'facetsStats' => 'setFacetsStats', - 'hitsPerPage' => 'setHitsPerPage', 'index' => 'setIndex', 'indexUsed' => 'setIndexUsed', 'message' => 'setMessage', - 'nbHits' => 'setNbHits', - 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', - 'page' => 'setPage', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', 'processingTimingsMS' => 'setProcessingTimingsMS', @@ -168,6 +164,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', 'queryID' => 'setQueryID', + 'page' => 'setPage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'hitsPerPage' => 'setHitsPerPage', 'hits' => 'setHits', 'query' => 'setQuery', 'params' => 'setParams', @@ -190,14 +190,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'exhaustiveTypo' => 'getExhaustiveTypo', 'facets' => 'getFacets', 'facetsStats' => 'getFacetsStats', - 'hitsPerPage' => 'getHitsPerPage', 'index' => 'getIndex', 'indexUsed' => 'getIndexUsed', 'message' => 'getMessage', - 'nbHits' => 'getNbHits', - 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', - 'page' => 'getPage', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', 'processingTimingsMS' => 'getProcessingTimingsMS', @@ -208,6 +204,10 @@ class SearchResult extends AbstractModel implements ModelInterface, \ArrayAccess 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', 'queryID' => 'getQueryID', + 'page' => 'getPage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'hitsPerPage' => 'getHitsPerPage', 'hits' => 'getHits', 'query' => 'getQuery', 'params' => 'getParams', @@ -258,9 +258,6 @@ public function __construct(?array $data = null) if (isset($data['facetsStats'])) { $this->container['facetsStats'] = $data['facetsStats']; } - if (isset($data['hitsPerPage'])) { - $this->container['hitsPerPage'] = $data['hitsPerPage']; - } if (isset($data['index'])) { $this->container['index'] = $data['index']; } @@ -270,18 +267,9 @@ public function __construct(?array $data = null) if (isset($data['message'])) { $this->container['message'] = $data['message']; } - if (isset($data['nbHits'])) { - $this->container['nbHits'] = $data['nbHits']; - } - if (isset($data['nbPages'])) { - $this->container['nbPages'] = $data['nbPages']; - } if (isset($data['nbSortedHits'])) { $this->container['nbSortedHits'] = $data['nbSortedHits']; } - if (isset($data['page'])) { - $this->container['page'] = $data['page']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } @@ -312,6 +300,18 @@ public function __construct(?array $data = null) if (isset($data['queryID'])) { $this->container['queryID'] = $data['queryID']; } + if (isset($data['page'])) { + $this->container['page'] = $data['page']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['nbPages'])) { + $this->container['nbPages'] = $data['nbPages']; + } + if (isset($data['hitsPerPage'])) { + $this->container['hitsPerPage'] = $data['hitsPerPage']; + } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -397,15 +397,14 @@ public function listInvalidProperties() if (!isset($this->container['exhaustiveFacetsCount']) || null === $this->container['exhaustiveFacetsCount']) { $invalidProperties[] = "'exhaustiveFacetsCount' can't be null"; } - if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { - $invalidProperties[] = "'hitsPerPage' can't be null"; + if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { + $invalidProperties[] = "'processingTimeMS' can't be null"; } - if ($this->container['hitsPerPage'] > 1000) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; + if (!isset($this->container['page']) || null === $this->container['page']) { + $invalidProperties[] = "'page' can't be null"; } - - if ($this->container['hitsPerPage'] < 1) { - $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; + if ($this->container['page'] < 0) { + $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; } if (!isset($this->container['nbHits']) || null === $this->container['nbHits']) { @@ -414,16 +413,17 @@ public function listInvalidProperties() if (!isset($this->container['nbPages']) || null === $this->container['nbPages']) { $invalidProperties[] = "'nbPages' can't be null"; } - if (!isset($this->container['page']) || null === $this->container['page']) { - $invalidProperties[] = "'page' can't be null"; + if (!isset($this->container['hitsPerPage']) || null === $this->container['hitsPerPage']) { + $invalidProperties[] = "'hitsPerPage' can't be null"; } - if ($this->container['page'] < 0) { - $invalidProperties[] = "invalid value for 'page', must be bigger than or equal to 0."; + if ($this->container['hitsPerPage'] > 1000) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be smaller than or equal to 1000."; } - if (!isset($this->container['processingTimeMS']) || null === $this->container['processingTimeMS']) { - $invalidProperties[] = "'processingTimeMS' can't be null"; + if ($this->container['hitsPerPage'] < 1) { + $invalidProperties[] = "invalid value for 'hitsPerPage', must be bigger than or equal to 1."; } + if (!isset($this->container['hits']) || null === $this->container['hits']) { $invalidProperties[] = "'hits' can't be null"; } @@ -707,37 +707,6 @@ public function setFacetsStats($facetsStats) return $this; } - /** - * Gets hitsPerPage. - * - * @return int - */ - public function getHitsPerPage() - { - return $this->container['hitsPerPage'] ?? null; - } - - /** - * Sets hitsPerPage. - * - * @param int $hitsPerPage number of hits per page - * - * @return self - */ - public function setHitsPerPage($hitsPerPage) - { - if ($hitsPerPage > 1000) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResult., must be smaller than or equal to 1000.'); - } - if ($hitsPerPage < 1) { - throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResult., must be bigger than or equal to 1.'); - } - - $this->container['hitsPerPage'] = $hitsPerPage; - - return $this; - } - /** * Gets index. * @@ -810,54 +779,6 @@ public function setMessage($message) return $this; } - /** - * Gets nbHits. - * - * @return int - */ - public function getNbHits() - { - return $this->container['nbHits'] ?? null; - } - - /** - * Sets nbHits. - * - * @param int $nbHits number of results (hits) - * - * @return self - */ - public function setNbHits($nbHits) - { - $this->container['nbHits'] = $nbHits; - - return $this; - } - - /** - * Gets nbPages. - * - * @return int - */ - public function getNbPages() - { - return $this->container['nbPages'] ?? null; - } - - /** - * Sets nbPages. - * - * @param int $nbPages number of pages of results - * - * @return self - */ - public function setNbPages($nbPages) - { - $this->container['nbPages'] = $nbPages; - - return $this; - } - /** * Gets nbSortedHits. * @@ -882,34 +803,6 @@ public function setNbSortedHits($nbSortedHits) return $this; } - /** - * Gets page. - * - * @return int - */ - public function getPage() - { - return $this->container['page'] ?? null; - } - - /** - * Sets page. - * - * @param int $page page of search results to retrieve - * - * @return self - */ - public function setPage($page) - { - if ($page < 0) { - throw new \InvalidArgumentException('invalid value for $page when calling SearchResult., must be bigger than or equal to 0.'); - } - - $this->container['page'] = $page; - - return $this; - } - /** * Gets parsedQuery. * @@ -1150,6 +1043,113 @@ public function setQueryID($queryID) return $this; } + /** + * Gets page. + * + * @return int + */ + public function getPage() + { + return $this->container['page'] ?? null; + } + + /** + * Sets page. + * + * @param int $page page of search results to retrieve + * + * @return self + */ + public function setPage($page) + { + if ($page < 0) { + throw new \InvalidArgumentException('invalid value for $page when calling SearchResult., must be bigger than or equal to 0.'); + } + + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbHits. + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param int $nbHits number of results (hits) + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages. + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages'] ?? null; + } + + /** + * Sets nbPages. + * + * @param int $nbPages number of pages of results + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets hitsPerPage. + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage'] ?? null; + } + + /** + * Sets hitsPerPage. + * + * @param int $hitsPerPage number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + if ($hitsPerPage > 1000) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResult., must be smaller than or equal to 1000.'); + } + if ($hitsPerPage < 1) { + throw new \InvalidArgumentException('invalid value for $hitsPerPage when calling SearchResult., must be bigger than or equal to 1.'); + } + + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + /** * Gets hits. * diff --git a/clients/algoliasearch-client-python/algoliasearch/recommend/models/base_search_response.py b/clients/algoliasearch-client-python/algoliasearch/recommend/models/base_search_response.py index 2bdad372444..16b8bbd22ae 100644 --- a/clients/algoliasearch-client-python/algoliasearch/recommend/models/base_search_response.py +++ b/clients/algoliasearch-client-python/algoliasearch/recommend/models/base_search_response.py @@ -73,9 +73,6 @@ class BaseSearchResponse(BaseModel): facets_stats: Optional[Dict[str, FacetsStats]] = Field( default=None, description="Statistics for numerical facets." ) - hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( - description="Number of hits per page.", alias="hitsPerPage" - ) index: Optional[StrictStr] = Field( default=None, description="Index name used for the query." ) @@ -87,18 +84,11 @@ class BaseSearchResponse(BaseModel): message: Optional[StrictStr] = Field( default=None, description="Warnings about the query." ) - nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") - nb_pages: StrictInt = Field( - description="Number of pages of results.", alias="nbPages" - ) nb_sorted_hits: Optional[StrictInt] = Field( default=None, description="Number of hits selected and sorted by the relevant sort algorithm.", alias="nbSortedHits", ) - page: Annotated[int, Field(strict=True, ge=0)] = Field( - description="Page of search results to retrieve." - ) parsed_query: Optional[StrictStr] = Field( default=None, description="Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.", @@ -154,14 +144,10 @@ class BaseSearchResponse(BaseModel): "exhaustiveTypo", "facets", "facets_stats", - "hitsPerPage", "index", "indexUsed", "message", - "nbHits", - "nbPages", "nbSortedHits", - "page", "parsedQuery", "processingTimeMS", "processingTimingsMS", @@ -267,14 +253,10 @@ def from_dict(cls, obj: Dict) -> Self: if obj.get("facets_stats") is not None else None ), - "hitsPerPage": obj.get("hitsPerPage"), "index": obj.get("index"), "indexUsed": obj.get("indexUsed"), "message": obj.get("message"), - "nbHits": obj.get("nbHits"), - "nbPages": obj.get("nbPages"), "nbSortedHits": obj.get("nbSortedHits"), - "page": obj.get("page"), "parsedQuery": obj.get("parsedQuery"), "processingTimeMS": obj.get("processingTimeMS"), "processingTimingsMS": obj.get("processingTimingsMS"), diff --git a/clients/algoliasearch-client-python/algoliasearch/recommend/models/recommendations_results.py b/clients/algoliasearch-client-python/algoliasearch/recommend/models/recommendations_results.py index 2fc67304c84..6e9e79fc7b4 100644 --- a/clients/algoliasearch-client-python/algoliasearch/recommend/models/recommendations_results.py +++ b/clients/algoliasearch-client-python/algoliasearch/recommend/models/recommendations_results.py @@ -74,9 +74,6 @@ class RecommendationsResults(BaseModel): facets_stats: Optional[Dict[str, FacetsStats]] = Field( default=None, description="Statistics for numerical facets." ) - hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( - description="Number of hits per page.", alias="hitsPerPage" - ) index: Optional[StrictStr] = Field( default=None, description="Index name used for the query." ) @@ -88,18 +85,11 @@ class RecommendationsResults(BaseModel): message: Optional[StrictStr] = Field( default=None, description="Warnings about the query." ) - nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") - nb_pages: StrictInt = Field( - description="Number of pages of results.", alias="nbPages" - ) nb_sorted_hits: Optional[StrictInt] = Field( default=None, description="Number of hits selected and sorted by the relevant sort algorithm.", alias="nbSortedHits", ) - page: Annotated[int, Field(strict=True, ge=0)] = Field( - description="Page of search results to retrieve." - ) parsed_query: Optional[StrictStr] = Field( default=None, description="Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.", @@ -143,6 +133,16 @@ class RecommendationsResults(BaseModel): description="Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).", alias="queryID", ) + page: Annotated[int, Field(strict=True, ge=0)] = Field( + description="Page of search results to retrieve." + ) + nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") + nb_pages: StrictInt = Field( + description="Number of pages of results.", alias="nbPages" + ) + hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( + description="Number of hits per page.", alias="hitsPerPage" + ) hits: List[RecommendationsHit] @field_validator("around_lat_lng") @@ -236,14 +236,10 @@ def from_dict(cls, obj: Dict) -> Self: if obj.get("facets_stats") is not None else None ), - "hitsPerPage": obj.get("hitsPerPage"), "index": obj.get("index"), "indexUsed": obj.get("indexUsed"), "message": obj.get("message"), - "nbHits": obj.get("nbHits"), - "nbPages": obj.get("nbPages"), "nbSortedHits": obj.get("nbSortedHits"), - "page": obj.get("page"), "parsedQuery": obj.get("parsedQuery"), "processingTimeMS": obj.get("processingTimeMS"), "processingTimingsMS": obj.get("processingTimingsMS"), @@ -262,6 +258,10 @@ def from_dict(cls, obj: Dict) -> Self: "serverUsed": obj.get("serverUsed"), "userData": obj.get("userData"), "queryID": obj.get("queryID"), + "page": obj.get("page"), + "nbHits": obj.get("nbHits"), + "nbPages": obj.get("nbPages"), + "hitsPerPage": obj.get("hitsPerPage"), "hits": ( [RecommendationsHit.from_dict(_item) for _item in obj.get("hits")] if obj.get("hits") is not None diff --git a/clients/algoliasearch-client-python/algoliasearch/recommend/models/search_pagination.py b/clients/algoliasearch-client-python/algoliasearch/recommend/models/search_pagination.py new file mode 100644 index 00000000000..9881e858f82 --- /dev/null +++ b/clients/algoliasearch-client-python/algoliasearch/recommend/models/search_pagination.py @@ -0,0 +1,77 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Annotated, Any, Dict, Self + +from pydantic import BaseModel, ConfigDict, Field, StrictInt + + +class SearchPagination(BaseModel): + """ + SearchPagination + """ + + page: Annotated[int, Field(strict=True, ge=0)] = Field( + description="Page of search results to retrieve." + ) + nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") + nb_pages: StrictInt = Field( + description="Number of pages of results.", alias="nbPages" + ) + hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( + description="Number of hits per page.", alias="hitsPerPage" + ) + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SearchPagination from a JSON string""" + return cls.from_dict(loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of SearchPagination from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "page": obj.get("page"), + "nbHits": obj.get("nbHits"), + "nbPages": obj.get("nbPages"), + "hitsPerPage": obj.get("hitsPerPage"), + } + ) + return _obj diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/base_search_response.py b/clients/algoliasearch-client-python/algoliasearch/search/models/base_search_response.py index 607f4ae3ca9..194f64f8b05 100644 --- a/clients/algoliasearch-client-python/algoliasearch/search/models/base_search_response.py +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/base_search_response.py @@ -73,9 +73,6 @@ class BaseSearchResponse(BaseModel): facets_stats: Optional[Dict[str, FacetsStats]] = Field( default=None, description="Statistics for numerical facets." ) - hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( - description="Number of hits per page.", alias="hitsPerPage" - ) index: Optional[StrictStr] = Field( default=None, description="Index name used for the query." ) @@ -87,18 +84,11 @@ class BaseSearchResponse(BaseModel): message: Optional[StrictStr] = Field( default=None, description="Warnings about the query." ) - nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") - nb_pages: StrictInt = Field( - description="Number of pages of results.", alias="nbPages" - ) nb_sorted_hits: Optional[StrictInt] = Field( default=None, description="Number of hits selected and sorted by the relevant sort algorithm.", alias="nbSortedHits", ) - page: Annotated[int, Field(strict=True, ge=0)] = Field( - description="Page of search results to retrieve." - ) parsed_query: Optional[StrictStr] = Field( default=None, description="Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.", @@ -154,14 +144,10 @@ class BaseSearchResponse(BaseModel): "exhaustiveTypo", "facets", "facets_stats", - "hitsPerPage", "index", "indexUsed", "message", - "nbHits", - "nbPages", "nbSortedHits", - "page", "parsedQuery", "processingTimeMS", "processingTimingsMS", @@ -267,14 +253,10 @@ def from_dict(cls, obj: Dict) -> Self: if obj.get("facets_stats") is not None else None ), - "hitsPerPage": obj.get("hitsPerPage"), "index": obj.get("index"), "indexUsed": obj.get("indexUsed"), "message": obj.get("message"), - "nbHits": obj.get("nbHits"), - "nbPages": obj.get("nbPages"), "nbSortedHits": obj.get("nbSortedHits"), - "page": obj.get("page"), "parsedQuery": obj.get("parsedQuery"), "processingTimeMS": obj.get("processingTimeMS"), "processingTimingsMS": obj.get("processingTimingsMS"), diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/browse_pagination.py b/clients/algoliasearch-client-python/algoliasearch/search/models/browse_pagination.py new file mode 100644 index 00000000000..f821ec2ea4d --- /dev/null +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/browse_pagination.py @@ -0,0 +1,79 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Annotated, Any, Dict, Optional, Self + +from pydantic import BaseModel, ConfigDict, Field, StrictInt + + +class BrowsePagination(BaseModel): + """ + BrowsePagination + """ + + page: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + default=0, description="Page of search results to retrieve." + ) + nb_hits: Optional[StrictInt] = Field( + default=None, description="Number of results (hits).", alias="nbHits" + ) + nb_pages: Optional[StrictInt] = Field( + default=None, description="Number of pages of results.", alias="nbPages" + ) + hits_per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field( + default=20, description="Number of hits per page.", alias="hitsPerPage" + ) + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BrowsePagination from a JSON string""" + return cls.from_dict(loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of BrowsePagination from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "page": obj.get("page"), + "nbHits": obj.get("nbHits"), + "nbPages": obj.get("nbPages"), + "hitsPerPage": obj.get("hitsPerPage"), + } + ) + return _obj diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/browse_response.py b/clients/algoliasearch-client-python/algoliasearch/search/models/browse_response.py index 3985649da35..038684af850 100644 --- a/clients/algoliasearch-client-python/algoliasearch/search/models/browse_response.py +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/browse_response.py @@ -74,9 +74,6 @@ class BrowseResponse(BaseModel): facets_stats: Optional[Dict[str, FacetsStats]] = Field( default=None, description="Statistics for numerical facets." ) - hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( - description="Number of hits per page.", alias="hitsPerPage" - ) index: Optional[StrictStr] = Field( default=None, description="Index name used for the query." ) @@ -88,18 +85,11 @@ class BrowseResponse(BaseModel): message: Optional[StrictStr] = Field( default=None, description="Warnings about the query." ) - nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") - nb_pages: StrictInt = Field( - description="Number of pages of results.", alias="nbPages" - ) nb_sorted_hits: Optional[StrictInt] = Field( default=None, description="Number of hits selected and sorted by the relevant sort algorithm.", alias="nbSortedHits", ) - page: Annotated[int, Field(strict=True, ge=0)] = Field( - description="Page of search results to retrieve." - ) parsed_query: Optional[StrictStr] = Field( default=None, description="Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.", @@ -143,6 +133,18 @@ class BrowseResponse(BaseModel): description="Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).", alias="queryID", ) + page: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + default=0, description="Page of search results to retrieve." + ) + nb_hits: Optional[StrictInt] = Field( + default=None, description="Number of results (hits).", alias="nbHits" + ) + nb_pages: Optional[StrictInt] = Field( + default=None, description="Number of pages of results.", alias="nbPages" + ) + hits_per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field( + default=20, description="Number of hits per page.", alias="hitsPerPage" + ) hits: List[Hit] = Field( description="Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. " ) @@ -246,14 +248,10 @@ def from_dict(cls, obj: Dict) -> Self: if obj.get("facets_stats") is not None else None ), - "hitsPerPage": obj.get("hitsPerPage"), "index": obj.get("index"), "indexUsed": obj.get("indexUsed"), "message": obj.get("message"), - "nbHits": obj.get("nbHits"), - "nbPages": obj.get("nbPages"), "nbSortedHits": obj.get("nbSortedHits"), - "page": obj.get("page"), "parsedQuery": obj.get("parsedQuery"), "processingTimeMS": obj.get("processingTimeMS"), "processingTimingsMS": obj.get("processingTimingsMS"), @@ -272,6 +270,10 @@ def from_dict(cls, obj: Dict) -> Self: "serverUsed": obj.get("serverUsed"), "userData": obj.get("userData"), "queryID": obj.get("queryID"), + "page": obj.get("page"), + "nbHits": obj.get("nbHits"), + "nbPages": obj.get("nbPages"), + "hitsPerPage": obj.get("hitsPerPage"), "hits": ( [Hit.from_dict(_item) for _item in obj.get("hits")] if obj.get("hits") is not None diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/search_pagination.py b/clients/algoliasearch-client-python/algoliasearch/search/models/search_pagination.py new file mode 100644 index 00000000000..9881e858f82 --- /dev/null +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/search_pagination.py @@ -0,0 +1,77 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Annotated, Any, Dict, Self + +from pydantic import BaseModel, ConfigDict, Field, StrictInt + + +class SearchPagination(BaseModel): + """ + SearchPagination + """ + + page: Annotated[int, Field(strict=True, ge=0)] = Field( + description="Page of search results to retrieve." + ) + nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") + nb_pages: StrictInt = Field( + description="Number of pages of results.", alias="nbPages" + ) + hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( + description="Number of hits per page.", alias="hitsPerPage" + ) + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SearchPagination from a JSON string""" + return cls.from_dict(loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of SearchPagination from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "page": obj.get("page"), + "nbHits": obj.get("nbHits"), + "nbPages": obj.get("nbPages"), + "hitsPerPage": obj.get("hitsPerPage"), + } + ) + return _obj diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/search_response.py b/clients/algoliasearch-client-python/algoliasearch/search/models/search_response.py index a664cef15d5..8140781d3d7 100644 --- a/clients/algoliasearch-client-python/algoliasearch/search/models/search_response.py +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/search_response.py @@ -74,9 +74,6 @@ class SearchResponse(BaseModel): facets_stats: Optional[Dict[str, FacetsStats]] = Field( default=None, description="Statistics for numerical facets." ) - hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( - description="Number of hits per page.", alias="hitsPerPage" - ) index: Optional[StrictStr] = Field( default=None, description="Index name used for the query." ) @@ -88,18 +85,11 @@ class SearchResponse(BaseModel): message: Optional[StrictStr] = Field( default=None, description="Warnings about the query." ) - nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") - nb_pages: StrictInt = Field( - description="Number of pages of results.", alias="nbPages" - ) nb_sorted_hits: Optional[StrictInt] = Field( default=None, description="Number of hits selected and sorted by the relevant sort algorithm.", alias="nbSortedHits", ) - page: Annotated[int, Field(strict=True, ge=0)] = Field( - description="Page of search results to retrieve." - ) parsed_query: Optional[StrictStr] = Field( default=None, description="Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.", @@ -143,6 +133,16 @@ class SearchResponse(BaseModel): description="Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).", alias="queryID", ) + page: Annotated[int, Field(strict=True, ge=0)] = Field( + description="Page of search results to retrieve." + ) + nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits") + nb_pages: StrictInt = Field( + description="Number of pages of results.", alias="nbPages" + ) + hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field( + description="Number of hits per page.", alias="hitsPerPage" + ) hits: List[Hit] = Field( description="Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. " ) @@ -162,14 +162,10 @@ class SearchResponse(BaseModel): "exhaustiveTypo", "facets", "facets_stats", - "hitsPerPage", "index", "indexUsed", "message", - "nbHits", - "nbPages", "nbSortedHits", - "page", "parsedQuery", "processingTimeMS", "processingTimingsMS", @@ -180,6 +176,10 @@ class SearchResponse(BaseModel): "serverUsed", "userData", "queryID", + "page", + "nbHits", + "nbPages", + "hitsPerPage", "hits", "query", "params", @@ -284,14 +284,10 @@ def from_dict(cls, obj: Dict) -> Self: if obj.get("facets_stats") is not None else None ), - "hitsPerPage": obj.get("hitsPerPage"), "index": obj.get("index"), "indexUsed": obj.get("indexUsed"), "message": obj.get("message"), - "nbHits": obj.get("nbHits"), - "nbPages": obj.get("nbPages"), "nbSortedHits": obj.get("nbSortedHits"), - "page": obj.get("page"), "parsedQuery": obj.get("parsedQuery"), "processingTimeMS": obj.get("processingTimeMS"), "processingTimingsMS": obj.get("processingTimingsMS"), @@ -310,6 +306,10 @@ def from_dict(cls, obj: Dict) -> Self: "serverUsed": obj.get("serverUsed"), "userData": obj.get("userData"), "queryID": obj.get("queryID"), + "page": obj.get("page"), + "nbHits": obj.get("nbHits"), + "nbPages": obj.get("nbPages"), + "hitsPerPage": obj.get("hitsPerPage"), "hits": ( [Hit.from_dict(_item) for _item in obj.get("hits")] if obj.get("hits") is not None diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/base_search_response.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/base_search_response.rb index 652041576b5..bf2afdb0044 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/base_search_response.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/base_search_response.rb @@ -35,9 +35,6 @@ class BaseSearchResponse # Statistics for numerical facets. attr_accessor :facets_stats - # Number of hits per page. - attr_accessor :hits_per_page - # Index name used for the query. attr_accessor :index @@ -47,18 +44,9 @@ class BaseSearchResponse # Warnings about the query. attr_accessor :message - # Number of results (hits). - attr_accessor :nb_hits - - # Number of pages of results. - attr_accessor :nb_pages - # Number of hits selected and sorted by the relevant sort algorithm. attr_accessor :nb_sorted_hits - # Page of search results to retrieve. - attr_accessor :page - # Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. attr_accessor :parsed_query @@ -102,14 +90,10 @@ def self.attribute_map :exhaustive_typo => :exhaustiveTypo, :facets => :facets, :facets_stats => :facets_stats, - :hits_per_page => :hitsPerPage, :index => :index, :index_used => :indexUsed, :message => :message, - :nb_hits => :nbHits, - :nb_pages => :nbPages, :nb_sorted_hits => :nbSortedHits, - :page => :page, :parsed_query => :parsedQuery, :processing_time_ms => :processingTimeMS, :processing_timings_ms => :processingTimingsMS, @@ -141,14 +125,10 @@ def self.types_mapping :exhaustive_typo => :"Boolean", :facets => :"Hash>", :facets_stats => :"Hash", - :hits_per_page => :"Integer", :index => :"String", :index_used => :"String", :message => :"String", - :nb_hits => :"Integer", - :nb_pages => :"Integer", :nb_sorted_hits => :"Integer", - :page => :"Integer", :parsed_query => :"String", :processing_time_ms => :"Integer", :processing_timings_ms => :"Object", @@ -223,12 +203,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - else - self.hits_per_page = nil - end - if attributes.key?(:index) self.index = attributes[:index] end @@ -241,28 +215,10 @@ def initialize(attributes = {}) self.message = attributes[:message] end - if attributes.key?(:nb_hits) - self.nb_hits = attributes[:nb_hits] - else - self.nb_hits = nil - end - - if attributes.key?(:nb_pages) - self.nb_pages = attributes[:nb_pages] - else - self.nb_pages = nil - end - if attributes.key?(:nb_sorted_hits) self.nb_sorted_hits = attributes[:nb_sorted_hits] end - if attributes.key?(:page) - self.page = attributes[:page] - else - self.page = nil - end - if attributes.key?(:parsed_query) self.parsed_query = attributes[:parsed_query] end @@ -339,38 +295,6 @@ def around_lat_lng=(around_lat_lng) @around_lat_lng = around_lat_lng end - # Custom attribute writer method with validation - # @param [Object] hits_per_page Value to be assigned - def hits_per_page=(hits_per_page) - if hits_per_page.nil? - raise ArgumentError, "hits_per_page cannot be nil" - end - - if hits_per_page > 1000 - raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." - end - - if hits_per_page < 1 - raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." - end - - @hits_per_page = hits_per_page - end - - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(other) @@ -386,14 +310,10 @@ def ==(other) exhaustive_typo == other.exhaustive_typo && facets == other.facets && facets_stats == other.facets_stats && - hits_per_page == other.hits_per_page && index == other.index && index_used == other.index_used && message == other.message && - nb_hits == other.nb_hits && - nb_pages == other.nb_pages && nb_sorted_hits == other.nb_sorted_hits && - page == other.page && parsed_query == other.parsed_query && processing_time_ms == other.processing_time_ms && processing_timings_ms == other.processing_timings_ms && @@ -426,14 +346,10 @@ def hash exhaustive_typo, facets, facets_stats, - hits_per_page, index, index_used, message, - nb_hits, - nb_pages, nb_sorted_hits, - page, parsed_query, processing_time_ms, processing_timings_ms, diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/recommendations_results.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/recommendations_results.rb index e878f537085..f123c1f62e5 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/recommendations_results.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/recommendations_results.rb @@ -35,9 +35,6 @@ class RecommendationsResults # Statistics for numerical facets. attr_accessor :facets_stats - # Number of hits per page. - attr_accessor :hits_per_page - # Index name used for the query. attr_accessor :index @@ -47,18 +44,9 @@ class RecommendationsResults # Warnings about the query. attr_accessor :message - # Number of results (hits). - attr_accessor :nb_hits - - # Number of pages of results. - attr_accessor :nb_pages - # Number of hits selected and sorted by the relevant sort algorithm. attr_accessor :nb_sorted_hits - # Page of search results to retrieve. - attr_accessor :page - # Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. attr_accessor :parsed_query @@ -87,6 +75,18 @@ class RecommendationsResults # Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). attr_accessor :query_id + # Page of search results to retrieve. + attr_accessor :page + + # Number of results (hits). + attr_accessor :nb_hits + + # Number of pages of results. + attr_accessor :nb_pages + + # Number of hits per page. + attr_accessor :hits_per_page + attr_accessor :hits # Attribute mapping from ruby-style variable name to JSON key. @@ -102,14 +102,10 @@ def self.attribute_map :exhaustive_typo => :exhaustiveTypo, :facets => :facets, :facets_stats => :facets_stats, - :hits_per_page => :hitsPerPage, :index => :index, :index_used => :indexUsed, :message => :message, - :nb_hits => :nbHits, - :nb_pages => :nbPages, :nb_sorted_hits => :nbSortedHits, - :page => :page, :parsed_query => :parsedQuery, :processing_time_ms => :processingTimeMS, :processing_timings_ms => :processingTimingsMS, @@ -120,6 +116,10 @@ def self.attribute_map :server_used => :serverUsed, :user_data => :userData, :query_id => :queryID, + :page => :page, + :nb_hits => :nbHits, + :nb_pages => :nbPages, + :hits_per_page => :hitsPerPage, :hits => :hits } end @@ -142,14 +142,10 @@ def self.types_mapping :exhaustive_typo => :"Boolean", :facets => :"Hash>", :facets_stats => :"Hash", - :hits_per_page => :"Integer", :index => :"String", :index_used => :"String", :message => :"String", - :nb_hits => :"Integer", - :nb_pages => :"Integer", :nb_sorted_hits => :"Integer", - :page => :"Integer", :parsed_query => :"String", :processing_time_ms => :"Integer", :processing_timings_ms => :"Object", @@ -160,6 +156,10 @@ def self.types_mapping :server_used => :"String", :user_data => :"Object", :query_id => :"String", + :page => :"Integer", + :nb_hits => :"Integer", + :nb_pages => :"Integer", + :hits_per_page => :"Integer", :hits => :"Array" } end @@ -175,7 +175,8 @@ def self.openapi_nullable def self.openapi_all_of [ :"BaseSearchResponse", - :"RecommendationsHits" + :"RecommendationsHits", + :"SearchPagination" ] end @@ -246,12 +247,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - else - self.hits_per_page = nil - end - if attributes.key?(:index) self.index = attributes[:index] end @@ -264,28 +259,10 @@ def initialize(attributes = {}) self.message = attributes[:message] end - if attributes.key?(:nb_hits) - self.nb_hits = attributes[:nb_hits] - else - self.nb_hits = nil - end - - if attributes.key?(:nb_pages) - self.nb_pages = attributes[:nb_pages] - else - self.nb_pages = nil - end - if attributes.key?(:nb_sorted_hits) self.nb_sorted_hits = attributes[:nb_sorted_hits] end - if attributes.key?(:page) - self.page = attributes[:page] - else - self.page = nil - end - if attributes.key?(:parsed_query) self.parsed_query = attributes[:parsed_query] end @@ -328,6 +305,30 @@ def initialize(attributes = {}) self.query_id = attributes[:query_id] end + if attributes.key?(:page) + self.page = attributes[:page] + else + self.page = nil + end + + if attributes.key?(:nb_hits) + self.nb_hits = attributes[:nb_hits] + else + self.nb_hits = nil + end + + if attributes.key?(:nb_pages) + self.nb_pages = attributes[:nb_pages] + else + self.nb_pages = nil + end + + if attributes.key?(:hits_per_page) + self.hits_per_page = attributes[:hits_per_page] + else + self.hits_per_page = nil + end + if attributes.key?(:hits) if (value = attributes[:hits]).is_a?(Array) self.hits = value @@ -366,6 +367,20 @@ def around_lat_lng=(around_lat_lng) @around_lat_lng = around_lat_lng end + # Custom attribute writer method with validation + # @param [Object] page Value to be assigned + def page=(page) + if page.nil? + raise ArgumentError, "page cannot be nil" + end + + if page < 0 + raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." + end + + @page = page + end + # Custom attribute writer method with validation # @param [Object] hits_per_page Value to be assigned def hits_per_page=(hits_per_page) @@ -384,20 +399,6 @@ def hits_per_page=(hits_per_page) @hits_per_page = hits_per_page end - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(other) @@ -413,14 +414,10 @@ def ==(other) exhaustive_typo == other.exhaustive_typo && facets == other.facets && facets_stats == other.facets_stats && - hits_per_page == other.hits_per_page && index == other.index && index_used == other.index_used && message == other.message && - nb_hits == other.nb_hits && - nb_pages == other.nb_pages && nb_sorted_hits == other.nb_sorted_hits && - page == other.page && parsed_query == other.parsed_query && processing_time_ms == other.processing_time_ms && processing_timings_ms == other.processing_timings_ms && @@ -431,6 +428,10 @@ def ==(other) server_used == other.server_used && user_data == other.user_data && query_id == other.query_id && + page == other.page && + nb_hits == other.nb_hits && + nb_pages == other.nb_pages && + hits_per_page == other.hits_per_page && hits == other.hits end @@ -454,14 +455,10 @@ def hash exhaustive_typo, facets, facets_stats, - hits_per_page, index, index_used, message, - nb_hits, - nb_pages, nb_sorted_hits, - page, parsed_query, processing_time_ms, processing_timings_ms, @@ -472,6 +469,10 @@ def hash server_used, user_data, query_id, + page, + nb_hits, + nb_pages, + hits_per_page, hits ].hash end diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/search_pagination.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/search_pagination.rb new file mode 100644 index 00000000000..fe94412171b --- /dev/null +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/search_pagination.rb @@ -0,0 +1,282 @@ +# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +require "date" +require "time" + +module Algolia + module Recommend + class SearchPagination + # Page of search results to retrieve. + attr_accessor :page + + # Number of results (hits). + attr_accessor :nb_hits + + # Number of pages of results. + attr_accessor :nb_pages + + # Number of hits per page. + attr_accessor :hits_per_page + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :page => :page, + :nb_hits => :nbHits, + :nb_pages => :nbPages, + :hits_per_page => :hitsPerPage + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.types_mapping + { + :page => :"Integer", + :nb_hits => :"Integer", + :nb_pages => :"Integer", + :hits_per_page => :"Integer" + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new( + [] + ) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + raise( + ArgumentError, + "The input argument (attributes) must be a hash in `Algolia::SearchPagination` initialize method" + ) + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + raise( + ArgumentError, + "`#{k}` is not a valid attribute in `Algolia::SearchPagination`. Please check the name to make sure it's valid. List of attributes: " + + self.class.attribute_map.keys.inspect + ) + end + + h[k.to_sym] = v + } + + if attributes.key?(:page) + self.page = attributes[:page] + else + self.page = nil + end + + if attributes.key?(:nb_hits) + self.nb_hits = attributes[:nb_hits] + else + self.nb_hits = nil + end + + if attributes.key?(:nb_pages) + self.nb_pages = attributes[:nb_pages] + else + self.nb_pages = nil + end + + if attributes.key?(:hits_per_page) + self.hits_per_page = attributes[:hits_per_page] + else + self.hits_per_page = nil + end + end + + # Custom attribute writer method with validation + # @param [Object] page Value to be assigned + def page=(page) + if page.nil? + raise ArgumentError, "page cannot be nil" + end + + if page < 0 + raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." + end + + @page = page + end + + # Custom attribute writer method with validation + # @param [Object] hits_per_page Value to be assigned + def hits_per_page=(hits_per_page) + if hits_per_page.nil? + raise ArgumentError, "hits_per_page cannot be nil" + end + + if hits_per_page > 1000 + raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." + end + + if hits_per_page < 1 + raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." + end + + @hits_per_page = hits_per_page + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(other) + return true if self.equal?(other) + self.class == other.class && + page == other.page && + nb_hits == other.nb_hits && + nb_pages == other.nb_pages && + hits_per_page == other.hits_per_page + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(other) + self == other + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [page, nb_hits, nb_pages, hits_per_page].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + types_mapping.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash[key.to_sym] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| + _deserialize(::Regexp.last_match(1), v) + } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) + end + end + + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + # model + else + # models (e.g. Pet) or oneOf + klass = Algolia::Recommend.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass + .build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + def to_json(*_args) + to_hash.to_json + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to?(:to_hash) + value.to_hash + else + value + end + end + + end + + end +end diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/base_search_response.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/base_search_response.rb index 988ea85ba41..7a027ea0755 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/search/base_search_response.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/base_search_response.rb @@ -35,9 +35,6 @@ class BaseSearchResponse # Statistics for numerical facets. attr_accessor :facets_stats - # Number of hits per page. - attr_accessor :hits_per_page - # Index name used for the query. attr_accessor :index @@ -47,18 +44,9 @@ class BaseSearchResponse # Warnings about the query. attr_accessor :message - # Number of results (hits). - attr_accessor :nb_hits - - # Number of pages of results. - attr_accessor :nb_pages - # Number of hits selected and sorted by the relevant sort algorithm. attr_accessor :nb_sorted_hits - # Page of search results to retrieve. - attr_accessor :page - # Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. attr_accessor :parsed_query @@ -102,14 +90,10 @@ def self.attribute_map :exhaustive_typo => :exhaustiveTypo, :facets => :facets, :facets_stats => :facets_stats, - :hits_per_page => :hitsPerPage, :index => :index, :index_used => :indexUsed, :message => :message, - :nb_hits => :nbHits, - :nb_pages => :nbPages, :nb_sorted_hits => :nbSortedHits, - :page => :page, :parsed_query => :parsedQuery, :processing_time_ms => :processingTimeMS, :processing_timings_ms => :processingTimingsMS, @@ -141,14 +125,10 @@ def self.types_mapping :exhaustive_typo => :"Boolean", :facets => :"Hash>", :facets_stats => :"Hash", - :hits_per_page => :"Integer", :index => :"String", :index_used => :"String", :message => :"String", - :nb_hits => :"Integer", - :nb_pages => :"Integer", :nb_sorted_hits => :"Integer", - :page => :"Integer", :parsed_query => :"String", :processing_time_ms => :"Integer", :processing_timings_ms => :"Object", @@ -223,12 +203,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - else - self.hits_per_page = nil - end - if attributes.key?(:index) self.index = attributes[:index] end @@ -241,28 +215,10 @@ def initialize(attributes = {}) self.message = attributes[:message] end - if attributes.key?(:nb_hits) - self.nb_hits = attributes[:nb_hits] - else - self.nb_hits = nil - end - - if attributes.key?(:nb_pages) - self.nb_pages = attributes[:nb_pages] - else - self.nb_pages = nil - end - if attributes.key?(:nb_sorted_hits) self.nb_sorted_hits = attributes[:nb_sorted_hits] end - if attributes.key?(:page) - self.page = attributes[:page] - else - self.page = nil - end - if attributes.key?(:parsed_query) self.parsed_query = attributes[:parsed_query] end @@ -339,38 +295,6 @@ def around_lat_lng=(around_lat_lng) @around_lat_lng = around_lat_lng end - # Custom attribute writer method with validation - # @param [Object] hits_per_page Value to be assigned - def hits_per_page=(hits_per_page) - if hits_per_page.nil? - raise ArgumentError, "hits_per_page cannot be nil" - end - - if hits_per_page > 1000 - raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." - end - - if hits_per_page < 1 - raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." - end - - @hits_per_page = hits_per_page - end - - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(other) @@ -386,14 +310,10 @@ def ==(other) exhaustive_typo == other.exhaustive_typo && facets == other.facets && facets_stats == other.facets_stats && - hits_per_page == other.hits_per_page && index == other.index && index_used == other.index_used && message == other.message && - nb_hits == other.nb_hits && - nb_pages == other.nb_pages && nb_sorted_hits == other.nb_sorted_hits && - page == other.page && parsed_query == other.parsed_query && processing_time_ms == other.processing_time_ms && processing_timings_ms == other.processing_timings_ms && @@ -426,14 +346,10 @@ def hash exhaustive_typo, facets, facets_stats, - hits_per_page, index, index_used, message, - nb_hits, - nb_pages, nb_sorted_hits, - page, parsed_query, processing_time_ms, processing_timings_ms, diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_pagination.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_pagination.rb new file mode 100644 index 00000000000..05ac8f1d320 --- /dev/null +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_pagination.rb @@ -0,0 +1,274 @@ +# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +require "date" +require "time" + +module Algolia + module Search + class BrowsePagination + # Page of search results to retrieve. + attr_accessor :page + + # Number of results (hits). + attr_accessor :nb_hits + + # Number of pages of results. + attr_accessor :nb_pages + + # Number of hits per page. + attr_accessor :hits_per_page + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :page => :page, + :nb_hits => :nbHits, + :nb_pages => :nbPages, + :hits_per_page => :hitsPerPage + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.types_mapping + { + :page => :"Integer", + :nb_hits => :"Integer", + :nb_pages => :"Integer", + :hits_per_page => :"Integer" + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new( + [] + ) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + raise( + ArgumentError, + "The input argument (attributes) must be a hash in `Algolia::BrowsePagination` initialize method" + ) + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + raise( + ArgumentError, + "`#{k}` is not a valid attribute in `Algolia::BrowsePagination`. Please check the name to make sure it's valid. List of attributes: " + + self.class.attribute_map.keys.inspect + ) + end + + h[k.to_sym] = v + } + + if attributes.key?(:page) + self.page = attributes[:page] + end + + if attributes.key?(:nb_hits) + self.nb_hits = attributes[:nb_hits] + end + + if attributes.key?(:nb_pages) + self.nb_pages = attributes[:nb_pages] + end + + if attributes.key?(:hits_per_page) + self.hits_per_page = attributes[:hits_per_page] + end + end + + # Custom attribute writer method with validation + # @param [Object] page Value to be assigned + def page=(page) + if page.nil? + raise ArgumentError, "page cannot be nil" + end + + if page < 0 + raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." + end + + @page = page + end + + # Custom attribute writer method with validation + # @param [Object] hits_per_page Value to be assigned + def hits_per_page=(hits_per_page) + if hits_per_page.nil? + raise ArgumentError, "hits_per_page cannot be nil" + end + + if hits_per_page > 1000 + raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." + end + + if hits_per_page < 1 + raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." + end + + @hits_per_page = hits_per_page + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(other) + return true if self.equal?(other) + self.class == other.class && + page == other.page && + nb_hits == other.nb_hits && + nb_pages == other.nb_pages && + hits_per_page == other.hits_per_page + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(other) + self == other + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [page, nb_hits, nb_pages, hits_per_page].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + types_mapping.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash[key.to_sym] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| + _deserialize(::Regexp.last_match(1), v) + } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) + end + end + + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + # model + else + # models (e.g. Pet) or oneOf + klass = Algolia::Search.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass + .build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + def to_json(*_args) + to_hash.to_json + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to?(:to_hash) + value.to_hash + else + value + end + end + + end + + end +end diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_response.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_response.rb index 0adc9610a09..6f204f46ef3 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_response.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/browse_response.rb @@ -35,9 +35,6 @@ class BrowseResponse # Statistics for numerical facets. attr_accessor :facets_stats - # Number of hits per page. - attr_accessor :hits_per_page - # Index name used for the query. attr_accessor :index @@ -47,18 +44,9 @@ class BrowseResponse # Warnings about the query. attr_accessor :message - # Number of results (hits). - attr_accessor :nb_hits - - # Number of pages of results. - attr_accessor :nb_pages - # Number of hits selected and sorted by the relevant sort algorithm. attr_accessor :nb_sorted_hits - # Page of search results to retrieve. - attr_accessor :page - # Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. attr_accessor :parsed_query @@ -87,6 +75,18 @@ class BrowseResponse # Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). attr_accessor :query_id + # Page of search results to retrieve. + attr_accessor :page + + # Number of results (hits). + attr_accessor :nb_hits + + # Number of pages of results. + attr_accessor :nb_pages + + # Number of hits per page. + attr_accessor :hits_per_page + # Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. attr_accessor :hits @@ -112,14 +112,10 @@ def self.attribute_map :exhaustive_typo => :exhaustiveTypo, :facets => :facets, :facets_stats => :facets_stats, - :hits_per_page => :hitsPerPage, :index => :index, :index_used => :indexUsed, :message => :message, - :nb_hits => :nbHits, - :nb_pages => :nbPages, :nb_sorted_hits => :nbSortedHits, - :page => :page, :parsed_query => :parsedQuery, :processing_time_ms => :processingTimeMS, :processing_timings_ms => :processingTimingsMS, @@ -130,6 +126,10 @@ def self.attribute_map :server_used => :serverUsed, :user_data => :userData, :query_id => :queryID, + :page => :page, + :nb_hits => :nbHits, + :nb_pages => :nbPages, + :hits_per_page => :hitsPerPage, :hits => :hits, :query => :query, :params => :params, @@ -155,14 +155,10 @@ def self.types_mapping :exhaustive_typo => :"Boolean", :facets => :"Hash>", :facets_stats => :"Hash", - :hits_per_page => :"Integer", :index => :"String", :index_used => :"String", :message => :"String", - :nb_hits => :"Integer", - :nb_pages => :"Integer", :nb_sorted_hits => :"Integer", - :page => :"Integer", :parsed_query => :"String", :processing_time_ms => :"Integer", :processing_timings_ms => :"Object", @@ -173,6 +169,10 @@ def self.types_mapping :server_used => :"String", :user_data => :"Object", :query_id => :"String", + :page => :"Integer", + :nb_hits => :"Integer", + :nb_pages => :"Integer", + :hits_per_page => :"Integer", :hits => :"Array", :query => :"String", :params => :"String", @@ -191,6 +191,7 @@ def self.openapi_nullable def self.openapi_all_of [ :"BaseSearchResponse", + :"BrowsePagination", :"Cursor", :"SearchHits" ] @@ -263,12 +264,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - else - self.hits_per_page = nil - end - if attributes.key?(:index) self.index = attributes[:index] end @@ -281,28 +276,10 @@ def initialize(attributes = {}) self.message = attributes[:message] end - if attributes.key?(:nb_hits) - self.nb_hits = attributes[:nb_hits] - else - self.nb_hits = nil - end - - if attributes.key?(:nb_pages) - self.nb_pages = attributes[:nb_pages] - else - self.nb_pages = nil - end - if attributes.key?(:nb_sorted_hits) self.nb_sorted_hits = attributes[:nb_sorted_hits] end - if attributes.key?(:page) - self.page = attributes[:page] - else - self.page = nil - end - if attributes.key?(:parsed_query) self.parsed_query = attributes[:parsed_query] end @@ -345,6 +322,22 @@ def initialize(attributes = {}) self.query_id = attributes[:query_id] end + if attributes.key?(:page) + self.page = attributes[:page] + end + + if attributes.key?(:nb_hits) + self.nb_hits = attributes[:nb_hits] + end + + if attributes.key?(:nb_pages) + self.nb_pages = attributes[:nb_pages] + end + + if attributes.key?(:hits_per_page) + self.hits_per_page = attributes[:hits_per_page] + end + if attributes.key?(:hits) if (value = attributes[:hits]).is_a?(Array) self.hits = value @@ -399,6 +392,20 @@ def around_lat_lng=(around_lat_lng) @around_lat_lng = around_lat_lng end + # Custom attribute writer method with validation + # @param [Object] page Value to be assigned + def page=(page) + if page.nil? + raise ArgumentError, "page cannot be nil" + end + + if page < 0 + raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." + end + + @page = page + end + # Custom attribute writer method with validation # @param [Object] hits_per_page Value to be assigned def hits_per_page=(hits_per_page) @@ -417,20 +424,6 @@ def hits_per_page=(hits_per_page) @hits_per_page = hits_per_page end - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(other) @@ -446,14 +439,10 @@ def ==(other) exhaustive_typo == other.exhaustive_typo && facets == other.facets && facets_stats == other.facets_stats && - hits_per_page == other.hits_per_page && index == other.index && index_used == other.index_used && message == other.message && - nb_hits == other.nb_hits && - nb_pages == other.nb_pages && nb_sorted_hits == other.nb_sorted_hits && - page == other.page && parsed_query == other.parsed_query && processing_time_ms == other.processing_time_ms && processing_timings_ms == other.processing_timings_ms && @@ -464,6 +453,10 @@ def ==(other) server_used == other.server_used && user_data == other.user_data && query_id == other.query_id && + page == other.page && + nb_hits == other.nb_hits && + nb_pages == other.nb_pages && + hits_per_page == other.hits_per_page && hits == other.hits && query == other.query && params == other.params && @@ -490,14 +483,10 @@ def hash exhaustive_typo, facets, facets_stats, - hits_per_page, index, index_used, message, - nb_hits, - nb_pages, nb_sorted_hits, - page, parsed_query, processing_time_ms, processing_timings_ms, @@ -508,6 +497,10 @@ def hash server_used, user_data, query_id, + page, + nb_hits, + nb_pages, + hits_per_page, hits, query, params, diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_pagination.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_pagination.rb new file mode 100644 index 00000000000..aba3c640eae --- /dev/null +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_pagination.rb @@ -0,0 +1,282 @@ +# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +require "date" +require "time" + +module Algolia + module Search + class SearchPagination + # Page of search results to retrieve. + attr_accessor :page + + # Number of results (hits). + attr_accessor :nb_hits + + # Number of pages of results. + attr_accessor :nb_pages + + # Number of hits per page. + attr_accessor :hits_per_page + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :page => :page, + :nb_hits => :nbHits, + :nb_pages => :nbPages, + :hits_per_page => :hitsPerPage + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.types_mapping + { + :page => :"Integer", + :nb_hits => :"Integer", + :nb_pages => :"Integer", + :hits_per_page => :"Integer" + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new( + [] + ) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + raise( + ArgumentError, + "The input argument (attributes) must be a hash in `Algolia::SearchPagination` initialize method" + ) + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + raise( + ArgumentError, + "`#{k}` is not a valid attribute in `Algolia::SearchPagination`. Please check the name to make sure it's valid. List of attributes: " + + self.class.attribute_map.keys.inspect + ) + end + + h[k.to_sym] = v + } + + if attributes.key?(:page) + self.page = attributes[:page] + else + self.page = nil + end + + if attributes.key?(:nb_hits) + self.nb_hits = attributes[:nb_hits] + else + self.nb_hits = nil + end + + if attributes.key?(:nb_pages) + self.nb_pages = attributes[:nb_pages] + else + self.nb_pages = nil + end + + if attributes.key?(:hits_per_page) + self.hits_per_page = attributes[:hits_per_page] + else + self.hits_per_page = nil + end + end + + # Custom attribute writer method with validation + # @param [Object] page Value to be assigned + def page=(page) + if page.nil? + raise ArgumentError, "page cannot be nil" + end + + if page < 0 + raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." + end + + @page = page + end + + # Custom attribute writer method with validation + # @param [Object] hits_per_page Value to be assigned + def hits_per_page=(hits_per_page) + if hits_per_page.nil? + raise ArgumentError, "hits_per_page cannot be nil" + end + + if hits_per_page > 1000 + raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." + end + + if hits_per_page < 1 + raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." + end + + @hits_per_page = hits_per_page + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(other) + return true if self.equal?(other) + self.class == other.class && + page == other.page && + nb_hits == other.nb_hits && + nb_pages == other.nb_pages && + hits_per_page == other.hits_per_page + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(other) + self == other + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [page, nb_hits, nb_pages, hits_per_page].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + types_mapping.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash[key.to_sym] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| + _deserialize(::Regexp.last_match(1), v) + } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) + end + end + + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + # model + else + # models (e.g. Pet) or oneOf + klass = Algolia::Search.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass + .build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + def to_json(*_args) + to_hash.to_json + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to?(:to_hash) + value.to_hash + else + value + end + end + + end + + end +end diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_response.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_response.rb index f6ae7697bb9..1ca5b1f8f58 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_response.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/search_response.rb @@ -35,9 +35,6 @@ class SearchResponse # Statistics for numerical facets. attr_accessor :facets_stats - # Number of hits per page. - attr_accessor :hits_per_page - # Index name used for the query. attr_accessor :index @@ -47,18 +44,9 @@ class SearchResponse # Warnings about the query. attr_accessor :message - # Number of results (hits). - attr_accessor :nb_hits - - # Number of pages of results. - attr_accessor :nb_pages - # Number of hits selected and sorted by the relevant sort algorithm. attr_accessor :nb_sorted_hits - # Page of search results to retrieve. - attr_accessor :page - # Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. attr_accessor :parsed_query @@ -87,6 +75,18 @@ class SearchResponse # Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). attr_accessor :query_id + # Page of search results to retrieve. + attr_accessor :page + + # Number of results (hits). + attr_accessor :nb_hits + + # Number of pages of results. + attr_accessor :nb_pages + + # Number of hits per page. + attr_accessor :hits_per_page + # Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. attr_accessor :hits @@ -111,14 +111,10 @@ def self.attribute_map :exhaustive_typo => :exhaustiveTypo, :facets => :facets, :facets_stats => :facets_stats, - :hits_per_page => :hitsPerPage, :index => :index, :index_used => :indexUsed, :message => :message, - :nb_hits => :nbHits, - :nb_pages => :nbPages, :nb_sorted_hits => :nbSortedHits, - :page => :page, :parsed_query => :parsedQuery, :processing_time_ms => :processingTimeMS, :processing_timings_ms => :processingTimingsMS, @@ -129,6 +125,10 @@ def self.attribute_map :server_used => :serverUsed, :user_data => :userData, :query_id => :queryID, + :page => :page, + :nb_hits => :nbHits, + :nb_pages => :nbPages, + :hits_per_page => :hitsPerPage, :hits => :hits, :query => :query, :params => :params @@ -153,14 +153,10 @@ def self.types_mapping :exhaustive_typo => :"Boolean", :facets => :"Hash>", :facets_stats => :"Hash", - :hits_per_page => :"Integer", :index => :"String", :index_used => :"String", :message => :"String", - :nb_hits => :"Integer", - :nb_pages => :"Integer", :nb_sorted_hits => :"Integer", - :page => :"Integer", :parsed_query => :"String", :processing_time_ms => :"Integer", :processing_timings_ms => :"Object", @@ -171,6 +167,10 @@ def self.types_mapping :server_used => :"String", :user_data => :"Object", :query_id => :"String", + :page => :"Integer", + :nb_hits => :"Integer", + :nb_pages => :"Integer", + :hits_per_page => :"Integer", :hits => :"Array", :query => :"String", :params => :"String" @@ -188,7 +188,8 @@ def self.openapi_nullable def self.openapi_all_of [ :"BaseSearchResponse", - :"SearchHits" + :"SearchHits", + :"SearchPagination" ] end @@ -246,12 +247,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - else - self.hits_per_page = nil - end - if attributes.key?(:index) self.index = attributes[:index] end @@ -264,28 +259,10 @@ def initialize(attributes = {}) self.message = attributes[:message] end - if attributes.key?(:nb_hits) - self.nb_hits = attributes[:nb_hits] - else - self.nb_hits = nil - end - - if attributes.key?(:nb_pages) - self.nb_pages = attributes[:nb_pages] - else - self.nb_pages = nil - end - if attributes.key?(:nb_sorted_hits) self.nb_sorted_hits = attributes[:nb_sorted_hits] end - if attributes.key?(:page) - self.page = attributes[:page] - else - self.page = nil - end - if attributes.key?(:parsed_query) self.parsed_query = attributes[:parsed_query] end @@ -328,6 +305,30 @@ def initialize(attributes = {}) self.query_id = attributes[:query_id] end + if attributes.key?(:page) + self.page = attributes[:page] + else + self.page = nil + end + + if attributes.key?(:nb_hits) + self.nb_hits = attributes[:nb_hits] + else + self.nb_hits = nil + end + + if attributes.key?(:nb_pages) + self.nb_pages = attributes[:nb_pages] + else + self.nb_pages = nil + end + + if attributes.key?(:hits_per_page) + self.hits_per_page = attributes[:hits_per_page] + else + self.hits_per_page = nil + end + if attributes.key?(:hits) if (value = attributes[:hits]).is_a?(Array) self.hits = value @@ -382,6 +383,20 @@ def around_lat_lng=(around_lat_lng) @around_lat_lng = around_lat_lng end + # Custom attribute writer method with validation + # @param [Object] page Value to be assigned + def page=(page) + if page.nil? + raise ArgumentError, "page cannot be nil" + end + + if page < 0 + raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." + end + + @page = page + end + # Custom attribute writer method with validation # @param [Object] hits_per_page Value to be assigned def hits_per_page=(hits_per_page) @@ -400,20 +415,6 @@ def hits_per_page=(hits_per_page) @hits_per_page = hits_per_page end - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(other) @@ -429,14 +430,10 @@ def ==(other) exhaustive_typo == other.exhaustive_typo && facets == other.facets && facets_stats == other.facets_stats && - hits_per_page == other.hits_per_page && index == other.index && index_used == other.index_used && message == other.message && - nb_hits == other.nb_hits && - nb_pages == other.nb_pages && nb_sorted_hits == other.nb_sorted_hits && - page == other.page && parsed_query == other.parsed_query && processing_time_ms == other.processing_time_ms && processing_timings_ms == other.processing_timings_ms && @@ -447,6 +444,10 @@ def ==(other) server_used == other.server_used && user_data == other.user_data && query_id == other.query_id && + page == other.page && + nb_hits == other.nb_hits && + nb_pages == other.nb_pages && + hits_per_page == other.hits_per_page && hits == other.hits && query == other.query && params == other.params @@ -472,14 +473,10 @@ def hash exhaustive_typo, facets, facets_stats, - hits_per_page, index, index_used, message, - nb_hits, - nb_pages, nb_sorted_hits, - page, parsed_query, processing_time_ms, processing_timings_ms, @@ -490,6 +487,10 @@ def hash server_used, user_data, query_id, + page, + nb_hits, + nb_pages, + hits_per_page, hits, query, params diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/BaseSearchResponse.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/BaseSearchResponse.scala index 55385a8a03f..e7f04a28808 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/BaseSearchResponse.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/BaseSearchResponse.scala @@ -52,22 +52,14 @@ import org.json4s.{Extraction, Formats, JField, JObject, JValue, Serializer, Typ * Facet counts. * @param facetsStats * Statistics for numerical facets. - * @param hitsPerPage - * Number of hits per page. * @param index * Index name used for the query. * @param indexUsed * Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. * @param message * Warnings about the query. - * @param nbHits - * Number of results (hits). - * @param nbPages - * Number of pages of results. * @param nbSortedHits * Number of hits selected and sorted by the relevant sort algorithm. - * @param page - * Page of search results to retrieve. * @param parsedQuery * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) * query string that will be searched. @@ -99,14 +91,10 @@ case class BaseSearchResponse( exhaustiveTypo: Option[Boolean] = scala.None, facets: Option[Map[String, Map[String, Int]]] = scala.None, facetsStats: Option[Map[String, FacetsStats]] = scala.None, - hitsPerPage: Int, index: Option[String] = scala.None, indexUsed: Option[String] = scala.None, message: Option[String] = scala.None, - nbHits: Int, - nbPages: Int, nbSortedHits: Option[Int] = scala.None, - page: Int, parsedQuery: Option[String] = scala.None, processingTimeMS: Int, processingTimingsMS: Option[Any] = scala.None, @@ -141,14 +129,10 @@ class BaseSearchResponseSerializer extends Serializer[BaseSearchResponse] { "exhaustiveTypo", "facets", "facetsStats", - "hitsPerPage", "index", "indexUsed", "message", - "nbHits", - "nbPages", "nbSortedHits", - "page", "parsedQuery", "processingTimeMS", "processingTimingsMS", diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/RecommendationsResults.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/RecommendationsResults.scala index fbdcb7b037c..f9c365a4c27 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/RecommendationsResults.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/RecommendationsResults.scala @@ -49,22 +49,14 @@ package algoliasearch.recommend * Facet counts. * @param facetsStats * Statistics for numerical facets. - * @param hitsPerPage - * Number of hits per page. * @param index * Index name used for the query. * @param indexUsed * Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. * @param message * Warnings about the query. - * @param nbHits - * Number of results (hits). - * @param nbPages - * Number of pages of results. * @param nbSortedHits * Number of hits selected and sorted by the relevant sort algorithm. - * @param page - * Page of search results to retrieve. * @param parsedQuery * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) * query string that will be searched. @@ -84,6 +76,14 @@ package algoliasearch.recommend * @param queryID * Unique identifier for the query. This is used for [click * analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). + * @param page + * Page of search results to retrieve. + * @param nbHits + * Number of results (hits). + * @param nbPages + * Number of pages of results. + * @param hitsPerPage + * Number of hits per page. */ case class RecommendationsResults( abTestID: Option[Int] = scala.None, @@ -96,14 +96,10 @@ case class RecommendationsResults( exhaustiveTypo: Option[Boolean] = scala.None, facets: Option[Map[String, Map[String, Int]]] = scala.None, facetsStats: Option[Map[String, FacetsStats]] = scala.None, - hitsPerPage: Int, index: Option[String] = scala.None, indexUsed: Option[String] = scala.None, message: Option[String] = scala.None, - nbHits: Int, - nbPages: Int, nbSortedHits: Option[Int] = scala.None, - page: Int, parsedQuery: Option[String] = scala.None, processingTimeMS: Int, processingTimingsMS: Option[Any] = scala.None, @@ -114,5 +110,9 @@ case class RecommendationsResults( serverUsed: Option[String] = scala.None, userData: Option[Any] = scala.None, queryID: Option[String] = scala.None, + page: Int, + nbHits: Int, + nbPages: Int, + hitsPerPage: Int, hits: Seq[RecommendationsHit] ) diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/SearchPagination.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/SearchPagination.scala new file mode 100644 index 00000000000..3d2594f7043 --- /dev/null +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/SearchPagination.scala @@ -0,0 +1,48 @@ +/** Recommend API The Recommend API lets you retrieve recommendations from one of Algolia's AI recommendation models + * that you previously trained on your data. ## Client libraries Use Algolia's API clients and libraries to reliably + * integrate Algolia's APIs with your apps. The official API clients are covered by Algolia's [Service Level + * Agreement](https://www.algolia.com/policies/sla/). See: [Algolia's + * ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ## Base URLs + * The base URLs for requests to the Recommend API are: - `https://{APPLICATION_ID}.algolia.net` - + * `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search + * Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both + * URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ## + * Retry strategy To guarantee a high availability, implement a retry strategy for all API requests using the URLs of + * your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` - + * `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different + * DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers. + * All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add + * these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the + * necessary permissions to make the request. The required access control list (ACL) to make a request is listed in + * each endpoint's reference. You can find your application ID and API key in the [Algolia + * dashboard](https://dashboard.algolia.com/account). ## Request format Request bodies must be JSON objects. ## + * Response status and errors The Recommend API returns JSON responses. Since JSON doesn't guarantee any specific + * ordering, don't rely on the order of attributes in the API response. Successful responses return a `2xx` status. + * Client errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message` + * property with more information. ## Version The current version of the Recommend API is version 1, as indicated by + * the `/1/` in each endpoint's URL. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech Do not edit the class manually. + */ +package algoliasearch.recommend + +/** SearchPagination + * + * @param page + * Page of search results to retrieve. + * @param nbHits + * Number of results (hits). + * @param nbPages + * Number of pages of results. + * @param hitsPerPage + * Number of hits per page. + */ +case class SearchPagination( + page: Int, + nbHits: Int, + nbPages: Int, + hitsPerPage: Int +) diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BaseSearchResponse.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BaseSearchResponse.scala index a6dafdecb42..e80851a7f56 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BaseSearchResponse.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BaseSearchResponse.scala @@ -56,22 +56,14 @@ import org.json4s.{Extraction, Formats, JField, JObject, JValue, Serializer, Typ * Facet counts. * @param facetsStats * Statistics for numerical facets. - * @param hitsPerPage - * Number of hits per page. * @param index * Index name used for the query. * @param indexUsed * Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. * @param message * Warnings about the query. - * @param nbHits - * Number of results (hits). - * @param nbPages - * Number of pages of results. * @param nbSortedHits * Number of hits selected and sorted by the relevant sort algorithm. - * @param page - * Page of search results to retrieve. * @param parsedQuery * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) * query string that will be searched. @@ -103,14 +95,10 @@ case class BaseSearchResponse( exhaustiveTypo: Option[Boolean] = scala.None, facets: Option[Map[String, Map[String, Int]]] = scala.None, facetsStats: Option[Map[String, FacetsStats]] = scala.None, - hitsPerPage: Int, index: Option[String] = scala.None, indexUsed: Option[String] = scala.None, message: Option[String] = scala.None, - nbHits: Int, - nbPages: Int, nbSortedHits: Option[Int] = scala.None, - page: Int, parsedQuery: Option[String] = scala.None, processingTimeMS: Int, processingTimingsMS: Option[Any] = scala.None, @@ -145,14 +133,10 @@ class BaseSearchResponseSerializer extends Serializer[BaseSearchResponse] { "exhaustiveTypo", "facets", "facetsStats", - "hitsPerPage", "index", "indexUsed", "message", - "nbHits", - "nbPages", "nbSortedHits", - "page", "parsedQuery", "processingTimeMS", "processingTimingsMS", diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowsePagination.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowsePagination.scala new file mode 100644 index 00000000000..6049140d133 --- /dev/null +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowsePagination.scala @@ -0,0 +1,52 @@ +/** Search API The Algolia Search API lets you search, configure, and mange your indices and records. ## Client + * libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. The official + * API clients are covered by Algolia's [Service Level Agreement](https://www.algolia.com/policies/sla/). See: + * [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ## + * Base URLs The base URLs for requests to the Search API are: - `https://{APPLICATION_ID}.algolia.net` - + * `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search + * Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both + * URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ## + * Retry strategy To guarantee a high availability, implement a retry strategy for all API requests using the URLs of + * your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` - + * `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different + * DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers. + * All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add + * these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the + * necessary permissions to make the request. The required access control list (ACL) to make a request is listed in + * each endpoint's reference. You can find your application ID and API key in the [Algolia + * dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are + * either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed as query parameters for GET and + * DELETE requests, and in the request body for POST and PUT requests. Query parameters must be + * [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be + * UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. Arrays as query parameters must be one of: - A + * comma-separated string: `attributesToRetrieve=title,description` - A URL-encoded JSON array: + * `attributesToRetrieve=%5B%22title%22,%22description%22%D` ## Response status and errors The Search API returns JSON + * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API + * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are + * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current + * version of the Search API is version 1, as indicated by the `/1/` in each endpoint's URL. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech Do not edit the class manually. + */ +package algoliasearch.search + +/** BrowsePagination + * + * @param page + * Page of search results to retrieve. + * @param nbHits + * Number of results (hits). + * @param nbPages + * Number of pages of results. + * @param hitsPerPage + * Number of hits per page. + */ +case class BrowsePagination( + page: Option[Int] = scala.None, + nbHits: Option[Int] = scala.None, + nbPages: Option[Int] = scala.None, + hitsPerPage: Option[Int] = scala.None +) diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowseResponse.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowseResponse.scala index b80feb34805..f783563252d 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowseResponse.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/BrowseResponse.scala @@ -53,22 +53,14 @@ package algoliasearch.search * Facet counts. * @param facetsStats * Statistics for numerical facets. - * @param hitsPerPage - * Number of hits per page. * @param index * Index name used for the query. * @param indexUsed * Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. * @param message * Warnings about the query. - * @param nbHits - * Number of results (hits). - * @param nbPages - * Number of pages of results. * @param nbSortedHits * Number of hits selected and sorted by the relevant sort algorithm. - * @param page - * Page of search results to retrieve. * @param parsedQuery * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) * query string that will be searched. @@ -88,6 +80,14 @@ package algoliasearch.search * @param queryID * Unique identifier for the query. This is used for [click * analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). + * @param page + * Page of search results to retrieve. + * @param nbHits + * Number of results (hits). + * @param nbPages + * Number of pages of results. + * @param hitsPerPage + * Number of hits per page. * @param hits * Search results (hits). Hits are records from your index that match the search criteria, augmented with additional * attributes, such as, for highlighting. @@ -110,14 +110,10 @@ case class BrowseResponse( exhaustiveTypo: Option[Boolean] = scala.None, facets: Option[Map[String, Map[String, Int]]] = scala.None, facetsStats: Option[Map[String, FacetsStats]] = scala.None, - hitsPerPage: Int, index: Option[String] = scala.None, indexUsed: Option[String] = scala.None, message: Option[String] = scala.None, - nbHits: Int, - nbPages: Int, nbSortedHits: Option[Int] = scala.None, - page: Int, parsedQuery: Option[String] = scala.None, processingTimeMS: Int, processingTimingsMS: Option[Any] = scala.None, @@ -128,6 +124,10 @@ case class BrowseResponse( serverUsed: Option[String] = scala.None, userData: Option[Any] = scala.None, queryID: Option[String] = scala.None, + page: Option[Int] = scala.None, + nbHits: Option[Int] = scala.None, + nbPages: Option[Int] = scala.None, + hitsPerPage: Option[Int] = scala.None, hits: Seq[Hit], query: String, params: String, diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchPagination.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchPagination.scala new file mode 100644 index 00000000000..85da75f973b --- /dev/null +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchPagination.scala @@ -0,0 +1,52 @@ +/** Search API The Algolia Search API lets you search, configure, and mange your indices and records. ## Client + * libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. The official + * API clients are covered by Algolia's [Service Level Agreement](https://www.algolia.com/policies/sla/). See: + * [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ## + * Base URLs The base URLs for requests to the Search API are: - `https://{APPLICATION_ID}.algolia.net` - + * `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search + * Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both + * URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ## + * Retry strategy To guarantee a high availability, implement a retry strategy for all API requests using the URLs of + * your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` - + * `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different + * DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers. + * All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add + * these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the + * necessary permissions to make the request. The required access control list (ACL) to make a request is listed in + * each endpoint's reference. You can find your application ID and API key in the [Algolia + * dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are + * either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed as query parameters for GET and + * DELETE requests, and in the request body for POST and PUT requests. Query parameters must be + * [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be + * UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. Arrays as query parameters must be one of: - A + * comma-separated string: `attributesToRetrieve=title,description` - A URL-encoded JSON array: + * `attributesToRetrieve=%5B%22title%22,%22description%22%D` ## Response status and errors The Search API returns JSON + * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API + * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are + * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current + * version of the Search API is version 1, as indicated by the `/1/` in each endpoint's URL. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech Do not edit the class manually. + */ +package algoliasearch.search + +/** SearchPagination + * + * @param page + * Page of search results to retrieve. + * @param nbHits + * Number of results (hits). + * @param nbPages + * Number of pages of results. + * @param hitsPerPage + * Number of hits per page. + */ +case class SearchPagination( + page: Int, + nbHits: Int, + nbPages: Int, + hitsPerPage: Int +) diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchResponse.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchResponse.scala index c757e057454..e7de7c43e0d 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchResponse.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/SearchResponse.scala @@ -53,22 +53,14 @@ package algoliasearch.search * Facet counts. * @param facetsStats * Statistics for numerical facets. - * @param hitsPerPage - * Number of hits per page. * @param index * Index name used for the query. * @param indexUsed * Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. * @param message * Warnings about the query. - * @param nbHits - * Number of results (hits). - * @param nbPages - * Number of pages of results. * @param nbSortedHits * Number of hits selected and sorted by the relevant sort algorithm. - * @param page - * Page of search results to retrieve. * @param parsedQuery * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) * query string that will be searched. @@ -88,6 +80,14 @@ package algoliasearch.search * @param queryID * Unique identifier for the query. This is used for [click * analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). + * @param page + * Page of search results to retrieve. + * @param nbHits + * Number of results (hits). + * @param nbPages + * Number of pages of results. + * @param hitsPerPage + * Number of hits per page. * @param hits * Search results (hits). Hits are records from your index that match the search criteria, augmented with additional * attributes, such as, for highlighting. @@ -107,14 +107,10 @@ case class SearchResponse( exhaustiveTypo: Option[Boolean] = scala.None, facets: Option[Map[String, Map[String, Int]]] = scala.None, facetsStats: Option[Map[String, FacetsStats]] = scala.None, - hitsPerPage: Int, index: Option[String] = scala.None, indexUsed: Option[String] = scala.None, message: Option[String] = scala.None, - nbHits: Int, - nbPages: Int, nbSortedHits: Option[Int] = scala.None, - page: Int, parsedQuery: Option[String] = scala.None, processingTimeMS: Int, processingTimingsMS: Option[Any] = scala.None, @@ -125,6 +121,10 @@ case class SearchResponse( serverUsed: Option[String] = scala.None, userData: Option[Any] = scala.None, queryID: Option[String] = scala.None, + page: Int, + nbHits: Int, + nbPages: Int, + hitsPerPage: Int, hits: Seq[Hit], query: String, params: String diff --git a/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendBaseSearchResponse.swift b/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendBaseSearchResponse.swift index ac69ed930e3..044dedb49a9 100644 --- a/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendBaseSearchResponse.swift +++ b/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendBaseSearchResponse.swift @@ -29,22 +29,14 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { public var facets: [String: [String: Int]]? /// Statistics for numerical facets. public var facetsStats: [String: RecommendFacetsStats]? - /// Number of hits per page. - public var hitsPerPage: Int /// Index name used for the query. public var index: String? /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. public var indexUsed: String? /// Warnings about the query. public var message: String? - /// Number of results (hits). - public var nbHits: Int - /// Number of pages of results. - public var nbPages: Int /// Number of hits selected and sorted by the relevant sort algorithm. public var nbSortedHits: Int? - /// Page of search results to retrieve. - public var page: Int /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) /// query string that will be searched. public var parsedQuery: String? @@ -78,14 +70,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { exhaustiveTypo: Bool? = nil, facets: [String: [String: Int]]? = nil, facetsStats: [String: RecommendFacetsStats]? = nil, - hitsPerPage: Int, index: String? = nil, indexUsed: String? = nil, message: String? = nil, - nbHits: Int, - nbPages: Int, nbSortedHits: Int? = nil, - page: Int, parsedQuery: String? = nil, processingTimeMS: Int, processingTimingsMS: AnyCodable? = nil, @@ -107,14 +95,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { self.exhaustiveTypo = exhaustiveTypo self.facets = facets self.facetsStats = facetsStats - self.hitsPerPage = hitsPerPage self.index = index self.indexUsed = indexUsed self.message = message - self.nbHits = nbHits - self.nbPages = nbPages self.nbSortedHits = nbSortedHits - self.page = page self.parsedQuery = parsedQuery self.processingTimeMS = processingTimeMS self.processingTimingsMS = processingTimingsMS @@ -138,14 +122,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { case exhaustiveTypo case facets case facetsStats = "facets_stats" - case hitsPerPage case index case indexUsed case message - case nbHits - case nbPages case nbSortedHits - case page case parsedQuery case processingTimeMS case processingTimingsMS @@ -194,30 +174,14 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { self.facetsStats = dictionary["facetsStats"]?.value as? [String: RecommendFacetsStats] - guard let hitsPerPage = dictionary["hitsPerPage"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.hitsPerPage = hitsPerPage self.index = dictionary["index"]?.value as? String self.indexUsed = dictionary["indexUsed"]?.value as? String self.message = dictionary["message"]?.value as? String - guard let nbHits = dictionary["nbHits"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.nbHits = nbHits - guard let nbPages = dictionary["nbPages"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.nbPages = nbPages self.nbSortedHits = dictionary["nbSortedHits"]?.value as? Int - guard let page = dictionary["page"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.page = page self.parsedQuery = dictionary["parsedQuery"]?.value as? String guard let processingTimeMS = dictionary["processingTimeMS"]?.value as? Int else { @@ -243,10 +207,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { for (key, value) in dictionary { switch key { case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive", - "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "hitsPerPage", - "index", "indexUsed", "message", "nbHits", "nbPages", "nbSortedHits", "page", "parsedQuery", - "processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent", - "serverTimeMS", "serverUsed", "userData", "queryID": + "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index", + "indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS", + "queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData", + "queryID": continue default: self.additionalProperties[key] = value @@ -268,14 +232,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo) try container.encodeIfPresent(self.facets, forKey: .facets) try container.encodeIfPresent(self.facetsStats, forKey: .facetsStats) - try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encodeIfPresent(self.index, forKey: .index) try container.encodeIfPresent(self.indexUsed, forKey: .indexUsed) try container.encodeIfPresent(self.message, forKey: .message) - try container.encode(self.nbHits, forKey: .nbHits) - try container.encode(self.nbPages, forKey: .nbPages) try container.encodeIfPresent(self.nbSortedHits, forKey: .nbSortedHits) - try container.encode(self.page, forKey: .page) try container.encodeIfPresent(self.parsedQuery, forKey: .parsedQuery) try container.encode(self.processingTimeMS, forKey: .processingTimeMS) try container.encodeIfPresent(self.processingTimingsMS, forKey: .processingTimingsMS) @@ -305,14 +265,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { self.exhaustiveTypo = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveTypo) self.facets = try container.decodeIfPresent([String: [String: Int]].self, forKey: .facets) self.facetsStats = try container.decodeIfPresent([String: RecommendFacetsStats].self, forKey: .facetsStats) - self.hitsPerPage = try container.decode(Int.self, forKey: .hitsPerPage) self.index = try container.decodeIfPresent(String.self, forKey: .index) self.indexUsed = try container.decodeIfPresent(String.self, forKey: .indexUsed) self.message = try container.decodeIfPresent(String.self, forKey: .message) - self.nbHits = try container.decode(Int.self, forKey: .nbHits) - self.nbPages = try container.decode(Int.self, forKey: .nbPages) self.nbSortedHits = try container.decodeIfPresent(Int.self, forKey: .nbSortedHits) - self.page = try container.decode(Int.self, forKey: .page) self.parsedQuery = try container.decodeIfPresent(String.self, forKey: .parsedQuery) self.processingTimeMS = try container.decode(Int.self, forKey: .processingTimeMS) self.processingTimingsMS = try container.decodeIfPresent(AnyCodable.self, forKey: .processingTimingsMS) @@ -334,14 +290,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("exhaustiveTypo") nonAdditionalPropertyKeys.insert("facets") nonAdditionalPropertyKeys.insert("facets_stats") - nonAdditionalPropertyKeys.insert("hitsPerPage") nonAdditionalPropertyKeys.insert("index") nonAdditionalPropertyKeys.insert("indexUsed") nonAdditionalPropertyKeys.insert("message") - nonAdditionalPropertyKeys.insert("nbHits") - nonAdditionalPropertyKeys.insert("nbPages") nonAdditionalPropertyKeys.insert("nbSortedHits") - nonAdditionalPropertyKeys.insert("page") nonAdditionalPropertyKeys.insert("parsedQuery") nonAdditionalPropertyKeys.insert("processingTimeMS") nonAdditionalPropertyKeys.insert("processingTimingsMS") @@ -372,14 +324,10 @@ extension RecommendBaseSearchResponse: Equatable { lhs.exhaustiveTypo == rhs.exhaustiveTypo && lhs.facets == rhs.facets && lhs.facetsStats == rhs.facetsStats && - lhs.hitsPerPage == rhs.hitsPerPage && lhs.index == rhs.index && lhs.indexUsed == rhs.indexUsed && lhs.message == rhs.message && - lhs.nbHits == rhs.nbHits && - lhs.nbPages == rhs.nbPages && lhs.nbSortedHits == rhs.nbSortedHits && - lhs.page == rhs.page && lhs.parsedQuery == rhs.parsedQuery && lhs.processingTimeMS == rhs.processingTimeMS && lhs.processingTimingsMS == rhs.processingTimingsMS && @@ -406,14 +354,10 @@ extension RecommendBaseSearchResponse: Hashable { hasher.combine(self.exhaustiveTypo?.hashValue) hasher.combine(self.facets?.hashValue) hasher.combine(self.facetsStats?.hashValue) - hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.index?.hashValue) hasher.combine(self.indexUsed?.hashValue) hasher.combine(self.message?.hashValue) - hasher.combine(self.nbHits.hashValue) - hasher.combine(self.nbPages.hashValue) hasher.combine(self.nbSortedHits?.hashValue) - hasher.combine(self.page.hashValue) hasher.combine(self.parsedQuery?.hashValue) hasher.combine(self.processingTimeMS.hashValue) hasher.combine(self.processingTimingsMS?.hashValue) diff --git a/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendSearchPagination.swift b/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendSearchPagination.swift new file mode 100644 index 00000000000..5df6f6933ed --- /dev/null +++ b/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendSearchPagination.swift @@ -0,0 +1,60 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on +// https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +import Foundation +#if canImport(Core) + import Core +#endif + +public struct RecommendSearchPagination: Codable, JSONEncodable { + /// Page of search results to retrieve. + public var page: Int + /// Number of results (hits). + public var nbHits: Int + /// Number of pages of results. + public var nbPages: Int + /// Number of hits per page. + public var hitsPerPage: Int + + public init(page: Int, nbHits: Int, nbPages: Int, hitsPerPage: Int) { + self.page = page + self.nbHits = nbHits + self.nbPages = nbPages + self.hitsPerPage = hitsPerPage + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case page + case nbHits + case nbPages + case hitsPerPage + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(self.page, forKey: .page) + try container.encode(self.nbHits, forKey: .nbHits) + try container.encode(self.nbPages, forKey: .nbPages) + try container.encode(self.hitsPerPage, forKey: .hitsPerPage) + } +} + +extension RecommendSearchPagination: Equatable { + public static func ==(lhs: RecommendSearchPagination, rhs: RecommendSearchPagination) -> Bool { + lhs.page == rhs.page && + lhs.nbHits == rhs.nbHits && + lhs.nbPages == rhs.nbPages && + lhs.hitsPerPage == rhs.hitsPerPage + } +} + +extension RecommendSearchPagination: Hashable { + public func hash(into hasher: inout Hasher) { + hasher.combine(self.page.hashValue) + hasher.combine(self.nbHits.hashValue) + hasher.combine(self.nbPages.hashValue) + hasher.combine(self.hitsPerPage.hashValue) + } +} diff --git a/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendationsResults.swift b/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendationsResults.swift index e9d88f42e23..3b07779d500 100644 --- a/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendationsResults.swift +++ b/clients/algoliasearch-client-swift/Sources/Recommend/Models/RecommendationsResults.swift @@ -29,22 +29,14 @@ public struct RecommendationsResults: Codable, JSONEncodable { public var facets: [String: [String: Int]]? /// Statistics for numerical facets. public var facetsStats: [String: RecommendFacetsStats]? - /// Number of hits per page. - public var hitsPerPage: Int /// Index name used for the query. public var index: String? /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. public var indexUsed: String? /// Warnings about the query. public var message: String? - /// Number of results (hits). - public var nbHits: Int - /// Number of pages of results. - public var nbPages: Int /// Number of hits selected and sorted by the relevant sort algorithm. public var nbSortedHits: Int? - /// Page of search results to retrieve. - public var page: Int /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) /// query string that will be searched. public var parsedQuery: String? @@ -66,6 +58,14 @@ public struct RecommendationsResults: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Page of search results to retrieve. + public var page: Int + /// Number of results (hits). + public var nbHits: Int + /// Number of pages of results. + public var nbPages: Int + /// Number of hits per page. + public var hitsPerPage: Int public var hits: [RecommendationsHit] public init( @@ -79,14 +79,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { exhaustiveTypo: Bool? = nil, facets: [String: [String: Int]]? = nil, facetsStats: [String: RecommendFacetsStats]? = nil, - hitsPerPage: Int, index: String? = nil, indexUsed: String? = nil, message: String? = nil, - nbHits: Int, - nbPages: Int, nbSortedHits: Int? = nil, - page: Int, parsedQuery: String? = nil, processingTimeMS: Int, processingTimingsMS: AnyCodable? = nil, @@ -97,6 +93,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { serverUsed: String? = nil, userData: AnyCodable? = nil, queryID: String? = nil, + page: Int, + nbHits: Int, + nbPages: Int, + hitsPerPage: Int, hits: [RecommendationsHit] ) { self.abTestID = abTestID @@ -109,14 +109,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { self.exhaustiveTypo = exhaustiveTypo self.facets = facets self.facetsStats = facetsStats - self.hitsPerPage = hitsPerPage self.index = index self.indexUsed = indexUsed self.message = message - self.nbHits = nbHits - self.nbPages = nbPages self.nbSortedHits = nbSortedHits - self.page = page self.parsedQuery = parsedQuery self.processingTimeMS = processingTimeMS self.processingTimingsMS = processingTimingsMS @@ -127,6 +123,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.page = page + self.nbHits = nbHits + self.nbPages = nbPages + self.hitsPerPage = hitsPerPage self.hits = hits } @@ -141,14 +141,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { case exhaustiveTypo case facets case facetsStats = "facets_stats" - case hitsPerPage case index case indexUsed case message - case nbHits - case nbPages case nbSortedHits - case page case parsedQuery case processingTimeMS case processingTimingsMS @@ -159,6 +155,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { case serverUsed case userData case queryID + case page + case nbHits + case nbPages + case hitsPerPage case hits } @@ -176,14 +176,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo) try container.encodeIfPresent(self.facets, forKey: .facets) try container.encodeIfPresent(self.facetsStats, forKey: .facetsStats) - try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encodeIfPresent(self.index, forKey: .index) try container.encodeIfPresent(self.indexUsed, forKey: .indexUsed) try container.encodeIfPresent(self.message, forKey: .message) - try container.encode(self.nbHits, forKey: .nbHits) - try container.encode(self.nbPages, forKey: .nbPages) try container.encodeIfPresent(self.nbSortedHits, forKey: .nbSortedHits) - try container.encode(self.page, forKey: .page) try container.encodeIfPresent(self.parsedQuery, forKey: .parsedQuery) try container.encode(self.processingTimeMS, forKey: .processingTimeMS) try container.encodeIfPresent(self.processingTimingsMS, forKey: .processingTimingsMS) @@ -194,6 +190,10 @@ public struct RecommendationsResults: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encode(self.page, forKey: .page) + try container.encode(self.nbHits, forKey: .nbHits) + try container.encode(self.nbPages, forKey: .nbPages) + try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encode(self.hits, forKey: .hits) } } @@ -210,14 +210,10 @@ extension RecommendationsResults: Equatable { lhs.exhaustiveTypo == rhs.exhaustiveTypo && lhs.facets == rhs.facets && lhs.facetsStats == rhs.facetsStats && - lhs.hitsPerPage == rhs.hitsPerPage && lhs.index == rhs.index && lhs.indexUsed == rhs.indexUsed && lhs.message == rhs.message && - lhs.nbHits == rhs.nbHits && - lhs.nbPages == rhs.nbPages && lhs.nbSortedHits == rhs.nbSortedHits && - lhs.page == rhs.page && lhs.parsedQuery == rhs.parsedQuery && lhs.processingTimeMS == rhs.processingTimeMS && lhs.processingTimingsMS == rhs.processingTimingsMS && @@ -228,6 +224,10 @@ extension RecommendationsResults: Equatable { lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && lhs.queryID == rhs.queryID && + lhs.page == rhs.page && + lhs.nbHits == rhs.nbHits && + lhs.nbPages == rhs.nbPages && + lhs.hitsPerPage == rhs.hitsPerPage && lhs.hits == rhs.hits } } @@ -244,14 +244,10 @@ extension RecommendationsResults: Hashable { hasher.combine(self.exhaustiveTypo?.hashValue) hasher.combine(self.facets?.hashValue) hasher.combine(self.facetsStats?.hashValue) - hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.index?.hashValue) hasher.combine(self.indexUsed?.hashValue) hasher.combine(self.message?.hashValue) - hasher.combine(self.nbHits.hashValue) - hasher.combine(self.nbPages.hashValue) hasher.combine(self.nbSortedHits?.hashValue) - hasher.combine(self.page.hashValue) hasher.combine(self.parsedQuery?.hashValue) hasher.combine(self.processingTimeMS.hashValue) hasher.combine(self.processingTimingsMS?.hashValue) @@ -262,6 +258,10 @@ extension RecommendationsResults: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.page.hashValue) + hasher.combine(self.nbHits.hashValue) + hasher.combine(self.nbPages.hashValue) + hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.hits.hashValue) } } diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/BrowsePagination.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/BrowsePagination.swift new file mode 100644 index 00000000000..4fa82f2ee8f --- /dev/null +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/BrowsePagination.swift @@ -0,0 +1,60 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on +// https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +import Foundation +#if canImport(Core) + import Core +#endif + +public struct BrowsePagination: Codable, JSONEncodable { + /// Page of search results to retrieve. + public var page: Int? + /// Number of results (hits). + public var nbHits: Int? + /// Number of pages of results. + public var nbPages: Int? + /// Number of hits per page. + public var hitsPerPage: Int? + + public init(page: Int? = nil, nbHits: Int? = nil, nbPages: Int? = nil, hitsPerPage: Int? = nil) { + self.page = page + self.nbHits = nbHits + self.nbPages = nbPages + self.hitsPerPage = hitsPerPage + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case page + case nbHits + case nbPages + case hitsPerPage + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.page, forKey: .page) + try container.encodeIfPresent(self.nbHits, forKey: .nbHits) + try container.encodeIfPresent(self.nbPages, forKey: .nbPages) + try container.encodeIfPresent(self.hitsPerPage, forKey: .hitsPerPage) + } +} + +extension BrowsePagination: Equatable { + public static func ==(lhs: BrowsePagination, rhs: BrowsePagination) -> Bool { + lhs.page == rhs.page && + lhs.nbHits == rhs.nbHits && + lhs.nbPages == rhs.nbPages && + lhs.hitsPerPage == rhs.hitsPerPage + } +} + +extension BrowsePagination: Hashable { + public func hash(into hasher: inout Hasher) { + hasher.combine(self.page?.hashValue) + hasher.combine(self.nbHits?.hashValue) + hasher.combine(self.nbPages?.hashValue) + hasher.combine(self.hitsPerPage?.hashValue) + } +} diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/BrowseResponse.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/BrowseResponse.swift index d8fd6e8317d..f8fb4e0adb2 100644 --- a/clients/algoliasearch-client-swift/Sources/Search/Models/BrowseResponse.swift +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/BrowseResponse.swift @@ -29,22 +29,14 @@ public struct BrowseResponse: Codable, JSONEncodable { public var facets: [String: [String: Int]]? /// Statistics for numerical facets. public var facetsStats: [String: SearchFacetsStats]? - /// Number of hits per page. - public var hitsPerPage: Int /// Index name used for the query. public var index: String? /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. public var indexUsed: String? /// Warnings about the query. public var message: String? - /// Number of results (hits). - public var nbHits: Int - /// Number of pages of results. - public var nbPages: Int /// Number of hits selected and sorted by the relevant sort algorithm. public var nbSortedHits: Int? - /// Page of search results to retrieve. - public var page: Int /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) /// query string that will be searched. public var parsedQuery: String? @@ -66,6 +58,14 @@ public struct BrowseResponse: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Page of search results to retrieve. + public var page: Int? + /// Number of results (hits). + public var nbHits: Int? + /// Number of pages of results. + public var nbPages: Int? + /// Number of hits per page. + public var hitsPerPage: Int? /// Search results (hits). Hits are records from your index that match the search criteria, augmented with /// additional attributes, such as, for highlighting. public var hits: [T] @@ -88,14 +88,10 @@ public struct BrowseResponse: Codable, JSONEncodable { exhaustiveTypo: Bool? = nil, facets: [String: [String: Int]]? = nil, facetsStats: [String: SearchFacetsStats]? = nil, - hitsPerPage: Int, index: String? = nil, indexUsed: String? = nil, message: String? = nil, - nbHits: Int, - nbPages: Int, nbSortedHits: Int? = nil, - page: Int, parsedQuery: String? = nil, processingTimeMS: Int, processingTimingsMS: AnyCodable? = nil, @@ -106,6 +102,10 @@ public struct BrowseResponse: Codable, JSONEncodable { serverUsed: String? = nil, userData: AnyCodable? = nil, queryID: String? = nil, + page: Int? = nil, + nbHits: Int? = nil, + nbPages: Int? = nil, + hitsPerPage: Int? = nil, hits: [T], query: String, params: String, @@ -121,14 +121,10 @@ public struct BrowseResponse: Codable, JSONEncodable { self.exhaustiveTypo = exhaustiveTypo self.facets = facets self.facetsStats = facetsStats - self.hitsPerPage = hitsPerPage self.index = index self.indexUsed = indexUsed self.message = message - self.nbHits = nbHits - self.nbPages = nbPages self.nbSortedHits = nbSortedHits - self.page = page self.parsedQuery = parsedQuery self.processingTimeMS = processingTimeMS self.processingTimingsMS = processingTimingsMS @@ -139,6 +135,10 @@ public struct BrowseResponse: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.page = page + self.nbHits = nbHits + self.nbPages = nbPages + self.hitsPerPage = hitsPerPage self.hits = hits self.query = query self.params = params @@ -156,14 +156,10 @@ public struct BrowseResponse: Codable, JSONEncodable { case exhaustiveTypo case facets case facetsStats = "facets_stats" - case hitsPerPage case index case indexUsed case message - case nbHits - case nbPages case nbSortedHits - case page case parsedQuery case processingTimeMS case processingTimingsMS @@ -174,6 +170,10 @@ public struct BrowseResponse: Codable, JSONEncodable { case serverUsed case userData case queryID + case page + case nbHits + case nbPages + case hitsPerPage case hits case query case params @@ -194,14 +194,10 @@ public struct BrowseResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo) try container.encodeIfPresent(self.facets, forKey: .facets) try container.encodeIfPresent(self.facetsStats, forKey: .facetsStats) - try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encodeIfPresent(self.index, forKey: .index) try container.encodeIfPresent(self.indexUsed, forKey: .indexUsed) try container.encodeIfPresent(self.message, forKey: .message) - try container.encode(self.nbHits, forKey: .nbHits) - try container.encode(self.nbPages, forKey: .nbPages) try container.encodeIfPresent(self.nbSortedHits, forKey: .nbSortedHits) - try container.encode(self.page, forKey: .page) try container.encodeIfPresent(self.parsedQuery, forKey: .parsedQuery) try container.encode(self.processingTimeMS, forKey: .processingTimeMS) try container.encodeIfPresent(self.processingTimingsMS, forKey: .processingTimingsMS) @@ -212,6 +208,10 @@ public struct BrowseResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encodeIfPresent(self.page, forKey: .page) + try container.encodeIfPresent(self.nbHits, forKey: .nbHits) + try container.encodeIfPresent(self.nbPages, forKey: .nbPages) + try container.encodeIfPresent(self.hitsPerPage, forKey: .hitsPerPage) try container.encode(self.hits, forKey: .hits) try container.encode(self.query, forKey: .query) try container.encode(self.params, forKey: .params) @@ -231,14 +231,10 @@ extension BrowseResponse: Equatable where T: Equatable { lhs.exhaustiveTypo == rhs.exhaustiveTypo && lhs.facets == rhs.facets && lhs.facetsStats == rhs.facetsStats && - lhs.hitsPerPage == rhs.hitsPerPage && lhs.index == rhs.index && lhs.indexUsed == rhs.indexUsed && lhs.message == rhs.message && - lhs.nbHits == rhs.nbHits && - lhs.nbPages == rhs.nbPages && lhs.nbSortedHits == rhs.nbSortedHits && - lhs.page == rhs.page && lhs.parsedQuery == rhs.parsedQuery && lhs.processingTimeMS == rhs.processingTimeMS && lhs.processingTimingsMS == rhs.processingTimingsMS && @@ -249,6 +245,10 @@ extension BrowseResponse: Equatable where T: Equatable { lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && lhs.queryID == rhs.queryID && + lhs.page == rhs.page && + lhs.nbHits == rhs.nbHits && + lhs.nbPages == rhs.nbPages && + lhs.hitsPerPage == rhs.hitsPerPage && lhs.hits == rhs.hits && lhs.query == rhs.query && lhs.params == rhs.params && @@ -268,14 +268,10 @@ extension BrowseResponse: Hashable where T: Hashable { hasher.combine(self.exhaustiveTypo?.hashValue) hasher.combine(self.facets?.hashValue) hasher.combine(self.facetsStats?.hashValue) - hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.index?.hashValue) hasher.combine(self.indexUsed?.hashValue) hasher.combine(self.message?.hashValue) - hasher.combine(self.nbHits.hashValue) - hasher.combine(self.nbPages.hashValue) hasher.combine(self.nbSortedHits?.hashValue) - hasher.combine(self.page.hashValue) hasher.combine(self.parsedQuery?.hashValue) hasher.combine(self.processingTimeMS.hashValue) hasher.combine(self.processingTimingsMS?.hashValue) @@ -286,6 +282,10 @@ extension BrowseResponse: Hashable where T: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.page?.hashValue) + hasher.combine(self.nbHits?.hashValue) + hasher.combine(self.nbPages?.hashValue) + hasher.combine(self.hitsPerPage?.hashValue) hasher.combine(self.hits.hashValue) hasher.combine(self.query.hashValue) hasher.combine(self.params.hashValue) diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/SearchBaseSearchResponse.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/SearchBaseSearchResponse.swift index c61a1d9a119..c198334074e 100644 --- a/clients/algoliasearch-client-swift/Sources/Search/Models/SearchBaseSearchResponse.swift +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/SearchBaseSearchResponse.swift @@ -29,22 +29,14 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { public var facets: [String: [String: Int]]? /// Statistics for numerical facets. public var facetsStats: [String: SearchFacetsStats]? - /// Number of hits per page. - public var hitsPerPage: Int /// Index name used for the query. public var index: String? /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. public var indexUsed: String? /// Warnings about the query. public var message: String? - /// Number of results (hits). - public var nbHits: Int - /// Number of pages of results. - public var nbPages: Int /// Number of hits selected and sorted by the relevant sort algorithm. public var nbSortedHits: Int? - /// Page of search results to retrieve. - public var page: Int /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) /// query string that will be searched. public var parsedQuery: String? @@ -78,14 +70,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { exhaustiveTypo: Bool? = nil, facets: [String: [String: Int]]? = nil, facetsStats: [String: SearchFacetsStats]? = nil, - hitsPerPage: Int, index: String? = nil, indexUsed: String? = nil, message: String? = nil, - nbHits: Int, - nbPages: Int, nbSortedHits: Int? = nil, - page: Int, parsedQuery: String? = nil, processingTimeMS: Int, processingTimingsMS: AnyCodable? = nil, @@ -107,14 +95,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { self.exhaustiveTypo = exhaustiveTypo self.facets = facets self.facetsStats = facetsStats - self.hitsPerPage = hitsPerPage self.index = index self.indexUsed = indexUsed self.message = message - self.nbHits = nbHits - self.nbPages = nbPages self.nbSortedHits = nbSortedHits - self.page = page self.parsedQuery = parsedQuery self.processingTimeMS = processingTimeMS self.processingTimingsMS = processingTimingsMS @@ -138,14 +122,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { case exhaustiveTypo case facets case facetsStats = "facets_stats" - case hitsPerPage case index case indexUsed case message - case nbHits - case nbPages case nbSortedHits - case page case parsedQuery case processingTimeMS case processingTimingsMS @@ -194,30 +174,14 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { self.facetsStats = dictionary["facetsStats"]?.value as? [String: SearchFacetsStats] - guard let hitsPerPage = dictionary["hitsPerPage"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.hitsPerPage = hitsPerPage self.index = dictionary["index"]?.value as? String self.indexUsed = dictionary["indexUsed"]?.value as? String self.message = dictionary["message"]?.value as? String - guard let nbHits = dictionary["nbHits"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.nbHits = nbHits - guard let nbPages = dictionary["nbPages"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.nbPages = nbPages self.nbSortedHits = dictionary["nbSortedHits"]?.value as? Int - guard let page = dictionary["page"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.page = page self.parsedQuery = dictionary["parsedQuery"]?.value as? String guard let processingTimeMS = dictionary["processingTimeMS"]?.value as? Int else { @@ -243,10 +207,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { for (key, value) in dictionary { switch key { case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive", - "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "hitsPerPage", - "index", "indexUsed", "message", "nbHits", "nbPages", "nbSortedHits", "page", "parsedQuery", - "processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent", - "serverTimeMS", "serverUsed", "userData", "queryID": + "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index", + "indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS", + "queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData", + "queryID": continue default: self.additionalProperties[key] = value @@ -268,14 +232,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo) try container.encodeIfPresent(self.facets, forKey: .facets) try container.encodeIfPresent(self.facetsStats, forKey: .facetsStats) - try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encodeIfPresent(self.index, forKey: .index) try container.encodeIfPresent(self.indexUsed, forKey: .indexUsed) try container.encodeIfPresent(self.message, forKey: .message) - try container.encode(self.nbHits, forKey: .nbHits) - try container.encode(self.nbPages, forKey: .nbPages) try container.encodeIfPresent(self.nbSortedHits, forKey: .nbSortedHits) - try container.encode(self.page, forKey: .page) try container.encodeIfPresent(self.parsedQuery, forKey: .parsedQuery) try container.encode(self.processingTimeMS, forKey: .processingTimeMS) try container.encodeIfPresent(self.processingTimingsMS, forKey: .processingTimingsMS) @@ -305,14 +265,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { self.exhaustiveTypo = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveTypo) self.facets = try container.decodeIfPresent([String: [String: Int]].self, forKey: .facets) self.facetsStats = try container.decodeIfPresent([String: SearchFacetsStats].self, forKey: .facetsStats) - self.hitsPerPage = try container.decode(Int.self, forKey: .hitsPerPage) self.index = try container.decodeIfPresent(String.self, forKey: .index) self.indexUsed = try container.decodeIfPresent(String.self, forKey: .indexUsed) self.message = try container.decodeIfPresent(String.self, forKey: .message) - self.nbHits = try container.decode(Int.self, forKey: .nbHits) - self.nbPages = try container.decode(Int.self, forKey: .nbPages) self.nbSortedHits = try container.decodeIfPresent(Int.self, forKey: .nbSortedHits) - self.page = try container.decode(Int.self, forKey: .page) self.parsedQuery = try container.decodeIfPresent(String.self, forKey: .parsedQuery) self.processingTimeMS = try container.decode(Int.self, forKey: .processingTimeMS) self.processingTimingsMS = try container.decodeIfPresent(AnyCodable.self, forKey: .processingTimingsMS) @@ -334,14 +290,10 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("exhaustiveTypo") nonAdditionalPropertyKeys.insert("facets") nonAdditionalPropertyKeys.insert("facets_stats") - nonAdditionalPropertyKeys.insert("hitsPerPage") nonAdditionalPropertyKeys.insert("index") nonAdditionalPropertyKeys.insert("indexUsed") nonAdditionalPropertyKeys.insert("message") - nonAdditionalPropertyKeys.insert("nbHits") - nonAdditionalPropertyKeys.insert("nbPages") nonAdditionalPropertyKeys.insert("nbSortedHits") - nonAdditionalPropertyKeys.insert("page") nonAdditionalPropertyKeys.insert("parsedQuery") nonAdditionalPropertyKeys.insert("processingTimeMS") nonAdditionalPropertyKeys.insert("processingTimingsMS") @@ -372,14 +324,10 @@ extension SearchBaseSearchResponse: Equatable { lhs.exhaustiveTypo == rhs.exhaustiveTypo && lhs.facets == rhs.facets && lhs.facetsStats == rhs.facetsStats && - lhs.hitsPerPage == rhs.hitsPerPage && lhs.index == rhs.index && lhs.indexUsed == rhs.indexUsed && lhs.message == rhs.message && - lhs.nbHits == rhs.nbHits && - lhs.nbPages == rhs.nbPages && lhs.nbSortedHits == rhs.nbSortedHits && - lhs.page == rhs.page && lhs.parsedQuery == rhs.parsedQuery && lhs.processingTimeMS == rhs.processingTimeMS && lhs.processingTimingsMS == rhs.processingTimingsMS && @@ -406,14 +354,10 @@ extension SearchBaseSearchResponse: Hashable { hasher.combine(self.exhaustiveTypo?.hashValue) hasher.combine(self.facets?.hashValue) hasher.combine(self.facetsStats?.hashValue) - hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.index?.hashValue) hasher.combine(self.indexUsed?.hashValue) hasher.combine(self.message?.hashValue) - hasher.combine(self.nbHits.hashValue) - hasher.combine(self.nbPages.hashValue) hasher.combine(self.nbSortedHits?.hashValue) - hasher.combine(self.page.hashValue) hasher.combine(self.parsedQuery?.hashValue) hasher.combine(self.processingTimeMS.hashValue) hasher.combine(self.processingTimingsMS?.hashValue) diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/SearchResponse.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/SearchResponse.swift index c3605ff6edc..88cdf820537 100644 --- a/clients/algoliasearch-client-swift/Sources/Search/Models/SearchResponse.swift +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/SearchResponse.swift @@ -29,22 +29,14 @@ public struct SearchResponse: Codable, JSONEncodable { public var facets: [String: [String: Int]]? /// Statistics for numerical facets. public var facetsStats: [String: SearchFacetsStats]? - /// Number of hits per page. - public var hitsPerPage: Int /// Index name used for the query. public var index: String? /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. public var indexUsed: String? /// Warnings about the query. public var message: String? - /// Number of results (hits). - public var nbHits: Int - /// Number of pages of results. - public var nbPages: Int /// Number of hits selected and sorted by the relevant sort algorithm. public var nbSortedHits: Int? - /// Page of search results to retrieve. - public var page: Int /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) /// query string that will be searched. public var parsedQuery: String? @@ -66,6 +58,14 @@ public struct SearchResponse: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Page of search results to retrieve. + public var page: Int + /// Number of results (hits). + public var nbHits: Int + /// Number of pages of results. + public var nbPages: Int + /// Number of hits per page. + public var hitsPerPage: Int /// Search results (hits). Hits are records from your index that match the search criteria, augmented with /// additional attributes, such as, for highlighting. public var hits: [T] @@ -85,14 +85,10 @@ public struct SearchResponse: Codable, JSONEncodable { exhaustiveTypo: Bool? = nil, facets: [String: [String: Int]]? = nil, facetsStats: [String: SearchFacetsStats]? = nil, - hitsPerPage: Int, index: String? = nil, indexUsed: String? = nil, message: String? = nil, - nbHits: Int, - nbPages: Int, nbSortedHits: Int? = nil, - page: Int, parsedQuery: String? = nil, processingTimeMS: Int, processingTimingsMS: AnyCodable? = nil, @@ -103,6 +99,10 @@ public struct SearchResponse: Codable, JSONEncodable { serverUsed: String? = nil, userData: AnyCodable? = nil, queryID: String? = nil, + page: Int, + nbHits: Int, + nbPages: Int, + hitsPerPage: Int, hits: [T], query: String, params: String @@ -117,14 +117,10 @@ public struct SearchResponse: Codable, JSONEncodable { self.exhaustiveTypo = exhaustiveTypo self.facets = facets self.facetsStats = facetsStats - self.hitsPerPage = hitsPerPage self.index = index self.indexUsed = indexUsed self.message = message - self.nbHits = nbHits - self.nbPages = nbPages self.nbSortedHits = nbSortedHits - self.page = page self.parsedQuery = parsedQuery self.processingTimeMS = processingTimeMS self.processingTimingsMS = processingTimingsMS @@ -135,6 +131,10 @@ public struct SearchResponse: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.page = page + self.nbHits = nbHits + self.nbPages = nbPages + self.hitsPerPage = hitsPerPage self.hits = hits self.query = query self.params = params @@ -151,14 +151,10 @@ public struct SearchResponse: Codable, JSONEncodable { case exhaustiveTypo case facets case facetsStats = "facets_stats" - case hitsPerPage case index case indexUsed case message - case nbHits - case nbPages case nbSortedHits - case page case parsedQuery case processingTimeMS case processingTimingsMS @@ -169,6 +165,10 @@ public struct SearchResponse: Codable, JSONEncodable { case serverUsed case userData case queryID + case page + case nbHits + case nbPages + case hitsPerPage case hits case query case params @@ -210,30 +210,14 @@ public struct SearchResponse: Codable, JSONEncodable { self.facetsStats = dictionary["facetsStats"]?.value as? [String: SearchFacetsStats] - guard let hitsPerPage = dictionary["hitsPerPage"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.hitsPerPage = hitsPerPage self.index = dictionary["index"]?.value as? String self.indexUsed = dictionary["indexUsed"]?.value as? String self.message = dictionary["message"]?.value as? String - guard let nbHits = dictionary["nbHits"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.nbHits = nbHits - guard let nbPages = dictionary["nbPages"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.nbPages = nbPages self.nbSortedHits = dictionary["nbSortedHits"]?.value as? Int - guard let page = dictionary["page"]?.value as? Int else { - throw GenericError(description: "Failed to cast") - } - self.page = page self.parsedQuery = dictionary["parsedQuery"]?.value as? String guard let processingTimeMS = dictionary["processingTimeMS"]?.value as? Int else { @@ -256,6 +240,22 @@ public struct SearchResponse: Codable, JSONEncodable { self.queryID = dictionary["queryID"]?.value as? String + guard let page = dictionary["page"]?.value as? Int else { + throw GenericError(description: "Failed to cast") + } + self.page = page + guard let nbHits = dictionary["nbHits"]?.value as? Int else { + throw GenericError(description: "Failed to cast") + } + self.nbHits = nbHits + guard let nbPages = dictionary["nbPages"]?.value as? Int else { + throw GenericError(description: "Failed to cast") + } + self.nbPages = nbPages + guard let hitsPerPage = dictionary["hitsPerPage"]?.value as? Int else { + throw GenericError(description: "Failed to cast") + } + self.hitsPerPage = hitsPerPage guard let hits = dictionary["hits"]?.value as? [T] else { throw GenericError(description: "Failed to cast") } @@ -271,10 +271,10 @@ public struct SearchResponse: Codable, JSONEncodable { for (key, value) in dictionary { switch key { case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive", - "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "hitsPerPage", - "index", "indexUsed", "message", "nbHits", "nbPages", "nbSortedHits", "page", "parsedQuery", - "processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent", - "serverTimeMS", "serverUsed", "userData", "queryID", "hits", "query", "params": + "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index", + "indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS", + "queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData", + "queryID", "page", "nbHits", "nbPages", "hitsPerPage", "hits", "query", "params": continue default: self.additionalProperties[key] = value @@ -296,14 +296,10 @@ public struct SearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo) try container.encodeIfPresent(self.facets, forKey: .facets) try container.encodeIfPresent(self.facetsStats, forKey: .facetsStats) - try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encodeIfPresent(self.index, forKey: .index) try container.encodeIfPresent(self.indexUsed, forKey: .indexUsed) try container.encodeIfPresent(self.message, forKey: .message) - try container.encode(self.nbHits, forKey: .nbHits) - try container.encode(self.nbPages, forKey: .nbPages) try container.encodeIfPresent(self.nbSortedHits, forKey: .nbSortedHits) - try container.encode(self.page, forKey: .page) try container.encodeIfPresent(self.parsedQuery, forKey: .parsedQuery) try container.encode(self.processingTimeMS, forKey: .processingTimeMS) try container.encodeIfPresent(self.processingTimingsMS, forKey: .processingTimingsMS) @@ -314,6 +310,10 @@ public struct SearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encode(self.page, forKey: .page) + try container.encode(self.nbHits, forKey: .nbHits) + try container.encode(self.nbPages, forKey: .nbPages) + try container.encode(self.hitsPerPage, forKey: .hitsPerPage) try container.encode(self.hits, forKey: .hits) try container.encode(self.query, forKey: .query) try container.encode(self.params, forKey: .params) @@ -336,14 +336,10 @@ public struct SearchResponse: Codable, JSONEncodable { self.exhaustiveTypo = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveTypo) self.facets = try container.decodeIfPresent([String: [String: Int]].self, forKey: .facets) self.facetsStats = try container.decodeIfPresent([String: SearchFacetsStats].self, forKey: .facetsStats) - self.hitsPerPage = try container.decode(Int.self, forKey: .hitsPerPage) self.index = try container.decodeIfPresent(String.self, forKey: .index) self.indexUsed = try container.decodeIfPresent(String.self, forKey: .indexUsed) self.message = try container.decodeIfPresent(String.self, forKey: .message) - self.nbHits = try container.decode(Int.self, forKey: .nbHits) - self.nbPages = try container.decode(Int.self, forKey: .nbPages) self.nbSortedHits = try container.decodeIfPresent(Int.self, forKey: .nbSortedHits) - self.page = try container.decode(Int.self, forKey: .page) self.parsedQuery = try container.decodeIfPresent(String.self, forKey: .parsedQuery) self.processingTimeMS = try container.decode(Int.self, forKey: .processingTimeMS) self.processingTimingsMS = try container.decodeIfPresent(AnyCodable.self, forKey: .processingTimingsMS) @@ -354,6 +350,10 @@ public struct SearchResponse: Codable, JSONEncodable { self.serverUsed = try container.decodeIfPresent(String.self, forKey: .serverUsed) self.userData = try container.decodeIfPresent(AnyCodable.self, forKey: .userData) self.queryID = try container.decodeIfPresent(String.self, forKey: .queryID) + self.page = try container.decode(Int.self, forKey: .page) + self.nbHits = try container.decode(Int.self, forKey: .nbHits) + self.nbPages = try container.decode(Int.self, forKey: .nbPages) + self.hitsPerPage = try container.decode(Int.self, forKey: .hitsPerPage) self.hits = try container.decode([T].self, forKey: .hits) self.query = try container.decode(String.self, forKey: .query) self.params = try container.decode(String.self, forKey: .params) @@ -368,14 +368,10 @@ public struct SearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("exhaustiveTypo") nonAdditionalPropertyKeys.insert("facets") nonAdditionalPropertyKeys.insert("facets_stats") - nonAdditionalPropertyKeys.insert("hitsPerPage") nonAdditionalPropertyKeys.insert("index") nonAdditionalPropertyKeys.insert("indexUsed") nonAdditionalPropertyKeys.insert("message") - nonAdditionalPropertyKeys.insert("nbHits") - nonAdditionalPropertyKeys.insert("nbPages") nonAdditionalPropertyKeys.insert("nbSortedHits") - nonAdditionalPropertyKeys.insert("page") nonAdditionalPropertyKeys.insert("parsedQuery") nonAdditionalPropertyKeys.insert("processingTimeMS") nonAdditionalPropertyKeys.insert("processingTimingsMS") @@ -386,6 +382,10 @@ public struct SearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("serverUsed") nonAdditionalPropertyKeys.insert("userData") nonAdditionalPropertyKeys.insert("queryID") + nonAdditionalPropertyKeys.insert("page") + nonAdditionalPropertyKeys.insert("nbHits") + nonAdditionalPropertyKeys.insert("nbPages") + nonAdditionalPropertyKeys.insert("hitsPerPage") nonAdditionalPropertyKeys.insert("hits") nonAdditionalPropertyKeys.insert("query") nonAdditionalPropertyKeys.insert("params") @@ -409,14 +409,10 @@ extension SearchResponse: Equatable where T: Equatable { lhs.exhaustiveTypo == rhs.exhaustiveTypo && lhs.facets == rhs.facets && lhs.facetsStats == rhs.facetsStats && - lhs.hitsPerPage == rhs.hitsPerPage && lhs.index == rhs.index && lhs.indexUsed == rhs.indexUsed && lhs.message == rhs.message && - lhs.nbHits == rhs.nbHits && - lhs.nbPages == rhs.nbPages && lhs.nbSortedHits == rhs.nbSortedHits && - lhs.page == rhs.page && lhs.parsedQuery == rhs.parsedQuery && lhs.processingTimeMS == rhs.processingTimeMS && lhs.processingTimingsMS == rhs.processingTimingsMS && @@ -427,6 +423,10 @@ extension SearchResponse: Equatable where T: Equatable { lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && lhs.queryID == rhs.queryID && + lhs.page == rhs.page && + lhs.nbHits == rhs.nbHits && + lhs.nbPages == rhs.nbPages && + lhs.hitsPerPage == rhs.hitsPerPage && lhs.hits == rhs.hits && lhs.query == rhs.query && lhs.params == rhs.params @@ -446,14 +446,10 @@ extension SearchResponse: Hashable where T: Hashable { hasher.combine(self.exhaustiveTypo?.hashValue) hasher.combine(self.facets?.hashValue) hasher.combine(self.facetsStats?.hashValue) - hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.index?.hashValue) hasher.combine(self.indexUsed?.hashValue) hasher.combine(self.message?.hashValue) - hasher.combine(self.nbHits.hashValue) - hasher.combine(self.nbPages.hashValue) hasher.combine(self.nbSortedHits?.hashValue) - hasher.combine(self.page.hashValue) hasher.combine(self.parsedQuery?.hashValue) hasher.combine(self.processingTimeMS.hashValue) hasher.combine(self.processingTimingsMS?.hashValue) @@ -464,6 +460,10 @@ extension SearchResponse: Hashable where T: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.page.hashValue) + hasher.combine(self.nbHits.hashValue) + hasher.combine(self.nbPages.hashValue) + hasher.combine(self.hitsPerPage.hashValue) hasher.combine(self.hits.hashValue) hasher.combine(self.query.hashValue) hasher.combine(self.params.hashValue) diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/SearchSearchPagination.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/SearchSearchPagination.swift new file mode 100644 index 00000000000..063660c92d5 --- /dev/null +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/SearchSearchPagination.swift @@ -0,0 +1,60 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on +// https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +import Foundation +#if canImport(Core) + import Core +#endif + +public struct SearchSearchPagination: Codable, JSONEncodable { + /// Page of search results to retrieve. + public var page: Int + /// Number of results (hits). + public var nbHits: Int + /// Number of pages of results. + public var nbPages: Int + /// Number of hits per page. + public var hitsPerPage: Int + + public init(page: Int, nbHits: Int, nbPages: Int, hitsPerPage: Int) { + self.page = page + self.nbHits = nbHits + self.nbPages = nbPages + self.hitsPerPage = hitsPerPage + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case page + case nbHits + case nbPages + case hitsPerPage + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(self.page, forKey: .page) + try container.encode(self.nbHits, forKey: .nbHits) + try container.encode(self.nbPages, forKey: .nbPages) + try container.encode(self.hitsPerPage, forKey: .hitsPerPage) + } +} + +extension SearchSearchPagination: Equatable { + public static func ==(lhs: SearchSearchPagination, rhs: SearchSearchPagination) -> Bool { + lhs.page == rhs.page && + lhs.nbHits == rhs.nbHits && + lhs.nbPages == rhs.nbPages && + lhs.hitsPerPage == rhs.hitsPerPage + } +} + +extension SearchSearchPagination: Hashable { + public func hash(into hasher: inout Hasher) { + hasher.combine(self.page.hashValue) + hasher.combine(self.nbHits.hashValue) + hasher.combine(self.nbPages.hashValue) + hasher.combine(self.hitsPerPage.hashValue) + } +} diff --git a/specs/bundled/algoliasearch.yml b/specs/bundled/algoliasearch.yml index 1e74271da52..a1811eaec6b 100644 --- a/specs/bundled/algoliasearch.yml +++ b/specs/bundled/algoliasearch.yml @@ -2204,14 +2204,6 @@ components: - $ref: '#/components/schemas/searchParamsObject' - type: object description: Search parameters for filtering the recommendations. - nbHits: - type: integer - description: Number of results (hits). - example: 20 - nbPages: - type: integer - description: Number of pages of results. - example: 1 processingTimeMS: type: integer description: Time the server took to process the request, in milliseconds. @@ -2261,10 +2253,6 @@ components: type: object additionalProperties: true required: - - nbHits - - page - - nbPages - - hitsPerPage - processingTimeMS properties: abTestID: @@ -2387,8 +2375,6 @@ components: type: number format: double description: Sum of all values in the results. - hitsPerPage: - $ref: '#/components/schemas/hitsPerPage' index: type: string example: indexName @@ -2402,16 +2388,10 @@ components: message: type: string description: Warnings about the query. - nbHits: - $ref: '#/components/schemas/nbHits' - nbPages: - $ref: '#/components/schemas/nbPages' nbSortedHits: type: integer description: Number of hits selected and sorted by the relevant sort algorithm. example: 20 - page: - $ref: '#/components/schemas/page' parsedQuery: type: string description: >- @@ -2461,6 +2441,31 @@ components: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). example: a00dbc80a8d13c4565a442e7e2dca80a + nbHits: + type: integer + description: Number of results (hits). + example: 20 + nbPages: + type: integer + description: Number of pages of results. + example: 1 + SearchPagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - page + - nbHits + - nbPages + - hitsPerPage objectID: type: string description: Unique record identifier. @@ -2701,6 +2706,7 @@ components: additionalProperties: true allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/SearchPagination' - $ref: '#/components/schemas/searchHits' indexName: type: string @@ -2851,9 +2857,22 @@ components: allOf: - $ref: '#/components/schemas/searchParamsObject' - $ref: '#/components/schemas/cursor' + BrowsePagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' browseResponse: allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/BrowsePagination' - $ref: '#/components/schemas/searchHits' - $ref: '#/components/schemas/cursor' baseIndexSettings: @@ -3818,6 +3837,7 @@ components: recommendationsResults: allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/SearchPagination' - $ref: '#/components/schemas/recommendationsHits' responses: BadRequest: diff --git a/specs/bundled/recommend.doc.yml b/specs/bundled/recommend.doc.yml index fcc96b043f8..1b9b679e8dd 100644 --- a/specs/bundled/recommend.doc.yml +++ b/specs/bundled/recommend.doc.yml @@ -4379,14 +4379,6 @@ components: - $ref: '#/components/schemas/trendingFacetsQuery' - $ref: '#/components/schemas/lookingSimilarQuery' - $ref: '#/components/schemas/recommendedForYouQuery' - nbHits: - type: integer - description: Number of results (hits). - example: 20 - nbPages: - type: integer - description: Number of pages of results. - example: 1 processingTimeMS: type: integer description: Time the server took to process the request, in milliseconds. @@ -4436,10 +4428,6 @@ components: type: object additionalProperties: true required: - - nbHits - - page - - nbPages - - hitsPerPage - processingTimeMS properties: abTestID: @@ -4562,8 +4550,6 @@ components: type: number format: double description: Sum of all values in the results. - hitsPerPage: - $ref: '#/components/schemas/hitsPerPage' index: type: string example: indexName @@ -4577,16 +4563,10 @@ components: message: type: string description: Warnings about the query. - nbHits: - $ref: '#/components/schemas/nbHits' - nbPages: - $ref: '#/components/schemas/nbPages' nbSortedHits: type: integer description: Number of hits selected and sorted by the relevant sort algorithm. example: 20 - page: - $ref: '#/components/schemas/page' parsedQuery: type: string description: >- @@ -4636,6 +4616,31 @@ components: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). example: a00dbc80a8d13c4565a442e7e2dca80a + nbHits: + type: integer + description: Number of results (hits). + example: 20 + nbPages: + type: integer + description: Number of pages of results. + example: 1 + SearchPagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - page + - nbHits + - nbPages + - hitsPerPage highlightedValue: type: string description: Highlighted attribute value, including HTML tags. @@ -4878,6 +4883,7 @@ components: recommendationsResults: allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/SearchPagination' - $ref: '#/components/schemas/recommendationsHits' recommendModels: type: string diff --git a/specs/bundled/recommend.yml b/specs/bundled/recommend.yml index 78af07b94d3..b96740a2492 100644 --- a/specs/bundled/recommend.yml +++ b/specs/bundled/recommend.yml @@ -2550,14 +2550,6 @@ components: - $ref: '#/components/schemas/trendingFacetsQuery' - $ref: '#/components/schemas/lookingSimilarQuery' - $ref: '#/components/schemas/recommendedForYouQuery' - nbHits: - type: integer - description: Number of results (hits). - example: 20 - nbPages: - type: integer - description: Number of pages of results. - example: 1 processingTimeMS: type: integer description: Time the server took to process the request, in milliseconds. @@ -2607,10 +2599,6 @@ components: type: object additionalProperties: true required: - - nbHits - - page - - nbPages - - hitsPerPage - processingTimeMS properties: abTestID: @@ -2733,8 +2721,6 @@ components: type: number format: double description: Sum of all values in the results. - hitsPerPage: - $ref: '#/components/schemas/hitsPerPage' index: type: string example: indexName @@ -2748,16 +2734,10 @@ components: message: type: string description: Warnings about the query. - nbHits: - $ref: '#/components/schemas/nbHits' - nbPages: - $ref: '#/components/schemas/nbPages' nbSortedHits: type: integer description: Number of hits selected and sorted by the relevant sort algorithm. example: 20 - page: - $ref: '#/components/schemas/page' parsedQuery: type: string description: >- @@ -2807,6 +2787,31 @@ components: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). example: a00dbc80a8d13c4565a442e7e2dca80a + nbHits: + type: integer + description: Number of results (hits). + example: 20 + nbPages: + type: integer + description: Number of pages of results. + example: 1 + SearchPagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - page + - nbHits + - nbPages + - hitsPerPage highlightedValue: type: string description: Highlighted attribute value, including HTML tags. @@ -3049,6 +3054,7 @@ components: recommendationsResults: allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/SearchPagination' - $ref: '#/components/schemas/recommendationsHits' recommendModels: type: string diff --git a/specs/bundled/search.doc.yml b/specs/bundled/search.doc.yml index e253c21f656..36cf507bcfc 100644 --- a/specs/bundled/search.doc.yml +++ b/specs/bundled/search.doc.yml @@ -17475,14 +17475,6 @@ components: oneOf: - $ref: '#/components/schemas/searchParamsString' - $ref: '#/components/schemas/searchParamsObject' - nbHits: - type: integer - description: Number of results (hits). - example: 20 - nbPages: - type: integer - description: Number of pages of results. - example: 1 processingTimeMS: type: integer description: Time the server took to process the request, in milliseconds. @@ -17532,10 +17524,6 @@ components: type: object additionalProperties: true required: - - nbHits - - page - - nbPages - - hitsPerPage - processingTimeMS properties: abTestID: @@ -17658,8 +17646,6 @@ components: type: number format: double description: Sum of all values in the results. - hitsPerPage: - $ref: '#/components/schemas/hitsPerPage' index: type: string example: indexName @@ -17673,16 +17659,10 @@ components: message: type: string description: Warnings about the query. - nbHits: - $ref: '#/components/schemas/nbHits' - nbPages: - $ref: '#/components/schemas/nbPages' nbSortedHits: type: integer description: Number of hits selected and sorted by the relevant sort algorithm. example: 20 - page: - $ref: '#/components/schemas/page' parsedQuery: type: string description: >- @@ -17732,6 +17712,31 @@ components: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). example: a00dbc80a8d13c4565a442e7e2dca80a + nbHits: + type: integer + description: Number of results (hits). + example: 20 + nbPages: + type: integer + description: Number of pages of results. + example: 1 + SearchPagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - page + - nbHits + - nbPages + - hitsPerPage objectID: type: string description: Unique record identifier. @@ -17972,6 +17977,7 @@ components: additionalProperties: true allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/SearchPagination' - $ref: '#/components/schemas/searchHits' indexName: type: string @@ -18126,9 +18132,22 @@ components: oneOf: - $ref: '#/components/schemas/searchParamsString' - $ref: '#/components/schemas/browseParamsObject' + BrowsePagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' browseResponse: allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/BrowsePagination' - $ref: '#/components/schemas/searchHits' - $ref: '#/components/schemas/cursor' createdAt: diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index c77ce61a67f..00414d1235a 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -5431,14 +5431,6 @@ components: oneOf: - $ref: '#/components/schemas/searchParamsString' - $ref: '#/components/schemas/searchParamsObject' - nbHits: - type: integer - description: Number of results (hits). - example: 20 - nbPages: - type: integer - description: Number of pages of results. - example: 1 processingTimeMS: type: integer description: Time the server took to process the request, in milliseconds. @@ -5488,10 +5480,6 @@ components: type: object additionalProperties: true required: - - nbHits - - page - - nbPages - - hitsPerPage - processingTimeMS properties: abTestID: @@ -5614,8 +5602,6 @@ components: type: number format: double description: Sum of all values in the results. - hitsPerPage: - $ref: '#/components/schemas/hitsPerPage' index: type: string example: indexName @@ -5629,16 +5615,10 @@ components: message: type: string description: Warnings about the query. - nbHits: - $ref: '#/components/schemas/nbHits' - nbPages: - $ref: '#/components/schemas/nbPages' nbSortedHits: type: integer description: Number of hits selected and sorted by the relevant sort algorithm. example: 20 - page: - $ref: '#/components/schemas/page' parsedQuery: type: string description: >- @@ -5688,6 +5668,31 @@ components: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). example: a00dbc80a8d13c4565a442e7e2dca80a + nbHits: + type: integer + description: Number of results (hits). + example: 20 + nbPages: + type: integer + description: Number of pages of results. + example: 1 + SearchPagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - page + - nbHits + - nbPages + - hitsPerPage objectID: type: string description: Unique record identifier. @@ -5928,6 +5933,7 @@ components: additionalProperties: true allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/SearchPagination' - $ref: '#/components/schemas/searchHits' indexName: type: string @@ -6082,9 +6088,22 @@ components: oneOf: - $ref: '#/components/schemas/searchParamsString' - $ref: '#/components/schemas/browseParamsObject' + BrowsePagination: + type: object + additionalProperties: false + properties: + page: + $ref: '#/components/schemas/page' + nbHits: + $ref: '#/components/schemas/nbHits' + nbPages: + $ref: '#/components/schemas/nbPages' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' browseResponse: allOf: - $ref: '#/components/schemas/baseSearchResponse' + - $ref: '#/components/schemas/BrowsePagination' - $ref: '#/components/schemas/searchHits' - $ref: '#/components/schemas/cursor' createdAt: