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 3d813ee439..7d7de87d3b 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch_lite.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch_lite.dart @@ -20,7 +20,6 @@ export 'src/model/base_index_settings.dart'; 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/base_search_response_redirect.dart'; export 'src/model/browse_params_object.dart'; export 'src/model/browse_response.dart'; export 'src/model/built_in_operation.dart'; @@ -41,6 +40,7 @@ export 'src/model/edit.dart'; export 'src/model/edit_type.dart'; export 'src/model/error_base.dart'; export 'src/model/exact_on_single_word_query.dart'; +export 'src/model/exhaustive.dart'; export 'src/model/facet_hits.dart'; export 'src/model/facet_ordering.dart'; export 'src/model/facets.dart'; @@ -64,6 +64,7 @@ export 'src/model/promote_object_id.dart'; export 'src/model/promote_object_ids.dart'; export 'src/model/query_type.dart'; export 'src/model/ranking_info.dart'; +export 'src/model/redirect.dart'; export 'src/model/redirect_rule_index_metadata.dart'; export 'src/model/redirect_rule_index_metadata_data.dart'; export 'src/model/remove_words_if_no_results.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 9ffdb6ad29..60830e1d22 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/deserialize.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/deserialize.dart @@ -13,7 +13,6 @@ import 'package:algoliasearch/src/model/base_index_settings.dart'; 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/base_search_response_redirect.dart'; import 'package:algoliasearch/src/model/browse_params_object.dart'; import 'package:algoliasearch/src/model/browse_response.dart'; import 'package:algoliasearch/src/model/built_in_operation.dart'; @@ -34,6 +33,7 @@ import 'package:algoliasearch/src/model/edit.dart'; import 'package:algoliasearch/src/model/edit_type.dart'; import 'package:algoliasearch/src/model/error_base.dart'; import 'package:algoliasearch/src/model/exact_on_single_word_query.dart'; +import 'package:algoliasearch/src/model/exhaustive.dart'; import 'package:algoliasearch/src/model/facet_hits.dart'; import 'package:algoliasearch/src/model/facet_ordering.dart'; import 'package:algoliasearch/src/model/facets.dart'; @@ -57,6 +57,7 @@ import 'package:algoliasearch/src/model/promote_object_id.dart'; import 'package:algoliasearch/src/model/promote_object_ids.dart'; import 'package:algoliasearch/src/model/query_type.dart'; import 'package:algoliasearch/src/model/ranking_info.dart'; +import 'package:algoliasearch/src/model/redirect.dart'; import 'package:algoliasearch/src/model/redirect_rule_index_metadata.dart'; import 'package:algoliasearch/src/model/redirect_rule_index_metadata_data.dart'; import 'package:algoliasearch/src/model/remove_words_if_no_results.dart'; @@ -150,9 +151,6 @@ ReturnType deserialize(dynamic value, String targetType, case 'BaseSearchResponse': return BaseSearchResponse.fromJson(value as Map) as ReturnType; - case 'BaseSearchResponseRedirect': - return BaseSearchResponseRedirect.fromJson(value as Map) - as ReturnType; case 'BrowseParamsObject': return BrowseParamsObject.fromJson(value as Map) as ReturnType; @@ -202,6 +200,8 @@ ReturnType deserialize(dynamic value, String targetType, return ErrorBase.fromJson(value as Map) as ReturnType; case 'ExactOnSingleWordQuery': return ExactOnSingleWordQuery.fromJson(value) as ReturnType; + case 'Exhaustive': + return Exhaustive.fromJson(value as Map) as ReturnType; case 'FacetHits': return FacetHits.fromJson(value as Map) as ReturnType; case 'FacetOrdering': @@ -258,6 +258,8 @@ ReturnType deserialize(dynamic value, String targetType, return QueryType.fromJson(value) as ReturnType; case 'RankingInfo': return RankingInfo.fromJson(value as Map) as ReturnType; + case 'Redirect': + return Redirect.fromJson(value as Map) as ReturnType; case 'RedirectRuleIndexMetadata': return RedirectRuleIndexMetadata.fromJson(value as Map) as ReturnType; 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 59145f9f44..538987c67a 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 @@ -1,21 +1,24 @@ // 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:algoliasearch/src/model/base_search_response_redirect.dart'; +import 'package:algoliasearch/src/model/redirect.dart'; import 'package:algoliasearch/src/model/facets_stats.dart'; import 'package:algoliasearch/src/model/rendering_content.dart'; +import 'package:algoliasearch/src/model/exhaustive.dart'; +import 'package:collection/collection.dart'; import 'package:json_annotation/json_annotation.dart'; part 'base_search_response.g.dart'; -@JsonSerializable() -final class BaseSearchResponse { +@JsonSerializable(createFieldMap: true) +final class BaseSearchResponse extends DelegatingMap { /// Returns a new [BaseSearchResponse] instance. const BaseSearchResponse({ this.abTestID, this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -29,14 +32,17 @@ final class BaseSearchResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, - }); + Map additionalProperties = const {}, + }) : super(additionalProperties); /// A/B test ID. This is only included in the response for indices that are part of an A/B test. @JsonKey(name: r'abTestID') @@ -55,15 +61,21 @@ final class BaseSearchResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -109,9 +121,6 @@ final class BaseSearchResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -120,10 +129,24 @@ final class BaseSearchResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -132,9 +155,6 @@ final class BaseSearchResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @override bool operator ==(Object other) => identical(this, other) || @@ -143,6 +163,7 @@ final class BaseSearchResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && + other.exhaustive == exhaustive && other.exhaustiveFacetsCount == exhaustiveFacetsCount && other.exhaustiveNbHits == exhaustiveNbHits && other.exhaustiveTypo == exhaustiveTypo && @@ -156,13 +177,16 @@ final class BaseSearchResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent; + const MapEquality().equals(this, this); @override int get hashCode => @@ -170,6 +194,7 @@ final class BaseSearchResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + + exhaustive.hashCode + exhaustiveFacetsCount.hashCode + exhaustiveNbHits.hashCode + exhaustiveTypo.hashCode + @@ -183,18 +208,56 @@ final class BaseSearchResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.hashCode; - - factory BaseSearchResponse.fromJson(Map json) => - _$BaseSearchResponseFromJson(json); + const MapEquality().hash(this); + + factory BaseSearchResponse.fromJson(Map json) { + final instance = _$BaseSearchResponseFromJson(json); + final additionalProperties = Map.from(json) + ..removeWhere( + (key, value) => _$BaseSearchResponseFieldMap.containsKey(key)); + return BaseSearchResponse( + abTestID: instance.abTestID, + abTestVariantID: instance.abTestVariantID, + aroundLatLng: instance.aroundLatLng, + automaticRadius: instance.automaticRadius, + exhaustive: instance.exhaustive, + exhaustiveFacetsCount: instance.exhaustiveFacetsCount, + exhaustiveNbHits: instance.exhaustiveNbHits, + 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, + queryAfterRemoval: instance.queryAfterRemoval, + redirect: instance.redirect, + renderingContent: instance.renderingContent, + serverTimeMS: instance.serverTimeMS, + serverUsed: instance.serverUsed, + userData: instance.userData, + additionalProperties: additionalProperties, + ); + } - Map toJson() => _$BaseSearchResponseToJson(this); + Map toJson() => + _$BaseSearchResponseToJson(this)..addAll(this); @override String toString() { 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 6904344f1a..bd5619d75b 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 @@ -17,6 +17,11 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,30 +46,61 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), ); return val; }, fieldKeyMap: const {'facetsStats': 'facets_stats'}, ); +const _$BaseSearchResponseFieldMap = { + 'abTestID': 'abTestID', + 'abTestVariantID': 'abTestVariantID', + 'aroundLatLng': 'aroundLatLng', + 'automaticRadius': 'automaticRadius', + 'exhaustive': 'exhaustive', + 'exhaustiveFacetsCount': 'exhaustiveFacetsCount', + 'exhaustiveNbHits': 'exhaustiveNbHits', + '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', + 'queryAfterRemoval': 'queryAfterRemoval', + 'redirect': 'redirect', + 'renderingContent': 'renderingContent', + 'serverTimeMS': 'serverTimeMS', + 'serverUsed': 'serverUsed', + 'userData': 'userData', +}; + Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { final val = {}; @@ -78,6 +114,7 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -92,12 +129,14 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); 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 ce4581707f..b9850d8ed6 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 @@ -1,9 +1,10 @@ // 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:algoliasearch/src/model/base_search_response_redirect.dart'; +import 'package:algoliasearch/src/model/redirect.dart'; import 'package:algoliasearch/src/model/hit.dart'; import 'package:algoliasearch/src/model/facets_stats.dart'; import 'package:algoliasearch/src/model/rendering_content.dart'; +import 'package:algoliasearch/src/model/exhaustive.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -17,6 +18,7 @@ final class BrowseResponse { this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -30,13 +32,15 @@ final class BrowseResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, required this.hits, required this.query, required this.params, @@ -60,15 +64,21 @@ final class BrowseResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -114,9 +124,6 @@ final class BrowseResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -125,10 +132,24 @@ final class BrowseResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -137,9 +158,6 @@ final class BrowseResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @JsonKey(name: r'hits') final List hits; @@ -163,9 +181,7 @@ final class BrowseResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && - other.exhaustiveFacetsCount == exhaustiveFacetsCount && - other.exhaustiveNbHits == exhaustiveNbHits && - other.exhaustiveTypo == exhaustiveTypo && + other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && other.hitsPerPage == hitsPerPage && @@ -176,13 +192,15 @@ final class BrowseResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent && other.hits == hits && other.query == query && other.params == params && @@ -194,9 +212,7 @@ final class BrowseResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + - exhaustiveFacetsCount.hashCode + - exhaustiveNbHits.hashCode + - exhaustiveTypo.hashCode + + exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + hitsPerPage.hashCode + @@ -207,13 +223,15 @@ final class BrowseResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.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 41e7ef22da..bcc65874c6 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 @@ -17,6 +17,11 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,24 +46,25 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -86,6 +92,7 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -100,13 +107,15 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); 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/exhaustive.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/exhaustive.dart new file mode 100644 index 0000000000..73da337c2a --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/exhaustive.dart @@ -0,0 +1,66 @@ +// 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 'exhaustive.g.dart'; + +@JsonSerializable() +final class Exhaustive { + /// Returns a new [Exhaustive] instance. + const Exhaustive({ + this.facetsCount, + this.facetValues, + this.nbHits, + this.rulesMatch, + this.typo, + }); + + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + @JsonKey(name: r'facetsCount') + final bool? facetsCount; + + /// The value is `false` if not all facet values are retrieved. + @JsonKey(name: r'facetValues') + final bool? facetValues; + + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + @JsonKey(name: r'nbHits') + final bool? nbHits; + + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + @JsonKey(name: r'rulesMatch') + final bool? rulesMatch; + + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + @JsonKey(name: r'typo') + final bool? typo; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Exhaustive && + other.facetsCount == facetsCount && + other.facetValues == facetValues && + other.nbHits == nbHits && + other.rulesMatch == rulesMatch && + other.typo == typo; + + @override + int get hashCode => + facetsCount.hashCode + + facetValues.hashCode + + nbHits.hashCode + + rulesMatch.hashCode + + typo.hashCode; + + factory Exhaustive.fromJson(Map json) => + _$ExhaustiveFromJson(json); + + Map toJson() => _$ExhaustiveToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/exhaustive.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/exhaustive.g.dart new file mode 100644 index 0000000000..d92dc943ac --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/exhaustive.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'exhaustive.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Exhaustive _$ExhaustiveFromJson(Map json) => $checkedCreate( + 'Exhaustive', + json, + ($checkedConvert) { + final val = Exhaustive( + facetsCount: $checkedConvert('facetsCount', (v) => v as bool?), + facetValues: $checkedConvert('facetValues', (v) => v as bool?), + nbHits: $checkedConvert('nbHits', (v) => v as bool?), + rulesMatch: $checkedConvert('rulesMatch', (v) => v as bool?), + typo: $checkedConvert('typo', (v) => v as bool?), + ); + return val; + }, + ); + +Map _$ExhaustiveToJson(Exhaustive instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('facetsCount', instance.facetsCount); + writeNotNull('facetValues', instance.facetValues); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('rulesMatch', instance.rulesMatch); + writeNotNull('typo', instance.typo); + return val; +} diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response_redirect.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/redirect.dart similarity index 57% rename from clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response_redirect.dart rename to clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/redirect.dart index c86d707dc6..ff8ab9bf84 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response_redirect.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/redirect.dart @@ -4,12 +4,12 @@ import 'package:algoliasearch/src/model/redirect_rule_index_metadata.dart'; import 'package:json_annotation/json_annotation.dart'; -part 'base_search_response_redirect.g.dart'; +part 'redirect.g.dart'; @JsonSerializable() -final class BaseSearchResponseRedirect { - /// Returns a new [BaseSearchResponseRedirect] instance. - const BaseSearchResponseRedirect({ +final class Redirect { + /// Returns a new [Redirect] instance. + const Redirect({ this.index, }); @@ -18,16 +18,15 @@ final class BaseSearchResponseRedirect { @override bool operator ==(Object other) => - identical(this, other) || - other is BaseSearchResponseRedirect && other.index == index; + identical(this, other) || other is Redirect && other.index == index; @override int get hashCode => index.hashCode; - factory BaseSearchResponseRedirect.fromJson(Map json) => - _$BaseSearchResponseRedirectFromJson(json); + factory Redirect.fromJson(Map json) => + _$RedirectFromJson(json); - Map toJson() => _$BaseSearchResponseRedirectToJson(this); + Map toJson() => _$RedirectToJson(this); @override String toString() { diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response_redirect.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/redirect.g.dart similarity index 69% rename from clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response_redirect.g.dart rename to clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/redirect.g.dart index af32790191..cb1842fe55 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/base_search_response_redirect.g.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/redirect.g.dart @@ -1,18 +1,16 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'base_search_response_redirect.dart'; +part of 'redirect.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -BaseSearchResponseRedirect _$BaseSearchResponseRedirectFromJson( - Map json) => - $checkedCreate( - 'BaseSearchResponseRedirect', +Redirect _$RedirectFromJson(Map json) => $checkedCreate( + 'Redirect', json, ($checkedConvert) { - final val = BaseSearchResponseRedirect( + final val = Redirect( index: $checkedConvert( 'index', (v) => (v as List?) @@ -24,8 +22,7 @@ BaseSearchResponseRedirect _$BaseSearchResponseRedirectFromJson( }, ); -Map _$BaseSearchResponseRedirectToJson( - BaseSearchResponseRedirect instance) { +Map _$RedirectToJson(Redirect instance) { final val = {}; void writeNotNull(String key, dynamic value) { diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.dart index 68887cda8b..fc56f207af 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.dart @@ -2,18 +2,20 @@ // ignore_for_file: unused_element import 'package:algoliasearch/src/model/hit.dart'; +import 'package:collection/collection.dart'; import 'package:json_annotation/json_annotation.dart'; part 'search_hits.g.dart'; -@JsonSerializable() -final class SearchHits { +@JsonSerializable(createFieldMap: true) +final class SearchHits extends DelegatingMap { /// Returns a new [SearchHits] instance. const SearchHits({ required this.hits, required this.query, required this.params, - }); + Map additionalProperties = const {}, + }) : super(additionalProperties); @JsonKey(name: r'hits') final List hits; @@ -32,15 +34,29 @@ final class SearchHits { other is SearchHits && other.hits == hits && other.query == query && - other.params == params; + other.params == params && + const MapEquality().equals(this, this); @override - int get hashCode => hits.hashCode + query.hashCode + params.hashCode; + int get hashCode => + hits.hashCode + + query.hashCode + + params.hashCode + + const MapEquality().hash(this); - factory SearchHits.fromJson(Map json) => - _$SearchHitsFromJson(json); + factory SearchHits.fromJson(Map json) { + final instance = _$SearchHitsFromJson(json); + final additionalProperties = Map.from(json) + ..removeWhere((key, value) => _$SearchHitsFieldMap.containsKey(key)); + return SearchHits( + hits: instance.hits, + query: instance.query, + params: instance.params, + additionalProperties: additionalProperties, + ); + } - Map toJson() => _$SearchHitsToJson(this); + Map toJson() => _$SearchHitsToJson(this)..addAll(this); @override String toString() { diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.g.dart index 613f7f3f80..50e2dda41c 100644 --- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.g.dart +++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_hits.g.dart @@ -23,6 +23,12 @@ SearchHits _$SearchHitsFromJson(Map json) => $checkedCreate( }, ); +const _$SearchHitsFieldMap = { + 'hits': 'hits', + 'query': 'query', + 'params': 'params', +}; + Map _$SearchHitsToJson(SearchHits instance) => { 'hits': instance.hits.map((e) => e.toJson()).toList(), 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 4af69d30c0..f583ce8447 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 @@ -1,9 +1,10 @@ // 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:algoliasearch/src/model/base_search_response_redirect.dart'; +import 'package:algoliasearch/src/model/redirect.dart'; import 'package:algoliasearch/src/model/hit.dart'; import 'package:algoliasearch/src/model/facets_stats.dart'; import 'package:algoliasearch/src/model/rendering_content.dart'; +import 'package:algoliasearch/src/model/exhaustive.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -17,6 +18,7 @@ final class SearchResponse { this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -30,13 +32,15 @@ final class SearchResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, required this.hits, required this.query, required this.params, @@ -59,15 +63,21 @@ final class SearchResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -113,9 +123,6 @@ final class SearchResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -124,10 +131,24 @@ final class SearchResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -136,9 +157,6 @@ final class SearchResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @JsonKey(name: r'hits') final List hits; @@ -158,9 +176,7 @@ final class SearchResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && - other.exhaustiveFacetsCount == exhaustiveFacetsCount && - other.exhaustiveNbHits == exhaustiveNbHits && - other.exhaustiveTypo == exhaustiveTypo && + other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && other.hitsPerPage == hitsPerPage && @@ -171,13 +187,15 @@ final class SearchResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent && other.hits == hits && other.query == query && other.params == params; @@ -188,9 +206,7 @@ final class SearchResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + - exhaustiveFacetsCount.hashCode + - exhaustiveNbHits.hashCode + - exhaustiveTypo.hashCode + + exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + hitsPerPage.hashCode + @@ -201,13 +217,15 @@ final class SearchResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.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 3834005bcd..679c7e7af0 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 @@ -17,6 +17,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,24 +46,25 @@ SearchResponse _$SearchResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -85,6 +91,7 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -99,13 +106,15 @@ Map _$SearchResponseToJson(SearchResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); 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 e9add2709a..dff4a0e929 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 @@ -16,7 +16,6 @@ export 'src/model/base_recommendations_query.dart'; 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/base_search_response_redirect.dart'; export 'src/model/base_trending_facets_query.dart'; export 'src/model/base_trending_items_query.dart'; export 'src/model/condition.dart'; @@ -29,6 +28,7 @@ export 'src/model/edit.dart'; export 'src/model/edit_type.dart'; export 'src/model/error_base.dart'; export 'src/model/exact_on_single_word_query.dart'; +export 'src/model/exhaustive.dart'; export 'src/model/facet_ordering.dart'; export 'src/model/facets.dart'; export 'src/model/facets_stats.dart'; @@ -52,6 +52,7 @@ export 'src/model/recommend_models.dart'; export 'src/model/recommendation_models.dart'; export 'src/model/recommendations_query.dart'; export 'src/model/recommendations_response.dart'; +export 'src/model/redirect.dart'; export 'src/model/redirect_rule_index_metadata.dart'; export 'src/model/redirect_rule_index_metadata_data.dart'; export 'src/model/remove_words_if_no_results.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 ae21368e77..e0a7ef2d1e 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 @@ -9,7 +9,6 @@ import 'package:algolia_client_recommend/src/model/base_recommendations_query.da import 'package:algolia_client_recommend/src/model/base_search_params.dart'; import 'package:algolia_client_recommend/src/model/base_search_params_without_query.dart'; import 'package:algolia_client_recommend/src/model/base_search_response.dart'; -import 'package:algolia_client_recommend/src/model/base_search_response_redirect.dart'; import 'package:algolia_client_recommend/src/model/base_trending_facets_query.dart'; import 'package:algolia_client_recommend/src/model/base_trending_items_query.dart'; import 'package:algolia_client_recommend/src/model/condition.dart'; @@ -22,6 +21,7 @@ import 'package:algolia_client_recommend/src/model/edit.dart'; import 'package:algolia_client_recommend/src/model/edit_type.dart'; import 'package:algolia_client_recommend/src/model/error_base.dart'; import 'package:algolia_client_recommend/src/model/exact_on_single_word_query.dart'; +import 'package:algolia_client_recommend/src/model/exhaustive.dart'; import 'package:algolia_client_recommend/src/model/facet_ordering.dart'; import 'package:algolia_client_recommend/src/model/facets.dart'; import 'package:algolia_client_recommend/src/model/facets_stats.dart'; @@ -45,6 +45,7 @@ import 'package:algolia_client_recommend/src/model/recommend_models.dart'; import 'package:algolia_client_recommend/src/model/recommendation_models.dart'; import 'package:algolia_client_recommend/src/model/recommendations_query.dart'; import 'package:algolia_client_recommend/src/model/recommendations_response.dart'; +import 'package:algolia_client_recommend/src/model/redirect.dart'; import 'package:algolia_client_recommend/src/model/redirect_rule_index_metadata.dart'; import 'package:algolia_client_recommend/src/model/redirect_rule_index_metadata_data.dart'; import 'package:algolia_client_recommend/src/model/remove_words_if_no_results.dart'; @@ -114,9 +115,6 @@ ReturnType deserialize(dynamic value, String targetType, case 'BaseSearchResponse': return BaseSearchResponse.fromJson(value as Map) as ReturnType; - case 'BaseSearchResponseRedirect': - return BaseSearchResponseRedirect.fromJson(value as Map) - as ReturnType; case 'BaseTrendingFacetsQuery': return BaseTrendingFacetsQuery.fromJson(value as Map) as ReturnType; @@ -147,6 +145,8 @@ ReturnType deserialize(dynamic value, String targetType, return ErrorBase.fromJson(value as Map) as ReturnType; case 'ExactOnSingleWordQuery': return ExactOnSingleWordQuery.fromJson(value) as ReturnType; + case 'Exhaustive': + return Exhaustive.fromJson(value as Map) as ReturnType; case 'FacetOrdering': return FacetOrdering.fromJson(value as Map) as ReturnType; @@ -206,6 +206,8 @@ ReturnType deserialize(dynamic value, String targetType, case 'RecommendationsResponse': return RecommendationsResponse.fromJson(value as Map) as ReturnType; + case 'Redirect': + return Redirect.fromJson(value as Map) as ReturnType; case 'RedirectRuleIndexMetadata': return RedirectRuleIndexMetadata.fromJson(value as Map) as ReturnType; 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 272079b74c..34a0ee743d 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 @@ -1,21 +1,24 @@ // 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:algolia_client_recommend/src/model/base_search_response_redirect.dart'; +import 'package:algolia_client_recommend/src/model/exhaustive.dart'; import 'package:algolia_client_recommend/src/model/facets_stats.dart'; +import 'package:algolia_client_recommend/src/model/redirect.dart'; import 'package:algolia_client_recommend/src/model/rendering_content.dart'; +import 'package:collection/collection.dart'; import 'package:json_annotation/json_annotation.dart'; part 'base_search_response.g.dart'; -@JsonSerializable() -final class BaseSearchResponse { +@JsonSerializable(createFieldMap: true) +final class BaseSearchResponse extends DelegatingMap { /// Returns a new [BaseSearchResponse] instance. const BaseSearchResponse({ this.abTestID, this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -29,14 +32,17 @@ final class BaseSearchResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, - }); + Map additionalProperties = const {}, + }) : super(additionalProperties); /// A/B test ID. This is only included in the response for indices that are part of an A/B test. @JsonKey(name: r'abTestID') @@ -55,15 +61,21 @@ final class BaseSearchResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -109,9 +121,6 @@ final class BaseSearchResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -120,10 +129,24 @@ final class BaseSearchResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -132,9 +155,6 @@ final class BaseSearchResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @override bool operator ==(Object other) => identical(this, other) || @@ -143,6 +163,7 @@ final class BaseSearchResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && + other.exhaustive == exhaustive && other.exhaustiveFacetsCount == exhaustiveFacetsCount && other.exhaustiveNbHits == exhaustiveNbHits && other.exhaustiveTypo == exhaustiveTypo && @@ -156,13 +177,16 @@ final class BaseSearchResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent; + const MapEquality().equals(this, this); @override int get hashCode => @@ -170,6 +194,7 @@ final class BaseSearchResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + + exhaustive.hashCode + exhaustiveFacetsCount.hashCode + exhaustiveNbHits.hashCode + exhaustiveTypo.hashCode + @@ -183,18 +208,56 @@ final class BaseSearchResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.hashCode; - - factory BaseSearchResponse.fromJson(Map json) => - _$BaseSearchResponseFromJson(json); + const MapEquality().hash(this); + + factory BaseSearchResponse.fromJson(Map json) { + final instance = _$BaseSearchResponseFromJson(json); + final additionalProperties = Map.from(json) + ..removeWhere( + (key, value) => _$BaseSearchResponseFieldMap.containsKey(key)); + return BaseSearchResponse( + abTestID: instance.abTestID, + abTestVariantID: instance.abTestVariantID, + aroundLatLng: instance.aroundLatLng, + automaticRadius: instance.automaticRadius, + exhaustive: instance.exhaustive, + exhaustiveFacetsCount: instance.exhaustiveFacetsCount, + exhaustiveNbHits: instance.exhaustiveNbHits, + 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, + queryAfterRemoval: instance.queryAfterRemoval, + redirect: instance.redirect, + renderingContent: instance.renderingContent, + serverTimeMS: instance.serverTimeMS, + serverUsed: instance.serverUsed, + userData: instance.userData, + additionalProperties: additionalProperties, + ); + } - Map toJson() => _$BaseSearchResponseToJson(this); + Map toJson() => + _$BaseSearchResponseToJson(this)..addAll(this); @override String toString() { 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 6904344f1a..bd5619d75b 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 @@ -17,6 +17,11 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,30 +46,61 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), ); return val; }, fieldKeyMap: const {'facetsStats': 'facets_stats'}, ); +const _$BaseSearchResponseFieldMap = { + 'abTestID': 'abTestID', + 'abTestVariantID': 'abTestVariantID', + 'aroundLatLng': 'aroundLatLng', + 'automaticRadius': 'automaticRadius', + 'exhaustive': 'exhaustive', + 'exhaustiveFacetsCount': 'exhaustiveFacetsCount', + 'exhaustiveNbHits': 'exhaustiveNbHits', + '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', + 'queryAfterRemoval': 'queryAfterRemoval', + 'redirect': 'redirect', + 'renderingContent': 'renderingContent', + 'serverTimeMS': 'serverTimeMS', + 'serverUsed': 'serverUsed', + 'userData': 'userData', +}; + Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { final val = {}; @@ -78,6 +114,7 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -92,12 +129,14 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); return val; } diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/exhaustive.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/exhaustive.dart new file mode 100644 index 0000000000..73da337c2a --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/exhaustive.dart @@ -0,0 +1,66 @@ +// 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 'exhaustive.g.dart'; + +@JsonSerializable() +final class Exhaustive { + /// Returns a new [Exhaustive] instance. + const Exhaustive({ + this.facetsCount, + this.facetValues, + this.nbHits, + this.rulesMatch, + this.typo, + }); + + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + @JsonKey(name: r'facetsCount') + final bool? facetsCount; + + /// The value is `false` if not all facet values are retrieved. + @JsonKey(name: r'facetValues') + final bool? facetValues; + + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + @JsonKey(name: r'nbHits') + final bool? nbHits; + + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + @JsonKey(name: r'rulesMatch') + final bool? rulesMatch; + + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + @JsonKey(name: r'typo') + final bool? typo; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Exhaustive && + other.facetsCount == facetsCount && + other.facetValues == facetValues && + other.nbHits == nbHits && + other.rulesMatch == rulesMatch && + other.typo == typo; + + @override + int get hashCode => + facetsCount.hashCode + + facetValues.hashCode + + nbHits.hashCode + + rulesMatch.hashCode + + typo.hashCode; + + factory Exhaustive.fromJson(Map json) => + _$ExhaustiveFromJson(json); + + Map toJson() => _$ExhaustiveToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/exhaustive.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/exhaustive.g.dart new file mode 100644 index 0000000000..d92dc943ac --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/exhaustive.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'exhaustive.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Exhaustive _$ExhaustiveFromJson(Map json) => $checkedCreate( + 'Exhaustive', + json, + ($checkedConvert) { + final val = Exhaustive( + facetsCount: $checkedConvert('facetsCount', (v) => v as bool?), + facetValues: $checkedConvert('facetValues', (v) => v as bool?), + nbHits: $checkedConvert('nbHits', (v) => v as bool?), + rulesMatch: $checkedConvert('rulesMatch', (v) => v as bool?), + typo: $checkedConvert('typo', (v) => v as bool?), + ); + return val; + }, + ); + +Map _$ExhaustiveToJson(Exhaustive instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('facetsCount', instance.facetsCount); + writeNotNull('facetValues', instance.facetValues); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('rulesMatch', instance.rulesMatch); + writeNotNull('typo', instance.typo); + return val; +} diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.dart index 938d8c98fa..5fa606140a 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.dart @@ -1,8 +1,9 @@ // 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:algolia_client_recommend/src/model/base_search_response_redirect.dart'; +import 'package:algolia_client_recommend/src/model/exhaustive.dart'; import 'package:algolia_client_recommend/src/model/facets_stats.dart'; import 'package:algolia_client_recommend/src/model/recommend_hit.dart'; +import 'package:algolia_client_recommend/src/model/redirect.dart'; import 'package:algolia_client_recommend/src/model/rendering_content.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -17,6 +18,7 @@ final class RecommendationsResponse { this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -30,13 +32,15 @@ final class RecommendationsResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, required this.hits, this.query, this.params, @@ -59,15 +63,21 @@ final class RecommendationsResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -113,9 +123,6 @@ final class RecommendationsResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -124,10 +131,24 @@ final class RecommendationsResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -136,9 +157,6 @@ final class RecommendationsResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @JsonKey(name: r'hits') final List hits; @@ -158,9 +176,7 @@ final class RecommendationsResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && - other.exhaustiveFacetsCount == exhaustiveFacetsCount && - other.exhaustiveNbHits == exhaustiveNbHits && - other.exhaustiveTypo == exhaustiveTypo && + other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && other.hitsPerPage == hitsPerPage && @@ -171,13 +187,15 @@ final class RecommendationsResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent && other.hits == hits && other.query == query && other.params == params; @@ -188,9 +206,7 @@ final class RecommendationsResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + - exhaustiveFacetsCount.hashCode + - exhaustiveNbHits.hashCode + - exhaustiveTypo.hashCode + + exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + hitsPerPage.hashCode + @@ -201,13 +217,15 @@ final class RecommendationsResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.hashCode + hits.hashCode + query.hashCode + params.hashCode; diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.g.dart index 184888602f..ba8a35c5a5 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/recommendations_response.g.dart @@ -18,6 +18,11 @@ RecommendationsResponse _$RecommendationsResponseFromJson( aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -42,24 +47,25 @@ RecommendationsResponse _$RecommendationsResponseFromJson( nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -87,6 +93,7 @@ Map _$RecommendationsResponseToJson( writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -101,13 +108,15 @@ Map _$RecommendationsResponseToJson( val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); val['hits'] = instance.hits.map((e) => e.toJson()).toList(); writeNotNull('query', instance.query); writeNotNull('params', instance.params); diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response_redirect.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/redirect.dart similarity index 57% rename from clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response_redirect.dart rename to clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/redirect.dart index 3a0d567c53..86f643ee05 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response_redirect.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/redirect.dart @@ -4,12 +4,12 @@ import 'package:algolia_client_recommend/src/model/redirect_rule_index_metadata. import 'package:json_annotation/json_annotation.dart'; -part 'base_search_response_redirect.g.dart'; +part 'redirect.g.dart'; @JsonSerializable() -final class BaseSearchResponseRedirect { - /// Returns a new [BaseSearchResponseRedirect] instance. - const BaseSearchResponseRedirect({ +final class Redirect { + /// Returns a new [Redirect] instance. + const Redirect({ this.index, }); @@ -18,16 +18,15 @@ final class BaseSearchResponseRedirect { @override bool operator ==(Object other) => - identical(this, other) || - other is BaseSearchResponseRedirect && other.index == index; + identical(this, other) || other is Redirect && other.index == index; @override int get hashCode => index.hashCode; - factory BaseSearchResponseRedirect.fromJson(Map json) => - _$BaseSearchResponseRedirectFromJson(json); + factory Redirect.fromJson(Map json) => + _$RedirectFromJson(json); - Map toJson() => _$BaseSearchResponseRedirectToJson(this); + Map toJson() => _$RedirectToJson(this); @override String toString() { diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response_redirect.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/redirect.g.dart similarity index 69% rename from clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response_redirect.g.dart rename to clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/redirect.g.dart index af32790191..cb1842fe55 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response_redirect.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/redirect.g.dart @@ -1,18 +1,16 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'base_search_response_redirect.dart'; +part of 'redirect.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -BaseSearchResponseRedirect _$BaseSearchResponseRedirectFromJson( - Map json) => - $checkedCreate( - 'BaseSearchResponseRedirect', +Redirect _$RedirectFromJson(Map json) => $checkedCreate( + 'Redirect', json, ($checkedConvert) { - final val = BaseSearchResponseRedirect( + final val = Redirect( index: $checkedConvert( 'index', (v) => (v as List?) @@ -24,8 +22,7 @@ BaseSearchResponseRedirect _$BaseSearchResponseRedirectFromJson( }, ); -Map _$BaseSearchResponseRedirectToJson( - BaseSearchResponseRedirect instance) { +Map _$RedirectToJson(Redirect instance) { final val = {}; void writeNotNull(String key, dynamic value) { 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 b64724cd59..5166c86f6f 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 @@ -21,7 +21,6 @@ export 'src/model/base_index_settings.dart'; 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/base_search_response_redirect.dart'; export 'src/model/batch_assign_user_ids_params.dart'; export 'src/model/batch_dictionary_entries_params.dart'; export 'src/model/batch_dictionary_entries_request.dart'; @@ -54,6 +53,7 @@ export 'src/model/edit.dart'; export 'src/model/edit_type.dart'; export 'src/model/error_base.dart'; export 'src/model/exact_on_single_word_query.dart'; +export 'src/model/exhaustive.dart'; export 'src/model/facet_hits.dart'; export 'src/model/facet_ordering.dart'; export 'src/model/facets.dart'; @@ -93,6 +93,7 @@ export 'src/model/promote_object_id.dart'; export 'src/model/promote_object_ids.dart'; export 'src/model/query_type.dart'; export 'src/model/ranking_info.dart'; +export 'src/model/redirect.dart'; export 'src/model/redirect_rule_index_metadata.dart'; export 'src/model/redirect_rule_index_metadata_data.dart'; export 'src/model/remove_user_id_response.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 e8930382db..1928578f7c 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 @@ -14,7 +14,6 @@ import 'package:algolia_client_search/src/model/base_index_settings.dart'; import 'package:algolia_client_search/src/model/base_search_params.dart'; import 'package:algolia_client_search/src/model/base_search_params_without_query.dart'; import 'package:algolia_client_search/src/model/base_search_response.dart'; -import 'package:algolia_client_search/src/model/base_search_response_redirect.dart'; import 'package:algolia_client_search/src/model/batch_assign_user_ids_params.dart'; import 'package:algolia_client_search/src/model/batch_dictionary_entries_params.dart'; import 'package:algolia_client_search/src/model/batch_dictionary_entries_request.dart'; @@ -47,6 +46,7 @@ import 'package:algolia_client_search/src/model/edit.dart'; import 'package:algolia_client_search/src/model/edit_type.dart'; import 'package:algolia_client_search/src/model/error_base.dart'; import 'package:algolia_client_search/src/model/exact_on_single_word_query.dart'; +import 'package:algolia_client_search/src/model/exhaustive.dart'; import 'package:algolia_client_search/src/model/facet_hits.dart'; import 'package:algolia_client_search/src/model/facet_ordering.dart'; import 'package:algolia_client_search/src/model/facets.dart'; @@ -86,6 +86,7 @@ import 'package:algolia_client_search/src/model/promote_object_id.dart'; import 'package:algolia_client_search/src/model/promote_object_ids.dart'; import 'package:algolia_client_search/src/model/query_type.dart'; import 'package:algolia_client_search/src/model/ranking_info.dart'; +import 'package:algolia_client_search/src/model/redirect.dart'; import 'package:algolia_client_search/src/model/redirect_rule_index_metadata.dart'; import 'package:algolia_client_search/src/model/redirect_rule_index_metadata_data.dart'; import 'package:algolia_client_search/src/model/remove_user_id_response.dart'; @@ -198,9 +199,6 @@ ReturnType deserialize(dynamic value, String targetType, case 'BaseSearchResponse': return BaseSearchResponse.fromJson(value as Map) as ReturnType; - case 'BaseSearchResponseRedirect': - return BaseSearchResponseRedirect.fromJson(value as Map) - as ReturnType; case 'BatchAssignUserIdsParams': return BatchAssignUserIdsParams.fromJson(value as Map) as ReturnType; @@ -284,6 +282,8 @@ ReturnType deserialize(dynamic value, String targetType, return ErrorBase.fromJson(value as Map) as ReturnType; case 'ExactOnSingleWordQuery': return ExactOnSingleWordQuery.fromJson(value) as ReturnType; + case 'Exhaustive': + return Exhaustive.fromJson(value as Map) as ReturnType; case 'FacetHits': return FacetHits.fromJson(value as Map) as ReturnType; case 'FacetOrdering': @@ -386,6 +386,8 @@ ReturnType deserialize(dynamic value, String targetType, return QueryType.fromJson(value) as ReturnType; case 'RankingInfo': return RankingInfo.fromJson(value as Map) as ReturnType; + case 'Redirect': + return Redirect.fromJson(value as Map) as ReturnType; case 'RedirectRuleIndexMetadata': return RedirectRuleIndexMetadata.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 b6f14ca0e5..76e9f06232 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 @@ -1,21 +1,24 @@ // 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:algolia_client_search/src/model/exhaustive.dart'; import 'package:algolia_client_search/src/model/rendering_content.dart'; -import 'package:algolia_client_search/src/model/base_search_response_redirect.dart'; +import 'package:algolia_client_search/src/model/redirect.dart'; import 'package:algolia_client_search/src/model/facets_stats.dart'; +import 'package:collection/collection.dart'; import 'package:json_annotation/json_annotation.dart'; part 'base_search_response.g.dart'; -@JsonSerializable() -final class BaseSearchResponse { +@JsonSerializable(createFieldMap: true) +final class BaseSearchResponse extends DelegatingMap { /// Returns a new [BaseSearchResponse] instance. const BaseSearchResponse({ this.abTestID, this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -29,14 +32,17 @@ final class BaseSearchResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, - }); + Map additionalProperties = const {}, + }) : super(additionalProperties); /// A/B test ID. This is only included in the response for indices that are part of an A/B test. @JsonKey(name: r'abTestID') @@ -55,15 +61,21 @@ final class BaseSearchResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -109,9 +121,6 @@ final class BaseSearchResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -120,10 +129,24 @@ final class BaseSearchResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -132,9 +155,6 @@ final class BaseSearchResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @override bool operator ==(Object other) => identical(this, other) || @@ -143,6 +163,7 @@ final class BaseSearchResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && + other.exhaustive == exhaustive && other.exhaustiveFacetsCount == exhaustiveFacetsCount && other.exhaustiveNbHits == exhaustiveNbHits && other.exhaustiveTypo == exhaustiveTypo && @@ -156,13 +177,16 @@ final class BaseSearchResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent; + const MapEquality().equals(this, this); @override int get hashCode => @@ -170,6 +194,7 @@ final class BaseSearchResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + + exhaustive.hashCode + exhaustiveFacetsCount.hashCode + exhaustiveNbHits.hashCode + exhaustiveTypo.hashCode + @@ -183,18 +208,56 @@ final class BaseSearchResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.hashCode; - - factory BaseSearchResponse.fromJson(Map json) => - _$BaseSearchResponseFromJson(json); + const MapEquality().hash(this); + + factory BaseSearchResponse.fromJson(Map json) { + final instance = _$BaseSearchResponseFromJson(json); + final additionalProperties = Map.from(json) + ..removeWhere( + (key, value) => _$BaseSearchResponseFieldMap.containsKey(key)); + return BaseSearchResponse( + abTestID: instance.abTestID, + abTestVariantID: instance.abTestVariantID, + aroundLatLng: instance.aroundLatLng, + automaticRadius: instance.automaticRadius, + exhaustive: instance.exhaustive, + exhaustiveFacetsCount: instance.exhaustiveFacetsCount, + exhaustiveNbHits: instance.exhaustiveNbHits, + 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, + queryAfterRemoval: instance.queryAfterRemoval, + redirect: instance.redirect, + renderingContent: instance.renderingContent, + serverTimeMS: instance.serverTimeMS, + serverUsed: instance.serverUsed, + userData: instance.userData, + additionalProperties: additionalProperties, + ); + } - Map toJson() => _$BaseSearchResponseToJson(this); + Map toJson() => + _$BaseSearchResponseToJson(this)..addAll(this); @override String toString() { 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 6904344f1a..bd5619d75b 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 @@ -17,6 +17,11 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,30 +46,61 @@ BaseSearchResponse _$BaseSearchResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), ); return val; }, fieldKeyMap: const {'facetsStats': 'facets_stats'}, ); +const _$BaseSearchResponseFieldMap = { + 'abTestID': 'abTestID', + 'abTestVariantID': 'abTestVariantID', + 'aroundLatLng': 'aroundLatLng', + 'automaticRadius': 'automaticRadius', + 'exhaustive': 'exhaustive', + 'exhaustiveFacetsCount': 'exhaustiveFacetsCount', + 'exhaustiveNbHits': 'exhaustiveNbHits', + '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', + 'queryAfterRemoval': 'queryAfterRemoval', + 'redirect': 'redirect', + 'renderingContent': 'renderingContent', + 'serverTimeMS': 'serverTimeMS', + 'serverUsed': 'serverUsed', + 'userData': 'userData', +}; + Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { final val = {}; @@ -78,6 +114,7 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -92,12 +129,14 @@ Map _$BaseSearchResponseToJson(BaseSearchResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); 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 efb270dd8d..29ce8279ba 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 @@ -1,8 +1,9 @@ // 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:algolia_client_search/src/model/hit.dart'; +import 'package:algolia_client_search/src/model/exhaustive.dart'; import 'package:algolia_client_search/src/model/rendering_content.dart'; -import 'package:algolia_client_search/src/model/base_search_response_redirect.dart'; +import 'package:algolia_client_search/src/model/redirect.dart'; import 'package:algolia_client_search/src/model/facets_stats.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -17,6 +18,7 @@ final class BrowseResponse { this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -30,13 +32,15 @@ final class BrowseResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, required this.hits, required this.query, required this.params, @@ -60,15 +64,21 @@ final class BrowseResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -114,9 +124,6 @@ final class BrowseResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -125,10 +132,24 @@ final class BrowseResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -137,9 +158,6 @@ final class BrowseResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @JsonKey(name: r'hits') final List hits; @@ -163,9 +181,7 @@ final class BrowseResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && - other.exhaustiveFacetsCount == exhaustiveFacetsCount && - other.exhaustiveNbHits == exhaustiveNbHits && - other.exhaustiveTypo == exhaustiveTypo && + other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && other.hitsPerPage == hitsPerPage && @@ -176,13 +192,15 @@ final class BrowseResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent && other.hits == hits && other.query == query && other.params == params && @@ -194,9 +212,7 @@ final class BrowseResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + - exhaustiveFacetsCount.hashCode + - exhaustiveNbHits.hashCode + - exhaustiveTypo.hashCode + + exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + hitsPerPage.hashCode + @@ -207,13 +223,15 @@ final class BrowseResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.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 41e7ef22da..bcc65874c6 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 @@ -17,6 +17,11 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,24 +46,25 @@ BrowseResponse _$BrowseResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -86,6 +92,7 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -100,13 +107,15 @@ Map _$BrowseResponseToJson(BrowseResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); 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/exhaustive.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/exhaustive.dart new file mode 100644 index 0000000000..73da337c2a --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/exhaustive.dart @@ -0,0 +1,66 @@ +// 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 'exhaustive.g.dart'; + +@JsonSerializable() +final class Exhaustive { + /// Returns a new [Exhaustive] instance. + const Exhaustive({ + this.facetsCount, + this.facetValues, + this.nbHits, + this.rulesMatch, + this.typo, + }); + + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + @JsonKey(name: r'facetsCount') + final bool? facetsCount; + + /// The value is `false` if not all facet values are retrieved. + @JsonKey(name: r'facetValues') + final bool? facetValues; + + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + @JsonKey(name: r'nbHits') + final bool? nbHits; + + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + @JsonKey(name: r'rulesMatch') + final bool? rulesMatch; + + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + @JsonKey(name: r'typo') + final bool? typo; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Exhaustive && + other.facetsCount == facetsCount && + other.facetValues == facetValues && + other.nbHits == nbHits && + other.rulesMatch == rulesMatch && + other.typo == typo; + + @override + int get hashCode => + facetsCount.hashCode + + facetValues.hashCode + + nbHits.hashCode + + rulesMatch.hashCode + + typo.hashCode; + + factory Exhaustive.fromJson(Map json) => + _$ExhaustiveFromJson(json); + + Map toJson() => _$ExhaustiveToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/exhaustive.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/exhaustive.g.dart new file mode 100644 index 0000000000..d92dc943ac --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/exhaustive.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'exhaustive.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Exhaustive _$ExhaustiveFromJson(Map json) => $checkedCreate( + 'Exhaustive', + json, + ($checkedConvert) { + final val = Exhaustive( + facetsCount: $checkedConvert('facetsCount', (v) => v as bool?), + facetValues: $checkedConvert('facetValues', (v) => v as bool?), + nbHits: $checkedConvert('nbHits', (v) => v as bool?), + rulesMatch: $checkedConvert('rulesMatch', (v) => v as bool?), + typo: $checkedConvert('typo', (v) => v as bool?), + ); + return val; + }, + ); + +Map _$ExhaustiveToJson(Exhaustive instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('facetsCount', instance.facetsCount); + writeNotNull('facetValues', instance.facetValues); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('rulesMatch', instance.rulesMatch); + writeNotNull('typo', instance.typo); + return val; +} diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response_redirect.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/redirect.dart similarity index 57% rename from clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response_redirect.dart rename to clients/algoliasearch-client-dart/packages/client_search/lib/src/model/redirect.dart index f91930a4af..0b8c775941 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/base_search_response_redirect.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/redirect.dart @@ -4,12 +4,12 @@ import 'package:algolia_client_search/src/model/redirect_rule_index_metadata.dar import 'package:json_annotation/json_annotation.dart'; -part 'base_search_response_redirect.g.dart'; +part 'redirect.g.dart'; @JsonSerializable() -final class BaseSearchResponseRedirect { - /// Returns a new [BaseSearchResponseRedirect] instance. - const BaseSearchResponseRedirect({ +final class Redirect { + /// Returns a new [Redirect] instance. + const Redirect({ this.index, }); @@ -18,16 +18,15 @@ final class BaseSearchResponseRedirect { @override bool operator ==(Object other) => - identical(this, other) || - other is BaseSearchResponseRedirect && other.index == index; + identical(this, other) || other is Redirect && other.index == index; @override int get hashCode => index.hashCode; - factory BaseSearchResponseRedirect.fromJson(Map json) => - _$BaseSearchResponseRedirectFromJson(json); + factory Redirect.fromJson(Map json) => + _$RedirectFromJson(json); - Map toJson() => _$BaseSearchResponseRedirectToJson(this); + Map toJson() => _$RedirectToJson(this); @override String toString() { diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response_redirect.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/redirect.g.dart similarity index 69% rename from clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response_redirect.g.dart rename to clients/algoliasearch-client-dart/packages/client_search/lib/src/model/redirect.g.dart index af32790191..cb1842fe55 100644 --- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/base_search_response_redirect.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/redirect.g.dart @@ -1,18 +1,16 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'base_search_response_redirect.dart'; +part of 'redirect.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -BaseSearchResponseRedirect _$BaseSearchResponseRedirectFromJson( - Map json) => - $checkedCreate( - 'BaseSearchResponseRedirect', +Redirect _$RedirectFromJson(Map json) => $checkedCreate( + 'Redirect', json, ($checkedConvert) { - final val = BaseSearchResponseRedirect( + final val = Redirect( index: $checkedConvert( 'index', (v) => (v as List?) @@ -24,8 +22,7 @@ BaseSearchResponseRedirect _$BaseSearchResponseRedirectFromJson( }, ); -Map _$BaseSearchResponseRedirectToJson( - BaseSearchResponseRedirect instance) { +Map _$RedirectToJson(Redirect instance) { final val = {}; void writeNotNull(String key, dynamic value) { diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.dart index 00d7d42365..79266eaba9 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.dart @@ -2,18 +2,20 @@ // ignore_for_file: unused_element import 'package:algolia_client_search/src/model/hit.dart'; +import 'package:collection/collection.dart'; import 'package:json_annotation/json_annotation.dart'; part 'search_hits.g.dart'; -@JsonSerializable() -final class SearchHits { +@JsonSerializable(createFieldMap: true) +final class SearchHits extends DelegatingMap { /// Returns a new [SearchHits] instance. const SearchHits({ required this.hits, required this.query, required this.params, - }); + Map additionalProperties = const {}, + }) : super(additionalProperties); @JsonKey(name: r'hits') final List hits; @@ -32,15 +34,29 @@ final class SearchHits { other is SearchHits && other.hits == hits && other.query == query && - other.params == params; + other.params == params && + const MapEquality().equals(this, this); @override - int get hashCode => hits.hashCode + query.hashCode + params.hashCode; + int get hashCode => + hits.hashCode + + query.hashCode + + params.hashCode + + const MapEquality().hash(this); - factory SearchHits.fromJson(Map json) => - _$SearchHitsFromJson(json); + factory SearchHits.fromJson(Map json) { + final instance = _$SearchHitsFromJson(json); + final additionalProperties = Map.from(json) + ..removeWhere((key, value) => _$SearchHitsFieldMap.containsKey(key)); + return SearchHits( + hits: instance.hits, + query: instance.query, + params: instance.params, + additionalProperties: additionalProperties, + ); + } - Map toJson() => _$SearchHitsToJson(this); + Map toJson() => _$SearchHitsToJson(this)..addAll(this); @override String toString() { diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.g.dart index 613f7f3f80..50e2dda41c 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/search_hits.g.dart @@ -23,6 +23,12 @@ SearchHits _$SearchHitsFromJson(Map json) => $checkedCreate( }, ); +const _$SearchHitsFieldMap = { + 'hits': 'hits', + 'query': 'query', + 'params': 'params', +}; + Map _$SearchHitsToJson(SearchHits instance) => { 'hits': instance.hits.map((e) => e.toJson()).toList(), 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 38e1d9767f..c37886d252 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 @@ -1,8 +1,9 @@ // 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:algolia_client_search/src/model/hit.dart'; +import 'package:algolia_client_search/src/model/exhaustive.dart'; import 'package:algolia_client_search/src/model/rendering_content.dart'; -import 'package:algolia_client_search/src/model/base_search_response_redirect.dart'; +import 'package:algolia_client_search/src/model/redirect.dart'; import 'package:algolia_client_search/src/model/facets_stats.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -17,6 +18,7 @@ final class SearchResponse { this.abTestVariantID, this.aroundLatLng, this.automaticRadius, + this.exhaustive, this.exhaustiveFacetsCount, this.exhaustiveNbHits, this.exhaustiveTypo, @@ -30,13 +32,15 @@ final class SearchResponse { required this.nbPages, this.nbSortedHits, required this.page, - this.redirect, this.parsedQuery, required this.processingTimeMS, + this.processingTimingsMS, this.queryAfterRemoval, + this.redirect, + this.renderingContent, + this.serverTimeMS, this.serverUsed, this.userData, - this.renderingContent, required this.hits, required this.query, required this.params, @@ -59,15 +63,21 @@ final class SearchResponse { @JsonKey(name: r'automaticRadius') final String? automaticRadius; - /// Indicates whether the facet count is exhaustive (exact) or approximate. + @JsonKey(name: r'exhaustive') + final Exhaustive? exhaustive; + + /// See the `facetsCount` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveFacetsCount has been deprecated') @JsonKey(name: r'exhaustiveFacetsCount') final bool? exhaustiveFacetsCount; - /// Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + /// See the `nbHits` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveNbHits has been deprecated') @JsonKey(name: r'exhaustiveNbHits') final bool? exhaustiveNbHits; - /// Indicates whether the search for typos was exhaustive (exact) or approximate. + /// See the `typo` field of the `exhaustive` object in the response. + @Deprecated('exhaustiveTypo has been deprecated') @JsonKey(name: r'exhaustiveTypo') final bool? exhaustiveTypo; @@ -113,9 +123,6 @@ final class SearchResponse { @JsonKey(name: r'page') final int page; - @JsonKey(name: r'redirect') - final BaseSearchResponseRedirect? redirect; - /// 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; @@ -124,10 +131,24 @@ final class SearchResponse { @JsonKey(name: r'processingTimeMS') final int processingTimeMS; + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + @JsonKey(name: r'processingTimingsMS') + final Object? processingTimingsMS; + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. @JsonKey(name: r'queryAfterRemoval') final String? queryAfterRemoval; + @JsonKey(name: r'redirect') + final Redirect? redirect; + + @JsonKey(name: r'renderingContent') + final RenderingContent? renderingContent; + + /// Time the server took to process the request, in milliseconds. + @JsonKey(name: r'serverTimeMS') + final int? serverTimeMS; + /// Host name of the server that processed the request. @JsonKey(name: r'serverUsed') final String? serverUsed; @@ -136,9 +157,6 @@ final class SearchResponse { @JsonKey(name: r'userData') final Object? userData; - @JsonKey(name: r'renderingContent') - final RenderingContent? renderingContent; - @JsonKey(name: r'hits') final List hits; @@ -158,9 +176,7 @@ final class SearchResponse { other.abTestVariantID == abTestVariantID && other.aroundLatLng == aroundLatLng && other.automaticRadius == automaticRadius && - other.exhaustiveFacetsCount == exhaustiveFacetsCount && - other.exhaustiveNbHits == exhaustiveNbHits && - other.exhaustiveTypo == exhaustiveTypo && + other.exhaustive == exhaustive && other.facets == facets && other.facetsStats == facetsStats && other.hitsPerPage == hitsPerPage && @@ -171,13 +187,15 @@ final class SearchResponse { other.nbPages == nbPages && other.nbSortedHits == nbSortedHits && other.page == page && - other.redirect == redirect && other.parsedQuery == parsedQuery && other.processingTimeMS == processingTimeMS && + other.processingTimingsMS == processingTimingsMS && other.queryAfterRemoval == queryAfterRemoval && + other.redirect == redirect && + other.renderingContent == renderingContent && + other.serverTimeMS == serverTimeMS && other.serverUsed == serverUsed && other.userData == userData && - other.renderingContent == renderingContent && other.hits == hits && other.query == query && other.params == params; @@ -188,9 +206,7 @@ final class SearchResponse { abTestVariantID.hashCode + aroundLatLng.hashCode + automaticRadius.hashCode + - exhaustiveFacetsCount.hashCode + - exhaustiveNbHits.hashCode + - exhaustiveTypo.hashCode + + exhaustive.hashCode + facets.hashCode + facetsStats.hashCode + hitsPerPage.hashCode + @@ -201,13 +217,15 @@ final class SearchResponse { nbPages.hashCode + nbSortedHits.hashCode + page.hashCode + - redirect.hashCode + parsedQuery.hashCode + processingTimeMS.hashCode + + processingTimingsMS.hashCode + queryAfterRemoval.hashCode + + redirect.hashCode + + renderingContent.hashCode + + serverTimeMS.hashCode + serverUsed.hashCode + (userData == null ? 0 : userData.hashCode) + - renderingContent.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 3834005bcd..679c7e7af0 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 @@ -17,6 +17,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => aroundLatLng: $checkedConvert('aroundLatLng', (v) => v as String?), automaticRadius: $checkedConvert('automaticRadius', (v) => v as String?), + exhaustive: $checkedConvert( + 'exhaustive', + (v) => v == null + ? null + : Exhaustive.fromJson(v as Map)), exhaustiveFacetsCount: $checkedConvert('exhaustiveFacetsCount', (v) => v as bool?), exhaustiveNbHits: @@ -41,24 +46,25 @@ SearchResponse _$SearchResponseFromJson(Map json) => nbPages: $checkedConvert('nbPages', (v) => v as int), nbSortedHits: $checkedConvert('nbSortedHits', (v) => v as int?), page: $checkedConvert('page', (v) => v as int), - redirect: $checkedConvert( - 'redirect', - (v) => v == null - ? null - : BaseSearchResponseRedirect.fromJson( - v as Map)), parsedQuery: $checkedConvert('parsedQuery', (v) => v as String?), processingTimeMS: $checkedConvert('processingTimeMS', (v) => v as int), + processingTimingsMS: $checkedConvert('processingTimingsMS', (v) => v), queryAfterRemoval: $checkedConvert('queryAfterRemoval', (v) => v as String?), - serverUsed: $checkedConvert('serverUsed', (v) => v as String?), - userData: $checkedConvert('userData', (v) => v), + redirect: $checkedConvert( + 'redirect', + (v) => v == null + ? null + : Redirect.fromJson(v as Map)), renderingContent: $checkedConvert( 'renderingContent', (v) => v == null ? null : RenderingContent.fromJson(v as Map)), + serverTimeMS: $checkedConvert('serverTimeMS', (v) => v as int?), + serverUsed: $checkedConvert('serverUsed', (v) => v as String?), + userData: $checkedConvert('userData', (v) => v), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -85,6 +91,7 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('abTestVariantID', instance.abTestVariantID); writeNotNull('aroundLatLng', instance.aroundLatLng); writeNotNull('automaticRadius', instance.automaticRadius); + writeNotNull('exhaustive', instance.exhaustive?.toJson()); writeNotNull('exhaustiveFacetsCount', instance.exhaustiveFacetsCount); writeNotNull('exhaustiveNbHits', instance.exhaustiveNbHits); writeNotNull('exhaustiveTypo', instance.exhaustiveTypo); @@ -99,13 +106,15 @@ Map _$SearchResponseToJson(SearchResponse instance) { val['nbPages'] = instance.nbPages; writeNotNull('nbSortedHits', instance.nbSortedHits); val['page'] = instance.page; - writeNotNull('redirect', instance.redirect?.toJson()); writeNotNull('parsedQuery', instance.parsedQuery); val['processingTimeMS'] = instance.processingTimeMS; + writeNotNull('processingTimingsMS', instance.processingTimingsMS); writeNotNull('queryAfterRemoval', instance.queryAfterRemoval); + writeNotNull('redirect', instance.redirect?.toJson()); + writeNotNull('renderingContent', instance.renderingContent?.toJson()); + writeNotNull('serverTimeMS', instance.serverTimeMS); writeNotNull('serverUsed', instance.serverUsed); writeNotNull('userData', instance.userData); - writeNotNull('renderingContent', instance.renderingContent?.toJson()); 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/analytics/model_average_click_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_average_click_event.go index 0c34f2d8ca..87db74c872 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_average_click_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_average_click_event.go @@ -9,11 +9,11 @@ import ( // AverageClickEvent struct for AverageClickEvent type AverageClickEvent struct { // Average count of all click events. - Average float64 `json:"average" validate:"required"` + Average float64 `json:"average"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` } // NewAverageClickEvent instantiates a new AverageClickEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_click_position.go b/clients/algoliasearch-client-go/algolia/analytics/model_click_position.go index 3005f8b11d..f25578668a 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_click_position.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_click_position.go @@ -9,9 +9,9 @@ import ( // ClickPosition struct for ClickPosition type ClickPosition struct { // Range of positions with the following pattern: - For positions 1 to 10, the number of click events are shown for each position - For positions 11 to 20, all click events are grouped - For positions 21 and up, all click events are grouped. - Position []int32 `json:"position" validate:"required"` + Position []int32 `json:"position"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` } // NewClickPosition instantiates a new ClickPosition object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_click_through_rate_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_click_through_rate_event.go index 35a75d8d60..ddfd72d4e2 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_click_through_rate_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_click_through_rate_event.go @@ -9,13 +9,13 @@ import ( // ClickThroughRateEvent struct for ClickThroughRateEvent type ClickThroughRateEvent struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` // Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. - TrackedSearchCount int32 `json:"trackedSearchCount" validate:"required"` + TrackedSearchCount int32 `json:"trackedSearchCount"` // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` } // NewClickThroughRateEvent instantiates a new ClickThroughRateEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_conversion_rate_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_conversion_rate_event.go index bea85e753f..32926fc300 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_conversion_rate_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_conversion_rate_event.go @@ -9,13 +9,13 @@ import ( // ConversionRateEvent struct for ConversionRateEvent type ConversionRateEvent struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. - TrackedSearchCount int32 `json:"trackedSearchCount" validate:"required"` + TrackedSearchCount int32 `json:"trackedSearchCount"` // Number of converted clicks. - ConversionCount int32 `json:"conversionCount" validate:"required"` + ConversionCount int32 `json:"conversionCount"` // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` } // NewConversionRateEvent instantiates a new ConversionRateEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_average_click_position_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_average_click_position_response.go index 692ee9026a..bf6334b1ea 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_average_click_position_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_average_click_position_response.go @@ -9,11 +9,11 @@ import ( // GetAverageClickPositionResponse struct for GetAverageClickPositionResponse type GetAverageClickPositionResponse struct { // Average count of all click events. - Average float64 `json:"average" validate:"required"` + Average float64 `json:"average"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` // Average click positions. - Dates []AverageClickEvent `json:"dates" validate:"required"` + Dates []AverageClickEvent `json:"dates"` } // NewGetAverageClickPositionResponse instantiates a new GetAverageClickPositionResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_click_positions_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_click_positions_response.go index 2b8106a740..4e7ca3cecf 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_click_positions_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_click_positions_response.go @@ -9,7 +9,7 @@ import ( // GetClickPositionsResponse struct for GetClickPositionsResponse type GetClickPositionsResponse struct { // Click positions. - Positions []ClickPosition `json:"positions" validate:"required"` + Positions []ClickPosition `json:"positions"` } // NewGetClickPositionsResponse instantiates a new GetClickPositionsResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_click_through_rate_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_click_through_rate_response.go index ef47638800..38ec5158d4 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_click_through_rate_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_click_through_rate_response.go @@ -9,13 +9,13 @@ import ( // GetClickThroughRateResponse struct for GetClickThroughRateResponse type GetClickThroughRateResponse struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` // Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. - TrackedSearchCount int32 `json:"trackedSearchCount" validate:"required"` + TrackedSearchCount int32 `json:"trackedSearchCount"` // Click-through rate events. - Dates []ClickThroughRateEvent `json:"dates" validate:"required"` + Dates []ClickThroughRateEvent `json:"dates"` } // NewGetClickThroughRateResponse instantiates a new GetClickThroughRateResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_conversation_rate_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_conversation_rate_response.go index 7898af6b6f..e35122c27f 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_conversation_rate_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_conversation_rate_response.go @@ -9,13 +9,13 @@ import ( // GetConversationRateResponse struct for GetConversationRateResponse type GetConversationRateResponse struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. - TrackedSearchCount int32 `json:"trackedSearchCount" validate:"required"` + TrackedSearchCount int32 `json:"trackedSearchCount"` // Number of converted clicks. - ConversionCount int32 `json:"conversionCount" validate:"required"` + ConversionCount int32 `json:"conversionCount"` // Conversion events. - Dates []ConversionRateEvent `json:"dates" validate:"required"` + Dates []ConversionRateEvent `json:"dates"` } // NewGetConversationRateResponse instantiates a new GetConversationRateResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_no_click_rate_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_no_click_rate_response.go index bb5df282a3..e3df0572fa 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_no_click_rate_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_no_click_rate_response.go @@ -9,13 +9,13 @@ import ( // GetNoClickRateResponse struct for GetNoClickRateResponse type GetNoClickRateResponse struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of click events. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Number of click events. - NoClickCount int32 `json:"noClickCount" validate:"required"` + NoClickCount int32 `json:"noClickCount"` // Overall count of searches without clicks plus a daily breakdown. - Dates []NoClickRateEvent `json:"dates" validate:"required"` + Dates []NoClickRateEvent `json:"dates"` } // NewGetNoClickRateResponse instantiates a new GetNoClickRateResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_no_results_rate_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_no_results_rate_response.go index 542e301b39..a4db474d60 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_no_results_rate_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_no_results_rate_response.go @@ -9,13 +9,13 @@ import ( // GetNoResultsRateResponse struct for GetNoResultsRateResponse type GetNoResultsRateResponse struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Number of occurrences. - NoResultCount int32 `json:"noResultCount" validate:"required"` + NoResultCount int32 `json:"noResultCount"` // Overall count of searches without results plus a daily breakdown. - Dates []NoResultsRateEvent `json:"dates" validate:"required"` + Dates []NoResultsRateEvent `json:"dates"` } // NewGetNoResultsRateResponse instantiates a new GetNoResultsRateResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_count_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_count_response.go index aca7332038..0086240df5 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_count_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_count_response.go @@ -9,9 +9,9 @@ import ( // GetSearchesCountResponse struct for GetSearchesCountResponse type GetSearchesCountResponse struct { // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Search events with their associated dates and hit counts. - Dates []SearchEvent `json:"dates" validate:"required"` + Dates []SearchEvent `json:"dates"` } // NewGetSearchesCountResponse instantiates a new GetSearchesCountResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_clicks_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_clicks_response.go index c697776506..aed0d15b72 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_clicks_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_clicks_response.go @@ -9,7 +9,7 @@ import ( // GetSearchesNoClicksResponse struct for GetSearchesNoClicksResponse type GetSearchesNoClicksResponse struct { // Searches with no clicks. - Searches []SearchNoClickEvent `json:"searches" validate:"required"` + Searches []SearchNoClickEvent `json:"searches"` } // NewGetSearchesNoClicksResponse instantiates a new GetSearchesNoClicksResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_results_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_results_response.go index df3f812f65..b235c5aea8 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_results_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_searches_no_results_response.go @@ -9,7 +9,7 @@ import ( // GetSearchesNoResultsResponse struct for GetSearchesNoResultsResponse type GetSearchesNoResultsResponse struct { // Searches with no results. - Searches []SearchNoResultEvent `json:"searches" validate:"required"` + Searches []SearchNoResultEvent `json:"searches"` } // NewGetSearchesNoResultsResponse instantiates a new GetSearchesNoResultsResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_status_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_status_response.go index 6a10633922..c6fe3f9ac3 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_status_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_status_response.go @@ -9,7 +9,7 @@ import ( // GetStatusResponse struct for GetStatusResponse type GetStatusResponse struct { // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewGetStatusResponse instantiates a new GetStatusResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_countries_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_countries_response.go index 25cb85b574..198551cc89 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_countries_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_countries_response.go @@ -9,7 +9,7 @@ import ( // GetTopCountriesResponse struct for GetTopCountriesResponse type GetTopCountriesResponse struct { // Countries - Countries []TopCountry `json:"countries" validate:"required"` + Countries []TopCountry `json:"countries"` } // NewGetTopCountriesResponse instantiates a new GetTopCountriesResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attribute.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attribute.go index 42683cba55..d8a9f495d4 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attribute.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attribute.go @@ -9,9 +9,9 @@ import ( // GetTopFilterAttribute struct for GetTopFilterAttribute type GetTopFilterAttribute struct { // Attribute name. - Attribute string `json:"attribute" validate:"required"` + Attribute string `json:"attribute"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewGetTopFilterAttribute instantiates a new GetTopFilterAttribute object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attributes_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attributes_response.go index 0e2f84de45..2c94b184eb 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attributes_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_attributes_response.go @@ -9,7 +9,7 @@ import ( // GetTopFilterAttributesResponse struct for GetTopFilterAttributesResponse type GetTopFilterAttributesResponse struct { // Filterable attributes. - Attributes []GetTopFilterAttribute `json:"attributes" validate:"required"` + Attributes []GetTopFilterAttribute `json:"attributes"` } // NewGetTopFilterAttributesResponse instantiates a new GetTopFilterAttributesResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute.go index 766775000a..ab59a5e08e 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute.go @@ -9,13 +9,13 @@ import ( // GetTopFilterForAttribute struct for GetTopFilterForAttribute type GetTopFilterForAttribute struct { // Attribute name. - Attribute string `json:"attribute" validate:"required"` + Attribute string `json:"attribute"` // Operator. - Operator string `json:"operator" validate:"required"` + Operator string `json:"operator"` // Attribute value. - Value string `json:"value" validate:"required"` + Value string `json:"value"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewGetTopFilterForAttribute instantiates a new GetTopFilterForAttribute object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute_response.go index 4b9b3146e4..a2ed6b5a36 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filter_for_attribute_response.go @@ -9,7 +9,7 @@ import ( // GetTopFilterForAttributeResponse struct for GetTopFilterForAttributeResponse type GetTopFilterForAttributeResponse struct { // Filter values for an attribute. - Values []GetTopFilterForAttribute `json:"values" validate:"required"` + Values []GetTopFilterForAttribute `json:"values"` } // NewGetTopFilterForAttributeResponse instantiates a new GetTopFilterForAttributeResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_response.go index d21b59dd5f..da7e964801 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_response.go @@ -9,7 +9,7 @@ import ( // GetTopFiltersNoResultsResponse struct for GetTopFiltersNoResultsResponse type GetTopFiltersNoResultsResponse struct { // Filters with no results. - Values []GetTopFiltersNoResultsValues `json:"values" validate:"required"` + Values []GetTopFiltersNoResultsValues `json:"values"` } // NewGetTopFiltersNoResultsResponse instantiates a new GetTopFiltersNoResultsResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_value.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_value.go index 6f2717387a..84375903cd 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_value.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_value.go @@ -9,11 +9,11 @@ import ( // GetTopFiltersNoResultsValue struct for GetTopFiltersNoResultsValue type GetTopFiltersNoResultsValue struct { // Attribute name. - Attribute string `json:"attribute" validate:"required"` + Attribute string `json:"attribute"` // Operator. - Operator string `json:"operator" validate:"required"` + Operator string `json:"operator"` // Attribute value. - Value string `json:"value" validate:"required"` + Value string `json:"value"` } // NewGetTopFiltersNoResultsValue instantiates a new GetTopFiltersNoResultsValue object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_values.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_values.go index 2a2f55d57f..76d28626ba 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_values.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_top_filters_no_results_values.go @@ -9,9 +9,9 @@ import ( // GetTopFiltersNoResultsValues struct for GetTopFiltersNoResultsValues type GetTopFiltersNoResultsValues struct { // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Filters with no results. - Values []GetTopFiltersNoResultsValue `json:"values" validate:"required"` + Values []GetTopFiltersNoResultsValue `json:"values"` } // NewGetTopFiltersNoResultsValues instantiates a new GetTopFiltersNoResultsValues object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_get_users_count_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_get_users_count_response.go index 698e38eb9e..e9c87f8aed 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_get_users_count_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_get_users_count_response.go @@ -9,9 +9,9 @@ import ( // GetUsersCountResponse struct for GetUsersCountResponse type GetUsersCountResponse struct { // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // User count. - Dates []UserWithDate `json:"dates" validate:"required"` + Dates []UserWithDate `json:"dates"` } // NewGetUsersCountResponse instantiates a new GetUsersCountResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_no_click_rate_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_no_click_rate_event.go index 25ad0c8a0a..31a286024c 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_no_click_rate_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_no_click_rate_event.go @@ -9,13 +9,13 @@ import ( // NoClickRateEvent struct for NoClickRateEvent type NoClickRateEvent struct { // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` // Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Number of click events. - NoClickCount int32 `json:"noClickCount" validate:"required"` + NoClickCount int32 `json:"noClickCount"` // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` } // NewNoClickRateEvent instantiates a new NoClickRateEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_no_results_rate_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_no_results_rate_event.go index 070c7022e0..1ca71f543b 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_no_results_rate_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_no_results_rate_event.go @@ -9,13 +9,13 @@ import ( // NoResultsRateEvent struct for NoResultsRateEvent type NoResultsRateEvent struct { // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` // Number of occurences. - NoResultCount int32 `json:"noResultCount" validate:"required"` + NoResultCount int32 `json:"noResultCount"` // Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - Rate float64 `json:"rate" validate:"required"` + Rate float64 `json:"rate"` } // NewNoResultsRateEvent instantiates a new NoResultsRateEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_search_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_search_event.go index 49c258ac4f..d677cc0edf 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_search_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_search_event.go @@ -9,9 +9,9 @@ import ( // SearchEvent struct for SearchEvent type SearchEvent struct { // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewSearchEvent instantiates a new SearchEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_search_no_click_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_search_no_click_event.go index b80d08a3fc..1fc89a3ae0 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_search_no_click_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_search_no_click_event.go @@ -9,11 +9,11 @@ import ( // SearchNoClickEvent struct for SearchNoClickEvent type SearchNoClickEvent struct { // User query. - Search string `json:"search" validate:"required"` + Search string `json:"search"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Number of occurrences. - WithFilterCount int32 `json:"withFilterCount" validate:"required"` + WithFilterCount int32 `json:"withFilterCount"` } // NewSearchNoClickEvent instantiates a new SearchNoClickEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_search_no_result_event.go b/clients/algoliasearch-client-go/algolia/analytics/model_search_no_result_event.go index ff2015a2b9..18bec68d13 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_search_no_result_event.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_search_no_result_event.go @@ -9,11 +9,11 @@ import ( // SearchNoResultEvent struct for SearchNoResultEvent type SearchNoResultEvent struct { // User query. - Search string `json:"search" validate:"required"` + Search string `json:"search"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` } // NewSearchNoResultEvent instantiates a new SearchNoResultEvent object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_country.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_country.go index d04ab15645..201eaf49e8 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_country.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_country.go @@ -9,9 +9,9 @@ import ( // TopCountry struct for TopCountry type TopCountry struct { // Country. - Country string `json:"country" validate:"required"` + Country string `json:"country"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewTopCountry instantiates a new TopCountry object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_hit.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_hit.go index 217adb5f85..aeaa8d61c3 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_hit.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_hit.go @@ -9,9 +9,9 @@ import ( // TopHit struct for TopHit type TopHit struct { // Hit. - Hit string `json:"hit" validate:"required"` + Hit string `json:"hit"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewTopHit instantiates a new TopHit object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_hit_with_analytics.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_hit_with_analytics.go index 4bee34c0f6..6be235068a 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_hit_with_analytics.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_hit_with_analytics.go @@ -9,19 +9,19 @@ import ( // TopHitWithAnalytics struct for TopHitWithAnalytics type TopHitWithAnalytics struct { // Hit. - Hit string `json:"hit" validate:"required"` + Hit string `json:"hit"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - ClickThroughRate float64 `json:"clickThroughRate" validate:"required"` + ClickThroughRate float64 `json:"clickThroughRate"` // [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). - ConversionRate float64 `json:"conversionRate" validate:"required"` + ConversionRate float64 `json:"conversionRate"` // Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. - TrackedSearchCount int32 `json:"trackedSearchCount" validate:"required"` + TrackedSearchCount int32 `json:"trackedSearchCount"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` // Number of converted clicks. - ConversionCount int32 `json:"conversionCount" validate:"required"` + ConversionCount int32 `json:"conversionCount"` } // NewTopHitWithAnalytics instantiates a new TopHitWithAnalytics object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response.go index bdad7c0e0d..f504915639 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response.go @@ -9,7 +9,7 @@ import ( // TopHitsResponse struct for TopHitsResponse type TopHitsResponse struct { // Top hits. - Hits []TopHit `json:"hits" validate:"required"` + Hits []TopHit `json:"hits"` } // NewTopHitsResponse instantiates a new TopHitsResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response_with_analytics.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response_with_analytics.go index 37d80aea63..885e72f3c4 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response_with_analytics.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_hits_response_with_analytics.go @@ -9,7 +9,7 @@ import ( // TopHitsResponseWithAnalytics struct for TopHitsResponseWithAnalytics type TopHitsResponseWithAnalytics struct { // Top hits. - Hits []TopHitWithAnalytics `json:"hits" validate:"required"` + Hits []TopHitWithAnalytics `json:"hits"` } // NewTopHitsResponseWithAnalytics instantiates a new TopHitsResponseWithAnalytics object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_search.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_search.go index 4214d34879..a362b7e149 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_search.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_search.go @@ -9,11 +9,11 @@ import ( // TopSearch struct for TopSearch type TopSearch struct { // User query. - Search string `json:"search" validate:"required"` + Search string `json:"search"` // Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` } // NewTopSearch instantiates a new TopSearch object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_search_with_analytics.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_search_with_analytics.go index b00f37d6d6..4549e30232 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_search_with_analytics.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_search_with_analytics.go @@ -9,23 +9,23 @@ import ( // TopSearchWithAnalytics struct for TopSearchWithAnalytics type TopSearchWithAnalytics struct { // User query. - Search string `json:"search" validate:"required"` + Search string `json:"search"` // Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` // [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). - ClickThroughRate float64 `json:"clickThroughRate" validate:"required"` + ClickThroughRate float64 `json:"clickThroughRate"` // Average [position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) of clicked search result. - AverageClickPosition int32 `json:"averageClickPosition" validate:"required"` + AverageClickPosition int32 `json:"averageClickPosition"` // [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). - ConversionRate float64 `json:"conversionRate" validate:"required"` + ConversionRate float64 `json:"conversionRate"` // Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. - TrackedSearchCount int32 `json:"trackedSearchCount" validate:"required"` + TrackedSearchCount int32 `json:"trackedSearchCount"` // Number of click events. - ClickCount int32 `json:"clickCount" validate:"required"` + ClickCount int32 `json:"clickCount"` // Number of converted clicks. - ConversionCount int32 `json:"conversionCount" validate:"required"` + ConversionCount int32 `json:"conversionCount"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` } // NewTopSearchWithAnalytics instantiates a new TopSearchWithAnalytics object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response.go index a7f07acb08..78fcba7324 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response.go @@ -9,7 +9,7 @@ import ( // TopSearchesResponse struct for TopSearchesResponse type TopSearchesResponse struct { // Top searches with their hits count. - Searches []TopSearch `json:"searches" validate:"required"` + Searches []TopSearch `json:"searches"` } // NewTopSearchesResponse instantiates a new TopSearchesResponse object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response_with_analytics.go b/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response_with_analytics.go index 83d15b741a..ae142fe3e4 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response_with_analytics.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_top_searches_response_with_analytics.go @@ -9,7 +9,7 @@ import ( // TopSearchesResponseWithAnalytics struct for TopSearchesResponseWithAnalytics type TopSearchesResponseWithAnalytics struct { // Top searches with their hits count and analytics. - Searches []TopSearchWithAnalytics `json:"searches" validate:"required"` + Searches []TopSearchWithAnalytics `json:"searches"` } // NewTopSearchesResponseWithAnalytics instantiates a new TopSearchesResponseWithAnalytics object diff --git a/clients/algoliasearch-client-go/algolia/analytics/model_user_with_date.go b/clients/algoliasearch-client-go/algolia/analytics/model_user_with_date.go index 6e96c09411..bf852133ee 100644 --- a/clients/algoliasearch-client-go/algolia/analytics/model_user_with_date.go +++ b/clients/algoliasearch-client-go/algolia/analytics/model_user_with_date.go @@ -9,9 +9,9 @@ import ( // UserWithDate struct for UserWithDate type UserWithDate struct { // Date of the event in the format YYYY-MM-DD. - Date string `json:"date" validate:"required"` + Date string `json:"date"` // Number of occurrences. - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewUserWithDate instantiates a new UserWithDate object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_algolia.go b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_algolia.go index 101a3f9163..3913106b2b 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_algolia.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_algolia.go @@ -9,9 +9,9 @@ import ( // AuthAlgolia struct for AuthAlgolia type AuthAlgolia struct { // Algolia Application ID. - AppID string `json:"appID" validate:"required"` + AppID string `json:"appID"` // Algolia API Key, with the correct rights to push to an index and change settings. - ApiKey string `json:"apiKey" validate:"required"` + ApiKey string `json:"apiKey"` } // NewAuthAlgolia instantiates a new AuthAlgolia object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_api_key.go b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_api_key.go index c5f6bd1426..ae9b8fba23 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_api_key.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_api_key.go @@ -8,7 +8,7 @@ import ( // AuthAPIKey Authentication input used for token credentials. type AuthAPIKey struct { - Key string `json:"key" validate:"required"` + Key string `json:"key"` } // NewAuthAPIKey instantiates a new AuthAPIKey object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_basic.go b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_basic.go index e8e185bc26..d662e69a6f 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_basic.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_basic.go @@ -8,8 +8,8 @@ import ( // AuthBasic Authentication input for Basic login with username and password. type AuthBasic struct { - Username string `json:"username" validate:"required"` - Password string `json:"password" validate:"required"` + Username string `json:"username"` + Password string `json:"password"` } // NewAuthBasic instantiates a new AuthBasic object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_google_service_account.go b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_google_service_account.go index cf5b10d8bf..107f717efe 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_google_service_account.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_google_service_account.go @@ -9,9 +9,9 @@ import ( // AuthGoogleServiceAccount Authentication input to connect to a Google service (e.g. BigQuery). type AuthGoogleServiceAccount struct { // Email address of the Service Account. - ClientEmail string `json:"clientEmail" validate:"required"` + ClientEmail string `json:"clientEmail"` // Private key of the Service Account. - PrivateKey string `json:"privateKey" validate:"required"` + PrivateKey string `json:"privateKey"` } // NewAuthGoogleServiceAccount instantiates a new AuthGoogleServiceAccount object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_o_auth.go b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_o_auth.go index e99ecf3e13..b1242f1b64 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_auth_o_auth.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_auth_o_auth.go @@ -9,11 +9,11 @@ import ( // AuthOAuth Authentication input for OAuth login. type AuthOAuth struct { // The OAuth endpoint URL. - Url string `json:"url" validate:"required"` + Url string `json:"url"` // The clientID. - ClientId string `json:"client_id" validate:"required"` + ClientId string `json:"client_id"` // The secret. - ClientSecret string `json:"client_secret" validate:"required"` + ClientSecret string `json:"client_secret"` } // NewAuthOAuth instantiates a new AuthOAuth object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication.go b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication.go index 51f20639ab..abb46fed1c 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication.go @@ -9,14 +9,14 @@ import ( // Authentication An authentication is used to login into a Source or a Destination. type Authentication struct { // The authentication UUID. - AuthenticationID string `json:"authenticationID" validate:"required"` - Type AuthenticationType `json:"type" validate:"required"` + AuthenticationID string `json:"authenticationID"` + Type AuthenticationType `json:"type"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` + Name string `json:"name"` Platform *Platform `json:"platform,omitempty"` - Input AuthInput `json:"input" validate:"required"` + Input AuthInput `json:"input"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Date of last update (RFC3339 format). UpdatedAt *string `json:"updatedAt,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create.go b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create.go index 9c1b107cc7..48b05d96e5 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create.go @@ -8,11 +8,11 @@ import ( // AuthenticationCreate The payload when creating an authentication. type AuthenticationCreate struct { - Type AuthenticationType `json:"type" validate:"required"` + Type AuthenticationType `json:"type"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` + Name string `json:"name"` Platform *Platform `json:"platform,omitempty"` - Input AuthInput `json:"input" validate:"required"` + Input AuthInput `json:"input"` } type AuthenticationCreateOption func(f *AuthenticationCreate) diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create_response.go index 3ea31af409..2edf546994 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_create_response.go @@ -9,11 +9,11 @@ import ( // AuthenticationCreateResponse Response from the API when the Authentication is successfully created. type AuthenticationCreateResponse struct { // The authentication UUID. - AuthenticationID string `json:"authenticationID" validate:"required"` + AuthenticationID string `json:"authenticationID"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` + Name string `json:"name"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewAuthenticationCreateResponse instantiates a new AuthenticationCreateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_search.go b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_search.go index 12ef052a67..8e6263c1b4 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_search.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_search.go @@ -8,7 +8,7 @@ import ( // AuthenticationSearch Payload to search for multiple authentications, based on the given `authenticationIDs`. type AuthenticationSearch struct { - AuthenticationIDs []string `json:"authenticationIDs" validate:"required"` + AuthenticationIDs []string `json:"authenticationIDs"` } // NewAuthenticationSearch instantiates a new AuthenticationSearch object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_update_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_update_response.go index 6b9f3476c3..88bce51a19 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_update_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_authentication_update_response.go @@ -9,11 +9,11 @@ import ( // AuthenticationUpdateResponse Response from the API when the Authentication is successfully updated. type AuthenticationUpdateResponse struct { // The authentication UUID. - AuthenticationID string `json:"authenticationID" validate:"required"` + AuthenticationID string `json:"authenticationID"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` + Name string `json:"name"` // Date of last update (RFC3339 format). - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewAuthenticationUpdateResponse instantiates a new AuthenticationUpdateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_channel.go b/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_channel.go index 11366dc947..1d41152129 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_channel.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_channel.go @@ -9,7 +9,7 @@ import ( // BigCommerceChannel struct for BigCommerceChannel type BigCommerceChannel struct { // The ID of the bigcommerce channel. - Id int32 `json:"id" validate:"required"` + Id int32 `json:"id"` // An array of currencies for the given channel `ID`, a currency is a trigram string that represents the currency code. Currencies []string `json:"currencies,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_metafield.go b/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_metafield.go index 8b09781b5e..1a96caa16f 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_metafield.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_big_commerce_metafield.go @@ -9,9 +9,9 @@ import ( // BigCommerceMetafield struct for BigCommerceMetafield type BigCommerceMetafield struct { // The namespace of the metafield. - Namespace string `json:"namespace" validate:"required"` + Namespace string `json:"namespace"` // The key identifier of the metafield. - Key string `json:"key" validate:"required"` + Key string `json:"key"` } // NewBigCommerceMetafield instantiates a new BigCommerceMetafield object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_delete_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_delete_response.go index 699220dae1..7d0d81c084 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_delete_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_delete_response.go @@ -9,7 +9,7 @@ import ( // DeleteResponse struct for DeleteResponse type DeleteResponse struct { // Date of deletion (RFC3339 format). - DeletedAt string `json:"deletedAt" validate:"required"` + DeletedAt string `json:"deletedAt"` } // NewDeleteResponse instantiates a new DeleteResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination.go index 21601939a7..59e2b7008c 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination.go @@ -9,13 +9,13 @@ import ( // Destination A destination describe how the data is indexed on the Algolia side. type Destination struct { // The destination UUID. - DestinationID string `json:"destinationID" validate:"required"` - Type DestinationType `json:"type" validate:"required"` + DestinationID string `json:"destinationID"` + Type DestinationType `json:"type"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` - Input DestinationInput `json:"input" validate:"required"` + Name string `json:"name"` + Input DestinationInput `json:"input"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Date of last update (RFC3339 format). UpdatedAt *string `json:"updatedAt,omitempty"` AuthenticationID *string `json:"authenticationID,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create.go index 0d98817e14..2950edee97 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create.go @@ -8,10 +8,10 @@ import ( // DestinationCreate The payload when creating a destination. type DestinationCreate struct { - Type DestinationType `json:"type" validate:"required"` + Type DestinationType `json:"type"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` - Input DestinationInput `json:"input" validate:"required"` + Name string `json:"name"` + Input DestinationInput `json:"input"` // The authentication UUID. AuthenticationID *string `json:"authenticationID,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create_response.go index f66fbebe67..7fca43a01c 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_create_response.go @@ -9,11 +9,11 @@ import ( // DestinationCreateResponse Response from the API when the Destination is successfully created. type DestinationCreateResponse struct { // The destination UUID. - DestinationID string `json:"destinationID" validate:"required"` + DestinationID string `json:"destinationID"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` + Name string `json:"name"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewDestinationCreateResponse instantiates a new DestinationCreateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_name.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_name.go index 6f530324fb..9d49dc4c0d 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_name.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_name.go @@ -9,7 +9,7 @@ import ( // DestinationIndexName struct for DestinationIndexName type DestinationIndexName struct { // The index name to store data in. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` RecordType *RecordType `json:"recordType,omitempty"` // Determines the attributes to exclude from an Algolia record. To remove nested element, you can separate the path to the element with dots (`.`): - \"foo.bar\": will remove `bar` from `foo`. To remove elements from an array, you can use the following: - \"foo.[0].bar\": will only remove `bar` from the first element of `foo`. - \"foo.[*].bar\": will remove `bar` from every elements of `foo`. AttributesToExclude []string `json:"attributesToExclude,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_prefix.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_prefix.go index 259a1d3f46..07b1c03602 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_prefix.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_index_prefix.go @@ -9,7 +9,7 @@ import ( // DestinationIndexPrefix struct for DestinationIndexPrefix type DestinationIndexPrefix struct { // The prefix of the final index name. - IndexPrefix string `json:"indexPrefix" validate:"required"` + IndexPrefix string `json:"indexPrefix"` } // NewDestinationIndexPrefix instantiates a new DestinationIndexPrefix object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_search.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_search.go index cd16cbedbc..f829459a3e 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_search.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_search.go @@ -8,7 +8,7 @@ import ( // DestinationSearch Payload to search for multiple destinations, based on the given `destinationIDs`. type DestinationSearch struct { - DestinationIDs []string `json:"destinationIDs" validate:"required"` + DestinationIDs []string `json:"destinationIDs"` } // NewDestinationSearch instantiates a new DestinationSearch object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_update_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_update_response.go index 1c6b879de3..820c760e3c 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_destination_update_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_destination_update_response.go @@ -9,11 +9,11 @@ import ( // DestinationUpdateResponse Response from the API when the Destination is successfully updated. type DestinationUpdateResponse struct { // The destination UUID. - DestinationID string `json:"destinationID" validate:"required"` + DestinationID string `json:"destinationID"` // An human readable name describing the object. - Name string `json:"name" validate:"required"` + Name string `json:"name"` // Date of last update (RFC3339 format). - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewDestinationUpdateResponse instantiates a new DestinationUpdateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_discover.go b/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_discover.go index 76db66bcf6..11e66e0ce3 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_discover.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_discover.go @@ -9,9 +9,9 @@ import ( // DockerSourceDiscover struct for DockerSourceDiscover type DockerSourceDiscover struct { // The run UUID. - RunID string `json:"runID" validate:"required"` + RunID string `json:"runID"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewDockerSourceDiscover instantiates a new DockerSourceDiscover object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_streams.go b/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_streams.go index eca6dc7806..0e6bc6206f 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_streams.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_docker_source_streams.go @@ -8,7 +8,7 @@ import ( // DockerSourceStreams struct for DockerSourceStreams type DockerSourceStreams struct { - Streams []map[string]interface{} `json:"streams" validate:"required"` + Streams []map[string]interface{} `json:"streams"` } // NewDockerSourceStreams instantiates a new DockerSourceStreams object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_event.go b/clients/algoliasearch-client-go/algolia/ingestion/model_event.go index 9b8f5013bd..c45e42262b 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_event.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_event.go @@ -9,18 +9,18 @@ import ( // Event An event describe a step of the task execution flow.. type Event struct { // The event UUID. - EventID string `json:"eventID" validate:"required"` + EventID string `json:"eventID"` // The run UUID. - RunID string `json:"runID" validate:"required"` + RunID string `json:"runID"` // The parent event, the cause of this event. ParentID *string `json:"parentID,omitempty"` - Status EventStatus `json:"status" validate:"required"` - Type EventType `json:"type" validate:"required"` + Status EventStatus `json:"status"` + Type EventType `json:"type"` // The extracted record batch size. - BatchSize int32 `json:"batchSize" validate:"required"` + BatchSize int32 `json:"batchSize"` Data map[string]interface{} `json:"data,omitempty"` // Date of publish (RFC3339 format). - PublishedAt string `json:"publishedAt" validate:"required"` + PublishedAt string `json:"publishedAt"` } type EventOption func(f *Event) diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_list_authentications_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_list_authentications_response.go index 23b2727e79..6e07626721 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_list_authentications_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_list_authentications_response.go @@ -8,8 +8,8 @@ import ( // ListAuthenticationsResponse struct for ListAuthenticationsResponse type ListAuthenticationsResponse struct { - Authentications []Authentication `json:"authentications" validate:"required"` - Pagination Pagination `json:"pagination" validate:"required"` + Authentications []Authentication `json:"authentications"` + Pagination Pagination `json:"pagination"` } // NewListAuthenticationsResponse instantiates a new ListAuthenticationsResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_list_destinations_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_list_destinations_response.go index cc731a993a..63b7d9e9dc 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_list_destinations_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_list_destinations_response.go @@ -8,8 +8,8 @@ import ( // ListDestinationsResponse struct for ListDestinationsResponse type ListDestinationsResponse struct { - Destinations []Destination `json:"destinations" validate:"required"` - Pagination Pagination `json:"pagination" validate:"required"` + Destinations []Destination `json:"destinations"` + Pagination Pagination `json:"pagination"` } // NewListDestinationsResponse instantiates a new ListDestinationsResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_list_events_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_list_events_response.go index c693409a2e..fb1c8cf401 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_list_events_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_list_events_response.go @@ -8,8 +8,8 @@ import ( // ListEventsResponse struct for ListEventsResponse type ListEventsResponse struct { - Events []Event `json:"events" validate:"required"` - Pagination Pagination `json:"pagination" validate:"required"` + Events []Event `json:"events"` + Pagination Pagination `json:"pagination"` } // NewListEventsResponse instantiates a new ListEventsResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_list_sources_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_list_sources_response.go index 72bfcf3efc..a5adf93a13 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_list_sources_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_list_sources_response.go @@ -8,8 +8,8 @@ import ( // ListSourcesResponse struct for ListSourcesResponse type ListSourcesResponse struct { - Sources []Source `json:"sources" validate:"required"` - Pagination Pagination `json:"pagination" validate:"required"` + Sources []Source `json:"sources"` + Pagination Pagination `json:"pagination"` } // NewListSourcesResponse instantiates a new ListSourcesResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_list_tasks_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_list_tasks_response.go index 7ca22c9827..d0b9bbb433 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_list_tasks_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_list_tasks_response.go @@ -8,8 +8,8 @@ import ( // ListTasksResponse A list of tasks with pagination details. type ListTasksResponse struct { - Tasks []Task `json:"tasks" validate:"required"` - Pagination Pagination `json:"pagination" validate:"required"` + Tasks []Task `json:"tasks"` + Pagination Pagination `json:"pagination"` } // NewListTasksResponse instantiates a new ListTasksResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_date_utils_input.go b/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_date_utils_input.go index 5ab6f875f7..63a6b6df0e 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_date_utils_input.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_date_utils_input.go @@ -9,9 +9,9 @@ import ( // OnDemandDateUtilsInput The input for an `onDemand` task whose source is of type `bigquery` and for which extracted data spans a given time range. type OnDemandDateUtilsInput struct { // The start date of the extraction (RFC3339 format). - StartDate string `json:"startDate" validate:"required"` + StartDate string `json:"startDate"` // The end date of the extraction (RFC3339 format). - EndDate string `json:"endDate" validate:"required"` + EndDate string `json:"endDate"` } // NewOnDemandDateUtilsInput instantiates a new OnDemandDateUtilsInput object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger.go b/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger.go index c4aa6901be..7b937d2f84 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger.go @@ -8,7 +8,7 @@ import ( // OnDemandTrigger The trigger information of a task of type `onDemand`. type OnDemandTrigger struct { - Type OnDemandTriggerType `json:"type" validate:"required"` + Type OnDemandTriggerType `json:"type"` // The last time the scheduled task ran (RFC3339 format). LastRun *string `json:"lastRun,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger_input.go b/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger_input.go index 965915a9d3..82c045d508 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger_input.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_on_demand_trigger_input.go @@ -8,7 +8,7 @@ import ( // OnDemandTriggerInput The trigger information of a task of type `onDemand`. type OnDemandTriggerInput struct { - Type OnDemandTriggerType `json:"type" validate:"required"` + Type OnDemandTriggerType `json:"type"` } // NewOnDemandTriggerInput instantiates a new OnDemandTriggerInput object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_pagination.go b/clients/algoliasearch-client-go/algolia/ingestion/model_pagination.go index 2adfd31328..e20e753e42 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_pagination.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_pagination.go @@ -8,10 +8,10 @@ import ( // Pagination struct for Pagination type Pagination struct { - NbPages int32 `json:"nbPages" validate:"required"` - Page int32 `json:"page" validate:"required"` - NbItems int32 `json:"nbItems" validate:"required"` - ItemsPerPage int32 `json:"itemsPerPage" validate:"required"` + NbPages int32 `json:"nbPages"` + Page int32 `json:"page"` + NbItems int32 `json:"nbItems"` + ItemsPerPage int32 `json:"itemsPerPage"` } // NewPagination instantiates a new Pagination object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_run.go b/clients/algoliasearch-client-go/algolia/ingestion/model_run.go index 2d3a509474..aa19c43c67 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_run.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_run.go @@ -9,11 +9,11 @@ import ( // Run struct for Run type Run struct { // The run UUID. - RunID string `json:"runID" validate:"required"` - AppID string `json:"appID" validate:"required"` + RunID string `json:"runID"` + AppID string `json:"appID"` // The task UUID. - TaskID string `json:"taskID" validate:"required"` - Status RunStatus `json:"status" validate:"required"` + TaskID string `json:"taskID"` + Status RunStatus `json:"status"` Progress *RunProgress `json:"progress,omitempty"` Outcome *RunOutcome `json:"outcome,omitempty"` // A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. @@ -21,9 +21,9 @@ type Run struct { // Explains the result of outcome. Reason *string `json:"reason,omitempty"` ReasonCode *RunReasonCode `json:"reasonCode,omitempty"` - Type RunType `json:"type" validate:"required"` + Type RunType `json:"type"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Date of start (RFC3339 format). StartedAt *string `json:"startedAt,omitempty"` // Date of finish (RFC3339 format). diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_run_list_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_run_list_response.go index d65f5e91d9..2ea36d8baf 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_run_list_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_run_list_response.go @@ -8,8 +8,8 @@ import ( // RunListResponse struct for RunListResponse type RunListResponse struct { - Runs []Run `json:"runs" validate:"required"` - Pagination Pagination `json:"pagination" validate:"required"` + Runs []Run `json:"runs"` + Pagination Pagination `json:"pagination"` } // NewRunListResponse instantiates a new RunListResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_run_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_run_response.go index 3b4cc47354..acccb034fb 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_run_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_run_response.go @@ -9,9 +9,9 @@ import ( // RunResponse The response from the run task API, containing an Observability Run ID and the time it was created at. type RunResponse struct { // The run UUID. - RunID string `json:"runID" validate:"required"` + RunID string `json:"runID"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewRunResponse instantiates a new RunResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_date_utils_input.go b/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_date_utils_input.go index da12442405..9171684792 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_date_utils_input.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_date_utils_input.go @@ -9,7 +9,7 @@ import ( // ScheduleDateUtilsInput The input for a `schedule` task whose source is of type `bigquery` and for which extracted data spans a fixed number of days. type ScheduleDateUtilsInput struct { // The timeframe of the extraction, in number of days from today. - Timeframe int32 `json:"timeframe" validate:"required"` + Timeframe int32 `json:"timeframe"` } // NewScheduleDateUtilsInput instantiates a new ScheduleDateUtilsInput object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger.go b/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger.go index 00521b5fe0..730f5beb4e 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger.go @@ -8,13 +8,13 @@ import ( // ScheduleTrigger The trigger information for a task of type 'schedule'. type ScheduleTrigger struct { - Type ScheduleTriggerType `json:"type" validate:"required"` + Type ScheduleTriggerType `json:"type"` // A cron expression that represent at which regularity the task should run. - Cron string `json:"cron" validate:"required"` + Cron string `json:"cron"` // The last time the scheduled task ran (RFC3339 format). LastRun *string `json:"lastRun,omitempty"` // The next scheduled run of the task (RFC3339 format). - NextRun string `json:"nextRun" validate:"required"` + NextRun string `json:"nextRun"` } type ScheduleTriggerOption func(f *ScheduleTrigger) diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger_input.go b/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger_input.go index 3bc0e07965..7930c9a48e 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger_input.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_schedule_trigger_input.go @@ -8,9 +8,9 @@ import ( // ScheduleTriggerInput The trigger input for a task of type 'schedule'. type ScheduleTriggerInput struct { - Type ScheduleTriggerType `json:"type" validate:"required"` + Type ScheduleTriggerType `json:"type"` // A cron expression that represent at which regularity the task should run. - Cron string `json:"cron" validate:"required"` + Cron string `json:"cron"` } // NewScheduleTriggerInput instantiates a new ScheduleTriggerInput object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source.go index 28a414e8e0..9a6e5c49d3 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source.go @@ -9,14 +9,14 @@ import ( // Source struct for Source type Source struct { // The source UUID. - SourceID string `json:"sourceID" validate:"required"` - Type SourceType `json:"type" validate:"required"` - Name string `json:"name" validate:"required"` - Input SourceInput `json:"input" validate:"required"` + SourceID string `json:"sourceID"` + Type SourceType `json:"type"` + Name string `json:"name"` + Input SourceInput `json:"input"` // The authentication UUID. AuthenticationID *string `json:"authenticationID,omitempty"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Date of last update (RFC3339 format). UpdatedAt *string `json:"updatedAt,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_big_query.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_big_query.go index 06a3612da7..33124d747b 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_big_query.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_big_query.go @@ -9,9 +9,9 @@ import ( // SourceBigQuery struct for SourceBigQuery type SourceBigQuery struct { // Project ID of the BigQuery Source. - ProjectID string `json:"projectID" validate:"required"` + ProjectID string `json:"projectID"` // Dataset ID of the BigQuery Source. - DatasetID string `json:"datasetID" validate:"required"` + DatasetID string `json:"datasetID"` DataType *BigQueryDataType `json:"dataType,omitempty"` // Table name (for default BQ). Table *string `json:"table,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_commercetools.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_commercetools.go index e1bb69bbcc..6ec9834f20 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_commercetools.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_commercetools.go @@ -11,8 +11,8 @@ type SourceCommercetools struct { StoreKeys []string `json:"storeKeys,omitempty"` // Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. Locales []string `json:"locales,omitempty"` - Url string `json:"url" validate:"required"` - ProjectKey string `json:"projectKey" validate:"required"` + Url string `json:"url"` + ProjectKey string `json:"projectKey"` // Determines the value that will be stored in the Algolia record if there's no inventory information on the product. FallbackIsInStockValue *bool `json:"fallbackIsInStockValue,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_create.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_create.go index 4c773cf7b9..72a26c8e7a 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_create.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_create.go @@ -8,9 +8,9 @@ import ( // SourceCreate struct for SourceCreate type SourceCreate struct { - Type SourceType `json:"type" validate:"required"` - Name string `json:"name" validate:"required"` - Input SourceInput `json:"input" validate:"required"` + Type SourceType `json:"type"` + Name string `json:"name"` + Input SourceInput `json:"input"` // The authentication UUID. AuthenticationID *string `json:"authenticationID,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_create_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_create_response.go index 879351dd74..70083cf873 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_create_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_create_response.go @@ -9,10 +9,10 @@ import ( // SourceCreateResponse struct for SourceCreateResponse type SourceCreateResponse struct { // The source UUID. - SourceID string `json:"sourceID" validate:"required"` - Name string `json:"name" validate:"required"` + SourceID string `json:"sourceID"` + Name string `json:"name"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewSourceCreateResponse instantiates a new SourceCreateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_csv.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_csv.go index ff97560980..f2ced9cee0 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_csv.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_csv.go @@ -9,7 +9,7 @@ import ( // SourceCSV struct for SourceCSV type SourceCSV struct { // The URL of the file. - Url string `json:"url" validate:"required"` + Url string `json:"url"` // The name of the column that contains the unique ID, used as `objectID` in Algolia. UniqueIDColumn *string `json:"uniqueIDColumn,omitempty"` // Mapping of type for every column. For example {\"myColumn\": \"boolean\", \"myOtherColumn\": \"json\"}. diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_docker.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_docker.go index 649cf11311..945e736d76 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_docker.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_docker.go @@ -8,14 +8,14 @@ import ( // SourceDocker struct for SourceDocker type SourceDocker struct { - ImageType DockerImageType `json:"imageType" validate:"required"` - Registry DockerRegistry `json:"registry" validate:"required"` + ImageType DockerImageType `json:"imageType"` + Registry DockerRegistry `json:"registry"` // The name of the image to pull. - Image string `json:"image" validate:"required"` + Image string `json:"image"` // The version of the image, defaults to `latest`. Version *string `json:"version,omitempty"` // The configuration of the spec. - Configuration map[string]interface{} `json:"configuration" validate:"required"` + Configuration map[string]interface{} `json:"configuration"` } type SourceDockerOption func(f *SourceDocker) diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_json.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_json.go index 38391e56bd..cfca93ae4a 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_json.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_json.go @@ -9,7 +9,7 @@ import ( // SourceJSON struct for SourceJSON type SourceJSON struct { // The URL of the file. - Url string `json:"url" validate:"required"` + Url string `json:"url"` // The name of the column that contains the unique ID, used as `objectID` in Algolia. UniqueIDColumn *string `json:"uniqueIDColumn,omitempty"` Method *MethodType `json:"method,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_search.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_search.go index 94311c4fef..15ed83913c 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_search.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_search.go @@ -8,7 +8,7 @@ import ( // SourceSearch struct for SourceSearch type SourceSearch struct { - SourceIDs []string `json:"sourceIDs" validate:"required"` + SourceIDs []string `json:"sourceIDs"` } // NewSourceSearch instantiates a new SourceSearch object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_docker.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_docker.go index 1959775a6a..ba36af1446 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_docker.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_docker.go @@ -14,7 +14,7 @@ type SourceUpdateDocker struct { // The version of the image, defaults to `latest`. Version *string `json:"version,omitempty"` // The configuration of the spec. - Configuration map[string]interface{} `json:"configuration" validate:"required"` + Configuration map[string]interface{} `json:"configuration"` } type SourceUpdateDockerOption func(f *SourceUpdateDocker) diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_response.go index 5606e6af01..6fcab31e41 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_update_response.go @@ -9,10 +9,10 @@ import ( // SourceUpdateResponse struct for SourceUpdateResponse type SourceUpdateResponse struct { // The source UUID. - SourceID string `json:"sourceID" validate:"required"` - Name string `json:"name" validate:"required"` + SourceID string `json:"sourceID"` + Name string `json:"name"` // Date of last update (RFC3339 format). - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewSourceUpdateResponse instantiates a new SourceUpdateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_subscription_trigger.go b/clients/algoliasearch-client-go/algolia/ingestion/model_subscription_trigger.go index 05c29d9ec1..328cb1c2d1 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_subscription_trigger.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_subscription_trigger.go @@ -8,7 +8,7 @@ import ( // SubscriptionTrigger The trigger input for a task of type 'subscription'. type SubscriptionTrigger struct { - Type SubscriptionTriggerType `json:"type" validate:"required"` + Type SubscriptionTriggerType `json:"type"` } // NewSubscriptionTrigger instantiates a new SubscriptionTrigger object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_task.go b/clients/algoliasearch-client-go/algolia/ingestion/model_task.go index 5d421ecbb5..fcf772180e 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_task.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_task.go @@ -9,20 +9,20 @@ import ( // Task struct for Task type Task struct { // The task UUID. - TaskID string `json:"taskID" validate:"required"` + TaskID string `json:"taskID"` // The source UUID. - SourceID string `json:"sourceID" validate:"required"` + SourceID string `json:"sourceID"` // The destination UUID. - DestinationID string `json:"destinationID" validate:"required"` - Trigger Trigger `json:"trigger" validate:"required"` + DestinationID string `json:"destinationID"` + Trigger Trigger `json:"trigger"` Input *TaskInput `json:"input,omitempty"` // Whether the task is enabled or not. - Enabled bool `json:"enabled" validate:"required"` + Enabled bool `json:"enabled"` // A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. FailureThreshold *int32 `json:"failureThreshold,omitempty"` - Action ActionType `json:"action" validate:"required"` + Action ActionType `json:"action"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Date of last update (RFC3339 format). UpdatedAt *string `json:"updatedAt,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_task_create.go b/clients/algoliasearch-client-go/algolia/ingestion/model_task_create.go index c3d8840351..ddd4e408d2 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_task_create.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_task_create.go @@ -9,11 +9,11 @@ import ( // TaskCreate The payload for a task creation. type TaskCreate struct { // The source UUID. - SourceID string `json:"sourceID" validate:"required"` + SourceID string `json:"sourceID"` // The destination UUID. - DestinationID string `json:"destinationID" validate:"required"` - Trigger TaskCreateTrigger `json:"trigger" validate:"required"` - Action ActionType `json:"action" validate:"required"` + DestinationID string `json:"destinationID"` + Trigger TaskCreateTrigger `json:"trigger"` + Action ActionType `json:"action"` // Whether the task is enabled or not. Enabled *bool `json:"enabled,omitempty"` // A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_task_create_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_task_create_response.go index 5b9c97ece9..83d1736a44 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_task_create_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_task_create_response.go @@ -9,9 +9,9 @@ import ( // TaskCreateResponse The response from the API after a task creation. type TaskCreateResponse struct { // The task UUID. - TaskID string `json:"taskID" validate:"required"` + TaskID string `json:"taskID"` // Date of creation (RFC3339 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewTaskCreateResponse instantiates a new TaskCreateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_task_search.go b/clients/algoliasearch-client-go/algolia/ingestion/model_task_search.go index 982a890089..c50f34ea58 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_task_search.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_task_search.go @@ -8,7 +8,7 @@ import ( // TaskSearch struct for TaskSearch type TaskSearch struct { - TaskIDs []string `json:"taskIDs" validate:"required"` + TaskIDs []string `json:"taskIDs"` } // NewTaskSearch instantiates a new TaskSearch object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_task_update_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_task_update_response.go index 7dcb00c600..ca2d00d17b 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_task_update_response.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_task_update_response.go @@ -9,9 +9,9 @@ import ( // TaskUpdateResponse The response from the API after a task update. type TaskUpdateResponse struct { // The task UUID. - TaskID string `json:"taskID" validate:"required"` + TaskID string `json:"taskID"` // Date of last update (RFC3339 format). - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewTaskUpdateResponse instantiates a new TaskUpdateResponse object diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_trigger_update_input.go b/clients/algoliasearch-client-go/algolia/ingestion/model_trigger_update_input.go index 2216ba52d2..b4a049544a 100644 --- a/clients/algoliasearch-client-go/algolia/ingestion/model_trigger_update_input.go +++ b/clients/algoliasearch-client-go/algolia/ingestion/model_trigger_update_input.go @@ -9,7 +9,7 @@ import ( // TriggerUpdateInput The trigger input for a task update. type TriggerUpdateInput struct { // A cron expression that represent at which regularity the task should run. - Cron string `json:"cron" validate:"required"` + Cron string `json:"cron"` } // NewTriggerUpdateInput instantiates a new TriggerUpdateInput object diff --git a/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids.go b/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids.go index e285dd7b72..bc68b3939b 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids.go @@ -9,19 +9,19 @@ import ( // AddedToCartObjectIDs Use this event to track when users add items to their shopping cart unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track add-to-cart events related to Algolia requests, use the \"Added to cart object IDs after search\" event. type AddedToCartObjectIDs struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` - EventSubtype AddToCartEvent `json:"eventSubtype" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` + EventSubtype AddToCartEvent `json:"eventSubtype"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. ObjectData []ObjectData `json:"objectData,omitempty"` // If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. Currency *string `json:"currency,omitempty"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids_after_search.go b/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids_after_search.go index a7d541e053..3a997f20eb 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids_after_search.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_added_to_cart_object_ids_after_search.go @@ -9,21 +9,21 @@ import ( // AddedToCartObjectIDsAfterSearch Use this event to track when users add items to their shopping cart after a previous Algolia request. If you're building your category pages with Algolia, you'll also use this event. type AddedToCartObjectIDsAfterSearch struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` - EventSubtype AddToCartEvent `json:"eventSubtype" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` + EventSubtype AddToCartEvent `json:"eventSubtype"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. - QueryID string `json:"queryID" validate:"required"` + QueryID string `json:"queryID"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. ObjectData []ObjectDataAfterSearch `json:"objectData,omitempty"` // If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. Currency *string `json:"currency,omitempty"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_clicked_filters.go b/clients/algoliasearch-client-go/algolia/insights/model_clicked_filters.go index 45b60c212d..e09cf42853 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_clicked_filters.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_clicked_filters.go @@ -9,14 +9,14 @@ import ( // ClickedFilters Use this event to track when users click facet filters in your user interface. type ClickedFilters struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ClickEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ClickEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. - Filters []string `json:"filters" validate:"required"` + Filters []string `json:"filters"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids.go b/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids.go index 060f1461bf..68967a4c1a 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids.go @@ -9,14 +9,14 @@ import ( // ClickedObjectIDs Use this event to track when users click items unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track click events related to Algolia requests, use the \"Clicked object IDs after search\" event. type ClickedObjectIDs struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ClickEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ClickEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids_after_search.go b/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids_after_search.go index 7af4f807d3..4c6a09bf36 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids_after_search.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_clicked_object_ids_after_search.go @@ -9,18 +9,18 @@ import ( // ClickedObjectIDsAfterSearch Click event after an Algolia request. Use this event to track when users click items in the search results. If you're building your category pages with Algolia, you'll also use this event. type ClickedObjectIDsAfterSearch struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ClickEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ClickEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`. - Positions []int32 `json:"positions" validate:"required"` + Positions []int32 `json:"positions"` // Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. - QueryID string `json:"queryID" validate:"required"` + QueryID string `json:"queryID"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_converted_filters.go b/clients/algoliasearch-client-go/algolia/insights/model_converted_filters.go index a264edf1dc..def26d47de 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_converted_filters.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_converted_filters.go @@ -9,14 +9,14 @@ import ( // ConvertedFilters struct for ConvertedFilters type ConvertedFilters struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. - Filters []string `json:"filters" validate:"required"` + Filters []string `json:"filters"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids.go b/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids.go index 65ee93a533..9503924548 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids.go @@ -9,14 +9,14 @@ import ( // ConvertedObjectIDs Use this event to track when users convert on items unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track conversion events related to Algolia requests, use the \"Converted object IDs after search\" event. type ConvertedObjectIDs struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids_after_search.go b/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids_after_search.go index a7a2088129..b657a7f6a8 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids_after_search.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_converted_object_ids_after_search.go @@ -9,16 +9,16 @@ import ( // ConvertedObjectIDsAfterSearch Use this event to track when users convert after a previous Algolia request. For example, a user clicks on an item in the search results to view the product detail page. Then, the user adds the item to their shopping cart. If you're building your category pages with Algolia, you'll also use this event. type ConvertedObjectIDsAfterSearch struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. - QueryID string `json:"queryID" validate:"required"` + QueryID string `json:"queryID"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_events_items.go b/clients/algoliasearch-client-go/algolia/insights/model_events_items.go index ba7f78bc17..51b82783f1 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_events_items.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_events_items.go @@ -109,162 +109,476 @@ func ViewedObjectIDsAsEventsItems(v *ViewedObjectIDs) EventsItems { // Unmarshal JSON data into one of the pointers in the struct func (dst *EventsItems) UnmarshalJSON(data []byte) error { var err error - // try to unmarshal data into AddedToCartObjectIDs - err = newStrictDecoder(data).Decode(&dst.AddedToCartObjectIDs) - if err == nil && validateStruct(dst.AddedToCartObjectIDs) == nil { - jsonAddedToCartObjectIDs, _ := json.Marshal(dst.AddedToCartObjectIDs) - if string(jsonAddedToCartObjectIDs) == "{}" { // empty struct - dst.AddedToCartObjectIDs = nil - } else { - return nil + // use discriminator value to speed up the lookup + var jsonDict map[string]any + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("Failed to unmarshal JSON into map for the discriminator lookup (AddedToCartObjectIDsAfterSearch).") + } + + // Hold the schema validity between checks + validSchemaForModel := true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false } - } else { - dst.AddedToCartObjectIDs = nil } - // try to unmarshal data into AddedToCartObjectIDsAfterSearch - err = newStrictDecoder(data).Decode(&dst.AddedToCartObjectIDsAfterSearch) - if err == nil && validateStruct(dst.AddedToCartObjectIDsAfterSearch) == nil { - jsonAddedToCartObjectIDsAfterSearch, _ := json.Marshal(dst.AddedToCartObjectIDsAfterSearch) - if string(jsonAddedToCartObjectIDsAfterSearch) == "{}" { // empty struct - dst.AddedToCartObjectIDsAfterSearch = nil + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventSubtype' + if _, ok := jsonDict["eventSubtype"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'queryID' + if _, ok := jsonDict["queryID"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into AddedToCartObjectIDsAfterSearch + err = newStrictDecoder(data).Decode(&dst.AddedToCartObjectIDsAfterSearch) + if err == nil && validateStruct(dst.AddedToCartObjectIDsAfterSearch) == nil { + jsonAddedToCartObjectIDsAfterSearch, _ := json.Marshal(dst.AddedToCartObjectIDsAfterSearch) + if string(jsonAddedToCartObjectIDsAfterSearch) == "{}" { // empty struct + dst.AddedToCartObjectIDsAfterSearch = nil + } else { + return nil + } } else { - return nil + dst.AddedToCartObjectIDsAfterSearch = nil } - } else { - dst.AddedToCartObjectIDsAfterSearch = nil } - // try to unmarshal data into ClickedFilters - err = newStrictDecoder(data).Decode(&dst.ClickedFilters) - if err == nil && validateStruct(dst.ClickedFilters) == nil { - jsonClickedFilters, _ := json.Marshal(dst.ClickedFilters) - if string(jsonClickedFilters) == "{}" { // empty struct - dst.ClickedFilters = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventSubtype' + if _, ok := jsonDict["eventSubtype"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'queryID' + if _, ok := jsonDict["queryID"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into PurchasedObjectIDsAfterSearch + err = newStrictDecoder(data).Decode(&dst.PurchasedObjectIDsAfterSearch) + if err == nil && validateStruct(dst.PurchasedObjectIDsAfterSearch) == nil { + jsonPurchasedObjectIDsAfterSearch, _ := json.Marshal(dst.PurchasedObjectIDsAfterSearch) + if string(jsonPurchasedObjectIDsAfterSearch) == "{}" { // empty struct + dst.PurchasedObjectIDsAfterSearch = nil + } else { + return nil + } } else { - return nil + dst.PurchasedObjectIDsAfterSearch = nil } - } else { - dst.ClickedFilters = nil } - // try to unmarshal data into ClickedObjectIDs - err = newStrictDecoder(data).Decode(&dst.ClickedObjectIDs) - if err == nil && validateStruct(dst.ClickedObjectIDs) == nil { - jsonClickedObjectIDs, _ := json.Marshal(dst.ClickedObjectIDs) - if string(jsonClickedObjectIDs) == "{}" { // empty struct - dst.ClickedObjectIDs = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventSubtype' + if _, ok := jsonDict["eventSubtype"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into AddedToCartObjectIDs + err = newStrictDecoder(data).Decode(&dst.AddedToCartObjectIDs) + if err == nil && validateStruct(dst.AddedToCartObjectIDs) == nil { + jsonAddedToCartObjectIDs, _ := json.Marshal(dst.AddedToCartObjectIDs) + if string(jsonAddedToCartObjectIDs) == "{}" { // empty struct + dst.AddedToCartObjectIDs = nil + } else { + return nil + } } else { - return nil + dst.AddedToCartObjectIDs = nil } - } else { - dst.ClickedObjectIDs = nil } - // try to unmarshal data into ClickedObjectIDsAfterSearch - err = newStrictDecoder(data).Decode(&dst.ClickedObjectIDsAfterSearch) - if err == nil && validateStruct(dst.ClickedObjectIDsAfterSearch) == nil { - jsonClickedObjectIDsAfterSearch, _ := json.Marshal(dst.ClickedObjectIDsAfterSearch) - if string(jsonClickedObjectIDsAfterSearch) == "{}" { // empty struct - dst.ClickedObjectIDsAfterSearch = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'positions' + if _, ok := jsonDict["positions"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'queryID' + if _, ok := jsonDict["queryID"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ClickedObjectIDsAfterSearch + err = newStrictDecoder(data).Decode(&dst.ClickedObjectIDsAfterSearch) + if err == nil && validateStruct(dst.ClickedObjectIDsAfterSearch) == nil { + jsonClickedObjectIDsAfterSearch, _ := json.Marshal(dst.ClickedObjectIDsAfterSearch) + if string(jsonClickedObjectIDsAfterSearch) == "{}" { // empty struct + dst.ClickedObjectIDsAfterSearch = nil + } else { + return nil + } } else { - return nil + dst.ClickedObjectIDsAfterSearch = nil } - } else { - dst.ClickedObjectIDsAfterSearch = nil } - // try to unmarshal data into ConvertedFilters - err = newStrictDecoder(data).Decode(&dst.ConvertedFilters) - if err == nil && validateStruct(dst.ConvertedFilters) == nil { - jsonConvertedFilters, _ := json.Marshal(dst.ConvertedFilters) - if string(jsonConvertedFilters) == "{}" { // empty struct - dst.ConvertedFilters = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventSubtype' + if _, ok := jsonDict["eventSubtype"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into PurchasedObjectIDs + err = newStrictDecoder(data).Decode(&dst.PurchasedObjectIDs) + if err == nil && validateStruct(dst.PurchasedObjectIDs) == nil { + jsonPurchasedObjectIDs, _ := json.Marshal(dst.PurchasedObjectIDs) + if string(jsonPurchasedObjectIDs) == "{}" { // empty struct + dst.PurchasedObjectIDs = nil + } else { + return nil + } } else { - return nil + dst.PurchasedObjectIDs = nil } - } else { - dst.ConvertedFilters = nil } - // try to unmarshal data into ConvertedObjectIDs - err = newStrictDecoder(data).Decode(&dst.ConvertedObjectIDs) - if err == nil && validateStruct(dst.ConvertedObjectIDs) == nil { - jsonConvertedObjectIDs, _ := json.Marshal(dst.ConvertedObjectIDs) - if string(jsonConvertedObjectIDs) == "{}" { // empty struct - dst.ConvertedObjectIDs = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'filters' + if _, ok := jsonDict["filters"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ClickedFilters + err = newStrictDecoder(data).Decode(&dst.ClickedFilters) + if err == nil && validateStruct(dst.ClickedFilters) == nil { + jsonClickedFilters, _ := json.Marshal(dst.ClickedFilters) + if string(jsonClickedFilters) == "{}" { // empty struct + dst.ClickedFilters = nil + } else { + return nil + } } else { - return nil + dst.ClickedFilters = nil } - } else { - dst.ConvertedObjectIDs = nil } - // try to unmarshal data into ConvertedObjectIDsAfterSearch - err = newStrictDecoder(data).Decode(&dst.ConvertedObjectIDsAfterSearch) - if err == nil && validateStruct(dst.ConvertedObjectIDsAfterSearch) == nil { - jsonConvertedObjectIDsAfterSearch, _ := json.Marshal(dst.ConvertedObjectIDsAfterSearch) - if string(jsonConvertedObjectIDsAfterSearch) == "{}" { // empty struct - dst.ConvertedObjectIDsAfterSearch = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ClickedObjectIDs + err = newStrictDecoder(data).Decode(&dst.ClickedObjectIDs) + if err == nil && validateStruct(dst.ClickedObjectIDs) == nil { + jsonClickedObjectIDs, _ := json.Marshal(dst.ClickedObjectIDs) + if string(jsonClickedObjectIDs) == "{}" { // empty struct + dst.ClickedObjectIDs = nil + } else { + return nil + } } else { - return nil + dst.ClickedObjectIDs = nil } - } else { - dst.ConvertedObjectIDsAfterSearch = nil } - // try to unmarshal data into PurchasedObjectIDs - err = newStrictDecoder(data).Decode(&dst.PurchasedObjectIDs) - if err == nil && validateStruct(dst.PurchasedObjectIDs) == nil { - jsonPurchasedObjectIDs, _ := json.Marshal(dst.PurchasedObjectIDs) - if string(jsonPurchasedObjectIDs) == "{}" { // empty struct - dst.PurchasedObjectIDs = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'filters' + if _, ok := jsonDict["filters"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ConvertedFilters + err = newStrictDecoder(data).Decode(&dst.ConvertedFilters) + if err == nil && validateStruct(dst.ConvertedFilters) == nil { + jsonConvertedFilters, _ := json.Marshal(dst.ConvertedFilters) + if string(jsonConvertedFilters) == "{}" { // empty struct + dst.ConvertedFilters = nil + } else { + return nil + } } else { - return nil + dst.ConvertedFilters = nil } - } else { - dst.PurchasedObjectIDs = nil } - // try to unmarshal data into PurchasedObjectIDsAfterSearch - err = newStrictDecoder(data).Decode(&dst.PurchasedObjectIDsAfterSearch) - if err == nil && validateStruct(dst.PurchasedObjectIDsAfterSearch) == nil { - jsonPurchasedObjectIDsAfterSearch, _ := json.Marshal(dst.PurchasedObjectIDsAfterSearch) - if string(jsonPurchasedObjectIDsAfterSearch) == "{}" { // empty struct - dst.PurchasedObjectIDsAfterSearch = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ConvertedObjectIDs + err = newStrictDecoder(data).Decode(&dst.ConvertedObjectIDs) + if err == nil && validateStruct(dst.ConvertedObjectIDs) == nil { + jsonConvertedObjectIDs, _ := json.Marshal(dst.ConvertedObjectIDs) + if string(jsonConvertedObjectIDs) == "{}" { // empty struct + dst.ConvertedObjectIDs = nil + } else { + return nil + } } else { - return nil + dst.ConvertedObjectIDs = nil } - } else { - dst.PurchasedObjectIDsAfterSearch = nil } - // try to unmarshal data into ViewedFilters - err = newStrictDecoder(data).Decode(&dst.ViewedFilters) - if err == nil && validateStruct(dst.ViewedFilters) == nil { - jsonViewedFilters, _ := json.Marshal(dst.ViewedFilters) - if string(jsonViewedFilters) == "{}" { // empty struct - dst.ViewedFilters = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'queryID' + if _, ok := jsonDict["queryID"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ConvertedObjectIDsAfterSearch + err = newStrictDecoder(data).Decode(&dst.ConvertedObjectIDsAfterSearch) + if err == nil && validateStruct(dst.ConvertedObjectIDsAfterSearch) == nil { + jsonConvertedObjectIDsAfterSearch, _ := json.Marshal(dst.ConvertedObjectIDsAfterSearch) + if string(jsonConvertedObjectIDsAfterSearch) == "{}" { // empty struct + dst.ConvertedObjectIDsAfterSearch = nil + } else { + return nil + } } else { - return nil + dst.ConvertedObjectIDsAfterSearch = nil } - } else { - dst.ViewedFilters = nil } - // try to unmarshal data into ViewedObjectIDs - err = newStrictDecoder(data).Decode(&dst.ViewedObjectIDs) - if err == nil && validateStruct(dst.ViewedObjectIDs) == nil { - jsonViewedObjectIDs, _ := json.Marshal(dst.ViewedObjectIDs) - if string(jsonViewedObjectIDs) == "{}" { // empty struct - dst.ViewedObjectIDs = nil + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'filters' + if _, ok := jsonDict["filters"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into ViewedFilters + err = newStrictDecoder(data).Decode(&dst.ViewedFilters) + if err == nil && validateStruct(dst.ViewedFilters) == nil { + jsonViewedFilters, _ := json.Marshal(dst.ViewedFilters) + if string(jsonViewedFilters) == "{}" { // empty struct + dst.ViewedFilters = nil + } else { + return nil + } } else { - return nil + dst.ViewedFilters = nil + } + } + + // Reset the schema validity for the next class check + validSchemaForModel = true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'eventType' + if _, ok := jsonDict["eventType"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'objectIDs' + if _, ok := jsonDict["objectIDs"]; !ok { + validSchemaForModel = false } - } else { - dst.ViewedObjectIDs = nil } + if validSchemaForModel { + // try to unmarshal data into ViewedObjectIDs + err = newStrictDecoder(data).Decode(&dst.ViewedObjectIDs) + if err == nil && validateStruct(dst.ViewedObjectIDs) == nil { + jsonViewedObjectIDs, _ := json.Marshal(dst.ViewedObjectIDs) + if string(jsonViewedObjectIDs) == "{}" { // empty struct + dst.ViewedObjectIDs = nil + } else { + return nil + } + } else { + dst.ViewedObjectIDs = nil + } + } return fmt.Errorf("Data failed to match schemas in oneOf(EventsItems)") } diff --git a/clients/algoliasearch-client-go/algolia/insights/model_insights_events.go b/clients/algoliasearch-client-go/algolia/insights/model_insights_events.go index c1e1af6276..5d77df7631 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_insights_events.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_insights_events.go @@ -9,7 +9,7 @@ import ( // InsightsEvents struct for InsightsEvents type InsightsEvents struct { // List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can't be declared at the same time. **All** events must be valid, otherwise the API returns an error. - Events []EventsItems `json:"events" validate:"required"` + Events []EventsItems `json:"events"` } // NewInsightsEvents instantiates a new InsightsEvents object diff --git a/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids.go b/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids.go index 6dee79ea95..e17d334119 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids.go @@ -9,19 +9,19 @@ import ( // PurchasedObjectIDs Use this event to track when users make a purchase unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track purchase events related to Algolia requests, use the \"Purchased object IDs after search\" event. type PurchasedObjectIDs struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` - EventSubtype PurchaseEvent `json:"eventSubtype" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` + EventSubtype PurchaseEvent `json:"eventSubtype"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. ObjectData []ObjectData `json:"objectData,omitempty"` // If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. Currency *string `json:"currency,omitempty"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids_after_search.go b/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids_after_search.go index f881f7c6c3..aec443f865 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids_after_search.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_purchased_object_ids_after_search.go @@ -9,21 +9,21 @@ import ( // PurchasedObjectIDsAfterSearch Use this event to track when users make a purchase after a previous Algolia request. If you're building your category pages with Algolia, you'll also use this event. type PurchasedObjectIDsAfterSearch struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ConversionEvent `json:"eventType" validate:"required"` - EventSubtype PurchaseEvent `json:"eventSubtype" validate:"required"` + EventName string `json:"eventName"` + EventType ConversionEvent `json:"eventType"` + EventSubtype PurchaseEvent `json:"eventSubtype"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. - QueryID string `json:"queryID" validate:"required"` + QueryID string `json:"queryID"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. ObjectData []ObjectDataAfterSearch `json:"objectData,omitempty"` // If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. Currency *string `json:"currency,omitempty"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_viewed_filters.go b/clients/algoliasearch-client-go/algolia/insights/model_viewed_filters.go index 8b0f48a86f..afaa566508 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_viewed_filters.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_viewed_filters.go @@ -9,14 +9,14 @@ import ( // ViewedFilters Use this method to capture active filters. For example, when browsing a category page, users see content filtered on that specific category. type ViewedFilters struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ViewEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ViewEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. - Filters []string `json:"filters" validate:"required"` + Filters []string `json:"filters"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/insights/model_viewed_object_ids.go b/clients/algoliasearch-client-go/algolia/insights/model_viewed_object_ids.go index 1baccc5776..76be953b47 100644 --- a/clients/algoliasearch-client-go/algolia/insights/model_viewed_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/insights/model_viewed_object_ids.go @@ -9,14 +9,14 @@ import ( // ViewedObjectIDs Use this event to track when users viewed items in the search results. type ViewedObjectIDs struct { // Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. - EventName string `json:"eventName" validate:"required"` - EventType ViewEvent `json:"eventType" validate:"required"` + EventName string `json:"eventName"` + EventType ViewEvent `json:"eventType"` // Name of the Algolia index. - Index string `json:"index" validate:"required"` + Index string `json:"index"` // List of object identifiers for items of an Algolia index. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. Timestamp *int64 `json:"timestamp,omitempty"` // User token for authenticated users. diff --git a/clients/algoliasearch-client-go/algolia/personalization/model_delete_user_profile_response.go b/clients/algoliasearch-client-go/algolia/personalization/model_delete_user_profile_response.go index 2d498c07f0..25381ce829 100644 --- a/clients/algoliasearch-client-go/algolia/personalization/model_delete_user_profile_response.go +++ b/clients/algoliasearch-client-go/algolia/personalization/model_delete_user_profile_response.go @@ -9,9 +9,9 @@ import ( // DeleteUserProfileResponse struct for DeleteUserProfileResponse type DeleteUserProfileResponse struct { // userToken representing the user for which to fetch the Personalization profile. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // A date until which the data can safely be considered as deleted for the given user. Any data received after the `deletedUntil` date will start building a new user profile. - DeletedUntil string `json:"deletedUntil" validate:"required"` + DeletedUntil string `json:"deletedUntil"` } // NewDeleteUserProfileResponse instantiates a new DeleteUserProfileResponse object diff --git a/clients/algoliasearch-client-go/algolia/personalization/model_event_scoring.go b/clients/algoliasearch-client-go/algolia/personalization/model_event_scoring.go index 52303621f7..2d5d4668dd 100644 --- a/clients/algoliasearch-client-go/algolia/personalization/model_event_scoring.go +++ b/clients/algoliasearch-client-go/algolia/personalization/model_event_scoring.go @@ -9,11 +9,11 @@ import ( // EventScoring struct for EventScoring type EventScoring struct { // The score for the event. - Score int32 `json:"score" validate:"required"` + Score int32 `json:"score"` // The name of the event. - EventName string `json:"eventName" validate:"required"` + EventName string `json:"eventName"` // The type of the event. - EventType string `json:"eventType" validate:"required"` + EventType string `json:"eventType"` } // NewEventScoring instantiates a new EventScoring object diff --git a/clients/algoliasearch-client-go/algolia/personalization/model_facet_scoring.go b/clients/algoliasearch-client-go/algolia/personalization/model_facet_scoring.go index 22c312d321..44990978c9 100644 --- a/clients/algoliasearch-client-go/algolia/personalization/model_facet_scoring.go +++ b/clients/algoliasearch-client-go/algolia/personalization/model_facet_scoring.go @@ -9,9 +9,9 @@ import ( // FacetScoring struct for FacetScoring type FacetScoring struct { // The score for the event. - Score int32 `json:"score" validate:"required"` + Score int32 `json:"score"` // The name of the facet. - FacetName string `json:"facetName" validate:"required"` + FacetName string `json:"facetName"` } // NewFacetScoring instantiates a new FacetScoring object diff --git a/clients/algoliasearch-client-go/algolia/personalization/model_get_user_token_response.go b/clients/algoliasearch-client-go/algolia/personalization/model_get_user_token_response.go index ae5351ed35..4bee91b40b 100644 --- a/clients/algoliasearch-client-go/algolia/personalization/model_get_user_token_response.go +++ b/clients/algoliasearch-client-go/algolia/personalization/model_get_user_token_response.go @@ -9,11 +9,11 @@ import ( // GetUserTokenResponse struct for GetUserTokenResponse type GetUserTokenResponse struct { // userToken representing the user for which to fetch the Personalization profile. - UserToken string `json:"userToken" validate:"required"` + UserToken string `json:"userToken"` // Date of last event update. (ISO-8601 format). - LastEventAt string `json:"lastEventAt" validate:"required"` + LastEventAt string `json:"lastEventAt"` // The userToken scores. - Scores map[string]interface{} `json:"scores" validate:"required"` + Scores map[string]interface{} `json:"scores"` } // NewGetUserTokenResponse instantiates a new GetUserTokenResponse object diff --git a/clients/algoliasearch-client-go/algolia/personalization/model_personalization_strategy_params.go b/clients/algoliasearch-client-go/algolia/personalization/model_personalization_strategy_params.go index 2b377d2911..e5dbdef043 100644 --- a/clients/algoliasearch-client-go/algolia/personalization/model_personalization_strategy_params.go +++ b/clients/algoliasearch-client-go/algolia/personalization/model_personalization_strategy_params.go @@ -9,11 +9,11 @@ import ( // PersonalizationStrategyParams struct for PersonalizationStrategyParams type PersonalizationStrategyParams struct { // Scores associated with the events. - EventScoring []EventScoring `json:"eventScoring" validate:"required"` + EventScoring []EventScoring `json:"eventScoring"` // Scores associated with the facets. - FacetScoring []FacetScoring `json:"facetScoring" validate:"required"` + FacetScoring []FacetScoring `json:"facetScoring"` // The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled). - PersonalizationImpact int32 `json:"personalizationImpact" validate:"required"` + PersonalizationImpact int32 `json:"personalizationImpact"` } // NewPersonalizationStrategyParams instantiates a new PersonalizationStrategyParams object diff --git a/clients/algoliasearch-client-go/algolia/personalization/model_set_personalization_strategy_response.go b/clients/algoliasearch-client-go/algolia/personalization/model_set_personalization_strategy_response.go index 7cf7947b98..38d1319ddb 100644 --- a/clients/algoliasearch-client-go/algolia/personalization/model_set_personalization_strategy_response.go +++ b/clients/algoliasearch-client-go/algolia/personalization/model_set_personalization_strategy_response.go @@ -9,7 +9,7 @@ import ( // SetPersonalizationStrategyResponse struct for SetPersonalizationStrategyResponse type SetPersonalizationStrategyResponse struct { // A message confirming the strategy update. - Message string `json:"message" validate:"required"` + Message string `json:"message"` } // NewSetPersonalizationStrategyResponse instantiates a new SetPersonalizationStrategyResponse object diff --git a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration.go b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration.go index c9720fc2ac..6291595416 100644 --- a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration.go +++ b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration.go @@ -9,7 +9,7 @@ import ( // QuerySuggestionsConfiguration Query Suggestions configuration. type QuerySuggestionsConfiguration struct { // Algolia indices from which to get the popular searches for query suggestions. - SourceIndices []SourceIndex `json:"sourceIndices" validate:"required"` + SourceIndices []SourceIndex `json:"sourceIndices"` Languages *Languages `json:"languages,omitempty"` // Patterns to exclude from query suggestions. Exclude []string `json:"exclude,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_response.go b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_response.go index 7b26af468b..f757b53036 100644 --- a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_response.go +++ b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_response.go @@ -17,9 +17,9 @@ type QuerySuggestionsConfigurationResponse struct { // API key used to read from external Algolia indices. ExternalIndicesAPIKey *string `json:"externalIndicesAPIKey,omitempty"` // Query Suggestions index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Algolia indices from which to get the popular searches for query suggestions. - SourceIndices []SourceIndex `json:"sourceIndices" validate:"required"` + SourceIndices []SourceIndex `json:"sourceIndices"` Languages *Languages `json:"languages,omitempty"` // Patterns to exclude from query suggestions. Exclude []string `json:"exclude,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index.go b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index.go index 721574e1e5..c1ac4c953a 100644 --- a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index.go +++ b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index.go @@ -9,9 +9,9 @@ import ( // QuerySuggestionsConfigurationWithIndex Query Suggestions configuration. type QuerySuggestionsConfigurationWithIndex struct { // Query Suggestions index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Algolia indices from which to get the popular searches for query suggestions. - SourceIndices []SourceIndex `json:"sourceIndices" validate:"required"` + SourceIndices []SourceIndex `json:"sourceIndices"` Languages *Languages `json:"languages,omitempty"` // Patterns to exclude from query suggestions. Exclude []string `json:"exclude,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index_all_of.go b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index_all_of.go index db76e8a0ea..3e72ea43e8 100644 --- a/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index_all_of.go +++ b/clients/algoliasearch-client-go/algolia/query-suggestions/model_query_suggestions_configuration_with_index_all_of.go @@ -9,7 +9,7 @@ import ( // QuerySuggestionsConfigurationWithIndexAllOf struct for QuerySuggestionsConfigurationWithIndexAllOf type QuerySuggestionsConfigurationWithIndexAllOf struct { // Query Suggestions index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` } // NewQuerySuggestionsConfigurationWithIndexAllOf instantiates a new QuerySuggestionsConfigurationWithIndexAllOf object diff --git a/clients/algoliasearch-client-go/algolia/query-suggestions/model_source_index.go b/clients/algoliasearch-client-go/algolia/query-suggestions/model_source_index.go index 9ce7264efe..64750f3c2d 100644 --- a/clients/algoliasearch-client-go/algolia/query-suggestions/model_source_index.go +++ b/clients/algoliasearch-client-go/algolia/query-suggestions/model_source_index.go @@ -9,7 +9,7 @@ import ( // SourceIndex Configuration of an Algolia index for Query Suggestions. type SourceIndex struct { // Name of the Algolia index to use as source for query suggestions. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // If true, Query Suggestions uses all replicas of the primary index to find popular searches. If false, only the primary index is used. Replicas *bool `json:"replicas,omitempty"` // [Analytics tags](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) for filtering the popular searches. diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_automatic_facet_filter.go b/clients/algoliasearch-client-go/algolia/recommend/model_automatic_facet_filter.go index e13512cabf..42933ad343 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_automatic_facet_filter.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_automatic_facet_filter.go @@ -9,7 +9,7 @@ import ( // AutomaticFacetFilter Automatic facet Filter. type AutomaticFacetFilter struct { // Attribute to filter on. This must match a facet placeholder in the Rule's pattern. - Facet string `json:"facet" validate:"required"` + Facet string `json:"facet"` // Score for the filter. Typically used for optional or disjunctive filters. Score *int32 `json:"score,omitempty"` // Whether the filter is disjunctive (true) or conjunctive (false). diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_base_recommend_request.go b/clients/algoliasearch-client-go/algolia/recommend/model_base_recommend_request.go index eeb219bacd..3cd3eeda72 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_base_recommend_request.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_base_recommend_request.go @@ -9,7 +9,7 @@ import ( // BaseRecommendRequest struct for BaseRecommendRequest type BaseRecommendRequest struct { // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. Threshold *int32 `json:"threshold,omitempty"` // Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_base_recommendations_query.go b/clients/algoliasearch-client-go/algolia/recommend/model_base_recommendations_query.go index 266144cc6c..4d0bc413c2 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_base_recommendations_query.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_base_recommendations_query.go @@ -8,9 +8,9 @@ import ( // BaseRecommendationsQuery struct for BaseRecommendationsQuery type BaseRecommendationsQuery struct { - Model RecommendationModels `json:"model" validate:"required"` + Model RecommendationModels `json:"model"` // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` QueryParameters *SearchParamsObject `json:"queryParameters,omitempty"` FallbackParameters *SearchParamsObject `json:"fallbackParameters,omitempty"` } 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 5e0e2b8d16..080dafed58 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 @@ -15,19 +15,23 @@ type BaseSearchResponse struct { // Computed geographical location. AroundLatLng *string `json:"aroundLatLng,omitempty"` // Automatically-computed radius. - AutomaticRadius *string `json:"automaticRadius,omitempty"` - // Indicates whether the facet count is exhaustive (exact) or approximate. + AutomaticRadius *string `json:"automaticRadius,omitempty"` + Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // See the `facetsCount` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` - // Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + // See the `nbHits` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveNbHits *bool `json:"exhaustiveNbHits,omitempty"` - // Indicates whether the search for typos was exhaustive (exact) or approximate. + // See the `typo` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveTypo *bool `json:"exhaustiveTypo,omitempty"` // Mapping of each facet name to the corresponding facet counts. 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" validate:"required"` + 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. @@ -35,27 +39,34 @@ type BaseSearchResponse struct { // Warnings about the query. Message *string `json:"message,omitempty"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Number of pages of results for the current query. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` // Page to retrieve (the first page is `0`, not `1`). - Page int32 `json:"page" validate:"required"` - Redirect *BaseSearchResponseRedirect `json:"redirect,omitempty"` + 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. - ProcessingTimeMS int32 `json:"processingTimeMS" validate:"required"` + ProcessingTimeMS int32 `json:"processingTimeMS"` + // Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + ProcessingTimingsMS map[string]interface{} `json:"processingTimingsMS,omitempty"` // Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. - QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + Redirect *Redirect `json:"redirect,omitempty"` + RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + // Time the server took to process the request, in milliseconds. + ServerTimeMS *int32 `json:"serverTimeMS,omitempty"` // Host name of the server that processed the request. ServerUsed *string `json:"serverUsed,omitempty"` // Lets you store custom data in your indices. - UserData interface{} `json:"userData,omitempty"` - RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + UserData interface{} `json:"userData,omitempty"` + AdditionalProperties map[string]any } +type _BaseSearchResponse BaseSearchResponse + type BaseSearchResponseOption func(f *BaseSearchResponse) func WithBaseSearchResponseAbTestID(val int32) BaseSearchResponseOption { @@ -82,6 +93,12 @@ func WithBaseSearchResponseAutomaticRadius(val string) BaseSearchResponseOption } } +func WithBaseSearchResponseExhaustive(val Exhaustive) BaseSearchResponseOption { + return func(f *BaseSearchResponse) { + f.Exhaustive = &val + } +} + func WithBaseSearchResponseExhaustiveFacetsCount(val bool) BaseSearchResponseOption { return func(f *BaseSearchResponse) { f.ExhaustiveFacetsCount = &val @@ -136,15 +153,15 @@ func WithBaseSearchResponseNbSortedHits(val int32) BaseSearchResponseOption { } } -func WithBaseSearchResponseRedirect(val BaseSearchResponseRedirect) BaseSearchResponseOption { +func WithBaseSearchResponseParsedQuery(val string) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.Redirect = &val + f.ParsedQuery = &val } } -func WithBaseSearchResponseParsedQuery(val string) BaseSearchResponseOption { +func WithBaseSearchResponseProcessingTimingsMS(val map[string]interface{}) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.ParsedQuery = &val + f.ProcessingTimingsMS = val } } @@ -154,21 +171,33 @@ func WithBaseSearchResponseQueryAfterRemoval(val string) BaseSearchResponseOptio } } -func WithBaseSearchResponseServerUsed(val string) BaseSearchResponseOption { +func WithBaseSearchResponseRedirect(val Redirect) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.ServerUsed = &val + f.Redirect = &val } } -func WithBaseSearchResponseUserData(val interface{}) BaseSearchResponseOption { +func WithBaseSearchResponseRenderingContent(val RenderingContent) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.UserData = val + f.RenderingContent = &val } } -func WithBaseSearchResponseRenderingContent(val RenderingContent) BaseSearchResponseOption { +func WithBaseSearchResponseServerTimeMS(val int32) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.RenderingContent = &val + f.ServerTimeMS = &val + } +} + +func WithBaseSearchResponseServerUsed(val string) BaseSearchResponseOption { + return func(f *BaseSearchResponse) { + f.ServerUsed = &val + } +} + +func WithBaseSearchResponseUserData(val interface{}) BaseSearchResponseOption { + return func(f *BaseSearchResponse) { + f.UserData = val } } @@ -329,7 +358,40 @@ func (o *BaseSearchResponse) SetAutomaticRadius(v string) { o.AutomaticRadius = &v } +// GetExhaustive returns the Exhaustive field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetExhaustive() Exhaustive { + if o == nil || o.Exhaustive == nil { + var ret Exhaustive + return ret + } + return *o.Exhaustive +} + +// GetExhaustiveOk returns a tuple with the Exhaustive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetExhaustiveOk() (*Exhaustive, bool) { + if o == nil || o.Exhaustive == nil { + return nil, false + } + return o.Exhaustive, true +} + +// HasExhaustive returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasExhaustive() bool { + if o != nil && o.Exhaustive != nil { + return true + } + + return false +} + +// SetExhaustive gets a reference to the given Exhaustive and assigns it to the Exhaustive field. +func (o *BaseSearchResponse) SetExhaustive(v Exhaustive) { + o.Exhaustive = &v +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveFacetsCount() bool { if o == nil || o.ExhaustiveFacetsCount == nil { var ret bool @@ -340,6 +402,7 @@ func (o *BaseSearchResponse) GetExhaustiveFacetsCount() bool { // GetExhaustiveFacetsCountOk returns a tuple with the ExhaustiveFacetsCount field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveFacetsCountOk() (*bool, bool) { if o == nil || o.ExhaustiveFacetsCount == nil { return nil, false @@ -357,11 +420,13 @@ func (o *BaseSearchResponse) HasExhaustiveFacetsCount() bool { } // SetExhaustiveFacetsCount gets a reference to the given bool and assigns it to the ExhaustiveFacetsCount field. +// Deprecated func (o *BaseSearchResponse) SetExhaustiveFacetsCount(v bool) { o.ExhaustiveFacetsCount = &v } // GetExhaustiveNbHits returns the ExhaustiveNbHits field value if set, zero value otherwise. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveNbHits() bool { if o == nil || o.ExhaustiveNbHits == nil { var ret bool @@ -372,6 +437,7 @@ func (o *BaseSearchResponse) GetExhaustiveNbHits() bool { // GetExhaustiveNbHitsOk returns a tuple with the ExhaustiveNbHits field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveNbHitsOk() (*bool, bool) { if o == nil || o.ExhaustiveNbHits == nil { return nil, false @@ -389,11 +455,13 @@ func (o *BaseSearchResponse) HasExhaustiveNbHits() bool { } // SetExhaustiveNbHits gets a reference to the given bool and assigns it to the ExhaustiveNbHits field. +// Deprecated func (o *BaseSearchResponse) SetExhaustiveNbHits(v bool) { o.ExhaustiveNbHits = &v } // GetExhaustiveTypo returns the ExhaustiveTypo field value if set, zero value otherwise. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveTypo() bool { if o == nil || o.ExhaustiveTypo == nil { var ret bool @@ -404,6 +472,7 @@ func (o *BaseSearchResponse) GetExhaustiveTypo() bool { // GetExhaustiveTypoOk returns a tuple with the ExhaustiveTypo field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveTypoOk() (*bool, bool) { if o == nil || o.ExhaustiveTypo == nil { return nil, false @@ -421,6 +490,7 @@ func (o *BaseSearchResponse) HasExhaustiveTypo() bool { } // SetExhaustiveTypo gets a reference to the given bool and assigns it to the ExhaustiveTypo field. +// Deprecated func (o *BaseSearchResponse) SetExhaustiveTypo(v bool) { o.ExhaustiveTypo = &v } @@ -713,38 +783,6 @@ func (o *BaseSearchResponse) SetPage(v int32) { o.Page = v } -// GetRedirect returns the Redirect field value if set, zero value otherwise. -func (o *BaseSearchResponse) GetRedirect() BaseSearchResponseRedirect { - if o == nil || o.Redirect == nil { - var ret BaseSearchResponseRedirect - return ret - } - return *o.Redirect -} - -// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetRedirectOk() (*BaseSearchResponseRedirect, bool) { - if o == nil || o.Redirect == nil { - return nil, false - } - return o.Redirect, true -} - -// HasRedirect returns a boolean if a field has been set. -func (o *BaseSearchResponse) HasRedirect() bool { - if o != nil && o.Redirect != nil { - return true - } - - return false -} - -// SetRedirect gets a reference to the given BaseSearchResponseRedirect and assigns it to the Redirect field. -func (o *BaseSearchResponse) SetRedirect(v BaseSearchResponseRedirect) { - o.Redirect = &v -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *BaseSearchResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -801,6 +839,38 @@ func (o *BaseSearchResponse) SetProcessingTimeMS(v int32) { o.ProcessingTimeMS = v } +// GetProcessingTimingsMS returns the ProcessingTimingsMS field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetProcessingTimingsMS() map[string]interface{} { + if o == nil || o.ProcessingTimingsMS == nil { + var ret map[string]interface{} + return ret + } + return o.ProcessingTimingsMS +} + +// GetProcessingTimingsMSOk returns a tuple with the ProcessingTimingsMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetProcessingTimingsMSOk() (map[string]interface{}, bool) { + if o == nil || o.ProcessingTimingsMS == nil { + return nil, false + } + return o.ProcessingTimingsMS, true +} + +// HasProcessingTimingsMS returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasProcessingTimingsMS() bool { + if o != nil && o.ProcessingTimingsMS != nil { + return true + } + + return false +} + +// SetProcessingTimingsMS gets a reference to the given map[string]interface{} and assigns it to the ProcessingTimingsMS field. +func (o *BaseSearchResponse) SetProcessingTimingsMS(v map[string]interface{}) { + o.ProcessingTimingsMS = v +} + // GetQueryAfterRemoval returns the QueryAfterRemoval field value if set, zero value otherwise. func (o *BaseSearchResponse) GetQueryAfterRemoval() string { if o == nil || o.QueryAfterRemoval == nil { @@ -833,6 +903,102 @@ func (o *BaseSearchResponse) SetQueryAfterRemoval(v string) { o.QueryAfterRemoval = &v } +// GetRedirect returns the Redirect field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetRedirect() Redirect { + if o == nil || o.Redirect == nil { + var ret Redirect + return ret + } + return *o.Redirect +} + +// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetRedirectOk() (*Redirect, bool) { + if o == nil || o.Redirect == nil { + return nil, false + } + return o.Redirect, true +} + +// HasRedirect returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasRedirect() bool { + if o != nil && o.Redirect != nil { + return true + } + + return false +} + +// SetRedirect gets a reference to the given Redirect and assigns it to the Redirect field. +func (o *BaseSearchResponse) SetRedirect(v Redirect) { + o.Redirect = &v +} + +// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetRenderingContent() RenderingContent { + if o == nil || o.RenderingContent == nil { + var ret RenderingContent + return ret + } + return *o.RenderingContent +} + +// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetRenderingContentOk() (*RenderingContent, bool) { + if o == nil || o.RenderingContent == nil { + return nil, false + } + return o.RenderingContent, true +} + +// HasRenderingContent returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasRenderingContent() bool { + if o != nil && o.RenderingContent != nil { + return true + } + + return false +} + +// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. +func (o *BaseSearchResponse) SetRenderingContent(v RenderingContent) { + o.RenderingContent = &v +} + +// GetServerTimeMS returns the ServerTimeMS field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetServerTimeMS() int32 { + if o == nil || o.ServerTimeMS == nil { + var ret int32 + return ret + } + return *o.ServerTimeMS +} + +// GetServerTimeMSOk returns a tuple with the ServerTimeMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetServerTimeMSOk() (*int32, bool) { + if o == nil || o.ServerTimeMS == nil { + return nil, false + } + return o.ServerTimeMS, true +} + +// HasServerTimeMS returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasServerTimeMS() bool { + if o != nil && o.ServerTimeMS != nil { + return true + } + + return false +} + +// SetServerTimeMS gets a reference to the given int32 and assigns it to the ServerTimeMS field. +func (o *BaseSearchResponse) SetServerTimeMS(v int32) { + o.ServerTimeMS = &v +} + // GetServerUsed returns the ServerUsed field value if set, zero value otherwise. func (o *BaseSearchResponse) GetServerUsed() string { if o == nil || o.ServerUsed == nil { @@ -898,38 +1064,6 @@ func (o *BaseSearchResponse) SetUserData(v interface{}) { o.UserData = v } -// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. -func (o *BaseSearchResponse) GetRenderingContent() RenderingContent { - if o == nil || o.RenderingContent == nil { - var ret RenderingContent - return ret - } - return *o.RenderingContent -} - -// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetRenderingContentOk() (*RenderingContent, bool) { - if o == nil || o.RenderingContent == nil { - return nil, false - } - return o.RenderingContent, true -} - -// HasRenderingContent returns a boolean if a field has been set. -func (o *BaseSearchResponse) HasRenderingContent() bool { - if o != nil && o.RenderingContent != nil { - return true - } - - return false -} - -// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. -func (o *BaseSearchResponse) SetRenderingContent(v RenderingContent) { - o.RenderingContent = &v -} - func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} if o.AbTestID != nil { @@ -944,6 +1078,9 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if o.AutomaticRadius != nil { toSerialize["automaticRadius"] = o.AutomaticRadius } + if o.Exhaustive != nil { + toSerialize["exhaustive"] = o.Exhaustive + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -983,36 +1120,91 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if true { toSerialize["page"] = o.Page } - if o.Redirect != nil { - toSerialize["redirect"] = o.Redirect - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } if true { toSerialize["processingTimeMS"] = o.ProcessingTimeMS } + if o.ProcessingTimingsMS != nil { + toSerialize["processingTimingsMS"] = o.ProcessingTimingsMS + } if o.QueryAfterRemoval != nil { toSerialize["queryAfterRemoval"] = o.QueryAfterRemoval } + if o.Redirect != nil { + toSerialize["redirect"] = o.Redirect + } + if o.RenderingContent != nil { + toSerialize["renderingContent"] = o.RenderingContent + } + if o.ServerTimeMS != nil { + toSerialize["serverTimeMS"] = o.ServerTimeMS + } if o.ServerUsed != nil { toSerialize["serverUsed"] = o.ServerUsed } if o.UserData != nil { toSerialize["userData"] = o.UserData } - if o.RenderingContent != nil { - toSerialize["renderingContent"] = o.RenderingContent + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value } + return json.Marshal(toSerialize) } +func (o *BaseSearchResponse) UnmarshalJSON(bytes []byte) (err error) { + varBaseSearchResponse := _BaseSearchResponse{} + + if err = json.Unmarshal(bytes, &varBaseSearchResponse); err == nil { + *o = BaseSearchResponse(varBaseSearchResponse) + } + + additionalProperties := make(map[string]any) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "abTestID") + delete(additionalProperties, "abTestVariantID") + delete(additionalProperties, "aroundLatLng") + delete(additionalProperties, "automaticRadius") + delete(additionalProperties, "exhaustive") + delete(additionalProperties, "exhaustiveFacetsCount") + delete(additionalProperties, "exhaustiveNbHits") + 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") + delete(additionalProperties, "queryAfterRemoval") + delete(additionalProperties, "redirect") + delete(additionalProperties, "renderingContent") + delete(additionalProperties, "serverTimeMS") + delete(additionalProperties, "serverUsed") + delete(additionalProperties, "userData") + o.AdditionalProperties = additionalProperties + } + + return err +} + func (o BaseSearchResponse) String() string { out := "" out += fmt.Sprintf(" abTestID=%v\n", o.AbTestID) out += fmt.Sprintf(" abTestVariantID=%v\n", o.AbTestVariantID) out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) + out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) @@ -1026,13 +1218,18 @@ func (o BaseSearchResponse) String() string { 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(" redirect=%v\n", o.Redirect) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) + out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) out += fmt.Sprintf(" queryAfterRemoval=%v\n", o.QueryAfterRemoval) + out += fmt.Sprintf(" redirect=%v\n", o.Redirect) + out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + out += fmt.Sprintf(" serverTimeMS=%v\n", o.ServerTimeMS) out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) - out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + for key, value := range o.AdditionalProperties { + out += fmt.Sprintf(" %s=%v\n", key, value) + } return fmt.Sprintf("BaseSearchResponse {\n%s}", out) } diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response_redirect.go b/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response_redirect.go deleted file mode 100644 index b244200a4a..0000000000 --- a/clients/algoliasearch-client-go/algolia/recommend/model_base_search_response_redirect.go +++ /dev/null @@ -1,122 +0,0 @@ -// 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" -) - -// BaseSearchResponseRedirect [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). -type BaseSearchResponseRedirect struct { - Index []RedirectRuleIndexMetadata `json:"index,omitempty"` -} - -type BaseSearchResponseRedirectOption func(f *BaseSearchResponseRedirect) - -func WithBaseSearchResponseRedirectIndex(val []RedirectRuleIndexMetadata) BaseSearchResponseRedirectOption { - return func(f *BaseSearchResponseRedirect) { - f.Index = val - } -} - -// NewBaseSearchResponseRedirect instantiates a new BaseSearchResponseRedirect 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 NewBaseSearchResponseRedirect(opts ...BaseSearchResponseRedirectOption) *BaseSearchResponseRedirect { - this := &BaseSearchResponseRedirect{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewBaseSearchResponseRedirectWithDefaults instantiates a new BaseSearchResponseRedirect object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewBaseSearchResponseRedirectWithDefaults() *BaseSearchResponseRedirect { - this := &BaseSearchResponseRedirect{} - return this -} - -// GetIndex returns the Index field value if set, zero value otherwise. -func (o *BaseSearchResponseRedirect) GetIndex() []RedirectRuleIndexMetadata { - if o == nil || o.Index == nil { - var ret []RedirectRuleIndexMetadata - return ret - } - return o.Index -} - -// GetIndexOk returns a tuple with the Index field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BaseSearchResponseRedirect) GetIndexOk() ([]RedirectRuleIndexMetadata, bool) { - if o == nil || o.Index == nil { - return nil, false - } - return o.Index, true -} - -// HasIndex returns a boolean if a field has been set. -func (o *BaseSearchResponseRedirect) HasIndex() bool { - if o != nil && o.Index != nil { - return true - } - - return false -} - -// SetIndex gets a reference to the given []RedirectRuleIndexMetadata and assigns it to the Index field. -func (o *BaseSearchResponseRedirect) SetIndex(v []RedirectRuleIndexMetadata) { - o.Index = v -} - -func (o BaseSearchResponseRedirect) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Index != nil { - toSerialize["index"] = o.Index - } - return json.Marshal(toSerialize) -} - -func (o BaseSearchResponseRedirect) String() string { - out := "" - out += fmt.Sprintf(" index=%v\n", o.Index) - return fmt.Sprintf("BaseSearchResponseRedirect {\n%s}", out) -} - -type NullableBaseSearchResponseRedirect struct { - value *BaseSearchResponseRedirect - isSet bool -} - -func (v NullableBaseSearchResponseRedirect) Get() *BaseSearchResponseRedirect { - return v.value -} - -func (v *NullableBaseSearchResponseRedirect) Set(val *BaseSearchResponseRedirect) { - v.value = val - v.isSet = true -} - -func (v NullableBaseSearchResponseRedirect) IsSet() bool { - return v.isSet -} - -func (v *NullableBaseSearchResponseRedirect) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBaseSearchResponseRedirect(val *BaseSearchResponseRedirect) *NullableBaseSearchResponseRedirect { - return &NullableBaseSearchResponseRedirect{value: val, isSet: true} -} - -func (v NullableBaseSearchResponseRedirect) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBaseSearchResponseRedirect) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_base_trending_facets_query.go b/clients/algoliasearch-client-go/algolia/recommend/model_base_trending_facets_query.go index c93a093fd1..45d2383e2d 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_base_trending_facets_query.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_base_trending_facets_query.go @@ -9,7 +9,7 @@ import ( // BaseTrendingFacetsQuery struct for BaseTrendingFacetsQuery type BaseTrendingFacetsQuery struct { // Facet name for trending models. - FacetName string `json:"facetName" validate:"required"` + FacetName string `json:"facetName"` Model *TrendingFacetsModel `json:"model,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_consequence_hide.go b/clients/algoliasearch-client-go/algolia/recommend/model_consequence_hide.go index b4f059ab46..431f3a33d6 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_consequence_hide.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_consequence_hide.go @@ -9,7 +9,7 @@ import ( // ConsequenceHide Unique identifier of the record to hide. type ConsequenceHide struct { // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` } // NewConsequenceHide instantiates a new ConsequenceHide object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_deleted_at_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_deleted_at_response.go index 141073e355..ea91257229 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_deleted_at_response.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_deleted_at_response.go @@ -9,9 +9,9 @@ import ( // DeletedAtResponse Response, taskID, and deletion timestamp. type DeletedAtResponse struct { // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` // Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - DeletedAt string `json:"deletedAt" validate:"required"` + DeletedAt string `json:"deletedAt"` } // NewDeletedAtResponse instantiates a new DeletedAtResponse object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_exhaustive.go b/clients/algoliasearch-client-go/algolia/recommend/model_exhaustive.go new file mode 100644 index 0000000000..647e58d3b2 --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/recommend/model_exhaustive.go @@ -0,0 +1,299 @@ +// 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" +) + +// Exhaustive Whether certain properties of the search response are calculated exhaustive (exact) or approximated. +type Exhaustive struct { + // Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + FacetsCount *bool `json:"facetsCount,omitempty"` + // The value is `false` if not all facet values are retrieved. + FacetValues *bool `json:"facetValues,omitempty"` + // Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + NbHits *bool `json:"nbHits,omitempty"` + // Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + RulesMatch *bool `json:"rulesMatch,omitempty"` + // Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + Typo *bool `json:"typo,omitempty"` +} + +type ExhaustiveOption func(f *Exhaustive) + +func WithExhaustiveFacetsCount(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.FacetsCount = &val + } +} + +func WithExhaustiveFacetValues(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.FacetValues = &val + } +} + +func WithExhaustiveNbHits(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.NbHits = &val + } +} + +func WithExhaustiveRulesMatch(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.RulesMatch = &val + } +} + +func WithExhaustiveTypo(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.Typo = &val + } +} + +// NewExhaustive instantiates a new Exhaustive 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 NewExhaustive(opts ...ExhaustiveOption) *Exhaustive { + this := &Exhaustive{} + for _, opt := range opts { + opt(this) + } + return this +} + +// NewExhaustiveWithDefaults instantiates a new Exhaustive object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExhaustiveWithDefaults() *Exhaustive { + this := &Exhaustive{} + return this +} + +// GetFacetsCount returns the FacetsCount field value if set, zero value otherwise. +func (o *Exhaustive) GetFacetsCount() bool { + if o == nil || o.FacetsCount == nil { + var ret bool + return ret + } + return *o.FacetsCount +} + +// GetFacetsCountOk returns a tuple with the FacetsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetFacetsCountOk() (*bool, bool) { + if o == nil || o.FacetsCount == nil { + return nil, false + } + return o.FacetsCount, true +} + +// HasFacetsCount returns a boolean if a field has been set. +func (o *Exhaustive) HasFacetsCount() bool { + if o != nil && o.FacetsCount != nil { + return true + } + + return false +} + +// SetFacetsCount gets a reference to the given bool and assigns it to the FacetsCount field. +func (o *Exhaustive) SetFacetsCount(v bool) { + o.FacetsCount = &v +} + +// GetFacetValues returns the FacetValues field value if set, zero value otherwise. +func (o *Exhaustive) GetFacetValues() bool { + if o == nil || o.FacetValues == nil { + var ret bool + return ret + } + return *o.FacetValues +} + +// GetFacetValuesOk returns a tuple with the FacetValues field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetFacetValuesOk() (*bool, bool) { + if o == nil || o.FacetValues == nil { + return nil, false + } + return o.FacetValues, true +} + +// HasFacetValues returns a boolean if a field has been set. +func (o *Exhaustive) HasFacetValues() bool { + if o != nil && o.FacetValues != nil { + return true + } + + return false +} + +// SetFacetValues gets a reference to the given bool and assigns it to the FacetValues field. +func (o *Exhaustive) SetFacetValues(v bool) { + o.FacetValues = &v +} + +// GetNbHits returns the NbHits field value if set, zero value otherwise. +func (o *Exhaustive) GetNbHits() bool { + if o == nil || o.NbHits == nil { + var ret bool + 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 *Exhaustive) GetNbHitsOk() (*bool, 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 *Exhaustive) HasNbHits() bool { + if o != nil && o.NbHits != nil { + return true + } + + return false +} + +// SetNbHits gets a reference to the given bool and assigns it to the NbHits field. +func (o *Exhaustive) SetNbHits(v bool) { + o.NbHits = &v +} + +// GetRulesMatch returns the RulesMatch field value if set, zero value otherwise. +func (o *Exhaustive) GetRulesMatch() bool { + if o == nil || o.RulesMatch == nil { + var ret bool + return ret + } + return *o.RulesMatch +} + +// GetRulesMatchOk returns a tuple with the RulesMatch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetRulesMatchOk() (*bool, bool) { + if o == nil || o.RulesMatch == nil { + return nil, false + } + return o.RulesMatch, true +} + +// HasRulesMatch returns a boolean if a field has been set. +func (o *Exhaustive) HasRulesMatch() bool { + if o != nil && o.RulesMatch != nil { + return true + } + + return false +} + +// SetRulesMatch gets a reference to the given bool and assigns it to the RulesMatch field. +func (o *Exhaustive) SetRulesMatch(v bool) { + o.RulesMatch = &v +} + +// GetTypo returns the Typo field value if set, zero value otherwise. +func (o *Exhaustive) GetTypo() bool { + if o == nil || o.Typo == nil { + var ret bool + return ret + } + return *o.Typo +} + +// GetTypoOk returns a tuple with the Typo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetTypoOk() (*bool, bool) { + if o == nil || o.Typo == nil { + return nil, false + } + return o.Typo, true +} + +// HasTypo returns a boolean if a field has been set. +func (o *Exhaustive) HasTypo() bool { + if o != nil && o.Typo != nil { + return true + } + + return false +} + +// SetTypo gets a reference to the given bool and assigns it to the Typo field. +func (o *Exhaustive) SetTypo(v bool) { + o.Typo = &v +} + +func (o Exhaustive) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if o.FacetsCount != nil { + toSerialize["facetsCount"] = o.FacetsCount + } + if o.FacetValues != nil { + toSerialize["facetValues"] = o.FacetValues + } + if o.NbHits != nil { + toSerialize["nbHits"] = o.NbHits + } + if o.RulesMatch != nil { + toSerialize["rulesMatch"] = o.RulesMatch + } + if o.Typo != nil { + toSerialize["typo"] = o.Typo + } + return json.Marshal(toSerialize) +} + +func (o Exhaustive) String() string { + out := "" + out += fmt.Sprintf(" facetsCount=%v\n", o.FacetsCount) + out += fmt.Sprintf(" facetValues=%v\n", o.FacetValues) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" rulesMatch=%v\n", o.RulesMatch) + out += fmt.Sprintf(" typo=%v\n", o.Typo) + return fmt.Sprintf("Exhaustive {\n%s}", out) +} + +type NullableExhaustive struct { + value *Exhaustive + isSet bool +} + +func (v NullableExhaustive) Get() *Exhaustive { + return v.value +} + +func (v *NullableExhaustive) Set(val *Exhaustive) { + v.value = val + v.isSet = true +} + +func (v NullableExhaustive) IsSet() bool { + return v.isSet +} + +func (v *NullableExhaustive) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExhaustive(val *Exhaustive) *NullableExhaustive { + return &NullableExhaustive{value: val, isSet: true} +} + +func (v NullableExhaustive) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExhaustive) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_get_recommend_task_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_get_recommend_task_response.go index 699bd016ea..00247abdb7 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_get_recommend_task_response.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_get_recommend_task_response.go @@ -8,7 +8,7 @@ import ( // GetRecommendTaskResponse struct for GetRecommendTaskResponse type GetRecommendTaskResponse struct { - Status TaskStatus `json:"status" validate:"required"` + Status TaskStatus `json:"status"` } // NewGetRecommendTaskResponse instantiates a new GetRecommendTaskResponse object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_params.go b/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_params.go index 327cd796aa..ca35703159 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_params.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_params.go @@ -9,7 +9,7 @@ import ( // GetRecommendationsParams Recommend parameters. type GetRecommendationsParams struct { // Request parameters depend on the model (recommendations or trending). - Requests []RecommendationsRequest `json:"requests" validate:"required"` + Requests []RecommendationsRequest `json:"requests"` } // NewGetRecommendationsParams instantiates a new GetRecommendationsParams object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_highlight_result_option.go b/clients/algoliasearch-client-go/algolia/recommend/model_highlight_result_option.go index 00091b993a..c4c2d265bc 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_highlight_result_option.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_highlight_result_option.go @@ -9,10 +9,10 @@ import ( // HighlightResultOption Show highlighted section and words matched on a query. type HighlightResultOption struct { // Markup text with `facetQuery` matches highlighted. - Value string `json:"value" validate:"required"` - MatchLevel MatchLevel `json:"matchLevel" validate:"required"` + Value string `json:"value"` + MatchLevel MatchLevel `json:"matchLevel"` // List of words from the query that matched the object. - MatchedWords []string `json:"matchedWords" validate:"required"` + MatchedWords []string `json:"matchedWords"` // Whether the entire attribute value is highlighted. FullyHighlighted *bool `json:"fullyHighlighted,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_id.go b/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_id.go index 49f072e78d..7a7c1dcd6f 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_id.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_id.go @@ -9,9 +9,9 @@ import ( // PromoteObjectID Record to promote. type PromoteObjectID struct { // Unique identifier of the record to promote. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. - Position int32 `json:"position" validate:"required"` + Position int32 `json:"position"` } // NewPromoteObjectID instantiates a new PromoteObjectID object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_ids.go b/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_ids.go index 7b197dd2f7..d63d63fcb8 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_promote_object_ids.go @@ -9,9 +9,9 @@ import ( // PromoteObjectIDs Records to promote. type PromoteObjectIDs struct { // Unique identifiers of the records to promote. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. - Position int32 `json:"position" validate:"required"` + Position int32 `json:"position"` } // NewPromoteObjectIDs instantiates a new PromoteObjectIDs object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_ranking_info.go b/clients/algoliasearch-client-go/algolia/recommend/model_ranking_info.go index 8205593b11..9d66acdb53 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_ranking_info.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_ranking_info.go @@ -9,27 +9,27 @@ import ( // RankingInfo struct for RankingInfo type RankingInfo struct { // This field is reserved for advanced usage. - Filters int32 `json:"filters" validate:"required"` + Filters int32 `json:"filters"` // Position of the most important matched attribute in the attributes to index list. - FirstMatchedWord int32 `json:"firstMatchedWord" validate:"required"` + FirstMatchedWord int32 `json:"firstMatchedWord"` // Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). - GeoDistance int32 `json:"geoDistance" validate:"required"` + GeoDistance int32 `json:"geoDistance"` // Precision used when computing the geo distance, in meters. GeoPrecision *int32 `json:"geoPrecision,omitempty"` MatchedGeoLocation *MatchedGeoLocation `json:"matchedGeoLocation,omitempty"` Personalization *Personalization `json:"personalization,omitempty"` // Number of exactly matched words. - NbExactWords int32 `json:"nbExactWords" validate:"required"` + NbExactWords int32 `json:"nbExactWords"` // Number of typos encountered when matching the record. - NbTypos int32 `json:"nbTypos" validate:"required"` + NbTypos int32 `json:"nbTypos"` // Present and set to true if a Rule promoted the hit. - Promoted bool `json:"promoted" validate:"required"` + Promoted bool `json:"promoted"` // When the query contains more than one word, the sum of the distances between matched words (in meters). ProximityDistance *int32 `json:"proximityDistance,omitempty"` // Custom ranking for the object, expressed as a single integer value. - UserScore int32 `json:"userScore" validate:"required"` + UserScore int32 `json:"userScore"` // Number of matched words, including prefixes and typos. - Words int32 `json:"words" validate:"required"` + Words int32 `json:"words"` // Wether the record are promoted by the re-ranking strategy. PromotedByReRanking *bool `json:"promotedByReRanking,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hit.go b/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hit.go index 39a8321015..cde2186d74 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hit.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hit.go @@ -9,7 +9,7 @@ import ( // RecommendHit Recommend hit. type RecommendHit struct { // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // Show highlighted section and words matched on a query. HighlightResult *map[string]HighlightResult `json:"_highlightResult,omitempty"` // Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. @@ -17,7 +17,7 @@ type RecommendHit struct { RankingInfo *RankingInfo `json:"_rankingInfo,omitempty"` DistinctSeqID *int32 `json:"_distinctSeqID,omitempty"` // Recommendation score. - Score float64 `json:"_score" validate:"required"` + Score float64 `json:"_score"` AdditionalProperties map[string]any } diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hits.go b/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hits.go index b71bbcae2c..23a7c24e88 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hits.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_recommend_hits.go @@ -8,7 +8,7 @@ import ( // RecommendHits struct for RecommendHits type RecommendHits struct { - Hits []RecommendHit `json:"hits" validate:"required"` + Hits []RecommendHit `json:"hits"` // Text to search for in an index. Query *string `json:"query,omitempty"` // URL-encoded string of all search parameters. diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_query.go b/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_query.go index 71447a922c..159242eb54 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_query.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_query.go @@ -8,13 +8,13 @@ import ( // RecommendationsQuery struct for RecommendationsQuery type RecommendationsQuery struct { - Model RecommendationModels `json:"model" validate:"required"` + Model RecommendationModels `json:"model"` // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` QueryParameters *SearchParamsObject `json:"queryParameters,omitempty"` FallbackParameters *SearchParamsObject `json:"fallbackParameters,omitempty"` // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. Threshold *int32 `json:"threshold,omitempty"` // Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_response.go index 9e6639c267..b34135ffdd 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_response.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_recommendations_response.go @@ -15,19 +15,23 @@ type RecommendationsResponse struct { // Computed geographical location. AroundLatLng *string `json:"aroundLatLng,omitempty"` // Automatically-computed radius. - AutomaticRadius *string `json:"automaticRadius,omitempty"` - // Indicates whether the facet count is exhaustive (exact) or approximate. + AutomaticRadius *string `json:"automaticRadius,omitempty"` + Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // See the `facetsCount` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` - // Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + // See the `nbHits` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveNbHits *bool `json:"exhaustiveNbHits,omitempty"` - // Indicates whether the search for typos was exhaustive (exact) or approximate. + // See the `typo` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveTypo *bool `json:"exhaustiveTypo,omitempty"` // Mapping of each facet name to the corresponding facet counts. 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" validate:"required"` + 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. @@ -35,26 +39,30 @@ type RecommendationsResponse struct { // Warnings about the query. Message *string `json:"message,omitempty"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Number of pages of results for the current query. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` // Page to retrieve (the first page is `0`, not `1`). - Page int32 `json:"page" validate:"required"` - Redirect *BaseSearchResponseRedirect `json:"redirect,omitempty"` + 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. - ProcessingTimeMS int32 `json:"processingTimeMS" validate:"required"` + ProcessingTimeMS int32 `json:"processingTimeMS"` + // Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + ProcessingTimingsMS map[string]interface{} `json:"processingTimingsMS,omitempty"` // Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. - QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + Redirect *Redirect `json:"redirect,omitempty"` + RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + // Time the server took to process the request, in milliseconds. + ServerTimeMS *int32 `json:"serverTimeMS,omitempty"` // Host name of the server that processed the request. ServerUsed *string `json:"serverUsed,omitempty"` // Lets you store custom data in your indices. - UserData interface{} `json:"userData,omitempty"` - RenderingContent *RenderingContent `json:"renderingContent,omitempty"` - Hits []RecommendHit `json:"hits" validate:"required"` + UserData interface{} `json:"userData,omitempty"` + Hits []RecommendHit `json:"hits"` // Text to search for in an index. Query *string `json:"query,omitempty"` // URL-encoded string of all search parameters. @@ -87,6 +95,12 @@ func WithRecommendationsResponseAutomaticRadius(val string) RecommendationsRespo } } +func WithRecommendationsResponseExhaustive(val Exhaustive) RecommendationsResponseOption { + return func(f *RecommendationsResponse) { + f.Exhaustive = &val + } +} + func WithRecommendationsResponseExhaustiveFacetsCount(val bool) RecommendationsResponseOption { return func(f *RecommendationsResponse) { f.ExhaustiveFacetsCount = &val @@ -141,15 +155,15 @@ func WithRecommendationsResponseNbSortedHits(val int32) RecommendationsResponseO } } -func WithRecommendationsResponseRedirect(val BaseSearchResponseRedirect) RecommendationsResponseOption { +func WithRecommendationsResponseParsedQuery(val string) RecommendationsResponseOption { return func(f *RecommendationsResponse) { - f.Redirect = &val + f.ParsedQuery = &val } } -func WithRecommendationsResponseParsedQuery(val string) RecommendationsResponseOption { +func WithRecommendationsResponseProcessingTimingsMS(val map[string]interface{}) RecommendationsResponseOption { return func(f *RecommendationsResponse) { - f.ParsedQuery = &val + f.ProcessingTimingsMS = val } } @@ -159,21 +173,33 @@ func WithRecommendationsResponseQueryAfterRemoval(val string) RecommendationsRes } } -func WithRecommendationsResponseServerUsed(val string) RecommendationsResponseOption { +func WithRecommendationsResponseRedirect(val Redirect) RecommendationsResponseOption { return func(f *RecommendationsResponse) { - f.ServerUsed = &val + f.Redirect = &val } } -func WithRecommendationsResponseUserData(val interface{}) RecommendationsResponseOption { +func WithRecommendationsResponseRenderingContent(val RenderingContent) RecommendationsResponseOption { return func(f *RecommendationsResponse) { - f.UserData = val + f.RenderingContent = &val } } -func WithRecommendationsResponseRenderingContent(val RenderingContent) RecommendationsResponseOption { +func WithRecommendationsResponseServerTimeMS(val int32) RecommendationsResponseOption { return func(f *RecommendationsResponse) { - f.RenderingContent = &val + f.ServerTimeMS = &val + } +} + +func WithRecommendationsResponseServerUsed(val string) RecommendationsResponseOption { + return func(f *RecommendationsResponse) { + f.ServerUsed = &val + } +} + +func WithRecommendationsResponseUserData(val interface{}) RecommendationsResponseOption { + return func(f *RecommendationsResponse) { + f.UserData = val } } @@ -349,7 +375,40 @@ func (o *RecommendationsResponse) SetAutomaticRadius(v string) { o.AutomaticRadius = &v } +// GetExhaustive returns the Exhaustive field value if set, zero value otherwise. +func (o *RecommendationsResponse) GetExhaustive() Exhaustive { + if o == nil || o.Exhaustive == nil { + var ret Exhaustive + return ret + } + return *o.Exhaustive +} + +// GetExhaustiveOk returns a tuple with the Exhaustive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecommendationsResponse) GetExhaustiveOk() (*Exhaustive, bool) { + if o == nil || o.Exhaustive == nil { + return nil, false + } + return o.Exhaustive, true +} + +// HasExhaustive returns a boolean if a field has been set. +func (o *RecommendationsResponse) HasExhaustive() bool { + if o != nil && o.Exhaustive != nil { + return true + } + + return false +} + +// SetExhaustive gets a reference to the given Exhaustive and assigns it to the Exhaustive field. +func (o *RecommendationsResponse) SetExhaustive(v Exhaustive) { + o.Exhaustive = &v +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. +// Deprecated func (o *RecommendationsResponse) GetExhaustiveFacetsCount() bool { if o == nil || o.ExhaustiveFacetsCount == nil { var ret bool @@ -360,6 +419,7 @@ func (o *RecommendationsResponse) GetExhaustiveFacetsCount() bool { // GetExhaustiveFacetsCountOk returns a tuple with the ExhaustiveFacetsCount field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *RecommendationsResponse) GetExhaustiveFacetsCountOk() (*bool, bool) { if o == nil || o.ExhaustiveFacetsCount == nil { return nil, false @@ -377,11 +437,13 @@ func (o *RecommendationsResponse) HasExhaustiveFacetsCount() bool { } // SetExhaustiveFacetsCount gets a reference to the given bool and assigns it to the ExhaustiveFacetsCount field. +// Deprecated func (o *RecommendationsResponse) SetExhaustiveFacetsCount(v bool) { o.ExhaustiveFacetsCount = &v } // GetExhaustiveNbHits returns the ExhaustiveNbHits field value if set, zero value otherwise. +// Deprecated func (o *RecommendationsResponse) GetExhaustiveNbHits() bool { if o == nil || o.ExhaustiveNbHits == nil { var ret bool @@ -392,6 +454,7 @@ func (o *RecommendationsResponse) GetExhaustiveNbHits() bool { // GetExhaustiveNbHitsOk returns a tuple with the ExhaustiveNbHits field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *RecommendationsResponse) GetExhaustiveNbHitsOk() (*bool, bool) { if o == nil || o.ExhaustiveNbHits == nil { return nil, false @@ -409,11 +472,13 @@ func (o *RecommendationsResponse) HasExhaustiveNbHits() bool { } // SetExhaustiveNbHits gets a reference to the given bool and assigns it to the ExhaustiveNbHits field. +// Deprecated func (o *RecommendationsResponse) SetExhaustiveNbHits(v bool) { o.ExhaustiveNbHits = &v } // GetExhaustiveTypo returns the ExhaustiveTypo field value if set, zero value otherwise. +// Deprecated func (o *RecommendationsResponse) GetExhaustiveTypo() bool { if o == nil || o.ExhaustiveTypo == nil { var ret bool @@ -424,6 +489,7 @@ func (o *RecommendationsResponse) GetExhaustiveTypo() bool { // GetExhaustiveTypoOk returns a tuple with the ExhaustiveTypo field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *RecommendationsResponse) GetExhaustiveTypoOk() (*bool, bool) { if o == nil || o.ExhaustiveTypo == nil { return nil, false @@ -441,6 +507,7 @@ func (o *RecommendationsResponse) HasExhaustiveTypo() bool { } // SetExhaustiveTypo gets a reference to the given bool and assigns it to the ExhaustiveTypo field. +// Deprecated func (o *RecommendationsResponse) SetExhaustiveTypo(v bool) { o.ExhaustiveTypo = &v } @@ -733,38 +800,6 @@ func (o *RecommendationsResponse) SetPage(v int32) { o.Page = v } -// GetRedirect returns the Redirect field value if set, zero value otherwise. -func (o *RecommendationsResponse) GetRedirect() BaseSearchResponseRedirect { - if o == nil || o.Redirect == nil { - var ret BaseSearchResponseRedirect - return ret - } - return *o.Redirect -} - -// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RecommendationsResponse) GetRedirectOk() (*BaseSearchResponseRedirect, bool) { - if o == nil || o.Redirect == nil { - return nil, false - } - return o.Redirect, true -} - -// HasRedirect returns a boolean if a field has been set. -func (o *RecommendationsResponse) HasRedirect() bool { - if o != nil && o.Redirect != nil { - return true - } - - return false -} - -// SetRedirect gets a reference to the given BaseSearchResponseRedirect and assigns it to the Redirect field. -func (o *RecommendationsResponse) SetRedirect(v BaseSearchResponseRedirect) { - o.Redirect = &v -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *RecommendationsResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -821,6 +856,38 @@ func (o *RecommendationsResponse) SetProcessingTimeMS(v int32) { o.ProcessingTimeMS = v } +// GetProcessingTimingsMS returns the ProcessingTimingsMS field value if set, zero value otherwise. +func (o *RecommendationsResponse) GetProcessingTimingsMS() map[string]interface{} { + if o == nil || o.ProcessingTimingsMS == nil { + var ret map[string]interface{} + return ret + } + return o.ProcessingTimingsMS +} + +// GetProcessingTimingsMSOk returns a tuple with the ProcessingTimingsMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecommendationsResponse) GetProcessingTimingsMSOk() (map[string]interface{}, bool) { + if o == nil || o.ProcessingTimingsMS == nil { + return nil, false + } + return o.ProcessingTimingsMS, true +} + +// HasProcessingTimingsMS returns a boolean if a field has been set. +func (o *RecommendationsResponse) HasProcessingTimingsMS() bool { + if o != nil && o.ProcessingTimingsMS != nil { + return true + } + + return false +} + +// SetProcessingTimingsMS gets a reference to the given map[string]interface{} and assigns it to the ProcessingTimingsMS field. +func (o *RecommendationsResponse) SetProcessingTimingsMS(v map[string]interface{}) { + o.ProcessingTimingsMS = v +} + // GetQueryAfterRemoval returns the QueryAfterRemoval field value if set, zero value otherwise. func (o *RecommendationsResponse) GetQueryAfterRemoval() string { if o == nil || o.QueryAfterRemoval == nil { @@ -853,6 +920,102 @@ func (o *RecommendationsResponse) SetQueryAfterRemoval(v string) { o.QueryAfterRemoval = &v } +// GetRedirect returns the Redirect field value if set, zero value otherwise. +func (o *RecommendationsResponse) GetRedirect() Redirect { + if o == nil || o.Redirect == nil { + var ret Redirect + return ret + } + return *o.Redirect +} + +// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecommendationsResponse) GetRedirectOk() (*Redirect, bool) { + if o == nil || o.Redirect == nil { + return nil, false + } + return o.Redirect, true +} + +// HasRedirect returns a boolean if a field has been set. +func (o *RecommendationsResponse) HasRedirect() bool { + if o != nil && o.Redirect != nil { + return true + } + + return false +} + +// SetRedirect gets a reference to the given Redirect and assigns it to the Redirect field. +func (o *RecommendationsResponse) SetRedirect(v Redirect) { + o.Redirect = &v +} + +// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. +func (o *RecommendationsResponse) GetRenderingContent() RenderingContent { + if o == nil || o.RenderingContent == nil { + var ret RenderingContent + return ret + } + return *o.RenderingContent +} + +// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecommendationsResponse) GetRenderingContentOk() (*RenderingContent, bool) { + if o == nil || o.RenderingContent == nil { + return nil, false + } + return o.RenderingContent, true +} + +// HasRenderingContent returns a boolean if a field has been set. +func (o *RecommendationsResponse) HasRenderingContent() bool { + if o != nil && o.RenderingContent != nil { + return true + } + + return false +} + +// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. +func (o *RecommendationsResponse) SetRenderingContent(v RenderingContent) { + o.RenderingContent = &v +} + +// GetServerTimeMS returns the ServerTimeMS field value if set, zero value otherwise. +func (o *RecommendationsResponse) GetServerTimeMS() int32 { + if o == nil || o.ServerTimeMS == nil { + var ret int32 + return ret + } + return *o.ServerTimeMS +} + +// GetServerTimeMSOk returns a tuple with the ServerTimeMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecommendationsResponse) GetServerTimeMSOk() (*int32, bool) { + if o == nil || o.ServerTimeMS == nil { + return nil, false + } + return o.ServerTimeMS, true +} + +// HasServerTimeMS returns a boolean if a field has been set. +func (o *RecommendationsResponse) HasServerTimeMS() bool { + if o != nil && o.ServerTimeMS != nil { + return true + } + + return false +} + +// SetServerTimeMS gets a reference to the given int32 and assigns it to the ServerTimeMS field. +func (o *RecommendationsResponse) SetServerTimeMS(v int32) { + o.ServerTimeMS = &v +} + // GetServerUsed returns the ServerUsed field value if set, zero value otherwise. func (o *RecommendationsResponse) GetServerUsed() string { if o == nil || o.ServerUsed == nil { @@ -918,38 +1081,6 @@ func (o *RecommendationsResponse) SetUserData(v interface{}) { o.UserData = v } -// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. -func (o *RecommendationsResponse) GetRenderingContent() RenderingContent { - if o == nil || o.RenderingContent == nil { - var ret RenderingContent - return ret - } - return *o.RenderingContent -} - -// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RecommendationsResponse) GetRenderingContentOk() (*RenderingContent, bool) { - if o == nil || o.RenderingContent == nil { - return nil, false - } - return o.RenderingContent, true -} - -// HasRenderingContent returns a boolean if a field has been set. -func (o *RecommendationsResponse) HasRenderingContent() bool { - if o != nil && o.RenderingContent != nil { - return true - } - - return false -} - -// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. -func (o *RecommendationsResponse) SetRenderingContent(v RenderingContent) { - o.RenderingContent = &v -} - // GetHits returns the Hits field value func (o *RecommendationsResponse) GetHits() []RecommendHit { if o == nil { @@ -1052,6 +1183,9 @@ func (o RecommendationsResponse) MarshalJSON() ([]byte, error) { if o.AutomaticRadius != nil { toSerialize["automaticRadius"] = o.AutomaticRadius } + if o.Exhaustive != nil { + toSerialize["exhaustive"] = o.Exhaustive + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -1091,27 +1225,33 @@ func (o RecommendationsResponse) MarshalJSON() ([]byte, error) { if true { toSerialize["page"] = o.Page } - if o.Redirect != nil { - toSerialize["redirect"] = o.Redirect - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } if true { toSerialize["processingTimeMS"] = o.ProcessingTimeMS } + if o.ProcessingTimingsMS != nil { + toSerialize["processingTimingsMS"] = o.ProcessingTimingsMS + } if o.QueryAfterRemoval != nil { toSerialize["queryAfterRemoval"] = o.QueryAfterRemoval } + if o.Redirect != nil { + toSerialize["redirect"] = o.Redirect + } + if o.RenderingContent != nil { + toSerialize["renderingContent"] = o.RenderingContent + } + if o.ServerTimeMS != nil { + toSerialize["serverTimeMS"] = o.ServerTimeMS + } if o.ServerUsed != nil { toSerialize["serverUsed"] = o.ServerUsed } if o.UserData != nil { toSerialize["userData"] = o.UserData } - if o.RenderingContent != nil { - toSerialize["renderingContent"] = o.RenderingContent - } if true { toSerialize["hits"] = o.Hits } @@ -1130,6 +1270,7 @@ func (o RecommendationsResponse) String() string { out += fmt.Sprintf(" abTestVariantID=%v\n", o.AbTestVariantID) out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) + out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) @@ -1143,13 +1284,15 @@ func (o RecommendationsResponse) String() string { 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(" redirect=%v\n", o.Redirect) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) + out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) out += fmt.Sprintf(" queryAfterRemoval=%v\n", o.QueryAfterRemoval) + out += fmt.Sprintf(" redirect=%v\n", o.Redirect) + out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + out += fmt.Sprintf(" serverTimeMS=%v\n", o.ServerTimeMS) out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) - out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) 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/recommend/model_redirect.go b/clients/algoliasearch-client-go/algolia/recommend/model_redirect.go new file mode 100644 index 0000000000..6049589837 --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/recommend/model_redirect.go @@ -0,0 +1,122 @@ +// 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" +) + +// Redirect [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). +type Redirect struct { + Index []RedirectRuleIndexMetadata `json:"index,omitempty"` +} + +type RedirectOption func(f *Redirect) + +func WithRedirectIndex(val []RedirectRuleIndexMetadata) RedirectOption { + return func(f *Redirect) { + f.Index = val + } +} + +// NewRedirect instantiates a new Redirect 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 NewRedirect(opts ...RedirectOption) *Redirect { + this := &Redirect{} + for _, opt := range opts { + opt(this) + } + return this +} + +// NewRedirectWithDefaults instantiates a new Redirect object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRedirectWithDefaults() *Redirect { + this := &Redirect{} + return this +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *Redirect) GetIndex() []RedirectRuleIndexMetadata { + if o == nil || o.Index == nil { + var ret []RedirectRuleIndexMetadata + return ret + } + return o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Redirect) GetIndexOk() ([]RedirectRuleIndexMetadata, bool) { + if o == nil || o.Index == nil { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *Redirect) HasIndex() bool { + if o != nil && o.Index != nil { + return true + } + + return false +} + +// SetIndex gets a reference to the given []RedirectRuleIndexMetadata and assigns it to the Index field. +func (o *Redirect) SetIndex(v []RedirectRuleIndexMetadata) { + o.Index = v +} + +func (o Redirect) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if o.Index != nil { + toSerialize["index"] = o.Index + } + return json.Marshal(toSerialize) +} + +func (o Redirect) String() string { + out := "" + out += fmt.Sprintf(" index=%v\n", o.Index) + return fmt.Sprintf("Redirect {\n%s}", out) +} + +type NullableRedirect struct { + value *Redirect + isSet bool +} + +func (v NullableRedirect) Get() *Redirect { + return v.value +} + +func (v *NullableRedirect) Set(val *Redirect) { + v.value = val + v.isSet = true +} + +func (v NullableRedirect) IsSet() bool { + return v.isSet +} + +func (v *NullableRedirect) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRedirect(val *Redirect) *NullableRedirect { + return &NullableRedirect{value: val, isSet: true} +} + +func (v NullableRedirect) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRedirect) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata.go b/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata.go index 8db87c2442..2c0299c500 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata.go @@ -9,14 +9,14 @@ import ( // RedirectRuleIndexMetadata struct for RedirectRuleIndexMetadata type RedirectRuleIndexMetadata struct { // Source index for the redirect rule. - Source string `json:"source" validate:"required"` + Source string `json:"source"` // Destination index for the redirect rule. - Dest string `json:"dest" validate:"required"` + Dest string `json:"dest"` // Reason for the redirect rule. - Reason string `json:"reason" validate:"required"` + Reason string `json:"reason"` // Redirect rule status. - Succeed bool `json:"succeed" validate:"required"` - Data RedirectRuleIndexMetadataData `json:"data" validate:"required"` + Succeed bool `json:"succeed"` + Data RedirectRuleIndexMetadataData `json:"data"` } // NewRedirectRuleIndexMetadata instantiates a new RedirectRuleIndexMetadata object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata_data.go b/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata_data.go index 9f8dc5faaf..8e130cc29a 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata_data.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_redirect_rule_index_metadata_data.go @@ -8,7 +8,7 @@ import ( // RedirectRuleIndexMetadataData Redirect rule data. type RedirectRuleIndexMetadataData struct { - RuleObjectID string `json:"ruleObjectID" validate:"required"` + RuleObjectID string `json:"ruleObjectID"` } // NewRedirectRuleIndexMetadataData instantiates a new RedirectRuleIndexMetadataData object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_rule_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_rule_response.go index 87fd615fb6..891c5c3109 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_rule_response.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_rule_response.go @@ -10,7 +10,7 @@ import ( type RuleResponse struct { Metadata *RuleResponseMetadata `json:"_metadata,omitempty"` // Unique identifier for a rule object. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. Conditions []Condition `json:"conditions,omitempty"` Consequence *Consequence `json:"consequence,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_search_recommend_rules_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_search_recommend_rules_response.go index 8fbdf2e8e4..8f0f42a048 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_search_recommend_rules_response.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_search_recommend_rules_response.go @@ -9,13 +9,13 @@ import ( // SearchRecommendRulesResponse struct for SearchRecommendRulesResponse type SearchRecommendRulesResponse struct { // Fetched rules. - Hits []RuleResponse `json:"hits" validate:"required"` + Hits []RuleResponse `json:"hits"` // Number of fetched rules. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Current page. - Page int32 `json:"page" validate:"required"` + Page int32 `json:"page"` // Number of pages. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` } // NewSearchRecommendRulesResponse instantiates a new SearchRecommendRulesResponse object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_snippet_result_option.go b/clients/algoliasearch-client-go/algolia/recommend/model_snippet_result_option.go index 6da3d25abb..c1ab820795 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_snippet_result_option.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_snippet_result_option.go @@ -9,8 +9,8 @@ import ( // SnippetResultOption Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. type SnippetResultOption struct { // Markup text with `facetQuery` matches highlighted. - Value string `json:"value" validate:"required"` - MatchLevel MatchLevel `json:"matchLevel" validate:"required"` + Value string `json:"value"` + MatchLevel MatchLevel `json:"matchLevel"` } // NewSnippetResultOption instantiates a new SnippetResultOption object diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_trending_facets_query.go b/clients/algoliasearch-client-go/algolia/recommend/model_trending_facets_query.go index 73284f4256..5ff3a86022 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_trending_facets_query.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_trending_facets_query.go @@ -9,10 +9,10 @@ import ( // TrendingFacetsQuery struct for TrendingFacetsQuery type TrendingFacetsQuery struct { // Facet name for trending models. - FacetName string `json:"facetName" validate:"required"` + FacetName string `json:"facetName"` Model *TrendingFacetsModel `json:"model,omitempty"` // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. Threshold *int32 `json:"threshold,omitempty"` // Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_trending_items_query.go b/clients/algoliasearch-client-go/algolia/recommend/model_trending_items_query.go index ef32622ea4..a891c218f4 100644 --- a/clients/algoliasearch-client-go/algolia/recommend/model_trending_items_query.go +++ b/clients/algoliasearch-client-go/algolia/recommend/model_trending_items_query.go @@ -16,7 +16,7 @@ type TrendingItemsQuery struct { QueryParameters *SearchParamsObject `json:"queryParameters,omitempty"` FallbackParameters *SearchParamsObject `json:"fallbackParameters,omitempty"` // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. Threshold *int32 `json:"threshold,omitempty"` // Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. diff --git a/clients/algoliasearch-client-go/algolia/search/model_add_api_key_response.go b/clients/algoliasearch-client-go/algolia/search/model_add_api_key_response.go index 1d92931f0e..c688d60ef9 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_add_api_key_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_add_api_key_response.go @@ -9,9 +9,9 @@ import ( // AddApiKeyResponse struct for AddApiKeyResponse type AddApiKeyResponse struct { // API key. - Key string `json:"key" validate:"required"` + Key string `json:"key"` // Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewAddApiKeyResponse instantiates a new AddApiKeyResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_api_key.go b/clients/algoliasearch-client-go/algolia/search/model_api_key.go index b69e51615a..057179bf83 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_api_key.go +++ b/clients/algoliasearch-client-go/algolia/search/model_api_key.go @@ -9,7 +9,7 @@ import ( // ApiKey API key object. type ApiKey struct { // [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. - Acl []Acl `json:"acl" validate:"required"` + Acl []Acl `json:"acl"` // Description of an API key for you and your team members. Description *string `json:"description,omitempty"` // Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". diff --git a/clients/algoliasearch-client-go/algolia/search/model_assign_user_id_params.go b/clients/algoliasearch-client-go/algolia/search/model_assign_user_id_params.go index 692104d0ce..0395b11bab 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_assign_user_id_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_assign_user_id_params.go @@ -9,7 +9,7 @@ import ( // AssignUserIdParams Assign userID parameters. type AssignUserIdParams struct { // Cluster name. - Cluster string `json:"cluster" validate:"required"` + Cluster string `json:"cluster"` } // NewAssignUserIdParams instantiates a new AssignUserIdParams object diff --git a/clients/algoliasearch-client-go/algolia/search/model_automatic_facet_filter.go b/clients/algoliasearch-client-go/algolia/search/model_automatic_facet_filter.go index 14a264a11d..e59af0d1a4 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_automatic_facet_filter.go +++ b/clients/algoliasearch-client-go/algolia/search/model_automatic_facet_filter.go @@ -9,7 +9,7 @@ import ( // AutomaticFacetFilter Automatic facet Filter. type AutomaticFacetFilter struct { // Attribute to filter on. This must match a facet placeholder in the Rule's pattern. - Facet string `json:"facet" validate:"required"` + Facet string `json:"facet"` // Score for the filter. Typically used for optional or disjunctive filters. Score *int32 `json:"score,omitempty"` // Whether the filter is disjunctive (true) or conjunctive (false). diff --git a/clients/algoliasearch-client-go/algolia/search/model_base_get_api_key_response.go b/clients/algoliasearch-client-go/algolia/search/model_base_get_api_key_response.go index df92e8d05c..10a113701e 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_base_get_api_key_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_base_get_api_key_response.go @@ -11,7 +11,7 @@ type BaseGetApiKeyResponse struct { // API key. Value *string `json:"value,omitempty"` // Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). - CreatedAt int64 `json:"createdAt" validate:"required"` + CreatedAt int64 `json:"createdAt"` } type BaseGetApiKeyResponseOption func(f *BaseGetApiKeyResponse) 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 7ee4d9fdf7..1e5b44cf43 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 @@ -15,19 +15,23 @@ type BaseSearchResponse struct { // Computed geographical location. AroundLatLng *string `json:"aroundLatLng,omitempty"` // Automatically-computed radius. - AutomaticRadius *string `json:"automaticRadius,omitempty"` - // Indicates whether the facet count is exhaustive (exact) or approximate. + AutomaticRadius *string `json:"automaticRadius,omitempty"` + Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // See the `facetsCount` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` - // Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + // See the `nbHits` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveNbHits *bool `json:"exhaustiveNbHits,omitempty"` - // Indicates whether the search for typos was exhaustive (exact) or approximate. + // See the `typo` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveTypo *bool `json:"exhaustiveTypo,omitempty"` // Mapping of each facet name to the corresponding facet counts. 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" validate:"required"` + 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. @@ -35,27 +39,34 @@ type BaseSearchResponse struct { // Warnings about the query. Message *string `json:"message,omitempty"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Number of pages of results for the current query. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` // Page to retrieve (the first page is `0`, not `1`). - Page int32 `json:"page" validate:"required"` - Redirect *BaseSearchResponseRedirect `json:"redirect,omitempty"` + 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. - ProcessingTimeMS int32 `json:"processingTimeMS" validate:"required"` + ProcessingTimeMS int32 `json:"processingTimeMS"` + // Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + ProcessingTimingsMS map[string]interface{} `json:"processingTimingsMS,omitempty"` // Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. - QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + Redirect *Redirect `json:"redirect,omitempty"` + RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + // Time the server took to process the request, in milliseconds. + ServerTimeMS *int32 `json:"serverTimeMS,omitempty"` // Host name of the server that processed the request. ServerUsed *string `json:"serverUsed,omitempty"` // Lets you store custom data in your indices. - UserData interface{} `json:"userData,omitempty"` - RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + UserData interface{} `json:"userData,omitempty"` + AdditionalProperties map[string]any } +type _BaseSearchResponse BaseSearchResponse + type BaseSearchResponseOption func(f *BaseSearchResponse) func WithBaseSearchResponseAbTestID(val int32) BaseSearchResponseOption { @@ -82,6 +93,12 @@ func WithBaseSearchResponseAutomaticRadius(val string) BaseSearchResponseOption } } +func WithBaseSearchResponseExhaustive(val Exhaustive) BaseSearchResponseOption { + return func(f *BaseSearchResponse) { + f.Exhaustive = &val + } +} + func WithBaseSearchResponseExhaustiveFacetsCount(val bool) BaseSearchResponseOption { return func(f *BaseSearchResponse) { f.ExhaustiveFacetsCount = &val @@ -136,15 +153,15 @@ func WithBaseSearchResponseNbSortedHits(val int32) BaseSearchResponseOption { } } -func WithBaseSearchResponseRedirect(val BaseSearchResponseRedirect) BaseSearchResponseOption { +func WithBaseSearchResponseParsedQuery(val string) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.Redirect = &val + f.ParsedQuery = &val } } -func WithBaseSearchResponseParsedQuery(val string) BaseSearchResponseOption { +func WithBaseSearchResponseProcessingTimingsMS(val map[string]interface{}) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.ParsedQuery = &val + f.ProcessingTimingsMS = val } } @@ -154,21 +171,33 @@ func WithBaseSearchResponseQueryAfterRemoval(val string) BaseSearchResponseOptio } } -func WithBaseSearchResponseServerUsed(val string) BaseSearchResponseOption { +func WithBaseSearchResponseRedirect(val Redirect) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.ServerUsed = &val + f.Redirect = &val } } -func WithBaseSearchResponseUserData(val interface{}) BaseSearchResponseOption { +func WithBaseSearchResponseRenderingContent(val RenderingContent) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.UserData = val + f.RenderingContent = &val } } -func WithBaseSearchResponseRenderingContent(val RenderingContent) BaseSearchResponseOption { +func WithBaseSearchResponseServerTimeMS(val int32) BaseSearchResponseOption { return func(f *BaseSearchResponse) { - f.RenderingContent = &val + f.ServerTimeMS = &val + } +} + +func WithBaseSearchResponseServerUsed(val string) BaseSearchResponseOption { + return func(f *BaseSearchResponse) { + f.ServerUsed = &val + } +} + +func WithBaseSearchResponseUserData(val interface{}) BaseSearchResponseOption { + return func(f *BaseSearchResponse) { + f.UserData = val } } @@ -329,7 +358,40 @@ func (o *BaseSearchResponse) SetAutomaticRadius(v string) { o.AutomaticRadius = &v } +// GetExhaustive returns the Exhaustive field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetExhaustive() Exhaustive { + if o == nil || o.Exhaustive == nil { + var ret Exhaustive + return ret + } + return *o.Exhaustive +} + +// GetExhaustiveOk returns a tuple with the Exhaustive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetExhaustiveOk() (*Exhaustive, bool) { + if o == nil || o.Exhaustive == nil { + return nil, false + } + return o.Exhaustive, true +} + +// HasExhaustive returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasExhaustive() bool { + if o != nil && o.Exhaustive != nil { + return true + } + + return false +} + +// SetExhaustive gets a reference to the given Exhaustive and assigns it to the Exhaustive field. +func (o *BaseSearchResponse) SetExhaustive(v Exhaustive) { + o.Exhaustive = &v +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveFacetsCount() bool { if o == nil || o.ExhaustiveFacetsCount == nil { var ret bool @@ -340,6 +402,7 @@ func (o *BaseSearchResponse) GetExhaustiveFacetsCount() bool { // GetExhaustiveFacetsCountOk returns a tuple with the ExhaustiveFacetsCount field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveFacetsCountOk() (*bool, bool) { if o == nil || o.ExhaustiveFacetsCount == nil { return nil, false @@ -357,11 +420,13 @@ func (o *BaseSearchResponse) HasExhaustiveFacetsCount() bool { } // SetExhaustiveFacetsCount gets a reference to the given bool and assigns it to the ExhaustiveFacetsCount field. +// Deprecated func (o *BaseSearchResponse) SetExhaustiveFacetsCount(v bool) { o.ExhaustiveFacetsCount = &v } // GetExhaustiveNbHits returns the ExhaustiveNbHits field value if set, zero value otherwise. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveNbHits() bool { if o == nil || o.ExhaustiveNbHits == nil { var ret bool @@ -372,6 +437,7 @@ func (o *BaseSearchResponse) GetExhaustiveNbHits() bool { // GetExhaustiveNbHitsOk returns a tuple with the ExhaustiveNbHits field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveNbHitsOk() (*bool, bool) { if o == nil || o.ExhaustiveNbHits == nil { return nil, false @@ -389,11 +455,13 @@ func (o *BaseSearchResponse) HasExhaustiveNbHits() bool { } // SetExhaustiveNbHits gets a reference to the given bool and assigns it to the ExhaustiveNbHits field. +// Deprecated func (o *BaseSearchResponse) SetExhaustiveNbHits(v bool) { o.ExhaustiveNbHits = &v } // GetExhaustiveTypo returns the ExhaustiveTypo field value if set, zero value otherwise. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveTypo() bool { if o == nil || o.ExhaustiveTypo == nil { var ret bool @@ -404,6 +472,7 @@ func (o *BaseSearchResponse) GetExhaustiveTypo() bool { // GetExhaustiveTypoOk returns a tuple with the ExhaustiveTypo field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BaseSearchResponse) GetExhaustiveTypoOk() (*bool, bool) { if o == nil || o.ExhaustiveTypo == nil { return nil, false @@ -421,6 +490,7 @@ func (o *BaseSearchResponse) HasExhaustiveTypo() bool { } // SetExhaustiveTypo gets a reference to the given bool and assigns it to the ExhaustiveTypo field. +// Deprecated func (o *BaseSearchResponse) SetExhaustiveTypo(v bool) { o.ExhaustiveTypo = &v } @@ -713,38 +783,6 @@ func (o *BaseSearchResponse) SetPage(v int32) { o.Page = v } -// GetRedirect returns the Redirect field value if set, zero value otherwise. -func (o *BaseSearchResponse) GetRedirect() BaseSearchResponseRedirect { - if o == nil || o.Redirect == nil { - var ret BaseSearchResponseRedirect - return ret - } - return *o.Redirect -} - -// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetRedirectOk() (*BaseSearchResponseRedirect, bool) { - if o == nil || o.Redirect == nil { - return nil, false - } - return o.Redirect, true -} - -// HasRedirect returns a boolean if a field has been set. -func (o *BaseSearchResponse) HasRedirect() bool { - if o != nil && o.Redirect != nil { - return true - } - - return false -} - -// SetRedirect gets a reference to the given BaseSearchResponseRedirect and assigns it to the Redirect field. -func (o *BaseSearchResponse) SetRedirect(v BaseSearchResponseRedirect) { - o.Redirect = &v -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *BaseSearchResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -801,6 +839,38 @@ func (o *BaseSearchResponse) SetProcessingTimeMS(v int32) { o.ProcessingTimeMS = v } +// GetProcessingTimingsMS returns the ProcessingTimingsMS field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetProcessingTimingsMS() map[string]interface{} { + if o == nil || o.ProcessingTimingsMS == nil { + var ret map[string]interface{} + return ret + } + return o.ProcessingTimingsMS +} + +// GetProcessingTimingsMSOk returns a tuple with the ProcessingTimingsMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetProcessingTimingsMSOk() (map[string]interface{}, bool) { + if o == nil || o.ProcessingTimingsMS == nil { + return nil, false + } + return o.ProcessingTimingsMS, true +} + +// HasProcessingTimingsMS returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasProcessingTimingsMS() bool { + if o != nil && o.ProcessingTimingsMS != nil { + return true + } + + return false +} + +// SetProcessingTimingsMS gets a reference to the given map[string]interface{} and assigns it to the ProcessingTimingsMS field. +func (o *BaseSearchResponse) SetProcessingTimingsMS(v map[string]interface{}) { + o.ProcessingTimingsMS = v +} + // GetQueryAfterRemoval returns the QueryAfterRemoval field value if set, zero value otherwise. func (o *BaseSearchResponse) GetQueryAfterRemoval() string { if o == nil || o.QueryAfterRemoval == nil { @@ -833,6 +903,102 @@ func (o *BaseSearchResponse) SetQueryAfterRemoval(v string) { o.QueryAfterRemoval = &v } +// GetRedirect returns the Redirect field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetRedirect() Redirect { + if o == nil || o.Redirect == nil { + var ret Redirect + return ret + } + return *o.Redirect +} + +// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetRedirectOk() (*Redirect, bool) { + if o == nil || o.Redirect == nil { + return nil, false + } + return o.Redirect, true +} + +// HasRedirect returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasRedirect() bool { + if o != nil && o.Redirect != nil { + return true + } + + return false +} + +// SetRedirect gets a reference to the given Redirect and assigns it to the Redirect field. +func (o *BaseSearchResponse) SetRedirect(v Redirect) { + o.Redirect = &v +} + +// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetRenderingContent() RenderingContent { + if o == nil || o.RenderingContent == nil { + var ret RenderingContent + return ret + } + return *o.RenderingContent +} + +// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetRenderingContentOk() (*RenderingContent, bool) { + if o == nil || o.RenderingContent == nil { + return nil, false + } + return o.RenderingContent, true +} + +// HasRenderingContent returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasRenderingContent() bool { + if o != nil && o.RenderingContent != nil { + return true + } + + return false +} + +// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. +func (o *BaseSearchResponse) SetRenderingContent(v RenderingContent) { + o.RenderingContent = &v +} + +// GetServerTimeMS returns the ServerTimeMS field value if set, zero value otherwise. +func (o *BaseSearchResponse) GetServerTimeMS() int32 { + if o == nil || o.ServerTimeMS == nil { + var ret int32 + return ret + } + return *o.ServerTimeMS +} + +// GetServerTimeMSOk returns a tuple with the ServerTimeMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSearchResponse) GetServerTimeMSOk() (*int32, bool) { + if o == nil || o.ServerTimeMS == nil { + return nil, false + } + return o.ServerTimeMS, true +} + +// HasServerTimeMS returns a boolean if a field has been set. +func (o *BaseSearchResponse) HasServerTimeMS() bool { + if o != nil && o.ServerTimeMS != nil { + return true + } + + return false +} + +// SetServerTimeMS gets a reference to the given int32 and assigns it to the ServerTimeMS field. +func (o *BaseSearchResponse) SetServerTimeMS(v int32) { + o.ServerTimeMS = &v +} + // GetServerUsed returns the ServerUsed field value if set, zero value otherwise. func (o *BaseSearchResponse) GetServerUsed() string { if o == nil || o.ServerUsed == nil { @@ -898,38 +1064,6 @@ func (o *BaseSearchResponse) SetUserData(v interface{}) { o.UserData = v } -// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. -func (o *BaseSearchResponse) GetRenderingContent() RenderingContent { - if o == nil || o.RenderingContent == nil { - var ret RenderingContent - return ret - } - return *o.RenderingContent -} - -// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BaseSearchResponse) GetRenderingContentOk() (*RenderingContent, bool) { - if o == nil || o.RenderingContent == nil { - return nil, false - } - return o.RenderingContent, true -} - -// HasRenderingContent returns a boolean if a field has been set. -func (o *BaseSearchResponse) HasRenderingContent() bool { - if o != nil && o.RenderingContent != nil { - return true - } - - return false -} - -// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. -func (o *BaseSearchResponse) SetRenderingContent(v RenderingContent) { - o.RenderingContent = &v -} - func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} if o.AbTestID != nil { @@ -944,6 +1078,9 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if o.AutomaticRadius != nil { toSerialize["automaticRadius"] = o.AutomaticRadius } + if o.Exhaustive != nil { + toSerialize["exhaustive"] = o.Exhaustive + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -983,36 +1120,91 @@ func (o BaseSearchResponse) MarshalJSON() ([]byte, error) { if true { toSerialize["page"] = o.Page } - if o.Redirect != nil { - toSerialize["redirect"] = o.Redirect - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } if true { toSerialize["processingTimeMS"] = o.ProcessingTimeMS } + if o.ProcessingTimingsMS != nil { + toSerialize["processingTimingsMS"] = o.ProcessingTimingsMS + } if o.QueryAfterRemoval != nil { toSerialize["queryAfterRemoval"] = o.QueryAfterRemoval } + if o.Redirect != nil { + toSerialize["redirect"] = o.Redirect + } + if o.RenderingContent != nil { + toSerialize["renderingContent"] = o.RenderingContent + } + if o.ServerTimeMS != nil { + toSerialize["serverTimeMS"] = o.ServerTimeMS + } if o.ServerUsed != nil { toSerialize["serverUsed"] = o.ServerUsed } if o.UserData != nil { toSerialize["userData"] = o.UserData } - if o.RenderingContent != nil { - toSerialize["renderingContent"] = o.RenderingContent + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value } + return json.Marshal(toSerialize) } +func (o *BaseSearchResponse) UnmarshalJSON(bytes []byte) (err error) { + varBaseSearchResponse := _BaseSearchResponse{} + + if err = json.Unmarshal(bytes, &varBaseSearchResponse); err == nil { + *o = BaseSearchResponse(varBaseSearchResponse) + } + + additionalProperties := make(map[string]any) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "abTestID") + delete(additionalProperties, "abTestVariantID") + delete(additionalProperties, "aroundLatLng") + delete(additionalProperties, "automaticRadius") + delete(additionalProperties, "exhaustive") + delete(additionalProperties, "exhaustiveFacetsCount") + delete(additionalProperties, "exhaustiveNbHits") + 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") + delete(additionalProperties, "queryAfterRemoval") + delete(additionalProperties, "redirect") + delete(additionalProperties, "renderingContent") + delete(additionalProperties, "serverTimeMS") + delete(additionalProperties, "serverUsed") + delete(additionalProperties, "userData") + o.AdditionalProperties = additionalProperties + } + + return err +} + func (o BaseSearchResponse) String() string { out := "" out += fmt.Sprintf(" abTestID=%v\n", o.AbTestID) out += fmt.Sprintf(" abTestVariantID=%v\n", o.AbTestVariantID) out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) + out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) @@ -1026,13 +1218,18 @@ func (o BaseSearchResponse) String() string { 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(" redirect=%v\n", o.Redirect) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) + out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) out += fmt.Sprintf(" queryAfterRemoval=%v\n", o.QueryAfterRemoval) + out += fmt.Sprintf(" redirect=%v\n", o.Redirect) + out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + out += fmt.Sprintf(" serverTimeMS=%v\n", o.ServerTimeMS) out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) - out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + for key, value := range o.AdditionalProperties { + out += fmt.Sprintf(" %s=%v\n", key, value) + } return fmt.Sprintf("BaseSearchResponse {\n%s}", out) } diff --git a/clients/algoliasearch-client-go/algolia/search/model_base_search_response_redirect.go b/clients/algoliasearch-client-go/algolia/search/model_base_search_response_redirect.go deleted file mode 100644 index a5b2d0031a..0000000000 --- a/clients/algoliasearch-client-go/algolia/search/model_base_search_response_redirect.go +++ /dev/null @@ -1,122 +0,0 @@ -// 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" -) - -// BaseSearchResponseRedirect [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). -type BaseSearchResponseRedirect struct { - Index []RedirectRuleIndexMetadata `json:"index,omitempty"` -} - -type BaseSearchResponseRedirectOption func(f *BaseSearchResponseRedirect) - -func WithBaseSearchResponseRedirectIndex(val []RedirectRuleIndexMetadata) BaseSearchResponseRedirectOption { - return func(f *BaseSearchResponseRedirect) { - f.Index = val - } -} - -// NewBaseSearchResponseRedirect instantiates a new BaseSearchResponseRedirect 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 NewBaseSearchResponseRedirect(opts ...BaseSearchResponseRedirectOption) *BaseSearchResponseRedirect { - this := &BaseSearchResponseRedirect{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewBaseSearchResponseRedirectWithDefaults instantiates a new BaseSearchResponseRedirect object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewBaseSearchResponseRedirectWithDefaults() *BaseSearchResponseRedirect { - this := &BaseSearchResponseRedirect{} - return this -} - -// GetIndex returns the Index field value if set, zero value otherwise. -func (o *BaseSearchResponseRedirect) GetIndex() []RedirectRuleIndexMetadata { - if o == nil || o.Index == nil { - var ret []RedirectRuleIndexMetadata - return ret - } - return o.Index -} - -// GetIndexOk returns a tuple with the Index field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BaseSearchResponseRedirect) GetIndexOk() ([]RedirectRuleIndexMetadata, bool) { - if o == nil || o.Index == nil { - return nil, false - } - return o.Index, true -} - -// HasIndex returns a boolean if a field has been set. -func (o *BaseSearchResponseRedirect) HasIndex() bool { - if o != nil && o.Index != nil { - return true - } - - return false -} - -// SetIndex gets a reference to the given []RedirectRuleIndexMetadata and assigns it to the Index field. -func (o *BaseSearchResponseRedirect) SetIndex(v []RedirectRuleIndexMetadata) { - o.Index = v -} - -func (o BaseSearchResponseRedirect) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Index != nil { - toSerialize["index"] = o.Index - } - return json.Marshal(toSerialize) -} - -func (o BaseSearchResponseRedirect) String() string { - out := "" - out += fmt.Sprintf(" index=%v\n", o.Index) - return fmt.Sprintf("BaseSearchResponseRedirect {\n%s}", out) -} - -type NullableBaseSearchResponseRedirect struct { - value *BaseSearchResponseRedirect - isSet bool -} - -func (v NullableBaseSearchResponseRedirect) Get() *BaseSearchResponseRedirect { - return v.value -} - -func (v *NullableBaseSearchResponseRedirect) Set(val *BaseSearchResponseRedirect) { - v.value = val - v.isSet = true -} - -func (v NullableBaseSearchResponseRedirect) IsSet() bool { - return v.isSet -} - -func (v *NullableBaseSearchResponseRedirect) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBaseSearchResponseRedirect(val *BaseSearchResponseRedirect) *NullableBaseSearchResponseRedirect { - return &NullableBaseSearchResponseRedirect{value: val, isSet: true} -} - -func (v NullableBaseSearchResponseRedirect) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBaseSearchResponseRedirect) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_assign_user_ids_params.go b/clients/algoliasearch-client-go/algolia/search/model_batch_assign_user_ids_params.go index 2faa54552f..d3ba91ee60 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_assign_user_ids_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_assign_user_ids_params.go @@ -9,9 +9,9 @@ import ( // BatchAssignUserIdsParams Assign userID parameters. type BatchAssignUserIdsParams struct { // Cluster name. - Cluster string `json:"cluster" validate:"required"` + Cluster string `json:"cluster"` // User IDs to assign. - Users []string `json:"users" validate:"required"` + Users []string `json:"users"` } // NewBatchAssignUserIdsParams instantiates a new BatchAssignUserIdsParams object diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_params.go b/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_params.go index 2ba22e7005..212d6780da 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_params.go @@ -11,7 +11,7 @@ type BatchDictionaryEntriesParams struct { // Incidates whether to replace all custom entries in the dictionary with the ones sent with this request. ClearExistingDictionaryEntries *bool `json:"clearExistingDictionaryEntries,omitempty"` // Operations to batch. - Requests []BatchDictionaryEntriesRequest `json:"requests" validate:"required"` + Requests []BatchDictionaryEntriesRequest `json:"requests"` } type BatchDictionaryEntriesParamsOption func(f *BatchDictionaryEntriesParams) diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_request.go b/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_request.go index 6da97d06a9..8749f6fafe 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_request.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_dictionary_entries_request.go @@ -8,8 +8,8 @@ import ( // BatchDictionaryEntriesRequest struct for BatchDictionaryEntriesRequest type BatchDictionaryEntriesRequest struct { - Action DictionaryAction `json:"action" validate:"required"` - Body DictionaryEntry `json:"body" validate:"required"` + Action DictionaryAction `json:"action"` + Body DictionaryEntry `json:"body"` } // NewBatchDictionaryEntriesRequest instantiates a new BatchDictionaryEntriesRequest object diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_params.go b/clients/algoliasearch-client-go/algolia/search/model_batch_params.go index 009d8b4b72..bb94f5980a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_params.go @@ -8,7 +8,7 @@ import ( // BatchParams Batch parameters. type BatchParams struct { - Requests []MultipleBatchRequest `json:"requests" validate:"required"` + Requests []MultipleBatchRequest `json:"requests"` } // NewBatchParams instantiates a new BatchParams object diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_request.go b/clients/algoliasearch-client-go/algolia/search/model_batch_request.go index d81fab5e6e..5fed1562dc 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_request.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_request.go @@ -8,9 +8,9 @@ import ( // BatchRequest struct for BatchRequest type BatchRequest struct { - Action Action `json:"action" validate:"required"` + Action Action `json:"action"` // Operation arguments (varies with specified `action`). - Body map[string]interface{} `json:"body" validate:"required"` + Body map[string]interface{} `json:"body"` } // NewBatchRequest instantiates a new BatchRequest object diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_response.go b/clients/algoliasearch-client-go/algolia/search/model_batch_response.go index 999d9e4f18..0e1493cef8 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_response.go @@ -9,9 +9,9 @@ import ( // BatchResponse struct for BatchResponse type BatchResponse struct { // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` // Unique object (record) identifiers. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` } // NewBatchResponse instantiates a new BatchResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_batch_write_params.go b/clients/algoliasearch-client-go/algolia/search/model_batch_write_params.go index c700fa4857..f38fbd6a9a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_batch_write_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_batch_write_params.go @@ -8,7 +8,7 @@ import ( // BatchWriteParams Batch parameters. type BatchWriteParams struct { - Requests []BatchRequest `json:"requests" validate:"required"` + Requests []BatchRequest `json:"requests"` } // NewBatchWriteParams instantiates a new BatchWriteParams object diff --git a/clients/algoliasearch-client-go/algolia/search/model_browse_params.go b/clients/algoliasearch-client-go/algolia/search/model_browse_params.go index 2fb35d8aae..32c094ab75 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_browse_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_browse_params.go @@ -29,6 +29,41 @@ func SearchParamsStringAsBrowseParams(v *SearchParamsString) BrowseParams { // Unmarshal JSON data into one of the pointers in the struct func (dst *BrowseParams) UnmarshalJSON(data []byte) error { var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]any + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("Failed to unmarshal JSON into map for the discriminator lookup (SearchParamsString).") + } + + // Hold the schema validity between checks + validSchemaForModel := true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'params' + if _, ok := jsonDict["params"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into SearchParamsString + err = newStrictDecoder(data).Decode(&dst.SearchParamsString) + if err == nil && validateStruct(dst.SearchParamsString) == nil { + jsonSearchParamsString, _ := json.Marshal(dst.SearchParamsString) + if string(jsonSearchParamsString) == "{}" { // empty struct + dst.SearchParamsString = nil + } else { + return nil + } + } else { + dst.SearchParamsString = nil + } + } + + // Reset the schema validity for the next class check + validSchemaForModel = true // try to unmarshal data into BrowseParamsObject err = newStrictDecoder(data).Decode(&dst.BrowseParamsObject) if err == nil && validateStruct(dst.BrowseParamsObject) == nil { @@ -42,19 +77,6 @@ func (dst *BrowseParams) UnmarshalJSON(data []byte) error { dst.BrowseParamsObject = nil } - // try to unmarshal data into SearchParamsString - err = newStrictDecoder(data).Decode(&dst.SearchParamsString) - if err == nil && validateStruct(dst.SearchParamsString) == nil { - jsonSearchParamsString, _ := json.Marshal(dst.SearchParamsString) - if string(jsonSearchParamsString) == "{}" { // empty struct - dst.SearchParamsString = nil - } else { - return nil - } - } else { - dst.SearchParamsString = nil - } - return fmt.Errorf("Data failed to match schemas in oneOf(BrowseParams)") } 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 45dc856fb4..5dbfaa5fd8 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_browse_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_browse_response.go @@ -15,19 +15,23 @@ type BrowseResponse struct { // Computed geographical location. AroundLatLng *string `json:"aroundLatLng,omitempty"` // Automatically-computed radius. - AutomaticRadius *string `json:"automaticRadius,omitempty"` - // Indicates whether the facet count is exhaustive (exact) or approximate. + AutomaticRadius *string `json:"automaticRadius,omitempty"` + Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // See the `facetsCount` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` - // Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + // See the `nbHits` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveNbHits *bool `json:"exhaustiveNbHits,omitempty"` - // Indicates whether the search for typos was exhaustive (exact) or approximate. + // See the `typo` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveTypo *bool `json:"exhaustiveTypo,omitempty"` // Mapping of each facet name to the corresponding facet counts. 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" validate:"required"` + 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. @@ -35,30 +39,34 @@ type BrowseResponse struct { // Warnings about the query. Message *string `json:"message,omitempty"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Number of pages of results for the current query. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` // Page to retrieve (the first page is `0`, not `1`). - Page int32 `json:"page" validate:"required"` - Redirect *BaseSearchResponseRedirect `json:"redirect,omitempty"` + 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. - ProcessingTimeMS int32 `json:"processingTimeMS" validate:"required"` + ProcessingTimeMS int32 `json:"processingTimeMS"` + // Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + ProcessingTimingsMS map[string]interface{} `json:"processingTimingsMS,omitempty"` // Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. - QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + Redirect *Redirect `json:"redirect,omitempty"` + RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + // Time the server took to process the request, in milliseconds. + ServerTimeMS *int32 `json:"serverTimeMS,omitempty"` // Host name of the server that processed the request. ServerUsed *string `json:"serverUsed,omitempty"` // Lets you store custom data in your indices. - UserData interface{} `json:"userData,omitempty"` - RenderingContent *RenderingContent `json:"renderingContent,omitempty"` - Hits []Hit `json:"hits" validate:"required"` + UserData interface{} `json:"userData,omitempty"` + Hits []Hit `json:"hits"` // Text to search for in an index. - Query string `json:"query" validate:"required"` + Query string `json:"query"` // URL-encoded string of all search parameters. - Params string `json:"params" validate:"required"` + Params string `json:"params"` // Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. Cursor *string `json:"cursor,omitempty"` } @@ -89,6 +97,12 @@ func WithBrowseResponseAutomaticRadius(val string) BrowseResponseOption { } } +func WithBrowseResponseExhaustive(val Exhaustive) BrowseResponseOption { + return func(f *BrowseResponse) { + f.Exhaustive = &val + } +} + func WithBrowseResponseExhaustiveFacetsCount(val bool) BrowseResponseOption { return func(f *BrowseResponse) { f.ExhaustiveFacetsCount = &val @@ -143,15 +157,15 @@ func WithBrowseResponseNbSortedHits(val int32) BrowseResponseOption { } } -func WithBrowseResponseRedirect(val BaseSearchResponseRedirect) BrowseResponseOption { +func WithBrowseResponseParsedQuery(val string) BrowseResponseOption { return func(f *BrowseResponse) { - f.Redirect = &val + f.ParsedQuery = &val } } -func WithBrowseResponseParsedQuery(val string) BrowseResponseOption { +func WithBrowseResponseProcessingTimingsMS(val map[string]interface{}) BrowseResponseOption { return func(f *BrowseResponse) { - f.ParsedQuery = &val + f.ProcessingTimingsMS = val } } @@ -161,21 +175,33 @@ func WithBrowseResponseQueryAfterRemoval(val string) BrowseResponseOption { } } -func WithBrowseResponseServerUsed(val string) BrowseResponseOption { +func WithBrowseResponseRedirect(val Redirect) BrowseResponseOption { return func(f *BrowseResponse) { - f.ServerUsed = &val + f.Redirect = &val } } -func WithBrowseResponseUserData(val interface{}) BrowseResponseOption { +func WithBrowseResponseRenderingContent(val RenderingContent) BrowseResponseOption { return func(f *BrowseResponse) { - f.UserData = val + f.RenderingContent = &val } } -func WithBrowseResponseRenderingContent(val RenderingContent) BrowseResponseOption { +func WithBrowseResponseServerTimeMS(val int32) BrowseResponseOption { return func(f *BrowseResponse) { - f.RenderingContent = &val + f.ServerTimeMS = &val + } +} + +func WithBrowseResponseServerUsed(val string) BrowseResponseOption { + return func(f *BrowseResponse) { + f.ServerUsed = &val + } +} + +func WithBrowseResponseUserData(val interface{}) BrowseResponseOption { + return func(f *BrowseResponse) { + f.UserData = val } } @@ -347,7 +373,40 @@ func (o *BrowseResponse) SetAutomaticRadius(v string) { o.AutomaticRadius = &v } +// GetExhaustive returns the Exhaustive field value if set, zero value otherwise. +func (o *BrowseResponse) GetExhaustive() Exhaustive { + if o == nil || o.Exhaustive == nil { + var ret Exhaustive + return ret + } + return *o.Exhaustive +} + +// GetExhaustiveOk returns a tuple with the Exhaustive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetExhaustiveOk() (*Exhaustive, bool) { + if o == nil || o.Exhaustive == nil { + return nil, false + } + return o.Exhaustive, true +} + +// HasExhaustive returns a boolean if a field has been set. +func (o *BrowseResponse) HasExhaustive() bool { + if o != nil && o.Exhaustive != nil { + return true + } + + return false +} + +// SetExhaustive gets a reference to the given Exhaustive and assigns it to the Exhaustive field. +func (o *BrowseResponse) SetExhaustive(v Exhaustive) { + o.Exhaustive = &v +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. +// Deprecated func (o *BrowseResponse) GetExhaustiveFacetsCount() bool { if o == nil || o.ExhaustiveFacetsCount == nil { var ret bool @@ -358,6 +417,7 @@ func (o *BrowseResponse) GetExhaustiveFacetsCount() bool { // GetExhaustiveFacetsCountOk returns a tuple with the ExhaustiveFacetsCount field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BrowseResponse) GetExhaustiveFacetsCountOk() (*bool, bool) { if o == nil || o.ExhaustiveFacetsCount == nil { return nil, false @@ -375,11 +435,13 @@ func (o *BrowseResponse) HasExhaustiveFacetsCount() bool { } // SetExhaustiveFacetsCount gets a reference to the given bool and assigns it to the ExhaustiveFacetsCount field. +// Deprecated func (o *BrowseResponse) SetExhaustiveFacetsCount(v bool) { o.ExhaustiveFacetsCount = &v } // GetExhaustiveNbHits returns the ExhaustiveNbHits field value if set, zero value otherwise. +// Deprecated func (o *BrowseResponse) GetExhaustiveNbHits() bool { if o == nil || o.ExhaustiveNbHits == nil { var ret bool @@ -390,6 +452,7 @@ func (o *BrowseResponse) GetExhaustiveNbHits() bool { // GetExhaustiveNbHitsOk returns a tuple with the ExhaustiveNbHits field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BrowseResponse) GetExhaustiveNbHitsOk() (*bool, bool) { if o == nil || o.ExhaustiveNbHits == nil { return nil, false @@ -407,11 +470,13 @@ func (o *BrowseResponse) HasExhaustiveNbHits() bool { } // SetExhaustiveNbHits gets a reference to the given bool and assigns it to the ExhaustiveNbHits field. +// Deprecated func (o *BrowseResponse) SetExhaustiveNbHits(v bool) { o.ExhaustiveNbHits = &v } // GetExhaustiveTypo returns the ExhaustiveTypo field value if set, zero value otherwise. +// Deprecated func (o *BrowseResponse) GetExhaustiveTypo() bool { if o == nil || o.ExhaustiveTypo == nil { var ret bool @@ -422,6 +487,7 @@ func (o *BrowseResponse) GetExhaustiveTypo() bool { // GetExhaustiveTypoOk returns a tuple with the ExhaustiveTypo field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *BrowseResponse) GetExhaustiveTypoOk() (*bool, bool) { if o == nil || o.ExhaustiveTypo == nil { return nil, false @@ -439,6 +505,7 @@ func (o *BrowseResponse) HasExhaustiveTypo() bool { } // SetExhaustiveTypo gets a reference to the given bool and assigns it to the ExhaustiveTypo field. +// Deprecated func (o *BrowseResponse) SetExhaustiveTypo(v bool) { o.ExhaustiveTypo = &v } @@ -731,38 +798,6 @@ func (o *BrowseResponse) SetPage(v int32) { o.Page = v } -// GetRedirect returns the Redirect field value if set, zero value otherwise. -func (o *BrowseResponse) GetRedirect() BaseSearchResponseRedirect { - if o == nil || o.Redirect == nil { - var ret BaseSearchResponseRedirect - return ret - } - return *o.Redirect -} - -// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BrowseResponse) GetRedirectOk() (*BaseSearchResponseRedirect, bool) { - if o == nil || o.Redirect == nil { - return nil, false - } - return o.Redirect, true -} - -// HasRedirect returns a boolean if a field has been set. -func (o *BrowseResponse) HasRedirect() bool { - if o != nil && o.Redirect != nil { - return true - } - - return false -} - -// SetRedirect gets a reference to the given BaseSearchResponseRedirect and assigns it to the Redirect field. -func (o *BrowseResponse) SetRedirect(v BaseSearchResponseRedirect) { - o.Redirect = &v -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *BrowseResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -819,6 +854,38 @@ func (o *BrowseResponse) SetProcessingTimeMS(v int32) { o.ProcessingTimeMS = v } +// GetProcessingTimingsMS returns the ProcessingTimingsMS field value if set, zero value otherwise. +func (o *BrowseResponse) GetProcessingTimingsMS() map[string]interface{} { + if o == nil || o.ProcessingTimingsMS == nil { + var ret map[string]interface{} + return ret + } + return o.ProcessingTimingsMS +} + +// GetProcessingTimingsMSOk returns a tuple with the ProcessingTimingsMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetProcessingTimingsMSOk() (map[string]interface{}, bool) { + if o == nil || o.ProcessingTimingsMS == nil { + return nil, false + } + return o.ProcessingTimingsMS, true +} + +// HasProcessingTimingsMS returns a boolean if a field has been set. +func (o *BrowseResponse) HasProcessingTimingsMS() bool { + if o != nil && o.ProcessingTimingsMS != nil { + return true + } + + return false +} + +// SetProcessingTimingsMS gets a reference to the given map[string]interface{} and assigns it to the ProcessingTimingsMS field. +func (o *BrowseResponse) SetProcessingTimingsMS(v map[string]interface{}) { + o.ProcessingTimingsMS = v +} + // GetQueryAfterRemoval returns the QueryAfterRemoval field value if set, zero value otherwise. func (o *BrowseResponse) GetQueryAfterRemoval() string { if o == nil || o.QueryAfterRemoval == nil { @@ -851,6 +918,102 @@ func (o *BrowseResponse) SetQueryAfterRemoval(v string) { o.QueryAfterRemoval = &v } +// GetRedirect returns the Redirect field value if set, zero value otherwise. +func (o *BrowseResponse) GetRedirect() Redirect { + if o == nil || o.Redirect == nil { + var ret Redirect + return ret + } + return *o.Redirect +} + +// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetRedirectOk() (*Redirect, bool) { + if o == nil || o.Redirect == nil { + return nil, false + } + return o.Redirect, true +} + +// HasRedirect returns a boolean if a field has been set. +func (o *BrowseResponse) HasRedirect() bool { + if o != nil && o.Redirect != nil { + return true + } + + return false +} + +// SetRedirect gets a reference to the given Redirect and assigns it to the Redirect field. +func (o *BrowseResponse) SetRedirect(v Redirect) { + o.Redirect = &v +} + +// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. +func (o *BrowseResponse) GetRenderingContent() RenderingContent { + if o == nil || o.RenderingContent == nil { + var ret RenderingContent + return ret + } + return *o.RenderingContent +} + +// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetRenderingContentOk() (*RenderingContent, bool) { + if o == nil || o.RenderingContent == nil { + return nil, false + } + return o.RenderingContent, true +} + +// HasRenderingContent returns a boolean if a field has been set. +func (o *BrowseResponse) HasRenderingContent() bool { + if o != nil && o.RenderingContent != nil { + return true + } + + return false +} + +// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. +func (o *BrowseResponse) SetRenderingContent(v RenderingContent) { + o.RenderingContent = &v +} + +// GetServerTimeMS returns the ServerTimeMS field value if set, zero value otherwise. +func (o *BrowseResponse) GetServerTimeMS() int32 { + if o == nil || o.ServerTimeMS == nil { + var ret int32 + return ret + } + return *o.ServerTimeMS +} + +// GetServerTimeMSOk returns a tuple with the ServerTimeMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetServerTimeMSOk() (*int32, bool) { + if o == nil || o.ServerTimeMS == nil { + return nil, false + } + return o.ServerTimeMS, true +} + +// HasServerTimeMS returns a boolean if a field has been set. +func (o *BrowseResponse) HasServerTimeMS() bool { + if o != nil && o.ServerTimeMS != nil { + return true + } + + return false +} + +// SetServerTimeMS gets a reference to the given int32 and assigns it to the ServerTimeMS field. +func (o *BrowseResponse) SetServerTimeMS(v int32) { + o.ServerTimeMS = &v +} + // GetServerUsed returns the ServerUsed field value if set, zero value otherwise. func (o *BrowseResponse) GetServerUsed() string { if o == nil || o.ServerUsed == nil { @@ -916,38 +1079,6 @@ func (o *BrowseResponse) SetUserData(v interface{}) { o.UserData = v } -// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. -func (o *BrowseResponse) GetRenderingContent() RenderingContent { - if o == nil || o.RenderingContent == nil { - var ret RenderingContent - return ret - } - return *o.RenderingContent -} - -// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *BrowseResponse) GetRenderingContentOk() (*RenderingContent, bool) { - if o == nil || o.RenderingContent == nil { - return nil, false - } - return o.RenderingContent, true -} - -// HasRenderingContent returns a boolean if a field has been set. -func (o *BrowseResponse) HasRenderingContent() bool { - if o != nil && o.RenderingContent != nil { - return true - } - - return false -} - -// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. -func (o *BrowseResponse) SetRenderingContent(v RenderingContent) { - o.RenderingContent = &v -} - // GetHits returns the Hits field value func (o *BrowseResponse) GetHits() []Hit { if o == nil { @@ -1066,6 +1197,9 @@ func (o BrowseResponse) MarshalJSON() ([]byte, error) { if o.AutomaticRadius != nil { toSerialize["automaticRadius"] = o.AutomaticRadius } + if o.Exhaustive != nil { + toSerialize["exhaustive"] = o.Exhaustive + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -1105,27 +1239,33 @@ func (o BrowseResponse) MarshalJSON() ([]byte, error) { if true { toSerialize["page"] = o.Page } - if o.Redirect != nil { - toSerialize["redirect"] = o.Redirect - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } if true { toSerialize["processingTimeMS"] = o.ProcessingTimeMS } + if o.ProcessingTimingsMS != nil { + toSerialize["processingTimingsMS"] = o.ProcessingTimingsMS + } if o.QueryAfterRemoval != nil { toSerialize["queryAfterRemoval"] = o.QueryAfterRemoval } + if o.Redirect != nil { + toSerialize["redirect"] = o.Redirect + } + if o.RenderingContent != nil { + toSerialize["renderingContent"] = o.RenderingContent + } + if o.ServerTimeMS != nil { + toSerialize["serverTimeMS"] = o.ServerTimeMS + } if o.ServerUsed != nil { toSerialize["serverUsed"] = o.ServerUsed } if o.UserData != nil { toSerialize["userData"] = o.UserData } - if o.RenderingContent != nil { - toSerialize["renderingContent"] = o.RenderingContent - } if true { toSerialize["hits"] = o.Hits } @@ -1147,6 +1287,7 @@ func (o BrowseResponse) String() string { out += fmt.Sprintf(" abTestVariantID=%v\n", o.AbTestVariantID) out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) + out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) @@ -1160,13 +1301,15 @@ func (o BrowseResponse) String() string { 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(" redirect=%v\n", o.Redirect) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) + out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) out += fmt.Sprintf(" queryAfterRemoval=%v\n", o.QueryAfterRemoval) + out += fmt.Sprintf(" redirect=%v\n", o.Redirect) + out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + out += fmt.Sprintf(" serverTimeMS=%v\n", o.ServerTimeMS) out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) - out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) 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_built_in_operation.go b/clients/algoliasearch-client-go/algolia/search/model_built_in_operation.go index 74930c01f9..48435797dc 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_built_in_operation.go +++ b/clients/algoliasearch-client-go/algolia/search/model_built_in_operation.go @@ -8,9 +8,9 @@ import ( // BuiltInOperation To update an attribute without pushing the entire record, you can use these built-in operations. type BuiltInOperation struct { - Operation BuiltInOperationType `json:"_operation" validate:"required"` + Operation BuiltInOperationType `json:"_operation"` // Value that corresponds to the operation, for example an `Increment` or `Decrement` step, `Add` or `Remove` value. - Value string `json:"value" validate:"required"` + Value string `json:"value"` } // NewBuiltInOperation instantiates a new BuiltInOperation object diff --git a/clients/algoliasearch-client-go/algolia/search/model_consequence_hide.go b/clients/algoliasearch-client-go/algolia/search/model_consequence_hide.go index 688831ee34..b4711a061c 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_consequence_hide.go +++ b/clients/algoliasearch-client-go/algolia/search/model_consequence_hide.go @@ -9,7 +9,7 @@ import ( // ConsequenceHide Unique identifier of the record to hide. type ConsequenceHide struct { // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` } // NewConsequenceHide instantiates a new ConsequenceHide object diff --git a/clients/algoliasearch-client-go/algolia/search/model_created_at_response.go b/clients/algoliasearch-client-go/algolia/search/model_created_at_response.go index ec939bf282..342ddc136f 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_created_at_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_created_at_response.go @@ -9,7 +9,7 @@ import ( // CreatedAtResponse Response and creation timestamp. type CreatedAtResponse struct { // Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` } // NewCreatedAtResponse instantiates a new CreatedAtResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_delete_api_key_response.go b/clients/algoliasearch-client-go/algolia/search/model_delete_api_key_response.go index 65dff7cc1c..fc80cc1e70 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_delete_api_key_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_delete_api_key_response.go @@ -9,7 +9,7 @@ import ( // DeleteApiKeyResponse struct for DeleteApiKeyResponse type DeleteApiKeyResponse struct { // Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - DeletedAt string `json:"deletedAt" validate:"required"` + DeletedAt string `json:"deletedAt"` } // NewDeleteApiKeyResponse instantiates a new DeleteApiKeyResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_delete_source_response.go b/clients/algoliasearch-client-go/algolia/search/model_delete_source_response.go index fd516d229e..179766f120 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_delete_source_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_delete_source_response.go @@ -9,7 +9,7 @@ import ( // DeleteSourceResponse struct for DeleteSourceResponse type DeleteSourceResponse struct { // Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - DeletedAt string `json:"deletedAt" validate:"required"` + DeletedAt string `json:"deletedAt"` } // NewDeleteSourceResponse instantiates a new DeleteSourceResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_deleted_at_response.go b/clients/algoliasearch-client-go/algolia/search/model_deleted_at_response.go index 4dbcd90dcf..362c974da6 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_deleted_at_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_deleted_at_response.go @@ -9,9 +9,9 @@ import ( // DeletedAtResponse Response, taskID, and deletion timestamp. type DeletedAtResponse struct { // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` // Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - DeletedAt string `json:"deletedAt" validate:"required"` + DeletedAt string `json:"deletedAt"` } // NewDeletedAtResponse instantiates a new DeletedAtResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go b/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go index fc3f4c1f96..08e84cd302 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go +++ b/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go @@ -9,9 +9,9 @@ import ( // DictionaryEntry Dictionary entry. type DictionaryEntry struct { // Unique identifier for a dictionary object. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). - Language string `json:"language" validate:"required"` + Language string `json:"language"` // Dictionary entry word. Usage depends on the type of dictionary entry. **`stopwordEntry`** The stop word you want to add or update. If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. **`compoundEntry`** When `decomposition` is empty: adds `word` as a compound atom. For example, atom “kino” decomposes the query “kopfkino” into \"kopf\" and \"kino\". When `decomposition` isn't empty: creates a decomposition exception. For example, when decomposition is set to the [\"hund\", \"hutte\"] exception, \"hundehutte\" decomposes into “hund” and “hutte”, discarding the linking \"e\". Word *string `json:"word,omitempty"` // Compound dictionary [word declensions](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/). If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. diff --git a/clients/algoliasearch-client-go/algolia/search/model_dictionary_settings_params.go b/clients/algoliasearch-client-go/algolia/search/model_dictionary_settings_params.go index 922fcdf794..0aef9ddd3c 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_dictionary_settings_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_dictionary_settings_params.go @@ -8,7 +8,7 @@ import ( // DictionarySettingsParams Enable or turn off the built-in Algolia stop words for a specific language. type DictionarySettingsParams struct { - DisableStandardEntries StandardEntries `json:"disableStandardEntries" validate:"required"` + DisableStandardEntries StandardEntries `json:"disableStandardEntries"` } // NewDictionarySettingsParams instantiates a new DictionarySettingsParams object diff --git a/clients/algoliasearch-client-go/algolia/search/model_exhaustive.go b/clients/algoliasearch-client-go/algolia/search/model_exhaustive.go new file mode 100644 index 0000000000..9c3431eb5a --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/search/model_exhaustive.go @@ -0,0 +1,299 @@ +// 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" +) + +// Exhaustive Whether certain properties of the search response are calculated exhaustive (exact) or approximated. +type Exhaustive struct { + // Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + FacetsCount *bool `json:"facetsCount,omitempty"` + // The value is `false` if not all facet values are retrieved. + FacetValues *bool `json:"facetValues,omitempty"` + // Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + NbHits *bool `json:"nbHits,omitempty"` + // Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + RulesMatch *bool `json:"rulesMatch,omitempty"` + // Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + Typo *bool `json:"typo,omitempty"` +} + +type ExhaustiveOption func(f *Exhaustive) + +func WithExhaustiveFacetsCount(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.FacetsCount = &val + } +} + +func WithExhaustiveFacetValues(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.FacetValues = &val + } +} + +func WithExhaustiveNbHits(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.NbHits = &val + } +} + +func WithExhaustiveRulesMatch(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.RulesMatch = &val + } +} + +func WithExhaustiveTypo(val bool) ExhaustiveOption { + return func(f *Exhaustive) { + f.Typo = &val + } +} + +// NewExhaustive instantiates a new Exhaustive 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 NewExhaustive(opts ...ExhaustiveOption) *Exhaustive { + this := &Exhaustive{} + for _, opt := range opts { + opt(this) + } + return this +} + +// NewExhaustiveWithDefaults instantiates a new Exhaustive object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExhaustiveWithDefaults() *Exhaustive { + this := &Exhaustive{} + return this +} + +// GetFacetsCount returns the FacetsCount field value if set, zero value otherwise. +func (o *Exhaustive) GetFacetsCount() bool { + if o == nil || o.FacetsCount == nil { + var ret bool + return ret + } + return *o.FacetsCount +} + +// GetFacetsCountOk returns a tuple with the FacetsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetFacetsCountOk() (*bool, bool) { + if o == nil || o.FacetsCount == nil { + return nil, false + } + return o.FacetsCount, true +} + +// HasFacetsCount returns a boolean if a field has been set. +func (o *Exhaustive) HasFacetsCount() bool { + if o != nil && o.FacetsCount != nil { + return true + } + + return false +} + +// SetFacetsCount gets a reference to the given bool and assigns it to the FacetsCount field. +func (o *Exhaustive) SetFacetsCount(v bool) { + o.FacetsCount = &v +} + +// GetFacetValues returns the FacetValues field value if set, zero value otherwise. +func (o *Exhaustive) GetFacetValues() bool { + if o == nil || o.FacetValues == nil { + var ret bool + return ret + } + return *o.FacetValues +} + +// GetFacetValuesOk returns a tuple with the FacetValues field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetFacetValuesOk() (*bool, bool) { + if o == nil || o.FacetValues == nil { + return nil, false + } + return o.FacetValues, true +} + +// HasFacetValues returns a boolean if a field has been set. +func (o *Exhaustive) HasFacetValues() bool { + if o != nil && o.FacetValues != nil { + return true + } + + return false +} + +// SetFacetValues gets a reference to the given bool and assigns it to the FacetValues field. +func (o *Exhaustive) SetFacetValues(v bool) { + o.FacetValues = &v +} + +// GetNbHits returns the NbHits field value if set, zero value otherwise. +func (o *Exhaustive) GetNbHits() bool { + if o == nil || o.NbHits == nil { + var ret bool + 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 *Exhaustive) GetNbHitsOk() (*bool, 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 *Exhaustive) HasNbHits() bool { + if o != nil && o.NbHits != nil { + return true + } + + return false +} + +// SetNbHits gets a reference to the given bool and assigns it to the NbHits field. +func (o *Exhaustive) SetNbHits(v bool) { + o.NbHits = &v +} + +// GetRulesMatch returns the RulesMatch field value if set, zero value otherwise. +func (o *Exhaustive) GetRulesMatch() bool { + if o == nil || o.RulesMatch == nil { + var ret bool + return ret + } + return *o.RulesMatch +} + +// GetRulesMatchOk returns a tuple with the RulesMatch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetRulesMatchOk() (*bool, bool) { + if o == nil || o.RulesMatch == nil { + return nil, false + } + return o.RulesMatch, true +} + +// HasRulesMatch returns a boolean if a field has been set. +func (o *Exhaustive) HasRulesMatch() bool { + if o != nil && o.RulesMatch != nil { + return true + } + + return false +} + +// SetRulesMatch gets a reference to the given bool and assigns it to the RulesMatch field. +func (o *Exhaustive) SetRulesMatch(v bool) { + o.RulesMatch = &v +} + +// GetTypo returns the Typo field value if set, zero value otherwise. +func (o *Exhaustive) GetTypo() bool { + if o == nil || o.Typo == nil { + var ret bool + return ret + } + return *o.Typo +} + +// GetTypoOk returns a tuple with the Typo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Exhaustive) GetTypoOk() (*bool, bool) { + if o == nil || o.Typo == nil { + return nil, false + } + return o.Typo, true +} + +// HasTypo returns a boolean if a field has been set. +func (o *Exhaustive) HasTypo() bool { + if o != nil && o.Typo != nil { + return true + } + + return false +} + +// SetTypo gets a reference to the given bool and assigns it to the Typo field. +func (o *Exhaustive) SetTypo(v bool) { + o.Typo = &v +} + +func (o Exhaustive) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if o.FacetsCount != nil { + toSerialize["facetsCount"] = o.FacetsCount + } + if o.FacetValues != nil { + toSerialize["facetValues"] = o.FacetValues + } + if o.NbHits != nil { + toSerialize["nbHits"] = o.NbHits + } + if o.RulesMatch != nil { + toSerialize["rulesMatch"] = o.RulesMatch + } + if o.Typo != nil { + toSerialize["typo"] = o.Typo + } + return json.Marshal(toSerialize) +} + +func (o Exhaustive) String() string { + out := "" + out += fmt.Sprintf(" facetsCount=%v\n", o.FacetsCount) + out += fmt.Sprintf(" facetValues=%v\n", o.FacetValues) + out += fmt.Sprintf(" nbHits=%v\n", o.NbHits) + out += fmt.Sprintf(" rulesMatch=%v\n", o.RulesMatch) + out += fmt.Sprintf(" typo=%v\n", o.Typo) + return fmt.Sprintf("Exhaustive {\n%s}", out) +} + +type NullableExhaustive struct { + value *Exhaustive + isSet bool +} + +func (v NullableExhaustive) Get() *Exhaustive { + return v.value +} + +func (v *NullableExhaustive) Set(val *Exhaustive) { + v.value = val + v.isSet = true +} + +func (v NullableExhaustive) IsSet() bool { + return v.isSet +} + +func (v *NullableExhaustive) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExhaustive(val *Exhaustive) *NullableExhaustive { + return &NullableExhaustive{value: val, isSet: true} +} + +func (v NullableExhaustive) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExhaustive) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/clients/algoliasearch-client-go/algolia/search/model_facet_hits.go b/clients/algoliasearch-client-go/algolia/search/model_facet_hits.go index 5e8575ee1a..b93d8d91de 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_facet_hits.go +++ b/clients/algoliasearch-client-go/algolia/search/model_facet_hits.go @@ -9,11 +9,11 @@ import ( // FacetHits struct for FacetHits type FacetHits struct { // Facet value. - Value string `json:"value" validate:"required"` + Value string `json:"value"` // Markup text with `facetQuery` matches highlighted. - Highlighted string `json:"highlighted" validate:"required"` + Highlighted string `json:"highlighted"` // Number of records containing this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the [counts may not be exhaustive](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). - Count int32 `json:"count" validate:"required"` + Count int32 `json:"count"` } // NewFacetHits instantiates a new FacetHits object diff --git a/clients/algoliasearch-client-go/algolia/search/model_fetched_index.go b/clients/algoliasearch-client-go/algolia/search/model_fetched_index.go index 6d0358f43b..5151692e85 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_fetched_index.go +++ b/clients/algoliasearch-client-go/algolia/search/model_fetched_index.go @@ -9,23 +9,23 @@ import ( // FetchedIndex struct for FetchedIndex type FetchedIndex struct { // Index name. - Name string `json:"name" validate:"required"` + Name string `json:"name"` // Index creation date. An empty string means that the index has no records. - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` // Number of records contained in the index. - Entries int32 `json:"entries" validate:"required"` + Entries int32 `json:"entries"` // Number of bytes of the index in minified format. - DataSize int32 `json:"dataSize" validate:"required"` + DataSize int32 `json:"dataSize"` // Number of bytes of the index binary file. - FileSize int32 `json:"fileSize" validate:"required"` + FileSize int32 `json:"fileSize"` // Last build time. - LastBuildTimeS int32 `json:"lastBuildTimeS" validate:"required"` + LastBuildTimeS int32 `json:"lastBuildTimeS"` // Number of pending indexing operations. This value is deprecated and should not be used. - NumberOfPendingTasks int32 `json:"numberOfPendingTasks" validate:"required"` + NumberOfPendingTasks int32 `json:"numberOfPendingTasks"` // A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. - PendingTask bool `json:"pendingTask" validate:"required"` + PendingTask bool `json:"pendingTask"` // Only present if the index is a replica. Contains the name of the related primary index. Primary *string `json:"primary,omitempty"` // Only present if the index is a primary index with replicas. Contains the names of all linked replicas. diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_api_key_response.go b/clients/algoliasearch-client-go/algolia/search/model_get_api_key_response.go index f841c805b8..dab8c68097 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_api_key_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_api_key_response.go @@ -11,9 +11,9 @@ type GetApiKeyResponse struct { // API key. Value *string `json:"value,omitempty"` // Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). - CreatedAt int64 `json:"createdAt" validate:"required"` + CreatedAt int64 `json:"createdAt"` // [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. - Acl []Acl `json:"acl" validate:"required"` + Acl []Acl `json:"acl"` // Description of an API key for you and your team members. Description *string `json:"description,omitempty"` // Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_dictionary_settings_response.go b/clients/algoliasearch-client-go/algolia/search/model_get_dictionary_settings_response.go index 8c48f3f36c..c39e81f6e6 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_dictionary_settings_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_dictionary_settings_response.go @@ -8,7 +8,7 @@ import ( // GetDictionarySettingsResponse struct for GetDictionarySettingsResponse type GetDictionarySettingsResponse struct { - DisableStandardEntries StandardEntries `json:"disableStandardEntries" validate:"required"` + DisableStandardEntries StandardEntries `json:"disableStandardEntries"` } // NewGetDictionarySettingsResponse instantiates a new GetDictionarySettingsResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_logs_response.go b/clients/algoliasearch-client-go/algolia/search/model_get_logs_response.go index 734aca8303..164dd8b1a6 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_logs_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_logs_response.go @@ -8,7 +8,7 @@ import ( // GetLogsResponse struct for GetLogsResponse type GetLogsResponse struct { - Logs []Log `json:"logs" validate:"required"` + Logs []Log `json:"logs"` } // NewGetLogsResponse instantiates a new GetLogsResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_objects_params.go b/clients/algoliasearch-client-go/algolia/search/model_get_objects_params.go index 6e53798a8d..c10a9b6c7f 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_objects_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_objects_params.go @@ -8,7 +8,7 @@ import ( // GetObjectsParams Request parameters. type GetObjectsParams struct { - Requests []GetObjectsRequest `json:"requests" validate:"required"` + Requests []GetObjectsRequest `json:"requests"` } // NewGetObjectsParams instantiates a new GetObjectsParams object diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_objects_request.go b/clients/algoliasearch-client-go/algolia/search/model_get_objects_request.go index a5838e3e29..fead8bef1a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_objects_request.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_objects_request.go @@ -11,9 +11,9 @@ type GetObjectsRequest struct { // Attributes to retrieve. If not specified, all retrievable attributes are returned. AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"` // Record's objectID. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // Name of the index containing the required records. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` } type GetObjectsRequestOption func(f *GetObjectsRequest) diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_objects_response.go b/clients/algoliasearch-client-go/algolia/search/model_get_objects_response.go index 0713fead7b..b6e17b08e9 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_objects_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_objects_response.go @@ -9,7 +9,7 @@ import ( // GetObjectsResponse struct for GetObjectsResponse type GetObjectsResponse struct { // Retrieved results. - Results []map[string]interface{} `json:"results" validate:"required"` + Results []map[string]interface{} `json:"results"` } // NewGetObjectsResponse instantiates a new GetObjectsResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_task_response.go b/clients/algoliasearch-client-go/algolia/search/model_get_task_response.go index f086a67958..357982844b 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_task_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_task_response.go @@ -8,7 +8,7 @@ import ( // GetTaskResponse struct for GetTaskResponse type GetTaskResponse struct { - Status TaskStatus `json:"status" validate:"required"` + Status TaskStatus `json:"status"` } // NewGetTaskResponse instantiates a new GetTaskResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_get_top_user_ids_response.go b/clients/algoliasearch-client-go/algolia/search/model_get_top_user_ids_response.go index cf8e60e9c4..a9327d7a25 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_get_top_user_ids_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_get_top_user_ids_response.go @@ -9,7 +9,7 @@ import ( // GetTopUserIdsResponse User IDs and clusters. type GetTopUserIdsResponse struct { // Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. - TopUsers []map[string][]UserId `json:"topUsers" validate:"required"` + TopUsers []map[string][]UserId `json:"topUsers"` } // NewGetTopUserIdsResponse instantiates a new GetTopUserIdsResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_has_pending_mappings_response.go b/clients/algoliasearch-client-go/algolia/search/model_has_pending_mappings_response.go index c9a74ac9ef..b75e256b67 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_has_pending_mappings_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_has_pending_mappings_response.go @@ -9,7 +9,7 @@ import ( // HasPendingMappingsResponse struct for HasPendingMappingsResponse type HasPendingMappingsResponse struct { // Indicates whether there are clusters undergoing migration, creation, or deletion. - Pending bool `json:"pending" validate:"required"` + Pending bool `json:"pending"` // Cluster pending mapping state: migrating, creating, deleting. Clusters *map[string][]string `json:"clusters,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_highlight_result_option.go b/clients/algoliasearch-client-go/algolia/search/model_highlight_result_option.go index 5f3ee633fc..25073cb1df 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_highlight_result_option.go +++ b/clients/algoliasearch-client-go/algolia/search/model_highlight_result_option.go @@ -9,10 +9,10 @@ import ( // HighlightResultOption Show highlighted section and words matched on a query. type HighlightResultOption struct { // Markup text with `facetQuery` matches highlighted. - Value string `json:"value" validate:"required"` - MatchLevel MatchLevel `json:"matchLevel" validate:"required"` + Value string `json:"value"` + MatchLevel MatchLevel `json:"matchLevel"` // List of words from the query that matched the object. - MatchedWords []string `json:"matchedWords" validate:"required"` + MatchedWords []string `json:"matchedWords"` // Whether the entire attribute value is highlighted. FullyHighlighted *bool `json:"fullyHighlighted,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_hit.go b/clients/algoliasearch-client-go/algolia/search/model_hit.go index 1ec2bb92b7..b8343a8bf0 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_hit.go +++ b/clients/algoliasearch-client-go/algolia/search/model_hit.go @@ -9,7 +9,7 @@ import ( // Hit A single hit. type Hit struct { // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // Show highlighted section and words matched on a query. HighlightResult *map[string]HighlightResult `json:"_highlightResult,omitempty"` // Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. diff --git a/clients/algoliasearch-client-go/algolia/search/model_languages.go b/clients/algoliasearch-client-go/algolia/search/model_languages.go index b3fb705b38..3344d9bc13 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_languages.go +++ b/clients/algoliasearch-client-go/algolia/search/model_languages.go @@ -8,9 +8,9 @@ import ( // Languages Dictionary language. type Languages struct { - Plurals NullableDictionaryLanguage `json:"plurals" validate:"required"` - Stopwords NullableDictionaryLanguage `json:"stopwords" validate:"required"` - Compounds NullableDictionaryLanguage `json:"compounds" validate:"required"` + Plurals NullableDictionaryLanguage `json:"plurals"` + Stopwords NullableDictionaryLanguage `json:"stopwords"` + Compounds NullableDictionaryLanguage `json:"compounds"` } // NewLanguages instantiates a new Languages object diff --git a/clients/algoliasearch-client-go/algolia/search/model_list_api_keys_response.go b/clients/algoliasearch-client-go/algolia/search/model_list_api_keys_response.go index 6527ccfae5..87998735a6 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_list_api_keys_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_list_api_keys_response.go @@ -9,7 +9,7 @@ import ( // ListApiKeysResponse struct for ListApiKeysResponse type ListApiKeysResponse struct { // API keys. - Keys []GetApiKeyResponse `json:"keys" validate:"required"` + Keys []GetApiKeyResponse `json:"keys"` } // NewListApiKeysResponse instantiates a new ListApiKeysResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_list_clusters_response.go b/clients/algoliasearch-client-go/algolia/search/model_list_clusters_response.go index 269010be3b..af968ff478 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_list_clusters_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_list_clusters_response.go @@ -9,7 +9,7 @@ import ( // ListClustersResponse Clusters. type ListClustersResponse struct { // Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. - TopUsers []string `json:"topUsers" validate:"required"` + TopUsers []string `json:"topUsers"` } // NewListClustersResponse instantiates a new ListClustersResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_list_indices_response.go b/clients/algoliasearch-client-go/algolia/search/model_list_indices_response.go index a1ac64493e..df0691229d 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_list_indices_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_list_indices_response.go @@ -9,7 +9,7 @@ import ( // ListIndicesResponse struct for ListIndicesResponse type ListIndicesResponse struct { // All indices in your Algolia application. - Items []FetchedIndex `json:"items" validate:"required"` + Items []FetchedIndex `json:"items"` // Number of pages. NbPages *int32 `json:"nbPages,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_list_user_ids_response.go b/clients/algoliasearch-client-go/algolia/search/model_list_user_ids_response.go index 026997eddf..1c040fcaf5 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_list_user_ids_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_list_user_ids_response.go @@ -9,7 +9,7 @@ import ( // ListUserIdsResponse User ID data. type ListUserIdsResponse struct { // User IDs. - UserIDs []UserId `json:"userIDs" validate:"required"` + UserIDs []UserId `json:"userIDs"` } // NewListUserIdsResponse instantiates a new ListUserIdsResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_log.go b/clients/algoliasearch-client-go/algolia/search/model_log.go index c440b201c8..224db955ed 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_log.go +++ b/clients/algoliasearch-client-go/algolia/search/model_log.go @@ -9,27 +9,27 @@ import ( // Log struct for Log type Log struct { // Timestamp in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - Timestamp string `json:"timestamp" validate:"required"` + Timestamp string `json:"timestamp"` // HTTP method of the performed request. - Method string `json:"method" validate:"required"` + Method string `json:"method"` // HTTP response code. - AnswerCode string `json:"answer_code" validate:"required"` + AnswerCode string `json:"answer_code"` // Request body. Truncated after 1,000 characters. - QueryBody string `json:"query_body" validate:"required"` + QueryBody string `json:"query_body"` // Answer body. Truncated after 1,000 characters. - Answer string `json:"answer" validate:"required"` + Answer string `json:"answer"` // Request URL. - Url string `json:"url" validate:"required"` + Url string `json:"url"` // IP address of the client that performed the request. - Ip string `json:"ip" validate:"required"` + Ip string `json:"ip"` // Request headers (API key is obfuscated). - QueryHeaders string `json:"query_headers" validate:"required"` + QueryHeaders string `json:"query_headers"` // SHA1 signature of the log entry. - Sha1 string `json:"sha1" validate:"required"` + Sha1 string `json:"sha1"` // Number of API calls. - NbApiCalls string `json:"nb_api_calls" validate:"required"` + NbApiCalls string `json:"nb_api_calls"` // Processing time for the query. Doesn't include network time. - ProcessingTimeMs string `json:"processing_time_ms" validate:"required"` + ProcessingTimeMs string `json:"processing_time_ms"` // Index targeted by the query. Index *string `json:"index,omitempty"` // Query parameters sent with the request. diff --git a/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go b/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go index 03950d9285..8ba26a9d2e 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go +++ b/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go @@ -8,11 +8,11 @@ import ( // MultipleBatchRequest struct for MultipleBatchRequest type MultipleBatchRequest struct { - Action Action `json:"action" validate:"required"` + Action Action `json:"action"` // Operation arguments (varies with specified `action`). - Body map[string]interface{} `json:"body" validate:"required"` + Body map[string]interface{} `json:"body"` // Index to target for this operation. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` } // NewMultipleBatchRequest instantiates a new MultipleBatchRequest object diff --git a/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_response.go b/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_response.go index 1d3d306454..ed8a92cb50 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_response.go @@ -9,9 +9,9 @@ import ( // MultipleBatchResponse struct for MultipleBatchResponse type MultipleBatchResponse struct { // TaskIDs per index. - TaskID map[string]int64 `json:"taskID" validate:"required"` + TaskID map[string]int64 `json:"taskID"` // Unique object (record) identifiers. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` } // NewMultipleBatchResponse instantiates a new MultipleBatchResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_operation_index_params.go b/clients/algoliasearch-client-go/algolia/search/model_operation_index_params.go index 39bc599cb9..24f6b2039a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_operation_index_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_operation_index_params.go @@ -8,9 +8,9 @@ import ( // OperationIndexParams struct for OperationIndexParams type OperationIndexParams struct { - Operation OperationType `json:"operation" validate:"required"` + Operation OperationType `json:"operation"` // Algolia index name. - Destination string `json:"destination" validate:"required"` + Destination string `json:"destination"` // **This only applies to the _copy_ operation.** If you omit `scope`, the copy command copies all records, settings, synonyms, and rules. If you specify `scope`, only the specified scopes are copied. Scope []ScopeType `json:"scope,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_promote_object_id.go b/clients/algoliasearch-client-go/algolia/search/model_promote_object_id.go index eb54be179b..78235a9fb4 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_promote_object_id.go +++ b/clients/algoliasearch-client-go/algolia/search/model_promote_object_id.go @@ -9,9 +9,9 @@ import ( // PromoteObjectID Record to promote. type PromoteObjectID struct { // Unique identifier of the record to promote. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. - Position int32 `json:"position" validate:"required"` + Position int32 `json:"position"` } // NewPromoteObjectID instantiates a new PromoteObjectID object diff --git a/clients/algoliasearch-client-go/algolia/search/model_promote_object_ids.go b/clients/algoliasearch-client-go/algolia/search/model_promote_object_ids.go index 0700432b83..51212bbc8c 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_promote_object_ids.go +++ b/clients/algoliasearch-client-go/algolia/search/model_promote_object_ids.go @@ -9,9 +9,9 @@ import ( // PromoteObjectIDs Records to promote. type PromoteObjectIDs struct { // Unique identifiers of the records to promote. - ObjectIDs []string `json:"objectIDs" validate:"required"` + ObjectIDs []string `json:"objectIDs"` // The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. - Position int32 `json:"position" validate:"required"` + Position int32 `json:"position"` } // NewPromoteObjectIDs instantiates a new PromoteObjectIDs object diff --git a/clients/algoliasearch-client-go/algolia/search/model_ranking_info.go b/clients/algoliasearch-client-go/algolia/search/model_ranking_info.go index a510acf6f2..088078731a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_ranking_info.go +++ b/clients/algoliasearch-client-go/algolia/search/model_ranking_info.go @@ -9,27 +9,27 @@ import ( // RankingInfo struct for RankingInfo type RankingInfo struct { // This field is reserved for advanced usage. - Filters int32 `json:"filters" validate:"required"` + Filters int32 `json:"filters"` // Position of the most important matched attribute in the attributes to index list. - FirstMatchedWord int32 `json:"firstMatchedWord" validate:"required"` + FirstMatchedWord int32 `json:"firstMatchedWord"` // Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). - GeoDistance int32 `json:"geoDistance" validate:"required"` + GeoDistance int32 `json:"geoDistance"` // Precision used when computing the geo distance, in meters. GeoPrecision *int32 `json:"geoPrecision,omitempty"` MatchedGeoLocation *MatchedGeoLocation `json:"matchedGeoLocation,omitempty"` Personalization *Personalization `json:"personalization,omitempty"` // Number of exactly matched words. - NbExactWords int32 `json:"nbExactWords" validate:"required"` + NbExactWords int32 `json:"nbExactWords"` // Number of typos encountered when matching the record. - NbTypos int32 `json:"nbTypos" validate:"required"` + NbTypos int32 `json:"nbTypos"` // Present and set to true if a Rule promoted the hit. - Promoted bool `json:"promoted" validate:"required"` + Promoted bool `json:"promoted"` // When the query contains more than one word, the sum of the distances between matched words (in meters). ProximityDistance *int32 `json:"proximityDistance,omitempty"` // Custom ranking for the object, expressed as a single integer value. - UserScore int32 `json:"userScore" validate:"required"` + UserScore int32 `json:"userScore"` // Number of matched words, including prefixes and typos. - Words int32 `json:"words" validate:"required"` + Words int32 `json:"words"` // Wether the record are promoted by the re-ranking strategy. PromotedByReRanking *bool `json:"promotedByReRanking,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_redirect.go b/clients/algoliasearch-client-go/algolia/search/model_redirect.go new file mode 100644 index 0000000000..feda075c42 --- /dev/null +++ b/clients/algoliasearch-client-go/algolia/search/model_redirect.go @@ -0,0 +1,122 @@ +// 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" +) + +// Redirect [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). +type Redirect struct { + Index []RedirectRuleIndexMetadata `json:"index,omitempty"` +} + +type RedirectOption func(f *Redirect) + +func WithRedirectIndex(val []RedirectRuleIndexMetadata) RedirectOption { + return func(f *Redirect) { + f.Index = val + } +} + +// NewRedirect instantiates a new Redirect 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 NewRedirect(opts ...RedirectOption) *Redirect { + this := &Redirect{} + for _, opt := range opts { + opt(this) + } + return this +} + +// NewRedirectWithDefaults instantiates a new Redirect object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRedirectWithDefaults() *Redirect { + this := &Redirect{} + return this +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *Redirect) GetIndex() []RedirectRuleIndexMetadata { + if o == nil || o.Index == nil { + var ret []RedirectRuleIndexMetadata + return ret + } + return o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Redirect) GetIndexOk() ([]RedirectRuleIndexMetadata, bool) { + if o == nil || o.Index == nil { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *Redirect) HasIndex() bool { + if o != nil && o.Index != nil { + return true + } + + return false +} + +// SetIndex gets a reference to the given []RedirectRuleIndexMetadata and assigns it to the Index field. +func (o *Redirect) SetIndex(v []RedirectRuleIndexMetadata) { + o.Index = v +} + +func (o Redirect) MarshalJSON() ([]byte, error) { + toSerialize := map[string]any{} + if o.Index != nil { + toSerialize["index"] = o.Index + } + return json.Marshal(toSerialize) +} + +func (o Redirect) String() string { + out := "" + out += fmt.Sprintf(" index=%v\n", o.Index) + return fmt.Sprintf("Redirect {\n%s}", out) +} + +type NullableRedirect struct { + value *Redirect + isSet bool +} + +func (v NullableRedirect) Get() *Redirect { + return v.value +} + +func (v *NullableRedirect) Set(val *Redirect) { + v.value = val + v.isSet = true +} + +func (v NullableRedirect) IsSet() bool { + return v.isSet +} + +func (v *NullableRedirect) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRedirect(val *Redirect) *NullableRedirect { + return &NullableRedirect{value: val, isSet: true} +} + +func (v NullableRedirect) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRedirect) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata.go b/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata.go index d4b896c260..634fc7c4da 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata.go +++ b/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata.go @@ -9,14 +9,14 @@ import ( // RedirectRuleIndexMetadata struct for RedirectRuleIndexMetadata type RedirectRuleIndexMetadata struct { // Source index for the redirect rule. - Source string `json:"source" validate:"required"` + Source string `json:"source"` // Destination index for the redirect rule. - Dest string `json:"dest" validate:"required"` + Dest string `json:"dest"` // Reason for the redirect rule. - Reason string `json:"reason" validate:"required"` + Reason string `json:"reason"` // Redirect rule status. - Succeed bool `json:"succeed" validate:"required"` - Data RedirectRuleIndexMetadataData `json:"data" validate:"required"` + Succeed bool `json:"succeed"` + Data RedirectRuleIndexMetadataData `json:"data"` } // NewRedirectRuleIndexMetadata instantiates a new RedirectRuleIndexMetadata object diff --git a/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata_data.go b/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata_data.go index 5c063e657d..27b0391114 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata_data.go +++ b/clients/algoliasearch-client-go/algolia/search/model_redirect_rule_index_metadata_data.go @@ -8,7 +8,7 @@ import ( // RedirectRuleIndexMetadataData Redirect rule data. type RedirectRuleIndexMetadataData struct { - RuleObjectID string `json:"ruleObjectID" validate:"required"` + RuleObjectID string `json:"ruleObjectID"` } // NewRedirectRuleIndexMetadataData instantiates a new RedirectRuleIndexMetadataData object diff --git a/clients/algoliasearch-client-go/algolia/search/model_remove_user_id_response.go b/clients/algoliasearch-client-go/algolia/search/model_remove_user_id_response.go index b33af574b9..c0d4bef48c 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_remove_user_id_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_remove_user_id_response.go @@ -9,7 +9,7 @@ import ( // RemoveUserIdResponse struct for RemoveUserIdResponse type RemoveUserIdResponse struct { // Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - DeletedAt string `json:"deletedAt" validate:"required"` + DeletedAt string `json:"deletedAt"` } // NewRemoveUserIdResponse instantiates a new RemoveUserIdResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_replace_source_response.go b/clients/algoliasearch-client-go/algolia/search/model_replace_source_response.go index ab7ebad10a..0403b9e356 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_replace_source_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_replace_source_response.go @@ -9,7 +9,7 @@ import ( // ReplaceSourceResponse struct for ReplaceSourceResponse type ReplaceSourceResponse struct { // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewReplaceSourceResponse instantiates a new ReplaceSourceResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_rule.go b/clients/algoliasearch-client-go/algolia/search/model_rule.go index 027e705144..b673b7214e 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_rule.go +++ b/clients/algoliasearch-client-go/algolia/search/model_rule.go @@ -9,7 +9,7 @@ import ( // Rule Rule object. type Rule struct { // Unique identifier for a rule object. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. Conditions []Condition `json:"conditions,omitempty"` Consequence *Consequence `json:"consequence,omitempty"` diff --git a/clients/algoliasearch-client-go/algolia/search/model_save_object_response.go b/clients/algoliasearch-client-go/algolia/search/model_save_object_response.go index dc852f6dcf..ba3f9d5343 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_save_object_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_save_object_response.go @@ -9,9 +9,9 @@ import ( // SaveObjectResponse struct for SaveObjectResponse type SaveObjectResponse struct { // Date of creation (ISO-8601 format). - CreatedAt string `json:"createdAt" validate:"required"` + CreatedAt string `json:"createdAt"` // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` // Unique object identifier. ObjectID *string `json:"objectID,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_save_synonym_response.go b/clients/algoliasearch-client-go/algolia/search/model_save_synonym_response.go index 97745105d2..85817ab901 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_save_synonym_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_save_synonym_response.go @@ -9,11 +9,11 @@ import ( // SaveSynonymResponse struct for SaveSynonymResponse type SaveSynonymResponse struct { // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` // Unique identifier of a synonym object. - Id string `json:"id" validate:"required"` + Id string `json:"id"` } // NewSaveSynonymResponse instantiates a new SaveSynonymResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_dictionary_entries_params.go b/clients/algoliasearch-client-go/algolia/search/model_search_dictionary_entries_params.go index 0c02b52e51..335458685d 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_dictionary_entries_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_dictionary_entries_params.go @@ -9,7 +9,7 @@ import ( // SearchDictionaryEntriesParams `searchDictionaryEntries` parameters. type SearchDictionaryEntriesParams struct { // Text to search for in an index. - Query string `json:"query" validate:"required"` + Query string `json:"query"` // Page to retrieve (the first page is `0`, not `1`). Page *int32 `json:"page,omitempty"` // Number of hits per page. diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_for_facet_values_response.go b/clients/algoliasearch-client-go/algolia/search/model_search_for_facet_values_response.go index 08902b2b1c..df8c2847a5 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_for_facet_values_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_for_facet_values_response.go @@ -8,7 +8,7 @@ import ( // SearchForFacetValuesResponse struct for SearchForFacetValuesResponse type SearchForFacetValuesResponse struct { - FacetHits []FacetHits `json:"facetHits" validate:"required"` + FacetHits []FacetHits `json:"facetHits"` } // NewSearchForFacetValuesResponse instantiates a new SearchForFacetValuesResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_for_facets.go b/clients/algoliasearch-client-go/algolia/search/model_search_for_facets.go index 9bdbd652fe..704c97e67a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_for_facets.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_for_facets.go @@ -150,12 +150,12 @@ type SearchForFacets struct { EnableReRanking *bool `json:"enableReRanking,omitempty"` ReRankingApplyFilter NullableReRankingApplyFilter `json:"reRankingApplyFilter,omitempty"` // Facet name. - Facet string `json:"facet" validate:"required"` + Facet string `json:"facet"` // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Text to search inside the facet's values. FacetQuery *string `json:"facetQuery,omitempty"` - Type SearchTypeFacet `json:"type" validate:"required"` + Type SearchTypeFacet `json:"type"` } type SearchForFacetsOption func(f *SearchForFacets) diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_for_facets_options.go b/clients/algoliasearch-client-go/algolia/search/model_search_for_facets_options.go index 685065a496..5901c6b70e 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_for_facets_options.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_for_facets_options.go @@ -9,14 +9,14 @@ import ( // SearchForFacetsOptions struct for SearchForFacetsOptions type SearchForFacetsOptions struct { // Facet name. - Facet string `json:"facet" validate:"required"` + Facet string `json:"facet"` // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` // Text to search inside the facet's values. FacetQuery *string `json:"facetQuery,omitempty"` // Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). MaxFacetHits *int32 `json:"maxFacetHits,omitempty"` - Type SearchTypeFacet `json:"type" validate:"required"` + Type SearchTypeFacet `json:"type"` } type SearchForFacetsOptionsOption func(f *SearchForFacetsOptions) diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_for_hits.go b/clients/algoliasearch-client-go/algolia/search/model_search_for_hits.go index a039e291ca..193018f89b 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_for_hits.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_for_hits.go @@ -150,7 +150,7 @@ type SearchForHits struct { EnableReRanking *bool `json:"enableReRanking,omitempty"` ReRankingApplyFilter NullableReRankingApplyFilter `json:"reRankingApplyFilter,omitempty"` // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` Type *SearchTypeDefault `json:"type,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_for_hits_options.go b/clients/algoliasearch-client-go/algolia/search/model_search_for_hits_options.go index 989d5e6429..73c8f8a16c 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_for_hits_options.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_for_hits_options.go @@ -9,7 +9,7 @@ import ( // SearchForHitsOptions struct for SearchForHitsOptions type SearchForHitsOptions struct { // Algolia index name. - IndexName string `json:"indexName" validate:"required"` + IndexName string `json:"indexName"` Type *SearchTypeDefault `json:"type,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_hits.go b/clients/algoliasearch-client-go/algolia/search/model_search_hits.go index e7f86e5551..74d988064a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_hits.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_hits.go @@ -8,13 +8,16 @@ import ( // SearchHits struct for SearchHits type SearchHits struct { - Hits []Hit `json:"hits" validate:"required"` + Hits []Hit `json:"hits"` // Text to search for in an index. - Query string `json:"query" validate:"required"` + Query string `json:"query"` // URL-encoded string of all search parameters. - Params string `json:"params" validate:"required"` + Params string `json:"params"` + AdditionalProperties map[string]any } +type _SearchHits SearchHits + // NewSearchHits instantiates a new SearchHits 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 @@ -120,14 +123,41 @@ func (o SearchHits) MarshalJSON() ([]byte, error) { if true { toSerialize["params"] = o.Params } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) } +func (o *SearchHits) UnmarshalJSON(bytes []byte) (err error) { + varSearchHits := _SearchHits{} + + if err = json.Unmarshal(bytes, &varSearchHits); err == nil { + *o = SearchHits(varSearchHits) + } + + additionalProperties := make(map[string]any) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "hits") + delete(additionalProperties, "query") + delete(additionalProperties, "params") + o.AdditionalProperties = additionalProperties + } + + return err +} + func (o SearchHits) String() string { out := "" out += fmt.Sprintf(" hits=%v\n", o.Hits) out += fmt.Sprintf(" query=%v\n", o.Query) out += fmt.Sprintf(" params=%v\n", o.Params) + for key, value := range o.AdditionalProperties { + out += fmt.Sprintf(" %s=%v\n", key, value) + } return fmt.Sprintf("SearchHits {\n%s}", out) } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_method_params.go b/clients/algoliasearch-client-go/algolia/search/model_search_method_params.go index 88ae7f5443..9ab6311955 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_method_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_method_params.go @@ -8,7 +8,7 @@ import ( // SearchMethodParams struct for SearchMethodParams type SearchMethodParams struct { - Requests []SearchQuery `json:"requests" validate:"required"` + Requests []SearchQuery `json:"requests"` Strategy *SearchStrategy `json:"strategy,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_params.go b/clients/algoliasearch-client-go/algolia/search/model_search_params.go index 6377bd83a0..6263790f4a 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_params.go @@ -29,6 +29,41 @@ func SearchParamsStringAsSearchParams(v *SearchParamsString) SearchParams { // Unmarshal JSON data into one of the pointers in the struct func (dst *SearchParams) UnmarshalJSON(data []byte) error { var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]any + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("Failed to unmarshal JSON into map for the discriminator lookup (SearchParamsString).") + } + + // Hold the schema validity between checks + validSchemaForModel := true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'params' + if _, ok := jsonDict["params"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into SearchParamsString + err = newStrictDecoder(data).Decode(&dst.SearchParamsString) + if err == nil && validateStruct(dst.SearchParamsString) == nil { + jsonSearchParamsString, _ := json.Marshal(dst.SearchParamsString) + if string(jsonSearchParamsString) == "{}" { // empty struct + dst.SearchParamsString = nil + } else { + return nil + } + } else { + dst.SearchParamsString = nil + } + } + + // Reset the schema validity for the next class check + validSchemaForModel = true // try to unmarshal data into SearchParamsObject err = newStrictDecoder(data).Decode(&dst.SearchParamsObject) if err == nil && validateStruct(dst.SearchParamsObject) == nil { @@ -42,19 +77,6 @@ func (dst *SearchParams) UnmarshalJSON(data []byte) error { dst.SearchParamsObject = nil } - // try to unmarshal data into SearchParamsString - err = newStrictDecoder(data).Decode(&dst.SearchParamsString) - if err == nil && validateStruct(dst.SearchParamsString) == nil { - jsonSearchParamsString, _ := json.Marshal(dst.SearchParamsString) - if string(jsonSearchParamsString) == "{}" { // empty struct - dst.SearchParamsString = nil - } else { - return nil - } - } else { - dst.SearchParamsString = nil - } - return fmt.Errorf("Data failed to match schemas in oneOf(SearchParams)") } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_query.go b/clients/algoliasearch-client-go/algolia/search/model_search_query.go index 947f75ea2a..d42d1cb8ea 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_query.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_query.go @@ -29,19 +29,50 @@ func SearchForHitsAsSearchQuery(v *SearchForHits) SearchQuery { // Unmarshal JSON data into one of the pointers in the struct func (dst *SearchQuery) UnmarshalJSON(data []byte) error { var err error - // try to unmarshal data into SearchForFacets - err = newStrictDecoder(data).Decode(&dst.SearchForFacets) - if err == nil && validateStruct(dst.SearchForFacets) == nil { - jsonSearchForFacets, _ := json.Marshal(dst.SearchForFacets) - if string(jsonSearchForFacets) == "{}" { // empty struct - dst.SearchForFacets = nil + // use discriminator value to speed up the lookup + var jsonDict map[string]any + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("Failed to unmarshal JSON into map for the discriminator lookup (SearchForFacets).") + } + + // Hold the schema validity between checks + validSchemaForModel := true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'facet' + if _, ok := jsonDict["facet"]; !ok { + validSchemaForModel = false + } + } + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'type' + if _, ok := jsonDict["type"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into SearchForFacets + err = newStrictDecoder(data).Decode(&dst.SearchForFacets) + if err == nil && validateStruct(dst.SearchForFacets) == nil { + jsonSearchForFacets, _ := json.Marshal(dst.SearchForFacets) + if string(jsonSearchForFacets) == "{}" { // empty struct + dst.SearchForFacets = nil + } else { + return nil + } } else { - return nil + dst.SearchForFacets = nil } - } else { - dst.SearchForFacets = nil } + // Reset the schema validity for the next class check + validSchemaForModel = true + // try to unmarshal data into SearchForHits err = newStrictDecoder(data).Decode(&dst.SearchForHits) if err == nil && validateStruct(dst.SearchForHits) == nil { 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 e25b3b4f0f..3fe4a12311 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_response.go @@ -15,19 +15,23 @@ type SearchResponse struct { // Computed geographical location. AroundLatLng *string `json:"aroundLatLng,omitempty"` // Automatically-computed radius. - AutomaticRadius *string `json:"automaticRadius,omitempty"` - // Indicates whether the facet count is exhaustive (exact) or approximate. + AutomaticRadius *string `json:"automaticRadius,omitempty"` + Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // See the `facetsCount` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` - // Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + // See the `nbHits` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveNbHits *bool `json:"exhaustiveNbHits,omitempty"` - // Indicates whether the search for typos was exhaustive (exact) or approximate. + // See the `typo` field of the `exhaustive` object in the response. + // Deprecated ExhaustiveTypo *bool `json:"exhaustiveTypo,omitempty"` // Mapping of each facet name to the corresponding facet counts. 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" validate:"required"` + 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. @@ -35,32 +39,39 @@ type SearchResponse struct { // Warnings about the query. Message *string `json:"message,omitempty"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Number of pages of results for the current query. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` // Number of hits selected and sorted by the relevant sort algorithm. NbSortedHits *int32 `json:"nbSortedHits,omitempty"` // Page to retrieve (the first page is `0`, not `1`). - Page int32 `json:"page" validate:"required"` - Redirect *BaseSearchResponseRedirect `json:"redirect,omitempty"` + 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. - ProcessingTimeMS int32 `json:"processingTimeMS" validate:"required"` + ProcessingTimeMS int32 `json:"processingTimeMS"` + // Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + ProcessingTimingsMS map[string]interface{} `json:"processingTimingsMS,omitempty"` // Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. - QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + QueryAfterRemoval *string `json:"queryAfterRemoval,omitempty"` + Redirect *Redirect `json:"redirect,omitempty"` + RenderingContent *RenderingContent `json:"renderingContent,omitempty"` + // Time the server took to process the request, in milliseconds. + ServerTimeMS *int32 `json:"serverTimeMS,omitempty"` // Host name of the server that processed the request. ServerUsed *string `json:"serverUsed,omitempty"` // Lets you store custom data in your indices. - UserData interface{} `json:"userData,omitempty"` - RenderingContent *RenderingContent `json:"renderingContent,omitempty"` - Hits []Hit `json:"hits" validate:"required"` + UserData interface{} `json:"userData,omitempty"` + Hits []Hit `json:"hits"` // Text to search for in an index. - Query string `json:"query" validate:"required"` + Query string `json:"query"` // URL-encoded string of all search parameters. - Params string `json:"params" validate:"required"` + Params string `json:"params"` + AdditionalProperties map[string]any } +type _SearchResponse SearchResponse + type SearchResponseOption func(f *SearchResponse) func WithSearchResponseAbTestID(val int32) SearchResponseOption { @@ -87,6 +98,12 @@ func WithSearchResponseAutomaticRadius(val string) SearchResponseOption { } } +func WithSearchResponseExhaustive(val Exhaustive) SearchResponseOption { + return func(f *SearchResponse) { + f.Exhaustive = &val + } +} + func WithSearchResponseExhaustiveFacetsCount(val bool) SearchResponseOption { return func(f *SearchResponse) { f.ExhaustiveFacetsCount = &val @@ -141,15 +158,15 @@ func WithSearchResponseNbSortedHits(val int32) SearchResponseOption { } } -func WithSearchResponseRedirect(val BaseSearchResponseRedirect) SearchResponseOption { +func WithSearchResponseParsedQuery(val string) SearchResponseOption { return func(f *SearchResponse) { - f.Redirect = &val + f.ParsedQuery = &val } } -func WithSearchResponseParsedQuery(val string) SearchResponseOption { +func WithSearchResponseProcessingTimingsMS(val map[string]interface{}) SearchResponseOption { return func(f *SearchResponse) { - f.ParsedQuery = &val + f.ProcessingTimingsMS = val } } @@ -159,21 +176,33 @@ func WithSearchResponseQueryAfterRemoval(val string) SearchResponseOption { } } -func WithSearchResponseServerUsed(val string) SearchResponseOption { +func WithSearchResponseRedirect(val Redirect) SearchResponseOption { return func(f *SearchResponse) { - f.ServerUsed = &val + f.Redirect = &val } } -func WithSearchResponseUserData(val interface{}) SearchResponseOption { +func WithSearchResponseRenderingContent(val RenderingContent) SearchResponseOption { return func(f *SearchResponse) { - f.UserData = val + f.RenderingContent = &val } } -func WithSearchResponseRenderingContent(val RenderingContent) SearchResponseOption { +func WithSearchResponseServerTimeMS(val int32) SearchResponseOption { return func(f *SearchResponse) { - f.RenderingContent = &val + f.ServerTimeMS = &val + } +} + +func WithSearchResponseServerUsed(val string) SearchResponseOption { + return func(f *SearchResponse) { + f.ServerUsed = &val + } +} + +func WithSearchResponseUserData(val interface{}) SearchResponseOption { + return func(f *SearchResponse) { + f.UserData = val } } @@ -339,7 +368,40 @@ func (o *SearchResponse) SetAutomaticRadius(v string) { o.AutomaticRadius = &v } +// GetExhaustive returns the Exhaustive field value if set, zero value otherwise. +func (o *SearchResponse) GetExhaustive() Exhaustive { + if o == nil || o.Exhaustive == nil { + var ret Exhaustive + return ret + } + return *o.Exhaustive +} + +// GetExhaustiveOk returns a tuple with the Exhaustive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetExhaustiveOk() (*Exhaustive, bool) { + if o == nil || o.Exhaustive == nil { + return nil, false + } + return o.Exhaustive, true +} + +// HasExhaustive returns a boolean if a field has been set. +func (o *SearchResponse) HasExhaustive() bool { + if o != nil && o.Exhaustive != nil { + return true + } + + return false +} + +// SetExhaustive gets a reference to the given Exhaustive and assigns it to the Exhaustive field. +func (o *SearchResponse) SetExhaustive(v Exhaustive) { + o.Exhaustive = &v +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. +// Deprecated func (o *SearchResponse) GetExhaustiveFacetsCount() bool { if o == nil || o.ExhaustiveFacetsCount == nil { var ret bool @@ -350,6 +412,7 @@ func (o *SearchResponse) GetExhaustiveFacetsCount() bool { // GetExhaustiveFacetsCountOk returns a tuple with the ExhaustiveFacetsCount field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *SearchResponse) GetExhaustiveFacetsCountOk() (*bool, bool) { if o == nil || o.ExhaustiveFacetsCount == nil { return nil, false @@ -367,11 +430,13 @@ func (o *SearchResponse) HasExhaustiveFacetsCount() bool { } // SetExhaustiveFacetsCount gets a reference to the given bool and assigns it to the ExhaustiveFacetsCount field. +// Deprecated func (o *SearchResponse) SetExhaustiveFacetsCount(v bool) { o.ExhaustiveFacetsCount = &v } // GetExhaustiveNbHits returns the ExhaustiveNbHits field value if set, zero value otherwise. +// Deprecated func (o *SearchResponse) GetExhaustiveNbHits() bool { if o == nil || o.ExhaustiveNbHits == nil { var ret bool @@ -382,6 +447,7 @@ func (o *SearchResponse) GetExhaustiveNbHits() bool { // GetExhaustiveNbHitsOk returns a tuple with the ExhaustiveNbHits field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *SearchResponse) GetExhaustiveNbHitsOk() (*bool, bool) { if o == nil || o.ExhaustiveNbHits == nil { return nil, false @@ -399,11 +465,13 @@ func (o *SearchResponse) HasExhaustiveNbHits() bool { } // SetExhaustiveNbHits gets a reference to the given bool and assigns it to the ExhaustiveNbHits field. +// Deprecated func (o *SearchResponse) SetExhaustiveNbHits(v bool) { o.ExhaustiveNbHits = &v } // GetExhaustiveTypo returns the ExhaustiveTypo field value if set, zero value otherwise. +// Deprecated func (o *SearchResponse) GetExhaustiveTypo() bool { if o == nil || o.ExhaustiveTypo == nil { var ret bool @@ -414,6 +482,7 @@ func (o *SearchResponse) GetExhaustiveTypo() bool { // GetExhaustiveTypoOk returns a tuple with the ExhaustiveTypo field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *SearchResponse) GetExhaustiveTypoOk() (*bool, bool) { if o == nil || o.ExhaustiveTypo == nil { return nil, false @@ -431,6 +500,7 @@ func (o *SearchResponse) HasExhaustiveTypo() bool { } // SetExhaustiveTypo gets a reference to the given bool and assigns it to the ExhaustiveTypo field. +// Deprecated func (o *SearchResponse) SetExhaustiveTypo(v bool) { o.ExhaustiveTypo = &v } @@ -723,38 +793,6 @@ func (o *SearchResponse) SetPage(v int32) { o.Page = v } -// GetRedirect returns the Redirect field value if set, zero value otherwise. -func (o *SearchResponse) GetRedirect() BaseSearchResponseRedirect { - if o == nil || o.Redirect == nil { - var ret BaseSearchResponseRedirect - return ret - } - return *o.Redirect -} - -// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchResponse) GetRedirectOk() (*BaseSearchResponseRedirect, bool) { - if o == nil || o.Redirect == nil { - return nil, false - } - return o.Redirect, true -} - -// HasRedirect returns a boolean if a field has been set. -func (o *SearchResponse) HasRedirect() bool { - if o != nil && o.Redirect != nil { - return true - } - - return false -} - -// SetRedirect gets a reference to the given BaseSearchResponseRedirect and assigns it to the Redirect field. -func (o *SearchResponse) SetRedirect(v BaseSearchResponseRedirect) { - o.Redirect = &v -} - // GetParsedQuery returns the ParsedQuery field value if set, zero value otherwise. func (o *SearchResponse) GetParsedQuery() string { if o == nil || o.ParsedQuery == nil { @@ -811,6 +849,38 @@ func (o *SearchResponse) SetProcessingTimeMS(v int32) { o.ProcessingTimeMS = v } +// GetProcessingTimingsMS returns the ProcessingTimingsMS field value if set, zero value otherwise. +func (o *SearchResponse) GetProcessingTimingsMS() map[string]interface{} { + if o == nil || o.ProcessingTimingsMS == nil { + var ret map[string]interface{} + return ret + } + return o.ProcessingTimingsMS +} + +// GetProcessingTimingsMSOk returns a tuple with the ProcessingTimingsMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetProcessingTimingsMSOk() (map[string]interface{}, bool) { + if o == nil || o.ProcessingTimingsMS == nil { + return nil, false + } + return o.ProcessingTimingsMS, true +} + +// HasProcessingTimingsMS returns a boolean if a field has been set. +func (o *SearchResponse) HasProcessingTimingsMS() bool { + if o != nil && o.ProcessingTimingsMS != nil { + return true + } + + return false +} + +// SetProcessingTimingsMS gets a reference to the given map[string]interface{} and assigns it to the ProcessingTimingsMS field. +func (o *SearchResponse) SetProcessingTimingsMS(v map[string]interface{}) { + o.ProcessingTimingsMS = v +} + // GetQueryAfterRemoval returns the QueryAfterRemoval field value if set, zero value otherwise. func (o *SearchResponse) GetQueryAfterRemoval() string { if o == nil || o.QueryAfterRemoval == nil { @@ -843,6 +913,102 @@ func (o *SearchResponse) SetQueryAfterRemoval(v string) { o.QueryAfterRemoval = &v } +// GetRedirect returns the Redirect field value if set, zero value otherwise. +func (o *SearchResponse) GetRedirect() Redirect { + if o == nil || o.Redirect == nil { + var ret Redirect + return ret + } + return *o.Redirect +} + +// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetRedirectOk() (*Redirect, bool) { + if o == nil || o.Redirect == nil { + return nil, false + } + return o.Redirect, true +} + +// HasRedirect returns a boolean if a field has been set. +func (o *SearchResponse) HasRedirect() bool { + if o != nil && o.Redirect != nil { + return true + } + + return false +} + +// SetRedirect gets a reference to the given Redirect and assigns it to the Redirect field. +func (o *SearchResponse) SetRedirect(v Redirect) { + o.Redirect = &v +} + +// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. +func (o *SearchResponse) GetRenderingContent() RenderingContent { + if o == nil || o.RenderingContent == nil { + var ret RenderingContent + return ret + } + return *o.RenderingContent +} + +// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetRenderingContentOk() (*RenderingContent, bool) { + if o == nil || o.RenderingContent == nil { + return nil, false + } + return o.RenderingContent, true +} + +// HasRenderingContent returns a boolean if a field has been set. +func (o *SearchResponse) HasRenderingContent() bool { + if o != nil && o.RenderingContent != nil { + return true + } + + return false +} + +// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. +func (o *SearchResponse) SetRenderingContent(v RenderingContent) { + o.RenderingContent = &v +} + +// GetServerTimeMS returns the ServerTimeMS field value if set, zero value otherwise. +func (o *SearchResponse) GetServerTimeMS() int32 { + if o == nil || o.ServerTimeMS == nil { + var ret int32 + return ret + } + return *o.ServerTimeMS +} + +// GetServerTimeMSOk returns a tuple with the ServerTimeMS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetServerTimeMSOk() (*int32, bool) { + if o == nil || o.ServerTimeMS == nil { + return nil, false + } + return o.ServerTimeMS, true +} + +// HasServerTimeMS returns a boolean if a field has been set. +func (o *SearchResponse) HasServerTimeMS() bool { + if o != nil && o.ServerTimeMS != nil { + return true + } + + return false +} + +// SetServerTimeMS gets a reference to the given int32 and assigns it to the ServerTimeMS field. +func (o *SearchResponse) SetServerTimeMS(v int32) { + o.ServerTimeMS = &v +} + // GetServerUsed returns the ServerUsed field value if set, zero value otherwise. func (o *SearchResponse) GetServerUsed() string { if o == nil || o.ServerUsed == nil { @@ -908,38 +1074,6 @@ func (o *SearchResponse) SetUserData(v interface{}) { o.UserData = v } -// GetRenderingContent returns the RenderingContent field value if set, zero value otherwise. -func (o *SearchResponse) GetRenderingContent() RenderingContent { - if o == nil || o.RenderingContent == nil { - var ret RenderingContent - return ret - } - return *o.RenderingContent -} - -// GetRenderingContentOk returns a tuple with the RenderingContent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchResponse) GetRenderingContentOk() (*RenderingContent, bool) { - if o == nil || o.RenderingContent == nil { - return nil, false - } - return o.RenderingContent, true -} - -// HasRenderingContent returns a boolean if a field has been set. -func (o *SearchResponse) HasRenderingContent() bool { - if o != nil && o.RenderingContent != nil { - return true - } - - return false -} - -// SetRenderingContent gets a reference to the given RenderingContent and assigns it to the RenderingContent field. -func (o *SearchResponse) SetRenderingContent(v RenderingContent) { - o.RenderingContent = &v -} - // GetHits returns the Hits field value func (o *SearchResponse) GetHits() []Hit { if o == nil { @@ -1026,6 +1160,9 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if o.AutomaticRadius != nil { toSerialize["automaticRadius"] = o.AutomaticRadius } + if o.Exhaustive != nil { + toSerialize["exhaustive"] = o.Exhaustive + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -1065,27 +1202,33 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if true { toSerialize["page"] = o.Page } - if o.Redirect != nil { - toSerialize["redirect"] = o.Redirect - } if o.ParsedQuery != nil { toSerialize["parsedQuery"] = o.ParsedQuery } if true { toSerialize["processingTimeMS"] = o.ProcessingTimeMS } + if o.ProcessingTimingsMS != nil { + toSerialize["processingTimingsMS"] = o.ProcessingTimingsMS + } if o.QueryAfterRemoval != nil { toSerialize["queryAfterRemoval"] = o.QueryAfterRemoval } + if o.Redirect != nil { + toSerialize["redirect"] = o.Redirect + } + if o.RenderingContent != nil { + toSerialize["renderingContent"] = o.RenderingContent + } + if o.ServerTimeMS != nil { + toSerialize["serverTimeMS"] = o.ServerTimeMS + } if o.ServerUsed != nil { toSerialize["serverUsed"] = o.ServerUsed } if o.UserData != nil { toSerialize["userData"] = o.UserData } - if o.RenderingContent != nil { - toSerialize["renderingContent"] = o.RenderingContent - } if true { toSerialize["hits"] = o.Hits } @@ -1095,15 +1238,67 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if true { toSerialize["params"] = o.Params } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) } +func (o *SearchResponse) UnmarshalJSON(bytes []byte) (err error) { + varSearchResponse := _SearchResponse{} + + if err = json.Unmarshal(bytes, &varSearchResponse); err == nil { + *o = SearchResponse(varSearchResponse) + } + + additionalProperties := make(map[string]any) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "abTestID") + delete(additionalProperties, "abTestVariantID") + delete(additionalProperties, "aroundLatLng") + delete(additionalProperties, "automaticRadius") + delete(additionalProperties, "exhaustive") + delete(additionalProperties, "exhaustiveFacetsCount") + delete(additionalProperties, "exhaustiveNbHits") + 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") + delete(additionalProperties, "queryAfterRemoval") + delete(additionalProperties, "redirect") + delete(additionalProperties, "renderingContent") + delete(additionalProperties, "serverTimeMS") + delete(additionalProperties, "serverUsed") + delete(additionalProperties, "userData") + delete(additionalProperties, "hits") + delete(additionalProperties, "query") + delete(additionalProperties, "params") + o.AdditionalProperties = additionalProperties + } + + return err +} + func (o SearchResponse) String() string { out := "" out += fmt.Sprintf(" abTestID=%v\n", o.AbTestID) out += fmt.Sprintf(" abTestVariantID=%v\n", o.AbTestVariantID) out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) + out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) @@ -1117,16 +1312,21 @@ func (o SearchResponse) String() string { 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(" redirect=%v\n", o.Redirect) out += fmt.Sprintf(" parsedQuery=%v\n", o.ParsedQuery) out += fmt.Sprintf(" processingTimeMS=%v\n", o.ProcessingTimeMS) + out += fmt.Sprintf(" processingTimingsMS=%v\n", o.ProcessingTimingsMS) out += fmt.Sprintf(" queryAfterRemoval=%v\n", o.QueryAfterRemoval) + out += fmt.Sprintf(" redirect=%v\n", o.Redirect) + out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) + out += fmt.Sprintf(" serverTimeMS=%v\n", o.ServerTimeMS) out += fmt.Sprintf(" serverUsed=%v\n", o.ServerUsed) out += fmt.Sprintf(" userData=%v\n", o.UserData) - out += fmt.Sprintf(" renderingContent=%v\n", o.RenderingContent) out += fmt.Sprintf(" hits=%v\n", o.Hits) out += fmt.Sprintf(" query=%v\n", o.Query) out += fmt.Sprintf(" params=%v\n", o.Params) + for key, value := range o.AdditionalProperties { + out += fmt.Sprintf(" %s=%v\n", key, value) + } return fmt.Sprintf("SearchResponse {\n%s}", out) } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_responses.go b/clients/algoliasearch-client-go/algolia/search/model_search_responses.go index 7c35fc31b3..71a83e2a8b 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_responses.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_responses.go @@ -8,7 +8,7 @@ import ( // SearchResponses struct for SearchResponses type SearchResponses struct { - Results []SearchResult `json:"results" validate:"required"` + Results []SearchResult `json:"results"` } // NewSearchResponses instantiates a new SearchResponses object diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_result.go b/clients/algoliasearch-client-go/algolia/search/model_search_result.go index 5c51174a79..cacb7911e7 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_result.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_result.go @@ -29,19 +29,41 @@ func SearchResponseAsSearchResult(v *SearchResponse) SearchResult { // Unmarshal JSON data into one of the pointers in the struct func (dst *SearchResult) UnmarshalJSON(data []byte) error { var err error - // try to unmarshal data into SearchForFacetValuesResponse - err = newStrictDecoder(data).Decode(&dst.SearchForFacetValuesResponse) - if err == nil && validateStruct(dst.SearchForFacetValuesResponse) == nil { - jsonSearchForFacetValuesResponse, _ := json.Marshal(dst.SearchForFacetValuesResponse) - if string(jsonSearchForFacetValuesResponse) == "{}" { // empty struct - dst.SearchForFacetValuesResponse = nil + // use discriminator value to speed up the lookup + var jsonDict map[string]any + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("Failed to unmarshal JSON into map for the discriminator lookup (SearchForFacetValuesResponse).") + } + + // Hold the schema validity between checks + validSchemaForModel := true + + // If the model wasn't discriminated yet, continue checking for other discriminating properties + if validSchemaForModel { + // Check if the model holds a property 'facetHits' + if _, ok := jsonDict["facetHits"]; !ok { + validSchemaForModel = false + } + } + + if validSchemaForModel { + // try to unmarshal data into SearchForFacetValuesResponse + err = newStrictDecoder(data).Decode(&dst.SearchForFacetValuesResponse) + if err == nil && validateStruct(dst.SearchForFacetValuesResponse) == nil { + jsonSearchForFacetValuesResponse, _ := json.Marshal(dst.SearchForFacetValuesResponse) + if string(jsonSearchForFacetValuesResponse) == "{}" { // empty struct + dst.SearchForFacetValuesResponse = nil + } else { + return nil + } } else { - return nil + dst.SearchForFacetValuesResponse = nil } - } else { - dst.SearchForFacetValuesResponse = nil } + // Reset the schema validity for the next class check + validSchemaForModel = true // try to unmarshal data into SearchResponse err = newStrictDecoder(data).Decode(&dst.SearchResponse) if err == nil && validateStruct(dst.SearchResponse) == nil { diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_rules_response.go b/clients/algoliasearch-client-go/algolia/search/model_search_rules_response.go index 99f2a2ea6f..90c48a976b 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_rules_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_rules_response.go @@ -9,13 +9,13 @@ import ( // SearchRulesResponse struct for SearchRulesResponse type SearchRulesResponse struct { // Fetched rules. - Hits []Rule `json:"hits" validate:"required"` + Hits []Rule `json:"hits"` // Number of fetched rules. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Current page. - Page int32 `json:"page" validate:"required"` + Page int32 `json:"page"` // Number of pages. - NbPages int32 `json:"nbPages" validate:"required"` + NbPages int32 `json:"nbPages"` } // NewSearchRulesResponse instantiates a new SearchRulesResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_synonyms_response.go b/clients/algoliasearch-client-go/algolia/search/model_search_synonyms_response.go index 648d823e58..a8c44a4167 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_synonyms_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_synonyms_response.go @@ -9,9 +9,9 @@ import ( // SearchSynonymsResponse struct for SearchSynonymsResponse type SearchSynonymsResponse struct { // Synonym objects. - Hits []SynonymHit `json:"hits" validate:"required"` + Hits []SynonymHit `json:"hits"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` AdditionalProperties map[string]any } diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_params.go b/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_params.go index a81cc83075..a6ef9eacae 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_params.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_params.go @@ -9,7 +9,7 @@ import ( // SearchUserIdsParams OK type SearchUserIdsParams struct { // Query to search. The search is a prefix search with [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) enabled. An empty query will retrieve all users. - Query string `json:"query" validate:"required"` + Query string `json:"query"` // Cluster name. ClusterName *string `json:"clusterName,omitempty"` // Page to retrieve (the first page is `0`, not `1`). diff --git a/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_response.go b/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_response.go index d65294f0c8..ac8caf0679 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_search_user_ids_response.go @@ -9,15 +9,15 @@ import ( // SearchUserIdsResponse userIDs data. type SearchUserIdsResponse struct { // User objects that match the query. - Hits []UserHit `json:"hits" validate:"required"` + Hits []UserHit `json:"hits"` // Number of hits the search query matched. - NbHits int32 `json:"nbHits" validate:"required"` + NbHits int32 `json:"nbHits"` // Page to retrieve (the first page is `0`, not `1`). - Page int32 `json:"page" validate:"required"` + Page int32 `json:"page"` // Maximum number of hits per page. - HitsPerPage int32 `json:"hitsPerPage" validate:"required"` + HitsPerPage int32 `json:"hitsPerPage"` // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewSearchUserIdsResponse instantiates a new SearchUserIdsResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_snippet_result_option.go b/clients/algoliasearch-client-go/algolia/search/model_snippet_result_option.go index af09aff223..05e07c4b2e 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_snippet_result_option.go +++ b/clients/algoliasearch-client-go/algolia/search/model_snippet_result_option.go @@ -9,8 +9,8 @@ import ( // SnippetResultOption Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. type SnippetResultOption struct { // Markup text with `facetQuery` matches highlighted. - Value string `json:"value" validate:"required"` - MatchLevel MatchLevel `json:"matchLevel" validate:"required"` + Value string `json:"value"` + MatchLevel MatchLevel `json:"matchLevel"` } // NewSnippetResultOption instantiates a new SnippetResultOption object diff --git a/clients/algoliasearch-client-go/algolia/search/model_source.go b/clients/algoliasearch-client-go/algolia/search/model_source.go index 6d087b05f4..b60dbdc959 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_source.go +++ b/clients/algoliasearch-client-go/algolia/search/model_source.go @@ -9,7 +9,7 @@ import ( // Source Source. type Source struct { // IP address range of the source. - Source string `json:"source" validate:"required"` + Source string `json:"source"` // Source description. Description *string `json:"description,omitempty"` } diff --git a/clients/algoliasearch-client-go/algolia/search/model_synonym_hit.go b/clients/algoliasearch-client-go/algolia/search/model_synonym_hit.go index ca29fda8a9..31b38b3e8b 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_synonym_hit.go +++ b/clients/algoliasearch-client-go/algolia/search/model_synonym_hit.go @@ -9,8 +9,8 @@ import ( // SynonymHit Synonym object. type SynonymHit struct { // Unique identifier of a synonym object. - ObjectID string `json:"objectID" validate:"required"` - Type SynonymType `json:"type" validate:"required"` + ObjectID string `json:"objectID"` + Type SynonymType `json:"type"` // Words or phrases considered equivalent. Synonyms []string `json:"synonyms,omitempty"` // Word or phrase to appear in query strings (for [`onewaysynonym`s](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/one-way-synonyms/)). diff --git a/clients/algoliasearch-client-go/algolia/search/model_time_range.go b/clients/algoliasearch-client-go/algolia/search/model_time_range.go index 1eea512603..60d4061d09 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_time_range.go +++ b/clients/algoliasearch-client-go/algolia/search/model_time_range.go @@ -9,9 +9,9 @@ import ( // TimeRange struct for TimeRange type TimeRange struct { // Lower bound of the time range (Unix timestamp). - From int32 `json:"from" validate:"required"` + From int32 `json:"from"` // Upper bound of the time range (Unix timestamp). - Until int32 `json:"until" validate:"required"` + Until int32 `json:"until"` } // NewTimeRange instantiates a new TimeRange object diff --git a/clients/algoliasearch-client-go/algolia/search/model_update_api_key_response.go b/clients/algoliasearch-client-go/algolia/search/model_update_api_key_response.go index b246088e26..f344fa3ee3 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_update_api_key_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_update_api_key_response.go @@ -9,9 +9,9 @@ import ( // UpdateApiKeyResponse struct for UpdateApiKeyResponse type UpdateApiKeyResponse struct { // API key. - Key string `json:"key" validate:"required"` + Key string `json:"key"` // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewUpdateApiKeyResponse instantiates a new UpdateApiKeyResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_updated_at_response.go b/clients/algoliasearch-client-go/algolia/search/model_updated_at_response.go index e7f288041e..ea62a37f2b 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_updated_at_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_updated_at_response.go @@ -9,9 +9,9 @@ import ( // UpdatedAtResponse Response, taskID, and update timestamp. type UpdatedAtResponse struct { // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` } // NewUpdatedAtResponse instantiates a new UpdatedAtResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_updated_rule_response.go b/clients/algoliasearch-client-go/algolia/search/model_updated_rule_response.go index d03a3af5d3..be824d24fd 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_updated_rule_response.go +++ b/clients/algoliasearch-client-go/algolia/search/model_updated_rule_response.go @@ -9,11 +9,11 @@ import ( // UpdatedRuleResponse struct for UpdatedRuleResponse type UpdatedRuleResponse struct { // Unique object identifier. - ObjectID string `json:"objectID" validate:"required"` + ObjectID string `json:"objectID"` // Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. - UpdatedAt string `json:"updatedAt" validate:"required"` + UpdatedAt string `json:"updatedAt"` // Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. - TaskID int64 `json:"taskID" validate:"required"` + TaskID int64 `json:"taskID"` } // NewUpdatedRuleResponse instantiates a new UpdatedRuleResponse object diff --git a/clients/algoliasearch-client-go/algolia/search/model_user_highlight_result.go b/clients/algoliasearch-client-go/algolia/search/model_user_highlight_result.go index 52086556c5..0eddcd0f41 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_user_highlight_result.go +++ b/clients/algoliasearch-client-go/algolia/search/model_user_highlight_result.go @@ -9,9 +9,9 @@ import ( // UserHighlightResult struct for UserHighlightResult type UserHighlightResult struct { // Show highlighted section and words matched on a query. - UserID map[string]HighlightResult `json:"userID" validate:"required"` + UserID map[string]HighlightResult `json:"userID"` // Show highlighted section and words matched on a query. - ClusterName map[string]HighlightResult `json:"clusterName" validate:"required"` + ClusterName map[string]HighlightResult `json:"clusterName"` } // NewUserHighlightResult instantiates a new UserHighlightResult object diff --git a/clients/algoliasearch-client-go/algolia/search/model_user_hit.go b/clients/algoliasearch-client-go/algolia/search/model_user_hit.go index f32a2899a1..f3cb0f5075 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_user_hit.go +++ b/clients/algoliasearch-client-go/algolia/search/model_user_hit.go @@ -9,16 +9,16 @@ import ( // UserHit struct for UserHit type UserHit struct { // userID of the user. - UserID string `json:"userID" validate:"required"` + UserID string `json:"userID"` // Cluster name. - ClusterName string `json:"clusterName" validate:"required"` + ClusterName string `json:"clusterName"` // Number of records in the cluster. - NbRecords int32 `json:"nbRecords" validate:"required"` + NbRecords int32 `json:"nbRecords"` // Data size taken by all the users assigned to the cluster. - DataSize int32 `json:"dataSize" validate:"required"` + DataSize int32 `json:"dataSize"` // userID of the requested user. Same as userID. - ObjectID string `json:"objectID" validate:"required"` - HighlightResult UserHighlightResult `json:"_highlightResult" validate:"required"` + ObjectID string `json:"objectID"` + HighlightResult UserHighlightResult `json:"_highlightResult"` } // NewUserHit instantiates a new UserHit object diff --git a/clients/algoliasearch-client-go/algolia/search/model_user_id.go b/clients/algoliasearch-client-go/algolia/search/model_user_id.go index 3936757dca..6fd28dd581 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_user_id.go +++ b/clients/algoliasearch-client-go/algolia/search/model_user_id.go @@ -9,13 +9,13 @@ import ( // UserId Unique user ID. type UserId struct { // userID of the user. - UserID string `json:"userID" validate:"required"` + UserID string `json:"userID"` // Cluster to which the user is assigned. - ClusterName string `json:"clusterName" validate:"required"` + ClusterName string `json:"clusterName"` // Number of records belonging to the user. - NbRecords int32 `json:"nbRecords" validate:"required"` + NbRecords int32 `json:"nbRecords"` // Data size used by the user. - DataSize int32 `json:"dataSize" validate:"required"` + DataSize int32 `json:"dataSize"` } // NewUserId instantiates a new UserId object diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/insights/EventsItems.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/insights/EventsItems.java index dbb080645b..1bcdef0d1f 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/insights/EventsItems.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/insights/EventsItems.java @@ -22,18 +22,8 @@ class Deserializer extends JsonDeserializer { public EventsItems deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonNode tree = jp.readValueAsTree(); - // deserialize AddedToCartObjectIDs - if (tree.isObject()) { - try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(AddedToCartObjectIDs.class); - } catch (Exception e) { - // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf AddedToCartObjectIDs (error: " + e.getMessage() + ") (type: AddedToCartObjectIDs)"); - } - } - // deserialize AddedToCartObjectIDsAfterSearch - if (tree.isObject()) { + if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("queryID") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { return parser.readValueAs(AddedToCartObjectIDsAfterSearch.class); } catch (Exception e) { @@ -46,28 +36,32 @@ public EventsItems deserialize(JsonParser jp, DeserializationContext ctxt) throw } } - // deserialize ClickedFilters - if (tree.isObject()) { + // deserialize PurchasedObjectIDsAfterSearch + if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("queryID") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(ClickedFilters.class); + return parser.readValueAs(PurchasedObjectIDsAfterSearch.class); } catch (Exception e) { // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf ClickedFilters (error: " + e.getMessage() + ") (type: ClickedFilters)"); + LOGGER.finest( + "Failed to deserialize oneOf PurchasedObjectIDsAfterSearch (error: " + + e.getMessage() + + ") (type: PurchasedObjectIDsAfterSearch)" + ); } } - // deserialize ClickedObjectIDs - if (tree.isObject()) { + // deserialize AddedToCartObjectIDs + if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(ClickedObjectIDs.class); + return parser.readValueAs(AddedToCartObjectIDs.class); } catch (Exception e) { // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf ClickedObjectIDs (error: " + e.getMessage() + ") (type: ClickedObjectIDs)"); + LOGGER.finest("Failed to deserialize oneOf AddedToCartObjectIDs (error: " + e.getMessage() + ") (type: AddedToCartObjectIDs)"); } } // deserialize ClickedObjectIDsAfterSearch - if (tree.isObject()) { + if (tree.isObject() && tree.has("positions") && tree.has("queryID") && tree.has("eventType")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { return parser.readValueAs(ClickedObjectIDsAfterSearch.class); } catch (Exception e) { @@ -78,66 +72,72 @@ public EventsItems deserialize(JsonParser jp, DeserializationContext ctxt) throw } } - // deserialize ConvertedFilters - if (tree.isObject()) { + // deserialize PurchasedObjectIDs + if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(ConvertedFilters.class); + return parser.readValueAs(PurchasedObjectIDs.class); } catch (Exception e) { // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf ConvertedFilters (error: " + e.getMessage() + ") (type: ConvertedFilters)"); + LOGGER.finest("Failed to deserialize oneOf PurchasedObjectIDs (error: " + e.getMessage() + ") (type: PurchasedObjectIDs)"); } } - // deserialize ConvertedObjectIDs - if (tree.isObject()) { + // deserialize ClickedFilters + if (tree.isObject() && tree.has("eventType") && tree.has("filters")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(ConvertedObjectIDs.class); + return parser.readValueAs(ClickedFilters.class); } catch (Exception e) { // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf ConvertedObjectIDs (error: " + e.getMessage() + ") (type: ConvertedObjectIDs)"); + LOGGER.finest("Failed to deserialize oneOf ClickedFilters (error: " + e.getMessage() + ") (type: ClickedFilters)"); } } - // deserialize ConvertedObjectIDsAfterSearch - if (tree.isObject()) { + // deserialize ClickedObjectIDs + if (tree.isObject() && tree.has("eventType") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(ConvertedObjectIDsAfterSearch.class); + return parser.readValueAs(ClickedObjectIDs.class); } catch (Exception e) { // deserialization failed, continue - LOGGER.finest( - "Failed to deserialize oneOf ConvertedObjectIDsAfterSearch (error: " + - e.getMessage() + - ") (type: ConvertedObjectIDsAfterSearch)" - ); + LOGGER.finest("Failed to deserialize oneOf ClickedObjectIDs (error: " + e.getMessage() + ") (type: ClickedObjectIDs)"); } } - // deserialize PurchasedObjectIDs - if (tree.isObject()) { + // deserialize ConvertedFilters + if (tree.isObject() && tree.has("eventType") && tree.has("filters")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(PurchasedObjectIDs.class); + return parser.readValueAs(ConvertedFilters.class); } catch (Exception e) { // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf PurchasedObjectIDs (error: " + e.getMessage() + ") (type: PurchasedObjectIDs)"); + LOGGER.finest("Failed to deserialize oneOf ConvertedFilters (error: " + e.getMessage() + ") (type: ConvertedFilters)"); } } - // deserialize PurchasedObjectIDsAfterSearch - if (tree.isObject()) { + // deserialize ConvertedObjectIDs + if (tree.isObject() && tree.has("eventType") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { - return parser.readValueAs(PurchasedObjectIDsAfterSearch.class); + return parser.readValueAs(ConvertedObjectIDs.class); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf ConvertedObjectIDs (error: " + e.getMessage() + ") (type: ConvertedObjectIDs)"); + } + } + + // deserialize ConvertedObjectIDsAfterSearch + if (tree.isObject() && tree.has("queryID") && tree.has("eventType")) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + return parser.readValueAs(ConvertedObjectIDsAfterSearch.class); } catch (Exception e) { // deserialization failed, continue LOGGER.finest( - "Failed to deserialize oneOf PurchasedObjectIDsAfterSearch (error: " + + "Failed to deserialize oneOf ConvertedObjectIDsAfterSearch (error: " + e.getMessage() + - ") (type: PurchasedObjectIDsAfterSearch)" + ") (type: ConvertedObjectIDsAfterSearch)" ); } } // deserialize ViewedFilters - if (tree.isObject()) { + if (tree.isObject() && tree.has("eventType") && tree.has("filters")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { return parser.readValueAs(ViewedFilters.class); } catch (Exception e) { @@ -147,7 +147,7 @@ public EventsItems deserialize(JsonParser jp, DeserializationContext ctxt) throw } // deserialize ViewedObjectIDs - if (tree.isObject()) { + if (tree.isObject() && tree.has("eventType") && tree.has("objectIDs")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { return parser.readValueAs(ViewedObjectIDs.class); } catch (Exception e) { 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 6335bc2469..3fdd3d0f58 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 @@ -24,6 +24,9 @@ public class BaseSearchResponse { @JsonProperty("automaticRadius") private String automaticRadius; + @JsonProperty("exhaustive") + private Exhaustive exhaustive; + @JsonProperty("exhaustiveFacetsCount") private Boolean exhaustiveFacetsCount; @@ -63,26 +66,45 @@ public class BaseSearchResponse { @JsonProperty("page") private Integer page; - @JsonProperty("redirect") - private BaseSearchResponseRedirect redirect; - @JsonProperty("parsedQuery") private String parsedQuery; @JsonProperty("processingTimeMS") private Integer processingTimeMS; + @JsonProperty("processingTimingsMS") + private Object processingTimingsMS; + @JsonProperty("queryAfterRemoval") private String queryAfterRemoval; + @JsonProperty("redirect") + private Redirect redirect; + + @JsonProperty("renderingContent") + private RenderingContent renderingContent; + + @JsonProperty("serverTimeMS") + private Integer serverTimeMS; + @JsonProperty("serverUsed") private String serverUsed; @JsonProperty("userData") private Object userData; - @JsonProperty("renderingContent") - private RenderingContent renderingContent; + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public BaseSearchResponse setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } public BaseSearchResponse setAbTestID(Integer abTestID) { this.abTestID = abTestID; @@ -133,12 +155,28 @@ public String getAutomaticRadius() { return automaticRadius; } + public BaseSearchResponse setExhaustive(Exhaustive exhaustive) { + this.exhaustive = exhaustive; + return this; + } + + /** Get exhaustive */ + @javax.annotation.Nullable + public Exhaustive getExhaustive() { + return exhaustive; + } + public BaseSearchResponse setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; return this; } - /** Indicates whether the facet count is exhaustive (exact) or approximate. */ + /** + * See the `facetsCount` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; @@ -149,7 +187,12 @@ public BaseSearchResponse setExhaustiveNbHits(Boolean exhaustiveNbHits) { return this; } - /** Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. */ + /** + * See the `nbHits` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; @@ -160,7 +203,12 @@ public BaseSearchResponse setExhaustiveTypo(Boolean exhaustiveTypo) { return this; } - /** Indicates whether the search for typos was exhaustive (exact) or approximate. */ + /** + * See the `typo` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveTypo() { return exhaustiveTypo; @@ -295,17 +343,6 @@ public Integer getPage() { return page; } - public BaseSearchResponse setRedirect(BaseSearchResponseRedirect redirect) { - this.redirect = redirect; - return this; - } - - /** Get redirect */ - @javax.annotation.Nullable - public BaseSearchResponseRedirect getRedirect() { - return redirect; - } - public BaseSearchResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -331,6 +368,20 @@ public Integer getProcessingTimeMS() { return processingTimeMS; } + public BaseSearchResponse setProcessingTimingsMS(Object processingTimingsMS) { + this.processingTimingsMS = processingTimingsMS; + return this; + } + + /** + * Experimental. List of processing steps and their times, in milliseconds. You can use this list + * to investigate performance issues. + */ + @javax.annotation.Nullable + public Object getProcessingTimingsMS() { + return processingTimingsMS; + } + public BaseSearchResponse setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; return this; @@ -345,6 +396,39 @@ public String getQueryAfterRemoval() { return queryAfterRemoval; } + public BaseSearchResponse setRedirect(Redirect redirect) { + this.redirect = redirect; + return this; + } + + /** Get redirect */ + @javax.annotation.Nullable + public Redirect getRedirect() { + return redirect; + } + + public BaseSearchResponse setRenderingContent(RenderingContent renderingContent) { + this.renderingContent = renderingContent; + return this; + } + + /** Get renderingContent */ + @javax.annotation.Nullable + public RenderingContent getRenderingContent() { + return renderingContent; + } + + public BaseSearchResponse setServerTimeMS(Integer serverTimeMS) { + this.serverTimeMS = serverTimeMS; + return this; + } + + /** Time the server took to process the request, in milliseconds. */ + @javax.annotation.Nullable + public Integer getServerTimeMS() { + return serverTimeMS; + } + public BaseSearchResponse setServerUsed(String serverUsed) { this.serverUsed = serverUsed; return this; @@ -367,17 +451,6 @@ public Object getUserData() { return userData; } - public BaseSearchResponse setRenderingContent(RenderingContent renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** Get renderingContent */ - @javax.annotation.Nullable - public RenderingContent getRenderingContent() { - return renderingContent; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -392,6 +465,7 @@ public boolean equals(Object o) { Objects.equals(this.abTestVariantID, baseSearchResponse.abTestVariantID) && Objects.equals(this.aroundLatLng, baseSearchResponse.aroundLatLng) && Objects.equals(this.automaticRadius, baseSearchResponse.automaticRadius) && + Objects.equals(this.exhaustive, baseSearchResponse.exhaustive) && Objects.equals(this.exhaustiveFacetsCount, baseSearchResponse.exhaustiveFacetsCount) && Objects.equals(this.exhaustiveNbHits, baseSearchResponse.exhaustiveNbHits) && Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && @@ -405,13 +479,16 @@ public boolean equals(Object o) { Objects.equals(this.nbPages, baseSearchResponse.nbPages) && Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && Objects.equals(this.page, baseSearchResponse.page) && - Objects.equals(this.redirect, baseSearchResponse.redirect) && Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && Objects.equals(this.processingTimeMS, baseSearchResponse.processingTimeMS) && + Objects.equals(this.processingTimingsMS, baseSearchResponse.processingTimingsMS) && Objects.equals(this.queryAfterRemoval, baseSearchResponse.queryAfterRemoval) && + Objects.equals(this.redirect, baseSearchResponse.redirect) && + Objects.equals(this.renderingContent, baseSearchResponse.renderingContent) && + Objects.equals(this.serverTimeMS, baseSearchResponse.serverTimeMS) && Objects.equals(this.serverUsed, baseSearchResponse.serverUsed) && Objects.equals(this.userData, baseSearchResponse.userData) && - Objects.equals(this.renderingContent, baseSearchResponse.renderingContent) + super.equals(o) ); } @@ -422,6 +499,7 @@ public int hashCode() { abTestVariantID, aroundLatLng, automaticRadius, + exhaustive, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, @@ -435,13 +513,16 @@ public int hashCode() { nbPages, nbSortedHits, page, - redirect, parsedQuery, processingTimeMS, + processingTimingsMS, queryAfterRemoval, + redirect, + renderingContent, + serverTimeMS, serverUsed, userData, - renderingContent + super.hashCode() ); } @@ -449,10 +530,12 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BaseSearchResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); + sb.append(" exhaustive: ").append(toIndentedString(exhaustive)).append("\n"); sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); @@ -466,13 +549,15 @@ public String toString() { 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(" redirect: ").append(toIndentedString(redirect)).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"); sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); + sb.append(" redirect: ").append(toIndentedString(redirect)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb.append(" serverTimeMS: ").append(toIndentedString(serverTimeMS)).append("\n"); sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); sb.append("}"); return sb.toString(); } 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 90146eadf9..02e1be4eb8 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 @@ -26,6 +26,9 @@ public class BrowseResponse { @JsonProperty("automaticRadius") private String automaticRadius; + @JsonProperty("exhaustive") + private Exhaustive exhaustive; + @JsonProperty("exhaustiveFacetsCount") private Boolean exhaustiveFacetsCount; @@ -65,27 +68,33 @@ public class BrowseResponse { @JsonProperty("page") private Integer page; - @JsonProperty("redirect") - private BaseSearchResponseRedirect redirect; - @JsonProperty("parsedQuery") private String parsedQuery; @JsonProperty("processingTimeMS") private Integer processingTimeMS; + @JsonProperty("processingTimingsMS") + private Object processingTimingsMS; + @JsonProperty("queryAfterRemoval") private String queryAfterRemoval; + @JsonProperty("redirect") + private Redirect redirect; + + @JsonProperty("renderingContent") + private RenderingContent renderingContent; + + @JsonProperty("serverTimeMS") + private Integer serverTimeMS; + @JsonProperty("serverUsed") private String serverUsed; @JsonProperty("userData") private Object userData; - @JsonProperty("renderingContent") - private RenderingContent renderingContent; - @JsonProperty("hits") private List hits = new ArrayList<>(); @@ -147,12 +156,28 @@ public String getAutomaticRadius() { return automaticRadius; } + public BrowseResponse setExhaustive(Exhaustive exhaustive) { + this.exhaustive = exhaustive; + return this; + } + + /** Get exhaustive */ + @javax.annotation.Nullable + public Exhaustive getExhaustive() { + return exhaustive; + } + public BrowseResponse setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; return this; } - /** Indicates whether the facet count is exhaustive (exact) or approximate. */ + /** + * See the `facetsCount` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; @@ -163,7 +188,12 @@ public BrowseResponse setExhaustiveNbHits(Boolean exhaustiveNbHits) { return this; } - /** Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. */ + /** + * See the `nbHits` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; @@ -174,7 +204,12 @@ public BrowseResponse setExhaustiveTypo(Boolean exhaustiveTypo) { return this; } - /** Indicates whether the search for typos was exhaustive (exact) or approximate. */ + /** + * See the `typo` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveTypo() { return exhaustiveTypo; @@ -309,17 +344,6 @@ public Integer getPage() { return page; } - public BrowseResponse setRedirect(BaseSearchResponseRedirect redirect) { - this.redirect = redirect; - return this; - } - - /** Get redirect */ - @javax.annotation.Nullable - public BaseSearchResponseRedirect getRedirect() { - return redirect; - } - public BrowseResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -345,6 +369,20 @@ public Integer getProcessingTimeMS() { return processingTimeMS; } + public BrowseResponse setProcessingTimingsMS(Object processingTimingsMS) { + this.processingTimingsMS = processingTimingsMS; + return this; + } + + /** + * Experimental. List of processing steps and their times, in milliseconds. You can use this list + * to investigate performance issues. + */ + @javax.annotation.Nullable + public Object getProcessingTimingsMS() { + return processingTimingsMS; + } + public BrowseResponse setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; return this; @@ -359,6 +397,39 @@ public String getQueryAfterRemoval() { return queryAfterRemoval; } + public BrowseResponse setRedirect(Redirect redirect) { + this.redirect = redirect; + return this; + } + + /** Get redirect */ + @javax.annotation.Nullable + public Redirect getRedirect() { + return redirect; + } + + public BrowseResponse setRenderingContent(RenderingContent renderingContent) { + this.renderingContent = renderingContent; + return this; + } + + /** Get renderingContent */ + @javax.annotation.Nullable + public RenderingContent getRenderingContent() { + return renderingContent; + } + + public BrowseResponse setServerTimeMS(Integer serverTimeMS) { + this.serverTimeMS = serverTimeMS; + return this; + } + + /** Time the server took to process the request, in milliseconds. */ + @javax.annotation.Nullable + public Integer getServerTimeMS() { + return serverTimeMS; + } + public BrowseResponse setServerUsed(String serverUsed) { this.serverUsed = serverUsed; return this; @@ -381,17 +452,6 @@ public Object getUserData() { return userData; } - public BrowseResponse setRenderingContent(RenderingContent renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** Get renderingContent */ - @javax.annotation.Nullable - public RenderingContent getRenderingContent() { - return renderingContent; - } - public BrowseResponse setHits(List hits) { this.hits = hits; return this; @@ -459,6 +519,7 @@ public boolean equals(Object o) { Objects.equals(this.abTestVariantID, browseResponse.abTestVariantID) && Objects.equals(this.aroundLatLng, browseResponse.aroundLatLng) && Objects.equals(this.automaticRadius, browseResponse.automaticRadius) && + Objects.equals(this.exhaustive, browseResponse.exhaustive) && Objects.equals(this.exhaustiveFacetsCount, browseResponse.exhaustiveFacetsCount) && Objects.equals(this.exhaustiveNbHits, browseResponse.exhaustiveNbHits) && Objects.equals(this.exhaustiveTypo, browseResponse.exhaustiveTypo) && @@ -472,13 +533,15 @@ public boolean equals(Object o) { Objects.equals(this.nbPages, browseResponse.nbPages) && Objects.equals(this.nbSortedHits, browseResponse.nbSortedHits) && Objects.equals(this.page, browseResponse.page) && - Objects.equals(this.redirect, browseResponse.redirect) && Objects.equals(this.parsedQuery, browseResponse.parsedQuery) && Objects.equals(this.processingTimeMS, browseResponse.processingTimeMS) && + Objects.equals(this.processingTimingsMS, browseResponse.processingTimingsMS) && Objects.equals(this.queryAfterRemoval, browseResponse.queryAfterRemoval) && + Objects.equals(this.redirect, browseResponse.redirect) && + Objects.equals(this.renderingContent, browseResponse.renderingContent) && + Objects.equals(this.serverTimeMS, browseResponse.serverTimeMS) && Objects.equals(this.serverUsed, browseResponse.serverUsed) && Objects.equals(this.userData, browseResponse.userData) && - Objects.equals(this.renderingContent, browseResponse.renderingContent) && Objects.equals(this.hits, browseResponse.hits) && Objects.equals(this.query, browseResponse.query) && Objects.equals(this.params, browseResponse.params) && @@ -493,6 +556,7 @@ public int hashCode() { abTestVariantID, aroundLatLng, automaticRadius, + exhaustive, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, @@ -506,13 +570,15 @@ public int hashCode() { nbPages, nbSortedHits, page, - redirect, parsedQuery, processingTimeMS, + processingTimingsMS, queryAfterRemoval, + redirect, + renderingContent, + serverTimeMS, serverUsed, userData, - renderingContent, hits, query, params, @@ -528,6 +594,7 @@ public String toString() { sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); + sb.append(" exhaustive: ").append(toIndentedString(exhaustive)).append("\n"); sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); @@ -541,13 +608,15 @@ public String toString() { 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(" redirect: ").append(toIndentedString(redirect)).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"); sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); + sb.append(" redirect: ").append(toIndentedString(redirect)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb.append(" serverTimeMS: ").append(toIndentedString(serverTimeMS)).append("\n"); sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).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/Exhaustive.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/Exhaustive.java new file mode 100644 index 0000000000..dce9f92af9 --- /dev/null +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/Exhaustive.java @@ -0,0 +1,150 @@ +// 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; + +/** + * Whether certain properties of the search response are calculated exhaustive (exact) or + * approximated. + */ +public class Exhaustive { + + @JsonProperty("facetsCount") + private Boolean facetsCount; + + @JsonProperty("facetValues") + private Boolean facetValues; + + @JsonProperty("nbHits") + private Boolean nbHits; + + @JsonProperty("rulesMatch") + private Boolean rulesMatch; + + @JsonProperty("typo") + private Boolean typo; + + public Exhaustive setFacetsCount(Boolean facetsCount) { + this.facetsCount = facetsCount; + return this; + } + + /** + * Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related + * discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ + @javax.annotation.Nullable + public Boolean getFacetsCount() { + return facetsCount; + } + + public Exhaustive setFacetValues(Boolean facetValues) { + this.facetValues = facetValues; + return this; + } + + /** The value is `false` if not all facet values are retrieved. */ + @javax.annotation.Nullable + public Boolean getFacetValues() { + return facetValues; + } + + public Exhaustive setNbHits(Boolean nbHits) { + this.nbHits = nbHits; + return this; + } + + /** + * Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more + * than 50ms to be processed, the engine makes an approximation. This can happen when using + * complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough + * hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` + * is reported as non-exhaustive whenever an approximation is made, even if the approximation + * didn’t, in the end, impact the exhaustivity of the query. + */ + @javax.annotation.Nullable + public Boolean getNbHits() { + return nbHits; + } + + public Exhaustive setRulesMatch(Boolean rulesMatch) { + this.rulesMatch = rulesMatch; + return this; + } + + /** + * Rules matching exhaustivity. The value is `false` if rules were enable for this query, and + * could not be fully processed due a timeout. This is generally caused by the number of + * alternatives (such as typos) which is too large. + */ + @javax.annotation.Nullable + public Boolean getRulesMatch() { + return rulesMatch; + } + + public Exhaustive setTypo(Boolean typo) { + this.typo = typo; + return this; + } + + /** + * Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is + * done when the typo search query part takes more than 10% of the query budget (ie. 5ms by + * default) to be processed (this can happen when a lot of typo alternatives exist for the query). + * This field will not be included when typo-tolerance is entirely disabled. + */ + @javax.annotation.Nullable + public Boolean getTypo() { + return typo; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Exhaustive exhaustive = (Exhaustive) o; + return ( + Objects.equals(this.facetsCount, exhaustive.facetsCount) && + Objects.equals(this.facetValues, exhaustive.facetValues) && + Objects.equals(this.nbHits, exhaustive.nbHits) && + Objects.equals(this.rulesMatch, exhaustive.rulesMatch) && + Objects.equals(this.typo, exhaustive.typo) + ); + } + + @Override + public int hashCode() { + return Objects.hash(facetsCount, facetValues, nbHits, rulesMatch, typo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Exhaustive {\n"); + sb.append(" facetsCount: ").append(toIndentedString(facetsCount)).append("\n"); + sb.append(" facetValues: ").append(toIndentedString(facetValues)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" rulesMatch: ").append(toIndentedString(rulesMatch)).append("\n"); + sb.append(" typo: ").append(toIndentedString(typo)).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/BaseSearchResponseRedirect.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/Redirect.java similarity index 79% rename from clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BaseSearchResponseRedirect.java rename to clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/Redirect.java index 98ad086b78..dc8b40b9dd 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/BaseSearchResponseRedirect.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/Redirect.java @@ -13,17 +13,17 @@ * [Redirect results to a * URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). */ -public class BaseSearchResponseRedirect { +public class Redirect { @JsonProperty("index") private List index; - public BaseSearchResponseRedirect setIndex(List index) { + public Redirect setIndex(List index) { this.index = index; return this; } - public BaseSearchResponseRedirect addIndex(RedirectRuleIndexMetadata indexItem) { + public Redirect addIndex(RedirectRuleIndexMetadata indexItem) { if (this.index == null) { this.index = new ArrayList<>(); } @@ -45,8 +45,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BaseSearchResponseRedirect baseSearchResponseRedirect = (BaseSearchResponseRedirect) o; - return Objects.equals(this.index, baseSearchResponseRedirect.index); + Redirect redirect = (Redirect) o; + return Objects.equals(this.index, redirect.index); } @Override @@ -57,7 +57,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BaseSearchResponseRedirect {\n"); + sb.append("class Redirect {\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchHits.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchHits.java index a2c41bf28d..de067a121f 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchHits.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchHits.java @@ -6,7 +6,9 @@ import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** SearchHits */ @@ -21,6 +23,19 @@ public class SearchHits { @JsonProperty("params") private String params; + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public SearchHits setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + public SearchHits setHits(List hits) { this.hits = hits; return this; @@ -71,19 +86,21 @@ public boolean equals(Object o) { return ( Objects.equals(this.hits, searchHits.hits) && Objects.equals(this.query, searchHits.query) && - Objects.equals(this.params, searchHits.params) + Objects.equals(this.params, searchHits.params) && + super.equals(o) ); } @Override public int hashCode() { - return Objects.hash(hits, query, params); + return Objects.hash(hits, query, params, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchHits {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/SearchQuery.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchQuery.java index 689cf6cd32..ee91829200 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchQuery.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/SearchQuery.java @@ -23,7 +23,7 @@ public SearchQuery deserialize(JsonParser jp, DeserializationContext ctxt) throw JsonNode tree = jp.readValueAsTree(); // deserialize SearchForFacets - if (tree.isObject()) { + if (tree.isObject() && tree.has("facet") && tree.has("type")) { try (JsonParser parser = tree.traverse(jp.getCodec())) { return parser.readValueAs(SearchForFacets.class); } catch (Exception e) { 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 11b5bd57e5..3f1fd7a47e 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 @@ -27,6 +27,9 @@ public class SearchResponse implements SearchResult { @JsonProperty("automaticRadius") private String automaticRadius; + @JsonProperty("exhaustive") + private Exhaustive exhaustive; + @JsonProperty("exhaustiveFacetsCount") private Boolean exhaustiveFacetsCount; @@ -66,27 +69,33 @@ public class SearchResponse implements SearchResult { @JsonProperty("page") private Integer page; - @JsonProperty("redirect") - private BaseSearchResponseRedirect redirect; - @JsonProperty("parsedQuery") private String parsedQuery; @JsonProperty("processingTimeMS") private Integer processingTimeMS; + @JsonProperty("processingTimingsMS") + private Object processingTimingsMS; + @JsonProperty("queryAfterRemoval") private String queryAfterRemoval; + @JsonProperty("redirect") + private Redirect redirect; + + @JsonProperty("renderingContent") + private RenderingContent renderingContent; + + @JsonProperty("serverTimeMS") + private Integer serverTimeMS; + @JsonProperty("serverUsed") private String serverUsed; @JsonProperty("userData") private Object userData; - @JsonProperty("renderingContent") - private RenderingContent renderingContent; - @JsonProperty("hits") private List hits = new ArrayList<>(); @@ -96,6 +105,19 @@ public class SearchResponse implements SearchResult { @JsonProperty("params") private String params; + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public SearchResponse setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + public SearchResponse setAbTestID(Integer abTestID) { this.abTestID = abTestID; return this; @@ -145,12 +167,28 @@ public String getAutomaticRadius() { return automaticRadius; } + public SearchResponse setExhaustive(Exhaustive exhaustive) { + this.exhaustive = exhaustive; + return this; + } + + /** Get exhaustive */ + @javax.annotation.Nullable + public Exhaustive getExhaustive() { + return exhaustive; + } + public SearchResponse setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; return this; } - /** Indicates whether the facet count is exhaustive (exact) or approximate. */ + /** + * See the `facetsCount` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; @@ -161,7 +199,12 @@ public SearchResponse setExhaustiveNbHits(Boolean exhaustiveNbHits) { return this; } - /** Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. */ + /** + * See the `nbHits` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; @@ -172,7 +215,12 @@ public SearchResponse setExhaustiveTypo(Boolean exhaustiveTypo) { return this; } - /** Indicates whether the search for typos was exhaustive (exact) or approximate. */ + /** + * See the `typo` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated @javax.annotation.Nullable public Boolean getExhaustiveTypo() { return exhaustiveTypo; @@ -307,17 +355,6 @@ public Integer getPage() { return page; } - public SearchResponse setRedirect(BaseSearchResponseRedirect redirect) { - this.redirect = redirect; - return this; - } - - /** Get redirect */ - @javax.annotation.Nullable - public BaseSearchResponseRedirect getRedirect() { - return redirect; - } - public SearchResponse setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; return this; @@ -343,6 +380,20 @@ public Integer getProcessingTimeMS() { return processingTimeMS; } + public SearchResponse setProcessingTimingsMS(Object processingTimingsMS) { + this.processingTimingsMS = processingTimingsMS; + return this; + } + + /** + * Experimental. List of processing steps and their times, in milliseconds. You can use this list + * to investigate performance issues. + */ + @javax.annotation.Nullable + public Object getProcessingTimingsMS() { + return processingTimingsMS; + } + public SearchResponse setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; return this; @@ -357,6 +408,39 @@ public String getQueryAfterRemoval() { return queryAfterRemoval; } + public SearchResponse setRedirect(Redirect redirect) { + this.redirect = redirect; + return this; + } + + /** Get redirect */ + @javax.annotation.Nullable + public Redirect getRedirect() { + return redirect; + } + + public SearchResponse setRenderingContent(RenderingContent renderingContent) { + this.renderingContent = renderingContent; + return this; + } + + /** Get renderingContent */ + @javax.annotation.Nullable + public RenderingContent getRenderingContent() { + return renderingContent; + } + + public SearchResponse setServerTimeMS(Integer serverTimeMS) { + this.serverTimeMS = serverTimeMS; + return this; + } + + /** Time the server took to process the request, in milliseconds. */ + @javax.annotation.Nullable + public Integer getServerTimeMS() { + return serverTimeMS; + } + public SearchResponse setServerUsed(String serverUsed) { this.serverUsed = serverUsed; return this; @@ -379,17 +463,6 @@ public Object getUserData() { return userData; } - public SearchResponse setRenderingContent(RenderingContent renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** Get renderingContent */ - @javax.annotation.Nullable - public RenderingContent getRenderingContent() { - return renderingContent; - } - public SearchResponse setHits(List hits) { this.hits = hits; return this; @@ -442,6 +515,7 @@ public boolean equals(Object o) { Objects.equals(this.abTestVariantID, searchResponse.abTestVariantID) && Objects.equals(this.aroundLatLng, searchResponse.aroundLatLng) && Objects.equals(this.automaticRadius, searchResponse.automaticRadius) && + Objects.equals(this.exhaustive, searchResponse.exhaustive) && Objects.equals(this.exhaustiveFacetsCount, searchResponse.exhaustiveFacetsCount) && Objects.equals(this.exhaustiveNbHits, searchResponse.exhaustiveNbHits) && Objects.equals(this.exhaustiveTypo, searchResponse.exhaustiveTypo) && @@ -455,16 +529,19 @@ public boolean equals(Object o) { Objects.equals(this.nbPages, searchResponse.nbPages) && Objects.equals(this.nbSortedHits, searchResponse.nbSortedHits) && Objects.equals(this.page, searchResponse.page) && - Objects.equals(this.redirect, searchResponse.redirect) && Objects.equals(this.parsedQuery, searchResponse.parsedQuery) && Objects.equals(this.processingTimeMS, searchResponse.processingTimeMS) && + Objects.equals(this.processingTimingsMS, searchResponse.processingTimingsMS) && Objects.equals(this.queryAfterRemoval, searchResponse.queryAfterRemoval) && + Objects.equals(this.redirect, searchResponse.redirect) && + Objects.equals(this.renderingContent, searchResponse.renderingContent) && + Objects.equals(this.serverTimeMS, searchResponse.serverTimeMS) && Objects.equals(this.serverUsed, searchResponse.serverUsed) && Objects.equals(this.userData, searchResponse.userData) && - Objects.equals(this.renderingContent, searchResponse.renderingContent) && Objects.equals(this.hits, searchResponse.hits) && Objects.equals(this.query, searchResponse.query) && - Objects.equals(this.params, searchResponse.params) + Objects.equals(this.params, searchResponse.params) && + super.equals(o) ); } @@ -475,6 +552,7 @@ public int hashCode() { abTestVariantID, aroundLatLng, automaticRadius, + exhaustive, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, @@ -488,16 +566,19 @@ public int hashCode() { nbPages, nbSortedHits, page, - redirect, parsedQuery, processingTimeMS, + processingTimingsMS, queryAfterRemoval, + redirect, + renderingContent, + serverTimeMS, serverUsed, userData, - renderingContent, hits, query, - params + params, + super.hashCode() ); } @@ -505,10 +586,12 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); + sb.append(" exhaustive: ").append(toIndentedString(exhaustive)).append("\n"); sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); @@ -522,13 +605,15 @@ public String toString() { 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(" redirect: ").append(toIndentedString(redirect)).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"); sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); + sb.append(" redirect: ").append(toIndentedString(redirect)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb.append(" serverTimeMS: ").append(toIndentedString(serverTimeMS)).append("\n"); sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).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/lite/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts index 00d48cefeb..c2ba1054d9 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponse.ts @@ -1,10 +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 { BaseSearchResponseRedirect } from './baseSearchResponseRedirect'; +import type { Exhaustive } from './exhaustive'; import type { FacetsStats } from './facetsStats'; +import type { Redirect } from './redirect'; import type { RenderingContent } from './renderingContent'; -export type BaseSearchResponse = { +export type BaseSearchResponse = Record & { /** * A/B test ID. This is only included in the response for indices that are part of an A/B test. */ @@ -25,18 +26,20 @@ export type BaseSearchResponse = { */ automaticRadius?: string; + exhaustive?: Exhaustive; + /** - * Indicates whether the facet count is exhaustive (exact) or approximate. + * See the `facetsCount` field of the `exhaustive` object in the response. */ exhaustiveFacetsCount?: boolean; /** - * Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + * See the `nbHits` field of the `exhaustive` object in the response. */ exhaustiveNbHits?: boolean; /** - * Indicates whether the search for typos was exhaustive (exact) or approximate. + * See the `typo` field of the `exhaustive` object in the response. */ exhaustiveTypo?: boolean; @@ -90,8 +93,6 @@ export type BaseSearchResponse = { */ page: number; - redirect?: BaseSearchResponseRedirect; - /** * 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. */ @@ -102,11 +103,25 @@ export type BaseSearchResponse = { */ processingTimeMS: number; + /** + * Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + */ + processingTimingsMS?: Record; + /** * Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ queryAfterRemoval?: string; + redirect?: Redirect; + + renderingContent?: RenderingContent; + + /** + * Time the server took to process the request, in milliseconds. + */ + serverTimeMS?: number; + /** * Host name of the server that processed the request. */ @@ -116,6 +131,4 @@ export type BaseSearchResponse = { * Lets you store custom data in your indices. */ userData?: any | null; - - renderingContent?: RenderingContent; }; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/exhaustive.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/exhaustive.ts new file mode 100644 index 0000000000..6e578adf14 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/exhaustive.ts @@ -0,0 +1,31 @@ +// 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. + +/** + * Whether certain properties of the search response are calculated exhaustive (exact) or approximated. + */ +export type Exhaustive = { + /** + * Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ + facetsCount?: boolean; + + /** + * The value is `false` if not all facet values are retrieved. + */ + facetValues?: boolean; + + /** + * Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + */ + nbHits?: boolean; + + /** + * Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + */ + rulesMatch?: boolean; + + /** + * Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + */ + typo?: boolean; +}; 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 b3d17b9e45..936c9a3f8f 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/index.ts @@ -19,7 +19,6 @@ export * from './baseIndexSettings'; export * from './baseSearchParams'; export * from './baseSearchParamsWithoutQuery'; export * from './baseSearchResponse'; -export * from './baseSearchResponseRedirect'; export * from './browseParams'; export * from './browseParamsObject'; export * from './browseResponse'; @@ -43,6 +42,7 @@ export * from './edit'; export * from './editType'; export * from './errorBase'; export * from './exactOnSingleWordQuery'; +export * from './exhaustive'; export * from './facetFilters'; export * from './facetHits'; export * from './facetOrdering'; @@ -74,6 +74,7 @@ export * from './promoteObjectIDs'; export * from './queryType'; export * from './rankingInfo'; export * from './reRankingApplyFilter'; +export * from './redirect'; export * from './redirectRuleIndexMetadata'; export * from './redirectRuleIndexMetadataData'; export * from './removeStopWords'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponseRedirect.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/redirect.ts similarity index 91% rename from clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponseRedirect.ts rename to clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/redirect.ts index 30100d6e27..b15a5c2c34 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/baseSearchResponseRedirect.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/redirect.ts @@ -5,6 +5,6 @@ import type { RedirectRuleIndexMetadata } from './redirectRuleIndexMetadata'; /** * [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). */ -export type BaseSearchResponseRedirect = { +export type Redirect = { index?: RedirectRuleIndexMetadata[]; }; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchHits.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchHits.ts index 781c9723a8..4ee57cf20d 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchHits.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/searchHits.ts @@ -2,7 +2,7 @@ import type { Hit } from './hit'; -export type SearchHits> = { +export type SearchHits> = Record & { hits: Array>; /** 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 00d48cefeb..c2ba1054d9 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts @@ -1,10 +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 { BaseSearchResponseRedirect } from './baseSearchResponseRedirect'; +import type { Exhaustive } from './exhaustive'; import type { FacetsStats } from './facetsStats'; +import type { Redirect } from './redirect'; import type { RenderingContent } from './renderingContent'; -export type BaseSearchResponse = { +export type BaseSearchResponse = Record & { /** * A/B test ID. This is only included in the response for indices that are part of an A/B test. */ @@ -25,18 +26,20 @@ export type BaseSearchResponse = { */ automaticRadius?: string; + exhaustive?: Exhaustive; + /** - * Indicates whether the facet count is exhaustive (exact) or approximate. + * See the `facetsCount` field of the `exhaustive` object in the response. */ exhaustiveFacetsCount?: boolean; /** - * Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. + * See the `nbHits` field of the `exhaustive` object in the response. */ exhaustiveNbHits?: boolean; /** - * Indicates whether the search for typos was exhaustive (exact) or approximate. + * See the `typo` field of the `exhaustive` object in the response. */ exhaustiveTypo?: boolean; @@ -90,8 +93,6 @@ export type BaseSearchResponse = { */ page: number; - redirect?: BaseSearchResponseRedirect; - /** * 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. */ @@ -102,11 +103,25 @@ export type BaseSearchResponse = { */ processingTimeMS: number; + /** + * Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + */ + processingTimingsMS?: Record; + /** * Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ queryAfterRemoval?: string; + redirect?: Redirect; + + renderingContent?: RenderingContent; + + /** + * Time the server took to process the request, in milliseconds. + */ + serverTimeMS?: number; + /** * Host name of the server that processed the request. */ @@ -116,6 +131,4 @@ export type BaseSearchResponse = { * Lets you store custom data in your indices. */ userData?: any | null; - - renderingContent?: RenderingContent; }; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/exhaustive.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/exhaustive.ts new file mode 100644 index 0000000000..6e578adf14 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/exhaustive.ts @@ -0,0 +1,31 @@ +// 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. + +/** + * Whether certain properties of the search response are calculated exhaustive (exact) or approximated. + */ +export type Exhaustive = { + /** + * Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ + facetsCount?: boolean; + + /** + * The value is `false` if not all facet values are retrieved. + */ + facetValues?: boolean; + + /** + * Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + */ + nbHits?: boolean; + + /** + * Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + */ + rulesMatch?: boolean; + + /** + * Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + */ + typo?: boolean; +}; 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 1fc1ddf4e2..8db900701a 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts @@ -20,7 +20,6 @@ export * from './baseIndexSettings'; export * from './baseSearchParams'; export * from './baseSearchParamsWithoutQuery'; export * from './baseSearchResponse'; -export * from './baseSearchResponseRedirect'; export * from './batchAssignUserIdsParams'; export * from './batchDictionaryEntriesParams'; export * from './batchDictionaryEntriesRequest'; @@ -56,6 +55,7 @@ export * from './edit'; export * from './editType'; export * from './errorBase'; export * from './exactOnSingleWordQuery'; +export * from './exhaustive'; export * from './facetFilters'; export * from './facetHits'; export * from './facetOrdering'; @@ -103,6 +103,7 @@ export * from './promoteObjectIDs'; export * from './queryType'; export * from './rankingInfo'; export * from './reRankingApplyFilter'; +export * from './redirect'; export * from './redirectRuleIndexMetadata'; export * from './redirectRuleIndexMetadataData'; export * from './removeStopWords'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseRedirect.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/redirect.ts similarity index 91% rename from clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseRedirect.ts rename to clients/algoliasearch-client-javascript/packages/client-search/model/redirect.ts index 30100d6e27..b15a5c2c34 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseRedirect.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/redirect.ts @@ -5,6 +5,6 @@ import type { RedirectRuleIndexMetadata } from './redirectRuleIndexMetadata'; /** * [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). */ -export type BaseSearchResponseRedirect = { +export type Redirect = { index?: RedirectRuleIndexMetadata[]; }; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts index 781c9723a8..4ee57cf20d 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts @@ -2,7 +2,7 @@ import type { Hit } from './hit'; -export type SearchHits> = { +export type SearchHits> = Record & { hits: Array>; /** diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/insights/EventsItems.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/insights/EventsItems.kt index e982b594ab..440eb59467 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/insights/EventsItems.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/insights/EventsItems.kt @@ -13,16 +13,16 @@ import kotlinx.serialization.json.* * EventsItems * * Implementations: - * - [AddedToCartObjectIDs] * - [AddedToCartObjectIDsAfterSearch] + * - [PurchasedObjectIDsAfterSearch] + * - [AddedToCartObjectIDs] + * - [ClickedObjectIDsAfterSearch] + * - [PurchasedObjectIDs] * - [ClickedFilters] * - [ClickedObjectIDs] - * - [ClickedObjectIDsAfterSearch] * - [ConvertedFilters] * - [ConvertedObjectIDs] * - [ConvertedObjectIDsAfterSearch] - * - [PurchasedObjectIDs] - * - [PurchasedObjectIDsAfterSearch] * - [ViewedFilters] * - [ViewedObjectIDs] */ @@ -39,16 +39,16 @@ internal class EventsItemsSerializer : KSerializer { override fun serialize(encoder: Encoder, value: EventsItems) { when (value) { - is AddedToCartObjectIDs -> AddedToCartObjectIDs.serializer().serialize(encoder, value) is AddedToCartObjectIDsAfterSearch -> AddedToCartObjectIDsAfterSearch.serializer().serialize(encoder, value) + is PurchasedObjectIDsAfterSearch -> PurchasedObjectIDsAfterSearch.serializer().serialize(encoder, value) + is AddedToCartObjectIDs -> AddedToCartObjectIDs.serializer().serialize(encoder, value) + is ClickedObjectIDsAfterSearch -> ClickedObjectIDsAfterSearch.serializer().serialize(encoder, value) + is PurchasedObjectIDs -> PurchasedObjectIDs.serializer().serialize(encoder, value) is ClickedFilters -> ClickedFilters.serializer().serialize(encoder, value) is ClickedObjectIDs -> ClickedObjectIDs.serializer().serialize(encoder, value) - is ClickedObjectIDsAfterSearch -> ClickedObjectIDsAfterSearch.serializer().serialize(encoder, value) is ConvertedFilters -> ConvertedFilters.serializer().serialize(encoder, value) is ConvertedObjectIDs -> ConvertedObjectIDs.serializer().serialize(encoder, value) is ConvertedObjectIDsAfterSearch -> ConvertedObjectIDsAfterSearch.serializer().serialize(encoder, value) - is PurchasedObjectIDs -> PurchasedObjectIDs.serializer().serialize(encoder, value) - is PurchasedObjectIDsAfterSearch -> PurchasedObjectIDsAfterSearch.serializer().serialize(encoder, value) is ViewedFilters -> ViewedFilters.serializer().serialize(encoder, value) is ViewedObjectIDs -> ViewedObjectIDs.serializer().serialize(encoder, value) } @@ -58,18 +58,8 @@ internal class EventsItemsSerializer : KSerializer { val codec = decoder.asJsonDecoder() val tree = codec.decodeJsonElement() - // deserialize AddedToCartObjectIDs - if (tree is JsonObject) { - try { - return codec.json.decodeFromJsonElement(AddedToCartObjectIDs.serializer(), tree) - } catch (e: Exception) { - // deserialization failed, continue - println("Failed to deserialize AddedToCartObjectIDs (error: ${e.message})") - } - } - // deserialize AddedToCartObjectIDsAfterSearch - if (tree is JsonObject) { + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("eventSubtype") && tree.containsKey("queryID") && tree.containsKey("objectIDs")) { try { return codec.json.decodeFromJsonElement(AddedToCartObjectIDsAfterSearch.serializer(), tree) } catch (e: Exception) { @@ -78,28 +68,28 @@ internal class EventsItemsSerializer : KSerializer { } } - // deserialize ClickedFilters - if (tree is JsonObject) { + // deserialize PurchasedObjectIDsAfterSearch + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("eventSubtype") && tree.containsKey("queryID") && tree.containsKey("objectIDs")) { try { - return codec.json.decodeFromJsonElement(ClickedFilters.serializer(), tree) + return codec.json.decodeFromJsonElement(PurchasedObjectIDsAfterSearch.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize ClickedFilters (error: ${e.message})") + println("Failed to deserialize PurchasedObjectIDsAfterSearch (error: ${e.message})") } } - // deserialize ClickedObjectIDs - if (tree is JsonObject) { + // deserialize AddedToCartObjectIDs + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("eventSubtype") && tree.containsKey("objectIDs")) { try { - return codec.json.decodeFromJsonElement(ClickedObjectIDs.serializer(), tree) + return codec.json.decodeFromJsonElement(AddedToCartObjectIDs.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize ClickedObjectIDs (error: ${e.message})") + println("Failed to deserialize AddedToCartObjectIDs (error: ${e.message})") } } // deserialize ClickedObjectIDsAfterSearch - if (tree is JsonObject) { + if (tree is JsonObject && tree.containsKey("positions") && tree.containsKey("queryID") && tree.containsKey("eventType")) { try { return codec.json.decodeFromJsonElement(ClickedObjectIDsAfterSearch.serializer(), tree) } catch (e: Exception) { @@ -108,58 +98,68 @@ internal class EventsItemsSerializer : KSerializer { } } - // deserialize ConvertedFilters - if (tree is JsonObject) { + // deserialize PurchasedObjectIDs + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("eventSubtype") && tree.containsKey("objectIDs")) { try { - return codec.json.decodeFromJsonElement(ConvertedFilters.serializer(), tree) + return codec.json.decodeFromJsonElement(PurchasedObjectIDs.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize ConvertedFilters (error: ${e.message})") + println("Failed to deserialize PurchasedObjectIDs (error: ${e.message})") } } - // deserialize ConvertedObjectIDs - if (tree is JsonObject) { + // deserialize ClickedFilters + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("filters")) { try { - return codec.json.decodeFromJsonElement(ConvertedObjectIDs.serializer(), tree) + return codec.json.decodeFromJsonElement(ClickedFilters.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize ConvertedObjectIDs (error: ${e.message})") + println("Failed to deserialize ClickedFilters (error: ${e.message})") } } - // deserialize ConvertedObjectIDsAfterSearch - if (tree is JsonObject) { + // deserialize ClickedObjectIDs + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("objectIDs")) { try { - return codec.json.decodeFromJsonElement(ConvertedObjectIDsAfterSearch.serializer(), tree) + return codec.json.decodeFromJsonElement(ClickedObjectIDs.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize ConvertedObjectIDsAfterSearch (error: ${e.message})") + println("Failed to deserialize ClickedObjectIDs (error: ${e.message})") } } - // deserialize PurchasedObjectIDs - if (tree is JsonObject) { + // deserialize ConvertedFilters + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("filters")) { try { - return codec.json.decodeFromJsonElement(PurchasedObjectIDs.serializer(), tree) + return codec.json.decodeFromJsonElement(ConvertedFilters.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize PurchasedObjectIDs (error: ${e.message})") + println("Failed to deserialize ConvertedFilters (error: ${e.message})") } } - // deserialize PurchasedObjectIDsAfterSearch - if (tree is JsonObject) { + // deserialize ConvertedObjectIDs + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("objectIDs")) { try { - return codec.json.decodeFromJsonElement(PurchasedObjectIDsAfterSearch.serializer(), tree) + return codec.json.decodeFromJsonElement(ConvertedObjectIDs.serializer(), tree) } catch (e: Exception) { // deserialization failed, continue - println("Failed to deserialize PurchasedObjectIDsAfterSearch (error: ${e.message})") + println("Failed to deserialize ConvertedObjectIDs (error: ${e.message})") + } + } + + // deserialize ConvertedObjectIDsAfterSearch + if (tree is JsonObject && tree.containsKey("queryID") && tree.containsKey("eventType")) { + try { + return codec.json.decodeFromJsonElement(ConvertedObjectIDsAfterSearch.serializer(), tree) + } catch (e: Exception) { + // deserialization failed, continue + println("Failed to deserialize ConvertedObjectIDsAfterSearch (error: ${e.message})") } } // deserialize ViewedFilters - if (tree is JsonObject) { + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("filters")) { try { return codec.json.decodeFromJsonElement(ViewedFilters.serializer(), tree) } catch (e: Exception) { @@ -169,7 +169,7 @@ internal class EventsItemsSerializer : KSerializer { } // deserialize ViewedObjectIDs - if (tree is JsonObject) { + if (tree is JsonObject && tree.containsKey("eventType") && tree.containsKey("objectIDs")) { try { return codec.json.decodeFromJsonElement(ViewedObjectIDs.serializer(), tree) } catch (e: Exception) { 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 555ac5a3fd..317759b135 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 @@ -1,7 +1,10 @@ /** 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 com.algolia.client.extensions.internal.* import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* import kotlinx.serialization.json.* /** @@ -16,92 +19,211 @@ import kotlinx.serialization.json.* * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. * @param aroundLatLng Computed geographical location. * @param automaticRadius Automatically-computed radius. - * @param exhaustiveFacetsCount Indicates whether the facet count is exhaustive (exact) or approximate. - * @param exhaustiveNbHits Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. - * @param exhaustiveTypo Indicates whether the search for typos was exhaustive (exact) or approximate. + * @param exhaustive + * @param exhaustiveFacetsCount See the `facetsCount` field of the `exhaustive` object in the response. + * @param exhaustiveNbHits See the `nbHits` field of the `exhaustive` object in the response. + * @param exhaustiveTypo See the `typo` field of the `exhaustive` object in the response. * @param facets Mapping of each facet name to the corresponding facet counts. * @param facetsStats Statistics for numerical facets. * @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 nbSortedHits Number of hits selected and sorted by the relevant sort algorithm. - * @param redirect * @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. + * @param processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * @param queryAfterRemoval Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + * @param redirect + * @param renderingContent + * @param serverTimeMS Time the server took to process the request, in milliseconds. * @param serverUsed Host name of the server that processed the request. * @param userData Lets you store custom data in your indices. - * @param renderingContent */ -@Serializable +@Serializable(BaseSearchResponseSerializer::class) public data class BaseSearchResponse( /** Number of hits per page. */ - @SerialName(value = "hitsPerPage") val hitsPerPage: Int, + val hitsPerPage: Int, /** Number of hits the search query matched. */ - @SerialName(value = "nbHits") val nbHits: Int, + val nbHits: Int, /** Number of pages of results for the current query. */ - @SerialName(value = "nbPages") val nbPages: Int, + val nbPages: Int, /** Page to retrieve (the first page is `0`, not `1`). */ - @SerialName(value = "page") val page: Int, + val page: Int, /** Time the server took to process the request, in milliseconds. */ - @SerialName(value = "processingTimeMS") val processingTimeMS: Int, + val processingTimeMS: Int, /** A/B test ID. This is only included in the response for indices that are part of an A/B test. */ - @SerialName(value = "abTestID") val abTestID: Int? = null, + val abTestID: Int? = null, /** Variant ID. This is only included in the response for indices that are part of an A/B test. */ - @SerialName(value = "abTestVariantID") val abTestVariantID: Int? = null, + val abTestVariantID: Int? = null, /** Computed geographical location. */ - @SerialName(value = "aroundLatLng") val aroundLatLng: String? = null, + val aroundLatLng: String? = null, /** Automatically-computed radius. */ - @SerialName(value = "automaticRadius") val automaticRadius: String? = null, + val automaticRadius: String? = null, + + val exhaustive: Exhaustive? = null, - /** Indicates whether the facet count is exhaustive (exact) or approximate. */ - @SerialName(value = "exhaustiveFacetsCount") val exhaustiveFacetsCount: Boolean? = null, + /** See the `facetsCount` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + val exhaustiveFacetsCount: Boolean? = null, - /** Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. */ - @SerialName(value = "exhaustiveNbHits") val exhaustiveNbHits: Boolean? = null, + /** See the `nbHits` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + val exhaustiveNbHits: Boolean? = null, - /** Indicates whether the search for typos was exhaustive (exact) or approximate. */ - @SerialName(value = "exhaustiveTypo") val exhaustiveTypo: Boolean? = null, + /** See the `typo` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + val exhaustiveTypo: Boolean? = null, /** Mapping of each facet name to the corresponding facet counts. */ - @SerialName(value = "facets") val facets: Map>? = null, + val facets: Map>? = null, /** Statistics for numerical facets. */ - @SerialName(value = "facets_stats") val facetsStats: Map? = null, + val facetsStats: Map? = null, /** Index name used for the query. */ - @SerialName(value = "index") val index: String? = null, + val index: String? = null, /** Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. */ - @SerialName(value = "indexUsed") val indexUsed: String? = null, + val indexUsed: String? = null, /** Warnings about the query. */ - @SerialName(value = "message") val message: String? = null, + val message: String? = null, /** Number of hits selected and sorted by the relevant sort algorithm. */ - @SerialName(value = "nbSortedHits") val nbSortedHits: Int? = null, - - @SerialName(value = "redirect") val redirect: BaseSearchResponseRedirect? = null, + val nbSortedHits: Int? = null, /** 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. */ - @SerialName(value = "parsedQuery") val parsedQuery: String? = null, + val parsedQuery: String? = null, + + /** Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. */ + val processingTimingsMS: JsonObject? = null, /** Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ - @SerialName(value = "queryAfterRemoval") val queryAfterRemoval: String? = null, + val queryAfterRemoval: String? = null, + + val redirect: Redirect? = null, + + val renderingContent: RenderingContent? = null, + + /** Time the server took to process the request, in milliseconds. */ + val serverTimeMS: Int? = null, /** Host name of the server that processed the request. */ - @SerialName(value = "serverUsed") val serverUsed: String? = null, + val serverUsed: String? = null, /** Lets you store custom data in your indices. */ - @SerialName(value = "userData") val userData: JsonElement? = null, + val userData: JsonElement? = null, - @SerialName(value = "renderingContent") val renderingContent: RenderingContent? = null, + val additionalProperties: Map? = null, ) + +internal object BaseSearchResponseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("BaseSearchResponse") { + element("hitsPerPage") + element("nbHits") + element("nbPages") + element("page") + element("processingTimeMS") + element("abTestID") + element("abTestVariantID") + element("aroundLatLng") + element("automaticRadius") + element("exhaustive") + element("exhaustiveFacetsCount") + element("exhaustiveNbHits") + element("exhaustiveTypo") + element>>("facets") + element>("facets_stats") + element("index") + element("indexUsed") + element("message") + element("nbSortedHits") + element("parsedQuery") + element("processingTimingsMS") + element("queryAfterRemoval") + element("redirect") + element("renderingContent") + element("serverTimeMS") + element("serverUsed") + element("userData") + } + + override fun deserialize(decoder: Decoder): BaseSearchResponse { + 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) }, + aroundLatLng = tree["aroundLatLng"]?.let { input.json.decodeFromJsonElement(it) }, + automaticRadius = tree["automaticRadius"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustive = tree["exhaustive"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustiveFacetsCount = tree["exhaustiveFacetsCount"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustiveNbHits = tree["exhaustiveNbHits"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustiveTypo = tree["exhaustiveTypo"]?.let { input.json.decodeFromJsonElement(it) }, + facets = tree["facets"]?.let { input.json.decodeFromJsonElement(it) }, + facetsStats = tree["facets_stats"]?.let { input.json.decodeFromJsonElement(it) }, + index = tree["index"]?.let { input.json.decodeFromJsonElement(it) }, + indexUsed = tree["indexUsed"]?.let { input.json.decodeFromJsonElement(it) }, + message = tree["message"]?.let { input.json.decodeFromJsonElement(it) }, + nbSortedHits = tree["nbSortedHits"]?.let { input.json.decodeFromJsonElement(it) }, + parsedQuery = tree["parsedQuery"]?.let { input.json.decodeFromJsonElement(it) }, + processingTimingsMS = tree["processingTimingsMS"]?.let { input.json.decodeFromJsonElement(it) }, + queryAfterRemoval = tree["queryAfterRemoval"]?.let { input.json.decodeFromJsonElement(it) }, + redirect = tree["redirect"]?.let { input.json.decodeFromJsonElement(it) }, + renderingContent = tree["renderingContent"]?.let { input.json.decodeFromJsonElement(it) }, + serverTimeMS = tree["serverTimeMS"]?.let { input.json.decodeFromJsonElement(it) }, + serverUsed = tree["serverUsed"]?.let { input.json.decodeFromJsonElement(it) }, + userData = tree["userData"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + 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)) } + value.aroundLatLng?.let { put("aroundLatLng", output.json.encodeToJsonElement(it)) } + value.automaticRadius?.let { put("automaticRadius", output.json.encodeToJsonElement(it)) } + value.exhaustive?.let { put("exhaustive", output.json.encodeToJsonElement(it)) } + value.exhaustiveFacetsCount?.let { put("exhaustiveFacetsCount", output.json.encodeToJsonElement(it)) } + value.exhaustiveNbHits?.let { put("exhaustiveNbHits", output.json.encodeToJsonElement(it)) } + value.exhaustiveTypo?.let { put("exhaustiveTypo", output.json.encodeToJsonElement(it)) } + value.facets?.let { put("facets", output.json.encodeToJsonElement(it)) } + value.facetsStats?.let { put("facets_stats", output.json.encodeToJsonElement(it)) } + value.index?.let { put("index", output.json.encodeToJsonElement(it)) } + value.indexUsed?.let { put("indexUsed", output.json.encodeToJsonElement(it)) } + value.message?.let { put("message", output.json.encodeToJsonElement(it)) } + value.nbSortedHits?.let { put("nbSortedHits", output.json.encodeToJsonElement(it)) } + value.parsedQuery?.let { put("parsedQuery", output.json.encodeToJsonElement(it)) } + value.processingTimingsMS?.let { put("processingTimingsMS", output.json.encodeToJsonElement(it)) } + value.queryAfterRemoval?.let { put("queryAfterRemoval", output.json.encodeToJsonElement(it)) } + value.redirect?.let { put("redirect", output.json.encodeToJsonElement(it)) } + value.renderingContent?.let { put("renderingContent", output.json.encodeToJsonElement(it)) } + value.serverTimeMS?.let { put("serverTimeMS", output.json.encodeToJsonElement(it)) } + value.serverUsed?.let { put("serverUsed", output.json.encodeToJsonElement(it)) } + value.userData?.let { put("userData", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} 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 b22b8f69d9..3f26168cf4 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 @@ -19,21 +19,24 @@ import kotlinx.serialization.json.* * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. * @param aroundLatLng Computed geographical location. * @param automaticRadius Automatically-computed radius. - * @param exhaustiveFacetsCount Indicates whether the facet count is exhaustive (exact) or approximate. - * @param exhaustiveNbHits Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. - * @param exhaustiveTypo Indicates whether the search for typos was exhaustive (exact) or approximate. + * @param exhaustive + * @param exhaustiveFacetsCount See the `facetsCount` field of the `exhaustive` object in the response. + * @param exhaustiveNbHits See the `nbHits` field of the `exhaustive` object in the response. + * @param exhaustiveTypo See the `typo` field of the `exhaustive` object in the response. * @param facets Mapping of each facet name to the corresponding facet counts. * @param facetsStats Statistics for numerical facets. * @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 nbSortedHits Number of hits selected and sorted by the relevant sort algorithm. - * @param redirect * @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. + * @param processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * @param queryAfterRemoval Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + * @param redirect + * @param renderingContent + * @param serverTimeMS Time the server took to process the request, in milliseconds. * @param serverUsed Host name of the server that processed the request. * @param userData Lets you store custom data in your indices. - * @param renderingContent * @param cursor Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. */ @Serializable @@ -74,13 +77,18 @@ public data class BrowseResponse( /** Automatically-computed radius. */ @SerialName(value = "automaticRadius") val automaticRadius: String? = null, - /** Indicates whether the facet count is exhaustive (exact) or approximate. */ + @SerialName(value = "exhaustive") val exhaustive: Exhaustive? = null, + + /** See the `facetsCount` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") @SerialName(value = "exhaustiveFacetsCount") val exhaustiveFacetsCount: Boolean? = null, - /** Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. */ + /** See the `nbHits` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") @SerialName(value = "exhaustiveNbHits") val exhaustiveNbHits: Boolean? = null, - /** Indicates whether the search for typos was exhaustive (exact) or approximate. */ + /** See the `typo` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") @SerialName(value = "exhaustiveTypo") val exhaustiveTypo: Boolean? = null, /** Mapping of each facet name to the corresponding facet counts. */ @@ -101,22 +109,28 @@ public data class BrowseResponse( /** Number of hits selected and sorted by the relevant sort algorithm. */ @SerialName(value = "nbSortedHits") val nbSortedHits: Int? = null, - @SerialName(value = "redirect") val redirect: BaseSearchResponseRedirect? = null, - /** 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. */ @SerialName(value = "parsedQuery") val parsedQuery: String? = null, + /** Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. */ + @SerialName(value = "processingTimingsMS") val processingTimingsMS: JsonObject? = null, + /** Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ @SerialName(value = "queryAfterRemoval") val queryAfterRemoval: String? = null, + @SerialName(value = "redirect") val redirect: Redirect? = null, + + @SerialName(value = "renderingContent") val renderingContent: RenderingContent? = null, + + /** Time the server took to process the request, in milliseconds. */ + @SerialName(value = "serverTimeMS") val serverTimeMS: Int? = null, + /** Host name of the server that processed the request. */ @SerialName(value = "serverUsed") val serverUsed: String? = null, /** Lets you store custom data in your indices. */ @SerialName(value = "userData") val userData: JsonElement? = null, - @SerialName(value = "renderingContent") val renderingContent: RenderingContent? = null, - /** Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. */ @SerialName(value = "cursor") val cursor: String? = null, ) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/Exhaustive.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/Exhaustive.kt new file mode 100644 index 0000000000..fa6933ee66 --- /dev/null +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/Exhaustive.kt @@ -0,0 +1,33 @@ +/** 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.* + +/** + * Whether certain properties of the search response are calculated exhaustive (exact) or approximated. + * + * @param facetsCount Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + * @param facetValues The value is `false` if not all facet values are retrieved. + * @param nbHits Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + * @param rulesMatch Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + * @param typo Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + */ +@Serializable +public data class Exhaustive( + + /** Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). */ + @SerialName(value = "facetsCount") val facetsCount: Boolean? = null, + + /** The value is `false` if not all facet values are retrieved. */ + @SerialName(value = "facetValues") val facetValues: Boolean? = null, + + /** Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. */ + @SerialName(value = "nbHits") val nbHits: Boolean? = null, + + /** Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. */ + @SerialName(value = "rulesMatch") val rulesMatch: Boolean? = null, + + /** Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. */ + @SerialName(value = "typo") val typo: Boolean? = null, +) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponseRedirect.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/Redirect.kt similarity index 92% rename from clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponseRedirect.kt rename to clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/Redirect.kt index 29058440c9..adf6526bb8 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/BaseSearchResponseRedirect.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/Redirect.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.json.* * @param index */ @Serializable -public data class BaseSearchResponseRedirect( +public data class Redirect( @SerialName(value = "index") val index: List? = null, ) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchHits.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchHits.kt index fa2e4fded8..8e346af94d 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchHits.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchHits.kt @@ -1,7 +1,10 @@ /** 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 com.algolia.client.extensions.internal.* import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* import kotlinx.serialization.json.* /** @@ -11,14 +14,47 @@ import kotlinx.serialization.json.* * @param query Text to search for in an index. * @param params URL-encoded string of all search parameters. */ -@Serializable +@Serializable(SearchHitsSerializer::class) public data class SearchHits( - @SerialName(value = "hits") val hits: List, + val hits: List, /** Text to search for in an index. */ - @SerialName(value = "query") val query: String, + val query: String, /** URL-encoded string of all search parameters. */ - @SerialName(value = "params") val params: String, + val params: String, + + val additionalProperties: Map? = null, ) + +internal object SearchHitsSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("SearchHits") { + element>("hits") + element("query") + element("params") + } + + override fun deserialize(decoder: Decoder): SearchHits { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return SearchHits( + 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) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: SearchHits) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + put("hits", output.json.encodeToJsonElement(value.hits)) + put("query", output.json.encodeToJsonElement(value.query)) + put("params", output.json.encodeToJsonElement(value.params)) + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchQuery.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchQuery.kt index 97123b8b4a..256e8d3eea 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchQuery.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/SearchQuery.kt @@ -39,7 +39,7 @@ internal class SearchQuerySerializer : KSerializer { val tree = codec.decodeJsonElement() // deserialize SearchForFacets - if (tree is JsonObject) { + if (tree is JsonObject && tree.containsKey("facet") && tree.containsKey("type")) { try { return codec.json.decodeFromJsonElement(SearchForFacets.serializer(), tree) } catch (e: Exception) { 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 feb0f6a29e..f2700dd800 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 @@ -1,7 +1,10 @@ /** 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 com.algolia.client.extensions.internal.* import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* import kotlinx.serialization.json.* /** @@ -19,100 +22,228 @@ import kotlinx.serialization.json.* * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. * @param aroundLatLng Computed geographical location. * @param automaticRadius Automatically-computed radius. - * @param exhaustiveFacetsCount Indicates whether the facet count is exhaustive (exact) or approximate. - * @param exhaustiveNbHits Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. - * @param exhaustiveTypo Indicates whether the search for typos was exhaustive (exact) or approximate. + * @param exhaustive + * @param exhaustiveFacetsCount See the `facetsCount` field of the `exhaustive` object in the response. + * @param exhaustiveNbHits See the `nbHits` field of the `exhaustive` object in the response. + * @param exhaustiveTypo See the `typo` field of the `exhaustive` object in the response. * @param facets Mapping of each facet name to the corresponding facet counts. * @param facetsStats Statistics for numerical facets. * @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 nbSortedHits Number of hits selected and sorted by the relevant sort algorithm. - * @param redirect * @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. + * @param processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * @param queryAfterRemoval Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + * @param redirect + * @param renderingContent + * @param serverTimeMS Time the server took to process the request, in milliseconds. * @param serverUsed Host name of the server that processed the request. * @param userData Lets you store custom data in your indices. - * @param renderingContent */ -@Serializable +@Serializable(SearchResponseSerializer::class) public data class SearchResponse( /** Number of hits per page. */ - @SerialName(value = "hitsPerPage") val hitsPerPage: Int, + val hitsPerPage: Int, /** Number of hits the search query matched. */ - @SerialName(value = "nbHits") val nbHits: Int, + val nbHits: Int, /** Number of pages of results for the current query. */ - @SerialName(value = "nbPages") val nbPages: Int, + val nbPages: Int, /** Page to retrieve (the first page is `0`, not `1`). */ - @SerialName(value = "page") val page: Int, + val page: Int, /** Time the server took to process the request, in milliseconds. */ - @SerialName(value = "processingTimeMS") val processingTimeMS: Int, + val processingTimeMS: Int, - @SerialName(value = "hits") val hits: List, + val hits: List, /** Text to search for in an index. */ - @SerialName(value = "query") val query: String, + val query: String, /** URL-encoded string of all search parameters. */ - @SerialName(value = "params") val params: String, + val params: String, /** A/B test ID. This is only included in the response for indices that are part of an A/B test. */ - @SerialName(value = "abTestID") val abTestID: Int? = null, + val abTestID: Int? = null, /** Variant ID. This is only included in the response for indices that are part of an A/B test. */ - @SerialName(value = "abTestVariantID") val abTestVariantID: Int? = null, + val abTestVariantID: Int? = null, /** Computed geographical location. */ - @SerialName(value = "aroundLatLng") val aroundLatLng: String? = null, + val aroundLatLng: String? = null, /** Automatically-computed radius. */ - @SerialName(value = "automaticRadius") val automaticRadius: String? = null, + val automaticRadius: String? = null, + + val exhaustive: Exhaustive? = null, - /** Indicates whether the facet count is exhaustive (exact) or approximate. */ - @SerialName(value = "exhaustiveFacetsCount") val exhaustiveFacetsCount: Boolean? = null, + /** See the `facetsCount` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + val exhaustiveFacetsCount: Boolean? = null, - /** Indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate. */ - @SerialName(value = "exhaustiveNbHits") val exhaustiveNbHits: Boolean? = null, + /** See the `nbHits` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + val exhaustiveNbHits: Boolean? = null, - /** Indicates whether the search for typos was exhaustive (exact) or approximate. */ - @SerialName(value = "exhaustiveTypo") val exhaustiveTypo: Boolean? = null, + /** See the `typo` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + val exhaustiveTypo: Boolean? = null, /** Mapping of each facet name to the corresponding facet counts. */ - @SerialName(value = "facets") val facets: Map>? = null, + val facets: Map>? = null, /** Statistics for numerical facets. */ - @SerialName(value = "facets_stats") val facetsStats: Map? = null, + val facetsStats: Map? = null, /** Index name used for the query. */ - @SerialName(value = "index") val index: String? = null, + val index: String? = null, /** Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. */ - @SerialName(value = "indexUsed") val indexUsed: String? = null, + val indexUsed: String? = null, /** Warnings about the query. */ - @SerialName(value = "message") val message: String? = null, + val message: String? = null, /** Number of hits selected and sorted by the relevant sort algorithm. */ - @SerialName(value = "nbSortedHits") val nbSortedHits: Int? = null, - - @SerialName(value = "redirect") val redirect: BaseSearchResponseRedirect? = null, + val nbSortedHits: Int? = null, /** 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. */ - @SerialName(value = "parsedQuery") val parsedQuery: String? = null, + val parsedQuery: String? = null, + + /** Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. */ + val processingTimingsMS: JsonObject? = null, /** Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ - @SerialName(value = "queryAfterRemoval") val queryAfterRemoval: String? = null, + val queryAfterRemoval: String? = null, + + val redirect: Redirect? = null, + + val renderingContent: RenderingContent? = null, + + /** Time the server took to process the request, in milliseconds. */ + val serverTimeMS: Int? = null, /** Host name of the server that processed the request. */ - @SerialName(value = "serverUsed") val serverUsed: String? = null, + val serverUsed: String? = null, /** Lets you store custom data in your indices. */ - @SerialName(value = "userData") val userData: JsonElement? = null, + val userData: JsonElement? = null, - @SerialName(value = "renderingContent") val renderingContent: RenderingContent? = null, + val additionalProperties: Map? = null, ) : SearchResult + +internal object SearchResponseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("SearchResponse") { + element("hitsPerPage") + element("nbHits") + element("nbPages") + element("page") + element("processingTimeMS") + element>("hits") + element("query") + element("params") + element("abTestID") + element("abTestVariantID") + element("aroundLatLng") + element("automaticRadius") + element("exhaustive") + element("exhaustiveFacetsCount") + element("exhaustiveNbHits") + element("exhaustiveTypo") + element>>("facets") + element>("facets_stats") + element("index") + element("indexUsed") + element("message") + element("nbSortedHits") + element("parsedQuery") + element("processingTimingsMS") + element("queryAfterRemoval") + element("redirect") + element("renderingContent") + element("serverTimeMS") + element("serverUsed") + element("userData") + } + + override fun deserialize(decoder: Decoder): SearchResponse { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return SearchResponse( + 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) }, + 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) }, + abTestID = tree["abTestID"]?.let { input.json.decodeFromJsonElement(it) }, + abTestVariantID = tree["abTestVariantID"]?.let { input.json.decodeFromJsonElement(it) }, + aroundLatLng = tree["aroundLatLng"]?.let { input.json.decodeFromJsonElement(it) }, + automaticRadius = tree["automaticRadius"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustive = tree["exhaustive"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustiveFacetsCount = tree["exhaustiveFacetsCount"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustiveNbHits = tree["exhaustiveNbHits"]?.let { input.json.decodeFromJsonElement(it) }, + exhaustiveTypo = tree["exhaustiveTypo"]?.let { input.json.decodeFromJsonElement(it) }, + facets = tree["facets"]?.let { input.json.decodeFromJsonElement(it) }, + facetsStats = tree["facets_stats"]?.let { input.json.decodeFromJsonElement(it) }, + index = tree["index"]?.let { input.json.decodeFromJsonElement(it) }, + indexUsed = tree["indexUsed"]?.let { input.json.decodeFromJsonElement(it) }, + message = tree["message"]?.let { input.json.decodeFromJsonElement(it) }, + nbSortedHits = tree["nbSortedHits"]?.let { input.json.decodeFromJsonElement(it) }, + parsedQuery = tree["parsedQuery"]?.let { input.json.decodeFromJsonElement(it) }, + processingTimingsMS = tree["processingTimingsMS"]?.let { input.json.decodeFromJsonElement(it) }, + queryAfterRemoval = tree["queryAfterRemoval"]?.let { input.json.decodeFromJsonElement(it) }, + redirect = tree["redirect"]?.let { input.json.decodeFromJsonElement(it) }, + renderingContent = tree["renderingContent"]?.let { input.json.decodeFromJsonElement(it) }, + serverTimeMS = tree["serverTimeMS"]?.let { input.json.decodeFromJsonElement(it) }, + serverUsed = tree["serverUsed"]?.let { input.json.decodeFromJsonElement(it) }, + userData = tree["userData"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: SearchResponse) { + 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)) + put("hits", output.json.encodeToJsonElement(value.hits)) + put("query", output.json.encodeToJsonElement(value.query)) + put("params", output.json.encodeToJsonElement(value.params)) + value.abTestID?.let { put("abTestID", output.json.encodeToJsonElement(it)) } + value.abTestVariantID?.let { put("abTestVariantID", output.json.encodeToJsonElement(it)) } + value.aroundLatLng?.let { put("aroundLatLng", output.json.encodeToJsonElement(it)) } + value.automaticRadius?.let { put("automaticRadius", output.json.encodeToJsonElement(it)) } + value.exhaustive?.let { put("exhaustive", output.json.encodeToJsonElement(it)) } + value.exhaustiveFacetsCount?.let { put("exhaustiveFacetsCount", output.json.encodeToJsonElement(it)) } + value.exhaustiveNbHits?.let { put("exhaustiveNbHits", output.json.encodeToJsonElement(it)) } + value.exhaustiveTypo?.let { put("exhaustiveTypo", output.json.encodeToJsonElement(it)) } + value.facets?.let { put("facets", output.json.encodeToJsonElement(it)) } + value.facetsStats?.let { put("facets_stats", output.json.encodeToJsonElement(it)) } + value.index?.let { put("index", output.json.encodeToJsonElement(it)) } + value.indexUsed?.let { put("indexUsed", output.json.encodeToJsonElement(it)) } + value.message?.let { put("message", output.json.encodeToJsonElement(it)) } + value.nbSortedHits?.let { put("nbSortedHits", output.json.encodeToJsonElement(it)) } + value.parsedQuery?.let { put("parsedQuery", output.json.encodeToJsonElement(it)) } + value.processingTimingsMS?.let { put("processingTimingsMS", output.json.encodeToJsonElement(it)) } + value.queryAfterRemoval?.let { put("queryAfterRemoval", output.json.encodeToJsonElement(it)) } + value.redirect?.let { put("redirect", output.json.encodeToJsonElement(it)) } + value.renderingContent?.let { put("renderingContent", output.json.encodeToJsonElement(it)) } + value.serverTimeMS?.let { put("serverTimeMS", output.json.encodeToJsonElement(it)) } + value.serverUsed?.let { put("serverUsed", output.json.encodeToJsonElement(it)) } + value.userData?.let { put("userData", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php index f8558d0529..d598a51477 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php @@ -21,6 +21,7 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'abTestVariantID' => 'int', 'aroundLatLng' => 'string', 'automaticRadius' => 'string', + 'exhaustive' => '\Algolia\AlgoliaSearch\Model\Search\Exhaustive', 'exhaustiveFacetsCount' => 'bool', 'exhaustiveNbHits' => 'bool', 'exhaustiveTypo' => 'bool', @@ -34,13 +35,15 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'nbPages' => 'int', 'nbSortedHits' => 'int', 'page' => 'int', - 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', + 'processingTimingsMS' => 'object', 'queryAfterRemoval' => 'string', + 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\Redirect', + 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', + 'serverTimeMS' => 'int', 'serverUsed' => 'string', 'userData' => 'mixed', - 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', ]; /** @@ -53,6 +56,7 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'abTestVariantID' => null, 'aroundLatLng' => null, 'automaticRadius' => null, + 'exhaustive' => null, 'exhaustiveFacetsCount' => null, 'exhaustiveNbHits' => null, 'exhaustiveTypo' => null, @@ -66,13 +70,15 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'nbPages' => null, 'nbSortedHits' => null, 'page' => null, - 'redirect' => null, 'parsedQuery' => null, 'processingTimeMS' => null, + 'processingTimingsMS' => null, 'queryAfterRemoval' => null, + 'redirect' => null, + 'renderingContent' => null, + 'serverTimeMS' => null, 'serverUsed' => null, 'userData' => null, - 'renderingContent' => null, ]; /** @@ -86,6 +92,7 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'abTestVariantID' => 'abTestVariantID', 'aroundLatLng' => 'aroundLatLng', 'automaticRadius' => 'automaticRadius', + 'exhaustive' => 'exhaustive', 'exhaustiveFacetsCount' => 'exhaustiveFacetsCount', 'exhaustiveNbHits' => 'exhaustiveNbHits', 'exhaustiveTypo' => 'exhaustiveTypo', @@ -99,13 +106,15 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', 'page' => 'page', - 'redirect' => 'redirect', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', + 'processingTimingsMS' => 'processingTimingsMS', 'queryAfterRemoval' => 'queryAfterRemoval', + 'redirect' => 'redirect', + 'renderingContent' => 'renderingContent', + 'serverTimeMS' => 'serverTimeMS', 'serverUsed' => 'serverUsed', 'userData' => 'userData', - 'renderingContent' => 'renderingContent', ]; /** @@ -118,6 +127,7 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'abTestVariantID' => 'setAbTestVariantID', 'aroundLatLng' => 'setAroundLatLng', 'automaticRadius' => 'setAutomaticRadius', + 'exhaustive' => 'setExhaustive', 'exhaustiveFacetsCount' => 'setExhaustiveFacetsCount', 'exhaustiveNbHits' => 'setExhaustiveNbHits', 'exhaustiveTypo' => 'setExhaustiveTypo', @@ -131,13 +141,15 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', 'page' => 'setPage', - 'redirect' => 'setRedirect', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', + 'processingTimingsMS' => 'setProcessingTimingsMS', 'queryAfterRemoval' => 'setQueryAfterRemoval', + 'redirect' => 'setRedirect', + 'renderingContent' => 'setRenderingContent', + 'serverTimeMS' => 'setServerTimeMS', 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', - 'renderingContent' => 'setRenderingContent', ]; /** @@ -150,6 +162,7 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'abTestVariantID' => 'getAbTestVariantID', 'aroundLatLng' => 'getAroundLatLng', 'automaticRadius' => 'getAutomaticRadius', + 'exhaustive' => 'getExhaustive', 'exhaustiveFacetsCount' => 'getExhaustiveFacetsCount', 'exhaustiveNbHits' => 'getExhaustiveNbHits', 'exhaustiveTypo' => 'getExhaustiveTypo', @@ -163,13 +176,15 @@ class BaseSearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', 'page' => 'getPage', - 'redirect' => 'getRedirect', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', + 'processingTimingsMS' => 'getProcessingTimingsMS', 'queryAfterRemoval' => 'getQueryAfterRemoval', + 'redirect' => 'getRedirect', + 'renderingContent' => 'getRenderingContent', + 'serverTimeMS' => 'getServerTimeMS', 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', - 'renderingContent' => 'getRenderingContent', ]; /** @@ -198,6 +213,9 @@ public function __construct(array $data = null) if (isset($data['automaticRadius'])) { $this->container['automaticRadius'] = $data['automaticRadius']; } + if (isset($data['exhaustive'])) { + $this->container['exhaustive'] = $data['exhaustive']; + } if (isset($data['exhaustiveFacetsCount'])) { $this->container['exhaustiveFacetsCount'] = $data['exhaustiveFacetsCount']; } @@ -237,27 +255,33 @@ public function __construct(array $data = null) if (isset($data['page'])) { $this->container['page'] = $data['page']; } - if (isset($data['redirect'])) { - $this->container['redirect'] = $data['redirect']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } if (isset($data['processingTimeMS'])) { $this->container['processingTimeMS'] = $data['processingTimeMS']; } + if (isset($data['processingTimingsMS'])) { + $this->container['processingTimingsMS'] = $data['processingTimingsMS']; + } if (isset($data['queryAfterRemoval'])) { $this->container['queryAfterRemoval'] = $data['queryAfterRemoval']; } + if (isset($data['redirect'])) { + $this->container['redirect'] = $data['redirect']; + } + if (isset($data['renderingContent'])) { + $this->container['renderingContent'] = $data['renderingContent']; + } + if (isset($data['serverTimeMS'])) { + $this->container['serverTimeMS'] = $data['serverTimeMS']; + } if (isset($data['serverUsed'])) { $this->container['serverUsed'] = $data['serverUsed']; } if (isset($data['userData'])) { $this->container['userData'] = $data['userData']; } - if (isset($data['renderingContent'])) { - $this->container['renderingContent'] = $data['renderingContent']; - } } /** @@ -470,10 +494,36 @@ public function setAutomaticRadius($automaticRadius) return $this; } + /** + * Gets exhaustive. + * + * @return null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive + */ + public function getExhaustive() + { + return $this->container['exhaustive'] ?? null; + } + + /** + * Sets exhaustive. + * + * @param null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive $exhaustive exhaustive + * + * @return self + */ + public function setExhaustive($exhaustive) + { + $this->container['exhaustive'] = $exhaustive; + + return $this; + } + /** * Gets exhaustiveFacetsCount. * * @return null|bool + * + * @deprecated */ public function getExhaustiveFacetsCount() { @@ -483,9 +533,11 @@ public function getExhaustiveFacetsCount() /** * Sets exhaustiveFacetsCount. * - * @param null|bool $exhaustiveFacetsCount indicates whether the facet count is exhaustive (exact) or approximate + * @param null|bool $exhaustiveFacetsCount see the `facetsCount` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) { @@ -498,6 +550,8 @@ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) * Gets exhaustiveNbHits. * * @return null|bool + * + * @deprecated */ public function getExhaustiveNbHits() { @@ -507,9 +561,11 @@ public function getExhaustiveNbHits() /** * Sets exhaustiveNbHits. * - * @param null|bool $exhaustiveNbHits indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate + * @param null|bool $exhaustiveNbHits see the `nbHits` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveNbHits($exhaustiveNbHits) { @@ -522,6 +578,8 @@ public function setExhaustiveNbHits($exhaustiveNbHits) * Gets exhaustiveTypo. * * @return null|bool + * + * @deprecated */ public function getExhaustiveTypo() { @@ -531,9 +589,11 @@ public function getExhaustiveTypo() /** * Sets exhaustiveTypo. * - * @param null|bool $exhaustiveTypo indicates whether the search for typos was exhaustive (exact) or approximate + * @param null|bool $exhaustiveTypo see the `typo` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveTypo($exhaustiveTypo) { @@ -789,30 +849,6 @@ public function setPage($page) return $this; } - /** - * Gets redirect. - * - * @return null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect - */ - public function getRedirect() - { - return $this->container['redirect'] ?? null; - } - - /** - * Sets redirect. - * - * @param null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect $redirect redirect - * - * @return self - */ - public function setRedirect($redirect) - { - $this->container['redirect'] = $redirect; - - return $this; - } - /** * Gets parsedQuery. * @@ -862,73 +898,73 @@ public function setProcessingTimeMS($processingTimeMS) } /** - * Gets queryAfterRemoval. + * Gets processingTimingsMS. * - * @return null|string + * @return null|object */ - public function getQueryAfterRemoval() + public function getProcessingTimingsMS() { - return $this->container['queryAfterRemoval'] ?? null; + return $this->container['processingTimingsMS'] ?? null; } /** - * Sets queryAfterRemoval. + * Sets processingTimingsMS. * - * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set + * @param null|object $processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * * @return self */ - public function setQueryAfterRemoval($queryAfterRemoval) + public function setProcessingTimingsMS($processingTimingsMS) { - $this->container['queryAfterRemoval'] = $queryAfterRemoval; + $this->container['processingTimingsMS'] = $processingTimingsMS; return $this; } /** - * Gets serverUsed. + * Gets queryAfterRemoval. * * @return null|string */ - public function getServerUsed() + public function getQueryAfterRemoval() { - return $this->container['serverUsed'] ?? null; + return $this->container['queryAfterRemoval'] ?? null; } /** - * Sets serverUsed. + * Sets queryAfterRemoval. * - * @param null|string $serverUsed host name of the server that processed the request + * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set * * @return self */ - public function setServerUsed($serverUsed) + public function setQueryAfterRemoval($queryAfterRemoval) { - $this->container['serverUsed'] = $serverUsed; + $this->container['queryAfterRemoval'] = $queryAfterRemoval; return $this; } /** - * Gets userData. + * Gets redirect. * - * @return null|mixed + * @return null|\Algolia\AlgoliaSearch\Model\Search\Redirect */ - public function getUserData() + public function getRedirect() { - return $this->container['userData'] ?? null; + return $this->container['redirect'] ?? null; } /** - * Sets userData. + * Sets redirect. * - * @param null|mixed $userData lets you store custom data in your indices + * @param null|\Algolia\AlgoliaSearch\Model\Search\Redirect $redirect redirect * * @return self */ - public function setUserData($userData) + public function setRedirect($redirect) { - $this->container['userData'] = $userData; + $this->container['redirect'] = $redirect; return $this; } @@ -957,6 +993,78 @@ public function setRenderingContent($renderingContent) return $this; } + /** + * Gets serverTimeMS. + * + * @return null|int + */ + public function getServerTimeMS() + { + return $this->container['serverTimeMS'] ?? null; + } + + /** + * Sets serverTimeMS. + * + * @param null|int $serverTimeMS time the server took to process the request, in milliseconds + * + * @return self + */ + public function setServerTimeMS($serverTimeMS) + { + $this->container['serverTimeMS'] = $serverTimeMS; + + return $this; + } + + /** + * Gets serverUsed. + * + * @return null|string + */ + public function getServerUsed() + { + return $this->container['serverUsed'] ?? null; + } + + /** + * Sets serverUsed. + * + * @param null|string $serverUsed host name of the server that processed the request + * + * @return self + */ + public function setServerUsed($serverUsed) + { + $this->container['serverUsed'] = $serverUsed; + + return $this; + } + + /** + * Gets userData. + * + * @return null|mixed + */ + public function getUserData() + { + return $this->container['userData'] ?? null; + } + + /** + * Sets userData. + * + * @param null|mixed $userData lets you store custom data in your indices + * + * @return self + */ + public function setUserData($userData) + { + $this->container['userData'] = $userData; + + return $this; + } + /** * Returns true if offset exists. False otherwise. * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php index 0688a64491..101ef372f1 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php @@ -21,6 +21,7 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'int', 'aroundLatLng' => 'string', 'automaticRadius' => 'string', + 'exhaustive' => '\Algolia\AlgoliaSearch\Model\Search\Exhaustive', 'exhaustiveFacetsCount' => 'bool', 'exhaustiveNbHits' => 'bool', 'exhaustiveTypo' => 'bool', @@ -34,13 +35,15 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'int', 'nbSortedHits' => 'int', 'page' => 'int', - 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', + 'processingTimingsMS' => 'object', 'queryAfterRemoval' => 'string', + 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\Redirect', + 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', + 'serverTimeMS' => 'int', 'serverUsed' => 'string', 'userData' => 'mixed', - 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', 'query' => 'string', 'params' => 'string', @@ -57,6 +60,7 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => null, 'aroundLatLng' => null, 'automaticRadius' => null, + 'exhaustive' => null, 'exhaustiveFacetsCount' => null, 'exhaustiveNbHits' => null, 'exhaustiveTypo' => null, @@ -70,13 +74,15 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => null, 'nbSortedHits' => null, 'page' => null, - 'redirect' => null, 'parsedQuery' => null, 'processingTimeMS' => null, + 'processingTimingsMS' => null, 'queryAfterRemoval' => null, + 'redirect' => null, + 'renderingContent' => null, + 'serverTimeMS' => null, 'serverUsed' => null, 'userData' => null, - 'renderingContent' => null, 'hits' => null, 'query' => null, 'params' => null, @@ -94,6 +100,7 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'abTestVariantID', 'aroundLatLng' => 'aroundLatLng', 'automaticRadius' => 'automaticRadius', + 'exhaustive' => 'exhaustive', 'exhaustiveFacetsCount' => 'exhaustiveFacetsCount', 'exhaustiveNbHits' => 'exhaustiveNbHits', 'exhaustiveTypo' => 'exhaustiveTypo', @@ -107,13 +114,15 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', 'page' => 'page', - 'redirect' => 'redirect', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', + 'processingTimingsMS' => 'processingTimingsMS', 'queryAfterRemoval' => 'queryAfterRemoval', + 'redirect' => 'redirect', + 'renderingContent' => 'renderingContent', + 'serverTimeMS' => 'serverTimeMS', 'serverUsed' => 'serverUsed', 'userData' => 'userData', - 'renderingContent' => 'renderingContent', 'hits' => 'hits', 'query' => 'query', 'params' => 'params', @@ -130,6 +139,7 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'setAbTestVariantID', 'aroundLatLng' => 'setAroundLatLng', 'automaticRadius' => 'setAutomaticRadius', + 'exhaustive' => 'setExhaustive', 'exhaustiveFacetsCount' => 'setExhaustiveFacetsCount', 'exhaustiveNbHits' => 'setExhaustiveNbHits', 'exhaustiveTypo' => 'setExhaustiveTypo', @@ -143,13 +153,15 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', 'page' => 'setPage', - 'redirect' => 'setRedirect', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', + 'processingTimingsMS' => 'setProcessingTimingsMS', 'queryAfterRemoval' => 'setQueryAfterRemoval', + 'redirect' => 'setRedirect', + 'renderingContent' => 'setRenderingContent', + 'serverTimeMS' => 'setServerTimeMS', 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', - 'renderingContent' => 'setRenderingContent', 'hits' => 'setHits', 'query' => 'setQuery', 'params' => 'setParams', @@ -166,6 +178,7 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'getAbTestVariantID', 'aroundLatLng' => 'getAroundLatLng', 'automaticRadius' => 'getAutomaticRadius', + 'exhaustive' => 'getExhaustive', 'exhaustiveFacetsCount' => 'getExhaustiveFacetsCount', 'exhaustiveNbHits' => 'getExhaustiveNbHits', 'exhaustiveTypo' => 'getExhaustiveTypo', @@ -179,13 +192,15 @@ class BrowseResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', 'page' => 'getPage', - 'redirect' => 'getRedirect', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', + 'processingTimingsMS' => 'getProcessingTimingsMS', 'queryAfterRemoval' => 'getQueryAfterRemoval', + 'redirect' => 'getRedirect', + 'renderingContent' => 'getRenderingContent', + 'serverTimeMS' => 'getServerTimeMS', 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', - 'renderingContent' => 'getRenderingContent', 'hits' => 'getHits', 'query' => 'getQuery', 'params' => 'getParams', @@ -218,6 +233,9 @@ public function __construct(array $data = null) if (isset($data['automaticRadius'])) { $this->container['automaticRadius'] = $data['automaticRadius']; } + if (isset($data['exhaustive'])) { + $this->container['exhaustive'] = $data['exhaustive']; + } if (isset($data['exhaustiveFacetsCount'])) { $this->container['exhaustiveFacetsCount'] = $data['exhaustiveFacetsCount']; } @@ -257,27 +275,33 @@ public function __construct(array $data = null) if (isset($data['page'])) { $this->container['page'] = $data['page']; } - if (isset($data['redirect'])) { - $this->container['redirect'] = $data['redirect']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } if (isset($data['processingTimeMS'])) { $this->container['processingTimeMS'] = $data['processingTimeMS']; } + if (isset($data['processingTimingsMS'])) { + $this->container['processingTimingsMS'] = $data['processingTimingsMS']; + } if (isset($data['queryAfterRemoval'])) { $this->container['queryAfterRemoval'] = $data['queryAfterRemoval']; } + if (isset($data['redirect'])) { + $this->container['redirect'] = $data['redirect']; + } + if (isset($data['renderingContent'])) { + $this->container['renderingContent'] = $data['renderingContent']; + } + if (isset($data['serverTimeMS'])) { + $this->container['serverTimeMS'] = $data['serverTimeMS']; + } if (isset($data['serverUsed'])) { $this->container['serverUsed'] = $data['serverUsed']; } if (isset($data['userData'])) { $this->container['userData'] = $data['userData']; } - if (isset($data['renderingContent'])) { - $this->container['renderingContent'] = $data['renderingContent']; - } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -511,10 +535,36 @@ public function setAutomaticRadius($automaticRadius) return $this; } + /** + * Gets exhaustive. + * + * @return null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive + */ + public function getExhaustive() + { + return $this->container['exhaustive'] ?? null; + } + + /** + * Sets exhaustive. + * + * @param null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive $exhaustive exhaustive + * + * @return self + */ + public function setExhaustive($exhaustive) + { + $this->container['exhaustive'] = $exhaustive; + + return $this; + } + /** * Gets exhaustiveFacetsCount. * * @return null|bool + * + * @deprecated */ public function getExhaustiveFacetsCount() { @@ -524,9 +574,11 @@ public function getExhaustiveFacetsCount() /** * Sets exhaustiveFacetsCount. * - * @param null|bool $exhaustiveFacetsCount indicates whether the facet count is exhaustive (exact) or approximate + * @param null|bool $exhaustiveFacetsCount see the `facetsCount` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) { @@ -539,6 +591,8 @@ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) * Gets exhaustiveNbHits. * * @return null|bool + * + * @deprecated */ public function getExhaustiveNbHits() { @@ -548,9 +602,11 @@ public function getExhaustiveNbHits() /** * Sets exhaustiveNbHits. * - * @param null|bool $exhaustiveNbHits indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate + * @param null|bool $exhaustiveNbHits see the `nbHits` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveNbHits($exhaustiveNbHits) { @@ -563,6 +619,8 @@ public function setExhaustiveNbHits($exhaustiveNbHits) * Gets exhaustiveTypo. * * @return null|bool + * + * @deprecated */ public function getExhaustiveTypo() { @@ -572,9 +630,11 @@ public function getExhaustiveTypo() /** * Sets exhaustiveTypo. * - * @param null|bool $exhaustiveTypo indicates whether the search for typos was exhaustive (exact) or approximate + * @param null|bool $exhaustiveTypo see the `typo` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveTypo($exhaustiveTypo) { @@ -830,30 +890,6 @@ public function setPage($page) return $this; } - /** - * Gets redirect. - * - * @return null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect - */ - public function getRedirect() - { - return $this->container['redirect'] ?? null; - } - - /** - * Sets redirect. - * - * @param null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect $redirect redirect - * - * @return self - */ - public function setRedirect($redirect) - { - $this->container['redirect'] = $redirect; - - return $this; - } - /** * Gets parsedQuery. * @@ -903,73 +939,73 @@ public function setProcessingTimeMS($processingTimeMS) } /** - * Gets queryAfterRemoval. + * Gets processingTimingsMS. * - * @return null|string + * @return null|object */ - public function getQueryAfterRemoval() + public function getProcessingTimingsMS() { - return $this->container['queryAfterRemoval'] ?? null; + return $this->container['processingTimingsMS'] ?? null; } /** - * Sets queryAfterRemoval. + * Sets processingTimingsMS. * - * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set + * @param null|object $processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * * @return self */ - public function setQueryAfterRemoval($queryAfterRemoval) + public function setProcessingTimingsMS($processingTimingsMS) { - $this->container['queryAfterRemoval'] = $queryAfterRemoval; + $this->container['processingTimingsMS'] = $processingTimingsMS; return $this; } /** - * Gets serverUsed. + * Gets queryAfterRemoval. * * @return null|string */ - public function getServerUsed() + public function getQueryAfterRemoval() { - return $this->container['serverUsed'] ?? null; + return $this->container['queryAfterRemoval'] ?? null; } /** - * Sets serverUsed. + * Sets queryAfterRemoval. * - * @param null|string $serverUsed host name of the server that processed the request + * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set * * @return self */ - public function setServerUsed($serverUsed) + public function setQueryAfterRemoval($queryAfterRemoval) { - $this->container['serverUsed'] = $serverUsed; + $this->container['queryAfterRemoval'] = $queryAfterRemoval; return $this; } /** - * Gets userData. + * Gets redirect. * - * @return null|mixed + * @return null|\Algolia\AlgoliaSearch\Model\Search\Redirect */ - public function getUserData() + public function getRedirect() { - return $this->container['userData'] ?? null; + return $this->container['redirect'] ?? null; } /** - * Sets userData. + * Sets redirect. * - * @param null|mixed $userData lets you store custom data in your indices + * @param null|\Algolia\AlgoliaSearch\Model\Search\Redirect $redirect redirect * * @return self */ - public function setUserData($userData) + public function setRedirect($redirect) { - $this->container['userData'] = $userData; + $this->container['redirect'] = $redirect; return $this; } @@ -998,6 +1034,78 @@ public function setRenderingContent($renderingContent) return $this; } + /** + * Gets serverTimeMS. + * + * @return null|int + */ + public function getServerTimeMS() + { + return $this->container['serverTimeMS'] ?? null; + } + + /** + * Sets serverTimeMS. + * + * @param null|int $serverTimeMS time the server took to process the request, in milliseconds + * + * @return self + */ + public function setServerTimeMS($serverTimeMS) + { + $this->container['serverTimeMS'] = $serverTimeMS; + + return $this; + } + + /** + * Gets serverUsed. + * + * @return null|string + */ + public function getServerUsed() + { + return $this->container['serverUsed'] ?? null; + } + + /** + * Sets serverUsed. + * + * @param null|string $serverUsed host name of the server that processed the request + * + * @return self + */ + public function setServerUsed($serverUsed) + { + $this->container['serverUsed'] = $serverUsed; + + return $this; + } + + /** + * Gets userData. + * + * @return null|mixed + */ + public function getUserData() + { + return $this->container['userData'] ?? null; + } + + /** + * Sets userData. + * + * @param null|mixed $userData lets you store custom data in your indices + * + * @return self + */ + public function setUserData($userData) + { + $this->container['userData'] = $userData; + + return $this; + } + /** * Gets hits. * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/Exhaustive.php b/clients/algoliasearch-client-php/lib/Model/Search/Exhaustive.php new file mode 100644 index 0000000000..10b993e9f3 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Exhaustive.php @@ -0,0 +1,353 @@ + 'bool', + 'facetValues' => 'bool', + 'nbHits' => 'bool', + 'rulesMatch' => 'bool', + 'typo' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization. + * + * @var string[] + */ + protected static $modelFormats = [ + 'facetsCount' => null, + 'facetValues' => null, + 'nbHits' => null, + 'rulesMatch' => null, + 'typo' => null, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name. + * + * @var string[] + */ + protected static $attributeMap = [ + 'facetsCount' => 'facetsCount', + 'facetValues' => 'facetValues', + 'nbHits' => 'nbHits', + 'rulesMatch' => 'rulesMatch', + 'typo' => 'typo', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses). + * + * @var string[] + */ + protected static $setters = [ + 'facetsCount' => 'setFacetsCount', + 'facetValues' => 'setFacetValues', + 'nbHits' => 'setNbHits', + 'rulesMatch' => 'setRulesMatch', + 'typo' => 'setTypo', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests). + * + * @var string[] + */ + protected static $getters = [ + 'facetsCount' => 'getFacetsCount', + 'facetValues' => 'getFacetValues', + 'nbHits' => 'getNbHits', + 'rulesMatch' => 'getRulesMatch', + 'typo' => 'getTypo', + ]; + + /** + * 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['facetsCount'])) { + $this->container['facetsCount'] = $data['facetsCount']; + } + if (isset($data['facetValues'])) { + $this->container['facetValues'] = $data['facetValues']; + } + if (isset($data['nbHits'])) { + $this->container['nbHits'] = $data['nbHits']; + } + if (isset($data['rulesMatch'])) { + $this->container['rulesMatch'] = $data['rulesMatch']; + } + if (isset($data['typo'])) { + $this->container['typo'] = $data['typo']; + } + } + + /** + * 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() + { + return []; + } + + /** + * 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 facetsCount. + * + * @return null|bool + */ + public function getFacetsCount() + { + return $this->container['facetsCount'] ?? null; + } + + /** + * Sets facetsCount. + * + * @param null|bool $facetsCount Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + * + * @return self + */ + public function setFacetsCount($facetsCount) + { + $this->container['facetsCount'] = $facetsCount; + + return $this; + } + + /** + * Gets facetValues. + * + * @return null|bool + */ + public function getFacetValues() + { + return $this->container['facetValues'] ?? null; + } + + /** + * Sets facetValues. + * + * @param null|bool $facetValues the value is `false` if not all facet values are retrieved + * + * @return self + */ + public function setFacetValues($facetValues) + { + $this->container['facetValues'] = $facetValues; + + return $this; + } + + /** + * Gets nbHits. + * + * @return null|bool + */ + public function getNbHits() + { + return $this->container['nbHits'] ?? null; + } + + /** + * Sets nbHits. + * + * @param null|bool $nbHits Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets rulesMatch. + * + * @return null|bool + */ + public function getRulesMatch() + { + return $this->container['rulesMatch'] ?? null; + } + + /** + * Sets rulesMatch. + * + * @param null|bool $rulesMatch Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + * + * @return self + */ + public function setRulesMatch($rulesMatch) + { + $this->container['rulesMatch'] = $rulesMatch; + + return $this; + } + + /** + * Gets typo. + * + * @return null|bool + */ + public function getTypo() + { + return $this->container['typo'] ?? null; + } + + /** + * Sets typo. + * + * @param null|bool $typo Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + * + * @return self + */ + public function setTypo($typo) + { + $this->container['typo'] = $typo; + + 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/BaseSearchResponseRedirect.php b/clients/algoliasearch-client-php/lib/Model/Search/Redirect.php similarity index 96% rename from clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponseRedirect.php rename to clients/algoliasearch-client-php/lib/Model/Search/Redirect.php index 19749991af..324136cb83 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponseRedirect.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/Redirect.php @@ -5,13 +5,13 @@ namespace Algolia\AlgoliaSearch\Model\Search; /** - * BaseSearchResponseRedirect Class Doc Comment. + * Redirect Class Doc Comment. * * @category Class * * @description [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). */ -class BaseSearchResponseRedirect extends \Algolia\AlgoliaSearch\Model\AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable +class Redirect extends \Algolia\AlgoliaSearch\Model\AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable { /** * Array of property to type mappings. Used for (de)serialization. diff --git a/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php index 7971359eb8..adf7ec942f 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php @@ -21,6 +21,7 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'int', 'aroundLatLng' => 'string', 'automaticRadius' => 'string', + 'exhaustive' => '\Algolia\AlgoliaSearch\Model\Search\Exhaustive', 'exhaustiveFacetsCount' => 'bool', 'exhaustiveNbHits' => 'bool', 'exhaustiveTypo' => 'bool', @@ -34,13 +35,15 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'int', 'nbSortedHits' => 'int', 'page' => 'int', - 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', + 'processingTimingsMS' => 'object', 'queryAfterRemoval' => 'string', + 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\Redirect', + 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', + 'serverTimeMS' => 'int', 'serverUsed' => 'string', 'userData' => 'mixed', - 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', 'query' => 'string', 'params' => 'string', @@ -56,6 +59,7 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => null, 'aroundLatLng' => null, 'automaticRadius' => null, + 'exhaustive' => null, 'exhaustiveFacetsCount' => null, 'exhaustiveNbHits' => null, 'exhaustiveTypo' => null, @@ -69,13 +73,15 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => null, 'nbSortedHits' => null, 'page' => null, - 'redirect' => null, 'parsedQuery' => null, 'processingTimeMS' => null, + 'processingTimingsMS' => null, 'queryAfterRemoval' => null, + 'redirect' => null, + 'renderingContent' => null, + 'serverTimeMS' => null, 'serverUsed' => null, 'userData' => null, - 'renderingContent' => null, 'hits' => null, 'query' => null, 'params' => null, @@ -92,6 +98,7 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'abTestVariantID', 'aroundLatLng' => 'aroundLatLng', 'automaticRadius' => 'automaticRadius', + 'exhaustive' => 'exhaustive', 'exhaustiveFacetsCount' => 'exhaustiveFacetsCount', 'exhaustiveNbHits' => 'exhaustiveNbHits', 'exhaustiveTypo' => 'exhaustiveTypo', @@ -105,13 +112,15 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', 'page' => 'page', - 'redirect' => 'redirect', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', + 'processingTimingsMS' => 'processingTimingsMS', 'queryAfterRemoval' => 'queryAfterRemoval', + 'redirect' => 'redirect', + 'renderingContent' => 'renderingContent', + 'serverTimeMS' => 'serverTimeMS', 'serverUsed' => 'serverUsed', 'userData' => 'userData', - 'renderingContent' => 'renderingContent', 'hits' => 'hits', 'query' => 'query', 'params' => 'params', @@ -127,6 +136,7 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'setAbTestVariantID', 'aroundLatLng' => 'setAroundLatLng', 'automaticRadius' => 'setAutomaticRadius', + 'exhaustive' => 'setExhaustive', 'exhaustiveFacetsCount' => 'setExhaustiveFacetsCount', 'exhaustiveNbHits' => 'setExhaustiveNbHits', 'exhaustiveTypo' => 'setExhaustiveTypo', @@ -140,13 +150,15 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', 'page' => 'setPage', - 'redirect' => 'setRedirect', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', + 'processingTimingsMS' => 'setProcessingTimingsMS', 'queryAfterRemoval' => 'setQueryAfterRemoval', + 'redirect' => 'setRedirect', + 'renderingContent' => 'setRenderingContent', + 'serverTimeMS' => 'setServerTimeMS', 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', - 'renderingContent' => 'setRenderingContent', 'hits' => 'setHits', 'query' => 'setQuery', 'params' => 'setParams', @@ -162,6 +174,7 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'abTestVariantID' => 'getAbTestVariantID', 'aroundLatLng' => 'getAroundLatLng', 'automaticRadius' => 'getAutomaticRadius', + 'exhaustive' => 'getExhaustive', 'exhaustiveFacetsCount' => 'getExhaustiveFacetsCount', 'exhaustiveNbHits' => 'getExhaustiveNbHits', 'exhaustiveTypo' => 'getExhaustiveTypo', @@ -175,13 +188,15 @@ class SearchResponse extends \Algolia\AlgoliaSearch\Model\AbstractModel implemen 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', 'page' => 'getPage', - 'redirect' => 'getRedirect', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', + 'processingTimingsMS' => 'getProcessingTimingsMS', 'queryAfterRemoval' => 'getQueryAfterRemoval', + 'redirect' => 'getRedirect', + 'renderingContent' => 'getRenderingContent', + 'serverTimeMS' => 'getServerTimeMS', 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', - 'renderingContent' => 'getRenderingContent', 'hits' => 'getHits', 'query' => 'getQuery', 'params' => 'getParams', @@ -213,6 +228,9 @@ public function __construct(array $data = null) if (isset($data['automaticRadius'])) { $this->container['automaticRadius'] = $data['automaticRadius']; } + if (isset($data['exhaustive'])) { + $this->container['exhaustive'] = $data['exhaustive']; + } if (isset($data['exhaustiveFacetsCount'])) { $this->container['exhaustiveFacetsCount'] = $data['exhaustiveFacetsCount']; } @@ -252,27 +270,33 @@ public function __construct(array $data = null) if (isset($data['page'])) { $this->container['page'] = $data['page']; } - if (isset($data['redirect'])) { - $this->container['redirect'] = $data['redirect']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } if (isset($data['processingTimeMS'])) { $this->container['processingTimeMS'] = $data['processingTimeMS']; } + if (isset($data['processingTimingsMS'])) { + $this->container['processingTimingsMS'] = $data['processingTimingsMS']; + } if (isset($data['queryAfterRemoval'])) { $this->container['queryAfterRemoval'] = $data['queryAfterRemoval']; } + if (isset($data['redirect'])) { + $this->container['redirect'] = $data['redirect']; + } + if (isset($data['renderingContent'])) { + $this->container['renderingContent'] = $data['renderingContent']; + } + if (isset($data['serverTimeMS'])) { + $this->container['serverTimeMS'] = $data['serverTimeMS']; + } if (isset($data['serverUsed'])) { $this->container['serverUsed'] = $data['serverUsed']; } if (isset($data['userData'])) { $this->container['userData'] = $data['userData']; } - if (isset($data['renderingContent'])) { - $this->container['renderingContent'] = $data['renderingContent']; - } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -503,10 +527,36 @@ public function setAutomaticRadius($automaticRadius) return $this; } + /** + * Gets exhaustive. + * + * @return null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive + */ + public function getExhaustive() + { + return $this->container['exhaustive'] ?? null; + } + + /** + * Sets exhaustive. + * + * @param null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive $exhaustive exhaustive + * + * @return self + */ + public function setExhaustive($exhaustive) + { + $this->container['exhaustive'] = $exhaustive; + + return $this; + } + /** * Gets exhaustiveFacetsCount. * * @return null|bool + * + * @deprecated */ public function getExhaustiveFacetsCount() { @@ -516,9 +566,11 @@ public function getExhaustiveFacetsCount() /** * Sets exhaustiveFacetsCount. * - * @param null|bool $exhaustiveFacetsCount indicates whether the facet count is exhaustive (exact) or approximate + * @param null|bool $exhaustiveFacetsCount see the `facetsCount` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) { @@ -531,6 +583,8 @@ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) * Gets exhaustiveNbHits. * * @return null|bool + * + * @deprecated */ public function getExhaustiveNbHits() { @@ -540,9 +594,11 @@ public function getExhaustiveNbHits() /** * Sets exhaustiveNbHits. * - * @param null|bool $exhaustiveNbHits indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate + * @param null|bool $exhaustiveNbHits see the `nbHits` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveNbHits($exhaustiveNbHits) { @@ -555,6 +611,8 @@ public function setExhaustiveNbHits($exhaustiveNbHits) * Gets exhaustiveTypo. * * @return null|bool + * + * @deprecated */ public function getExhaustiveTypo() { @@ -564,9 +622,11 @@ public function getExhaustiveTypo() /** * Sets exhaustiveTypo. * - * @param null|bool $exhaustiveTypo indicates whether the search for typos was exhaustive (exact) or approximate + * @param null|bool $exhaustiveTypo see the `typo` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveTypo($exhaustiveTypo) { @@ -822,30 +882,6 @@ public function setPage($page) return $this; } - /** - * Gets redirect. - * - * @return null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect - */ - public function getRedirect() - { - return $this->container['redirect'] ?? null; - } - - /** - * Sets redirect. - * - * @param null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect $redirect redirect - * - * @return self - */ - public function setRedirect($redirect) - { - $this->container['redirect'] = $redirect; - - return $this; - } - /** * Gets parsedQuery. * @@ -895,73 +931,73 @@ public function setProcessingTimeMS($processingTimeMS) } /** - * Gets queryAfterRemoval. + * Gets processingTimingsMS. * - * @return null|string + * @return null|object */ - public function getQueryAfterRemoval() + public function getProcessingTimingsMS() { - return $this->container['queryAfterRemoval'] ?? null; + return $this->container['processingTimingsMS'] ?? null; } /** - * Sets queryAfterRemoval. + * Sets processingTimingsMS. * - * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set + * @param null|object $processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * * @return self */ - public function setQueryAfterRemoval($queryAfterRemoval) + public function setProcessingTimingsMS($processingTimingsMS) { - $this->container['queryAfterRemoval'] = $queryAfterRemoval; + $this->container['processingTimingsMS'] = $processingTimingsMS; return $this; } /** - * Gets serverUsed. + * Gets queryAfterRemoval. * * @return null|string */ - public function getServerUsed() + public function getQueryAfterRemoval() { - return $this->container['serverUsed'] ?? null; + return $this->container['queryAfterRemoval'] ?? null; } /** - * Sets serverUsed. + * Sets queryAfterRemoval. * - * @param null|string $serverUsed host name of the server that processed the request + * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set * * @return self */ - public function setServerUsed($serverUsed) + public function setQueryAfterRemoval($queryAfterRemoval) { - $this->container['serverUsed'] = $serverUsed; + $this->container['queryAfterRemoval'] = $queryAfterRemoval; return $this; } /** - * Gets userData. + * Gets redirect. * - * @return null|mixed + * @return null|\Algolia\AlgoliaSearch\Model\Search\Redirect */ - public function getUserData() + public function getRedirect() { - return $this->container['userData'] ?? null; + return $this->container['redirect'] ?? null; } /** - * Sets userData. + * Sets redirect. * - * @param null|mixed $userData lets you store custom data in your indices + * @param null|\Algolia\AlgoliaSearch\Model\Search\Redirect $redirect redirect * * @return self */ - public function setUserData($userData) + public function setRedirect($redirect) { - $this->container['userData'] = $userData; + $this->container['redirect'] = $redirect; return $this; } @@ -990,6 +1026,78 @@ public function setRenderingContent($renderingContent) return $this; } + /** + * Gets serverTimeMS. + * + * @return null|int + */ + public function getServerTimeMS() + { + return $this->container['serverTimeMS'] ?? null; + } + + /** + * Sets serverTimeMS. + * + * @param null|int $serverTimeMS time the server took to process the request, in milliseconds + * + * @return self + */ + public function setServerTimeMS($serverTimeMS) + { + $this->container['serverTimeMS'] = $serverTimeMS; + + return $this; + } + + /** + * Gets serverUsed. + * + * @return null|string + */ + public function getServerUsed() + { + return $this->container['serverUsed'] ?? null; + } + + /** + * Sets serverUsed. + * + * @param null|string $serverUsed host name of the server that processed the request + * + * @return self + */ + public function setServerUsed($serverUsed) + { + $this->container['serverUsed'] = $serverUsed; + + return $this; + } + + /** + * Gets userData. + * + * @return null|mixed + */ + public function getUserData() + { + return $this->container['userData'] ?? null; + } + + /** + * Sets userData. + * + * @param null|mixed $userData lets you store custom data in your indices + * + * @return self + */ + public function setUserData($userData) + { + $this->container['userData'] = $userData; + + 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 12fae034fd..043ef6ad71 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/SearchResult.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchResult.php @@ -21,6 +21,7 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'abTestVariantID' => 'int', 'aroundLatLng' => 'string', 'automaticRadius' => 'string', + 'exhaustive' => '\Algolia\AlgoliaSearch\Model\Search\Exhaustive', 'exhaustiveFacetsCount' => 'bool', 'exhaustiveNbHits' => 'bool', 'exhaustiveTypo' => 'bool', @@ -34,13 +35,15 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'nbPages' => 'int', 'nbSortedHits' => 'int', 'page' => 'int', - 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect', 'parsedQuery' => 'string', 'processingTimeMS' => 'int', + 'processingTimingsMS' => 'object', 'queryAfterRemoval' => 'string', + 'redirect' => '\Algolia\AlgoliaSearch\Model\Search\Redirect', + 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', + 'serverTimeMS' => 'int', 'serverUsed' => 'string', 'userData' => 'mixed', - 'renderingContent' => '\Algolia\AlgoliaSearch\Model\Search\RenderingContent', 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', 'query' => 'string', 'params' => 'string', @@ -57,6 +60,7 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'abTestVariantID' => null, 'aroundLatLng' => null, 'automaticRadius' => null, + 'exhaustive' => null, 'exhaustiveFacetsCount' => null, 'exhaustiveNbHits' => null, 'exhaustiveTypo' => null, @@ -70,13 +74,15 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'nbPages' => null, 'nbSortedHits' => null, 'page' => null, - 'redirect' => null, 'parsedQuery' => null, 'processingTimeMS' => null, + 'processingTimingsMS' => null, 'queryAfterRemoval' => null, + 'redirect' => null, + 'renderingContent' => null, + 'serverTimeMS' => null, 'serverUsed' => null, 'userData' => null, - 'renderingContent' => null, 'hits' => null, 'query' => null, 'params' => null, @@ -94,6 +100,7 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'abTestVariantID' => 'abTestVariantID', 'aroundLatLng' => 'aroundLatLng', 'automaticRadius' => 'automaticRadius', + 'exhaustive' => 'exhaustive', 'exhaustiveFacetsCount' => 'exhaustiveFacetsCount', 'exhaustiveNbHits' => 'exhaustiveNbHits', 'exhaustiveTypo' => 'exhaustiveTypo', @@ -107,13 +114,15 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'nbPages' => 'nbPages', 'nbSortedHits' => 'nbSortedHits', 'page' => 'page', - 'redirect' => 'redirect', 'parsedQuery' => 'parsedQuery', 'processingTimeMS' => 'processingTimeMS', + 'processingTimingsMS' => 'processingTimingsMS', 'queryAfterRemoval' => 'queryAfterRemoval', + 'redirect' => 'redirect', + 'renderingContent' => 'renderingContent', + 'serverTimeMS' => 'serverTimeMS', 'serverUsed' => 'serverUsed', 'userData' => 'userData', - 'renderingContent' => 'renderingContent', 'hits' => 'hits', 'query' => 'query', 'params' => 'params', @@ -130,6 +139,7 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'abTestVariantID' => 'setAbTestVariantID', 'aroundLatLng' => 'setAroundLatLng', 'automaticRadius' => 'setAutomaticRadius', + 'exhaustive' => 'setExhaustive', 'exhaustiveFacetsCount' => 'setExhaustiveFacetsCount', 'exhaustiveNbHits' => 'setExhaustiveNbHits', 'exhaustiveTypo' => 'setExhaustiveTypo', @@ -143,13 +153,15 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'nbPages' => 'setNbPages', 'nbSortedHits' => 'setNbSortedHits', 'page' => 'setPage', - 'redirect' => 'setRedirect', 'parsedQuery' => 'setParsedQuery', 'processingTimeMS' => 'setProcessingTimeMS', + 'processingTimingsMS' => 'setProcessingTimingsMS', 'queryAfterRemoval' => 'setQueryAfterRemoval', + 'redirect' => 'setRedirect', + 'renderingContent' => 'setRenderingContent', + 'serverTimeMS' => 'setServerTimeMS', 'serverUsed' => 'setServerUsed', 'userData' => 'setUserData', - 'renderingContent' => 'setRenderingContent', 'hits' => 'setHits', 'query' => 'setQuery', 'params' => 'setParams', @@ -166,6 +178,7 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'abTestVariantID' => 'getAbTestVariantID', 'aroundLatLng' => 'getAroundLatLng', 'automaticRadius' => 'getAutomaticRadius', + 'exhaustive' => 'getExhaustive', 'exhaustiveFacetsCount' => 'getExhaustiveFacetsCount', 'exhaustiveNbHits' => 'getExhaustiveNbHits', 'exhaustiveTypo' => 'getExhaustiveTypo', @@ -179,13 +192,15 @@ class SearchResult extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'nbPages' => 'getNbPages', 'nbSortedHits' => 'getNbSortedHits', 'page' => 'getPage', - 'redirect' => 'getRedirect', 'parsedQuery' => 'getParsedQuery', 'processingTimeMS' => 'getProcessingTimeMS', + 'processingTimingsMS' => 'getProcessingTimingsMS', 'queryAfterRemoval' => 'getQueryAfterRemoval', + 'redirect' => 'getRedirect', + 'renderingContent' => 'getRenderingContent', + 'serverTimeMS' => 'getServerTimeMS', 'serverUsed' => 'getServerUsed', 'userData' => 'getUserData', - 'renderingContent' => 'getRenderingContent', 'hits' => 'getHits', 'query' => 'getQuery', 'params' => 'getParams', @@ -218,6 +233,9 @@ public function __construct(array $data = null) if (isset($data['automaticRadius'])) { $this->container['automaticRadius'] = $data['automaticRadius']; } + if (isset($data['exhaustive'])) { + $this->container['exhaustive'] = $data['exhaustive']; + } if (isset($data['exhaustiveFacetsCount'])) { $this->container['exhaustiveFacetsCount'] = $data['exhaustiveFacetsCount']; } @@ -257,27 +275,33 @@ public function __construct(array $data = null) if (isset($data['page'])) { $this->container['page'] = $data['page']; } - if (isset($data['redirect'])) { - $this->container['redirect'] = $data['redirect']; - } if (isset($data['parsedQuery'])) { $this->container['parsedQuery'] = $data['parsedQuery']; } if (isset($data['processingTimeMS'])) { $this->container['processingTimeMS'] = $data['processingTimeMS']; } + if (isset($data['processingTimingsMS'])) { + $this->container['processingTimingsMS'] = $data['processingTimingsMS']; + } if (isset($data['queryAfterRemoval'])) { $this->container['queryAfterRemoval'] = $data['queryAfterRemoval']; } + if (isset($data['redirect'])) { + $this->container['redirect'] = $data['redirect']; + } + if (isset($data['renderingContent'])) { + $this->container['renderingContent'] = $data['renderingContent']; + } + if (isset($data['serverTimeMS'])) { + $this->container['serverTimeMS'] = $data['serverTimeMS']; + } if (isset($data['serverUsed'])) { $this->container['serverUsed'] = $data['serverUsed']; } if (isset($data['userData'])) { $this->container['userData'] = $data['userData']; } - if (isset($data['renderingContent'])) { - $this->container['renderingContent'] = $data['renderingContent']; - } if (isset($data['hits'])) { $this->container['hits'] = $data['hits']; } @@ -514,10 +538,36 @@ public function setAutomaticRadius($automaticRadius) return $this; } + /** + * Gets exhaustive. + * + * @return null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive + */ + public function getExhaustive() + { + return $this->container['exhaustive'] ?? null; + } + + /** + * Sets exhaustive. + * + * @param null|\Algolia\AlgoliaSearch\Model\Search\Exhaustive $exhaustive exhaustive + * + * @return self + */ + public function setExhaustive($exhaustive) + { + $this->container['exhaustive'] = $exhaustive; + + return $this; + } + /** * Gets exhaustiveFacetsCount. * * @return null|bool + * + * @deprecated */ public function getExhaustiveFacetsCount() { @@ -527,9 +577,11 @@ public function getExhaustiveFacetsCount() /** * Sets exhaustiveFacetsCount. * - * @param null|bool $exhaustiveFacetsCount indicates whether the facet count is exhaustive (exact) or approximate + * @param null|bool $exhaustiveFacetsCount see the `facetsCount` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) { @@ -542,6 +594,8 @@ public function setExhaustiveFacetsCount($exhaustiveFacetsCount) * Gets exhaustiveNbHits. * * @return null|bool + * + * @deprecated */ public function getExhaustiveNbHits() { @@ -551,9 +605,11 @@ public function getExhaustiveNbHits() /** * Sets exhaustiveNbHits. * - * @param null|bool $exhaustiveNbHits indicates whether the number of hits `nbHits` is exhaustive (exact) or approximate + * @param null|bool $exhaustiveNbHits see the `nbHits` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveNbHits($exhaustiveNbHits) { @@ -566,6 +622,8 @@ public function setExhaustiveNbHits($exhaustiveNbHits) * Gets exhaustiveTypo. * * @return null|bool + * + * @deprecated */ public function getExhaustiveTypo() { @@ -575,9 +633,11 @@ public function getExhaustiveTypo() /** * Sets exhaustiveTypo. * - * @param null|bool $exhaustiveTypo indicates whether the search for typos was exhaustive (exact) or approximate + * @param null|bool $exhaustiveTypo see the `typo` field of the `exhaustive` object in the response * * @return self + * + * @deprecated */ public function setExhaustiveTypo($exhaustiveTypo) { @@ -833,30 +893,6 @@ public function setPage($page) return $this; } - /** - * Gets redirect. - * - * @return null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect - */ - public function getRedirect() - { - return $this->container['redirect'] ?? null; - } - - /** - * Sets redirect. - * - * @param null|\Algolia\AlgoliaSearch\Model\Search\BaseSearchResponseRedirect $redirect redirect - * - * @return self - */ - public function setRedirect($redirect) - { - $this->container['redirect'] = $redirect; - - return $this; - } - /** * Gets parsedQuery. * @@ -906,73 +942,73 @@ public function setProcessingTimeMS($processingTimeMS) } /** - * Gets queryAfterRemoval. + * Gets processingTimingsMS. * - * @return null|string + * @return null|object */ - public function getQueryAfterRemoval() + public function getProcessingTimingsMS() { - return $this->container['queryAfterRemoval'] ?? null; + return $this->container['processingTimingsMS'] ?? null; } /** - * Sets queryAfterRemoval. + * Sets processingTimingsMS. * - * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set + * @param null|object $processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. * * @return self */ - public function setQueryAfterRemoval($queryAfterRemoval) + public function setProcessingTimingsMS($processingTimingsMS) { - $this->container['queryAfterRemoval'] = $queryAfterRemoval; + $this->container['processingTimingsMS'] = $processingTimingsMS; return $this; } /** - * Gets serverUsed. + * Gets queryAfterRemoval. * * @return null|string */ - public function getServerUsed() + public function getQueryAfterRemoval() { - return $this->container['serverUsed'] ?? null; + return $this->container['queryAfterRemoval'] ?? null; } /** - * Sets serverUsed. + * Sets queryAfterRemoval. * - * @param null|string $serverUsed host name of the server that processed the request + * @param null|string $queryAfterRemoval markup text indicating which parts of the original query have been removed to retrieve a non-empty result set * * @return self */ - public function setServerUsed($serverUsed) + public function setQueryAfterRemoval($queryAfterRemoval) { - $this->container['serverUsed'] = $serverUsed; + $this->container['queryAfterRemoval'] = $queryAfterRemoval; return $this; } /** - * Gets userData. + * Gets redirect. * - * @return null|mixed + * @return null|\Algolia\AlgoliaSearch\Model\Search\Redirect */ - public function getUserData() + public function getRedirect() { - return $this->container['userData'] ?? null; + return $this->container['redirect'] ?? null; } /** - * Sets userData. + * Sets redirect. * - * @param null|mixed $userData lets you store custom data in your indices + * @param null|\Algolia\AlgoliaSearch\Model\Search\Redirect $redirect redirect * * @return self */ - public function setUserData($userData) + public function setRedirect($redirect) { - $this->container['userData'] = $userData; + $this->container['redirect'] = $redirect; return $this; } @@ -1001,6 +1037,78 @@ public function setRenderingContent($renderingContent) return $this; } + /** + * Gets serverTimeMS. + * + * @return null|int + */ + public function getServerTimeMS() + { + return $this->container['serverTimeMS'] ?? null; + } + + /** + * Sets serverTimeMS. + * + * @param null|int $serverTimeMS time the server took to process the request, in milliseconds + * + * @return self + */ + public function setServerTimeMS($serverTimeMS) + { + $this->container['serverTimeMS'] = $serverTimeMS; + + return $this; + } + + /** + * Gets serverUsed. + * + * @return null|string + */ + public function getServerUsed() + { + return $this->container['serverUsed'] ?? null; + } + + /** + * Sets serverUsed. + * + * @param null|string $serverUsed host name of the server that processed the request + * + * @return self + */ + public function setServerUsed($serverUsed) + { + $this->container['serverUsed'] = $serverUsed; + + return $this; + } + + /** + * Gets userData. + * + * @return null|mixed + */ + public function getUserData() + { + return $this->container['userData'] ?? null; + } + + /** + * Sets userData. + * + * @param null|mixed $userData lets you store custom data in your indices + * + * @return self + */ + public function setUserData($userData) + { + $this->container['userData'] = $userData; + + return $this; + } + /** * Gets hits. * diff --git a/specs/bundled/algoliasearch.yml b/specs/bundled/algoliasearch.yml index a372eecfd4..a46dc7d75c 100644 --- a/specs/bundled/algoliasearch.yml +++ b/specs/bundled/algoliasearch.yml @@ -1305,7 +1305,7 @@ components: - Advanced baseSearchResponse: type: object - additionalProperties: false + additionalProperties: true required: - nbHits - page @@ -1332,21 +1332,69 @@ components: automaticRadius: type: string description: Automatically-computed radius. + exhaustive: + type: object + title: exhaustive + description: >- + Whether certain properties of the search response are calculated + exhaustive (exact) or approximated. + properties: + facetsCount: + type: boolean + title: facetsCount + description: >- + Whether the facet count is exhaustive (`true`) or approximate + (`false`). See the [related + discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + facetValues: + type: boolean + title: facetValues + description: The value is `false` if not all facet values are retrieved. + nbHits: + type: boolean + title: nbHits + description: >- + Whether the `nbHits` is exhaustive (`true`) or approximate + (`false`). When the query takes more than 50ms to be processed, + the engine makes an approximation. This can happen when using + complex filters on millions of records, when typo-tolerance was + not exhaustive, or when enough hits have been retrieved (for + example, after the engine finds 10,000 exact matches). `nbHits` + is reported as non-exhaustive whenever an approximation is made, + even if the approximation didn’t, in the end, impact the + exhaustivity of the query. + rulesMatch: + type: boolean + title: rulesMatch + description: >- + Rules matching exhaustivity. The value is `false` if rules were + enable for this query, and could not be fully processed due a + timeout. This is generally caused by the number of alternatives + (such as typos) which is too large. + typo: + type: boolean + title: typo + description: >- + Whether the typo search was exhaustive (`true`) or approximate + (`false`). An approximation is done when the typo search query + part takes more than 10% of the query budget (ie. 5ms by + default) to be processed (this can happen when a lot of typo + alternatives exist for the query). This field will not be + included when typo-tolerance is entirely disabled. exhaustiveFacetsCount: type: boolean description: >- - Indicates whether the facet count is exhaustive (exact) or - approximate. + See the `facetsCount` field of the `exhaustive` object in the + response. + deprecated: true exhaustiveNbHits: type: boolean - description: >- - Indicates whether the number of hits `nbHits` is exhaustive (exact) - or approximate. + description: See the `nbHits` field of the `exhaustive` object in the response. + deprecated: true exhaustiveTypo: type: boolean - description: >- - Indicates whether the search for typos was exhaustive (exact) or - approximate. + description: See the `typo` field of the `exhaustive` object in the response. + deprecated: true facets: title: facets type: object @@ -1408,16 +1456,6 @@ components: example: 20 page: $ref: '#/components/schemas/page' - redirect: - type: object - description: > - [Redirect results to a - URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). - properties: - index: - type: array - items: - $ref: '#/components/schemas/RedirectRuleIndexMetadata' parsedQuery: type: string description: >- @@ -1428,19 +1466,40 @@ components: type: integer description: Time the server took to process the request, in milliseconds. example: 20 + processingTimingsMS: + type: object + description: >- + Experimental. List of processing steps and their times, in + milliseconds. You can use this list to investigate performance + issues. queryAfterRemoval: type: string description: >- Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + redirect: + title: redirect + type: object + description: > + [Redirect results to a + URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). + properties: + index: + type: array + items: + $ref: '#/components/schemas/RedirectRuleIndexMetadata' + renderingContent: + $ref: '#/components/schemas/renderingContent' + serverTimeMS: + type: integer + description: Time the server took to process the request, in milliseconds. + example: 20 serverUsed: type: string description: Host name of the server that processed the request. example: c2-uk-3.algolia.net userData: $ref: '#/components/schemas/userData' - renderingContent: - $ref: '#/components/schemas/renderingContent' objectID: type: string description: Unique object identifier. @@ -1624,7 +1683,7 @@ components: $ref: '#/components/schemas/_distinctSeqID' searchHits: type: object - additionalProperties: false + additionalProperties: true properties: hits: type: array @@ -1641,6 +1700,7 @@ components: - query - params searchResponse: + additionalProperties: true allOf: - $ref: '#/components/schemas/baseSearchResponse' - $ref: '#/components/schemas/searchHits' @@ -1705,6 +1765,9 @@ components: allOf: - $ref: '#/components/schemas/searchParams' - $ref: '#/components/schemas/searchForFacetsOptions' + x-discriminator-fields: + - facet + - type SearchQuery: oneOf: - $ref: '#/components/schemas/SearchForHits' diff --git a/specs/bundled/insights.yml b/specs/bundled/insights.yml index dc8ce6d306..cf3a269d91 100644 --- a/specs/bundled/insights.yml +++ b/specs/bundled/insights.yml @@ -173,6 +173,10 @@ components: - positions - queryID - userToken + x-discriminator-fields: + - positions + - queryID + - eventType ConversionEvent: type: string enum: @@ -218,6 +222,9 @@ components: - objectIDs - queryID - userToken + x-discriminator-fields: + - queryID + - eventType ClickedObjectIDs: type: object title: Clicked object IDs @@ -251,6 +258,9 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - objectIDs ConvertedObjectIDs: type: object title: Converted object IDs @@ -286,6 +296,9 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - objectIDs filters: type: array description: | @@ -326,6 +339,9 @@ components: - index - filters - userToken + x-discriminator-fields: + - eventType + - filters ConvertedFilters: type: object title: Converted filters @@ -351,6 +367,9 @@ components: - index - filters - userToken + x-discriminator-fields: + - eventType + - filters ViewEvent: type: string enum: @@ -381,6 +400,9 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - objectIDs ViewedFilters: type: object title: Viewed filters @@ -410,6 +432,9 @@ components: - index - filters - userToken + x-discriminator-fields: + - eventType + - filters AddToCartEvent: type: string enum: @@ -508,6 +533,11 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - eventSubtype + - queryID + - objectIDs objectData: type: object additionalProperties: false @@ -573,6 +603,10 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - eventSubtype + - objectIDs PurchaseEvent: type: string enum: @@ -617,6 +651,10 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - eventSubtype + - objectIDs PurchasedObjectIDsAfterSearch: type: object title: Purchased object IDs after search @@ -658,6 +696,11 @@ components: - index - objectIDs - userToken + x-discriminator-fields: + - eventType + - eventSubtype + - queryID + - objectIDs EventsItems: oneOf: - $ref: '#/components/schemas/ClickedObjectIDsAfterSearch' diff --git a/specs/bundled/recommend.yml b/specs/bundled/recommend.yml index 6f4763fe1e..f038082b5e 100644 --- a/specs/bundled/recommend.yml +++ b/specs/bundled/recommend.yml @@ -1287,7 +1287,7 @@ components: - Advanced baseSearchResponse: type: object - additionalProperties: false + additionalProperties: true required: - nbHits - page @@ -1314,21 +1314,69 @@ components: automaticRadius: type: string description: Automatically-computed radius. + exhaustive: + type: object + title: exhaustive + description: >- + Whether certain properties of the search response are calculated + exhaustive (exact) or approximated. + properties: + facetsCount: + type: boolean + title: facetsCount + description: >- + Whether the facet count is exhaustive (`true`) or approximate + (`false`). See the [related + discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + facetValues: + type: boolean + title: facetValues + description: The value is `false` if not all facet values are retrieved. + nbHits: + type: boolean + title: nbHits + description: >- + Whether the `nbHits` is exhaustive (`true`) or approximate + (`false`). When the query takes more than 50ms to be processed, + the engine makes an approximation. This can happen when using + complex filters on millions of records, when typo-tolerance was + not exhaustive, or when enough hits have been retrieved (for + example, after the engine finds 10,000 exact matches). `nbHits` + is reported as non-exhaustive whenever an approximation is made, + even if the approximation didn’t, in the end, impact the + exhaustivity of the query. + rulesMatch: + type: boolean + title: rulesMatch + description: >- + Rules matching exhaustivity. The value is `false` if rules were + enable for this query, and could not be fully processed due a + timeout. This is generally caused by the number of alternatives + (such as typos) which is too large. + typo: + type: boolean + title: typo + description: >- + Whether the typo search was exhaustive (`true`) or approximate + (`false`). An approximation is done when the typo search query + part takes more than 10% of the query budget (ie. 5ms by + default) to be processed (this can happen when a lot of typo + alternatives exist for the query). This field will not be + included when typo-tolerance is entirely disabled. exhaustiveFacetsCount: type: boolean description: >- - Indicates whether the facet count is exhaustive (exact) or - approximate. + See the `facetsCount` field of the `exhaustive` object in the + response. + deprecated: true exhaustiveNbHits: type: boolean - description: >- - Indicates whether the number of hits `nbHits` is exhaustive (exact) - or approximate. + description: See the `nbHits` field of the `exhaustive` object in the response. + deprecated: true exhaustiveTypo: type: boolean - description: >- - Indicates whether the search for typos was exhaustive (exact) or - approximate. + description: See the `typo` field of the `exhaustive` object in the response. + deprecated: true facets: title: facets type: object @@ -1390,16 +1438,6 @@ components: example: 20 page: $ref: '#/components/schemas/page' - redirect: - type: object - description: > - [Redirect results to a - URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). - properties: - index: - type: array - items: - $ref: '#/components/schemas/RedirectRuleIndexMetadata' parsedQuery: type: string description: >- @@ -1410,19 +1448,40 @@ components: type: integer description: Time the server took to process the request, in milliseconds. example: 20 + processingTimingsMS: + type: object + description: >- + Experimental. List of processing steps and their times, in + milliseconds. You can use this list to investigate performance + issues. queryAfterRemoval: type: string description: >- Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + redirect: + title: redirect + type: object + description: > + [Redirect results to a + URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). + properties: + index: + type: array + items: + $ref: '#/components/schemas/RedirectRuleIndexMetadata' + renderingContent: + $ref: '#/components/schemas/renderingContent' + serverTimeMS: + type: integer + description: Time the server took to process the request, in milliseconds. + example: 20 serverUsed: type: string description: Host name of the server that processed the request. example: c2-uk-3.algolia.net userData: $ref: '#/components/schemas/userData' - renderingContent: - $ref: '#/components/schemas/renderingContent' highlightedValue: type: string description: Markup text with `facetQuery` matches highlighted. diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index c4231bddc0..cff7a99141 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -1305,7 +1305,7 @@ components: - Advanced baseSearchResponse: type: object - additionalProperties: false + additionalProperties: true required: - nbHits - page @@ -1332,21 +1332,69 @@ components: automaticRadius: type: string description: Automatically-computed radius. + exhaustive: + type: object + title: exhaustive + description: >- + Whether certain properties of the search response are calculated + exhaustive (exact) or approximated. + properties: + facetsCount: + type: boolean + title: facetsCount + description: >- + Whether the facet count is exhaustive (`true`) or approximate + (`false`). See the [related + discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + facetValues: + type: boolean + title: facetValues + description: The value is `false` if not all facet values are retrieved. + nbHits: + type: boolean + title: nbHits + description: >- + Whether the `nbHits` is exhaustive (`true`) or approximate + (`false`). When the query takes more than 50ms to be processed, + the engine makes an approximation. This can happen when using + complex filters on millions of records, when typo-tolerance was + not exhaustive, or when enough hits have been retrieved (for + example, after the engine finds 10,000 exact matches). `nbHits` + is reported as non-exhaustive whenever an approximation is made, + even if the approximation didn’t, in the end, impact the + exhaustivity of the query. + rulesMatch: + type: boolean + title: rulesMatch + description: >- + Rules matching exhaustivity. The value is `false` if rules were + enable for this query, and could not be fully processed due a + timeout. This is generally caused by the number of alternatives + (such as typos) which is too large. + typo: + type: boolean + title: typo + description: >- + Whether the typo search was exhaustive (`true`) or approximate + (`false`). An approximation is done when the typo search query + part takes more than 10% of the query budget (ie. 5ms by + default) to be processed (this can happen when a lot of typo + alternatives exist for the query). This field will not be + included when typo-tolerance is entirely disabled. exhaustiveFacetsCount: type: boolean description: >- - Indicates whether the facet count is exhaustive (exact) or - approximate. + See the `facetsCount` field of the `exhaustive` object in the + response. + deprecated: true exhaustiveNbHits: type: boolean - description: >- - Indicates whether the number of hits `nbHits` is exhaustive (exact) - or approximate. + description: See the `nbHits` field of the `exhaustive` object in the response. + deprecated: true exhaustiveTypo: type: boolean - description: >- - Indicates whether the search for typos was exhaustive (exact) or - approximate. + description: See the `typo` field of the `exhaustive` object in the response. + deprecated: true facets: title: facets type: object @@ -1408,16 +1456,6 @@ components: example: 20 page: $ref: '#/components/schemas/page' - redirect: - type: object - description: > - [Redirect results to a - URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). - properties: - index: - type: array - items: - $ref: '#/components/schemas/RedirectRuleIndexMetadata' parsedQuery: type: string description: >- @@ -1428,19 +1466,40 @@ components: type: integer description: Time the server took to process the request, in milliseconds. example: 20 + processingTimingsMS: + type: object + description: >- + Experimental. List of processing steps and their times, in + milliseconds. You can use this list to investigate performance + issues. queryAfterRemoval: type: string description: >- Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + redirect: + title: redirect + type: object + description: > + [Redirect results to a + URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). + properties: + index: + type: array + items: + $ref: '#/components/schemas/RedirectRuleIndexMetadata' + renderingContent: + $ref: '#/components/schemas/renderingContent' + serverTimeMS: + type: integer + description: Time the server took to process the request, in milliseconds. + example: 20 serverUsed: type: string description: Host name of the server that processed the request. example: c2-uk-3.algolia.net userData: $ref: '#/components/schemas/userData' - renderingContent: - $ref: '#/components/schemas/renderingContent' objectID: type: string description: Unique object identifier. @@ -1624,7 +1683,7 @@ components: $ref: '#/components/schemas/_distinctSeqID' searchHits: type: object - additionalProperties: false + additionalProperties: true properties: hits: type: array @@ -1641,6 +1700,7 @@ components: - query - params searchResponse: + additionalProperties: true allOf: - $ref: '#/components/schemas/baseSearchResponse' - $ref: '#/components/schemas/searchHits' @@ -1705,6 +1765,9 @@ components: allOf: - $ref: '#/components/schemas/searchParams' - $ref: '#/components/schemas/searchForFacetsOptions' + x-discriminator-fields: + - facet + - type SearchQuery: oneOf: - $ref: '#/components/schemas/SearchForHits'