diff --git a/packages/algoliasearch/lib/src/model/recommendations_results.dart b/packages/algoliasearch/lib/src/model/recommendations_results.dart index 4b8a9f4..a7bf538 100644 --- a/packages/algoliasearch/lib/src/model/recommendations_results.dart +++ b/packages/algoliasearch/lib/src/model/recommendations_results.dart @@ -38,10 +38,10 @@ final class RecommendationsResults { this.userData, this.queryID, this.automaticInsights, - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, required this.hits, }); @@ -149,21 +149,21 @@ final class RecommendationsResults { /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; /// One of types: /// - [RecommendHit] diff --git a/packages/algoliasearch/lib/src/model/recommendations_results.g.dart b/packages/algoliasearch/lib/src/model/recommendations_results.g.dart index 1f705fe..1f239ed 100644 --- a/packages/algoliasearch/lib/src/model/recommendations_results.g.dart +++ b/packages/algoliasearch/lib/src/model/recommendations_results.g.dart @@ -68,11 +68,11 @@ RecommendationsResults _$RecommendationsResultsFromJson( queryID: $checkedConvert('queryID', (v) => v as String?), automaticInsights: $checkedConvert('_automaticInsights', (v) => v as bool?), - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), hits: $checkedConvert('hits', (v) => v as List), ); return val; @@ -119,10 +119,10 @@ Map _$RecommendationsResultsToJson( writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); writeNotNull('_automaticInsights', instance.automaticInsights); - val['page'] = instance.page; - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; - val['hitsPerPage'] = instance.hitsPerPage; + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); val['hits'] = instance.hits.toList(); return val; } diff --git a/packages/algoliasearch/lib/src/model/search_pagination.dart b/packages/algoliasearch/lib/src/model/search_pagination.dart index 4c7eb08..60a6194 100644 --- a/packages/algoliasearch/lib/src/model/search_pagination.dart +++ b/packages/algoliasearch/lib/src/model/search_pagination.dart @@ -9,30 +9,30 @@ part 'search_pagination.g.dart'; final class SearchPagination { /// Returns a new [SearchPagination] instance. const SearchPagination({ - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, }); /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; @override bool operator ==(Object other) => diff --git a/packages/algoliasearch/lib/src/model/search_pagination.g.dart b/packages/algoliasearch/lib/src/model/search_pagination.g.dart index b58a96c..fc0b00e 100644 --- a/packages/algoliasearch/lib/src/model/search_pagination.g.dart +++ b/packages/algoliasearch/lib/src/model/search_pagination.g.dart @@ -12,20 +12,28 @@ SearchPagination _$SearchPaginationFromJson(Map json) => json, ($checkedConvert) { final val = SearchPagination( - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), ); return val; }, ); -Map _$SearchPaginationToJson(SearchPagination instance) => - { - 'page': instance.page, - 'nbHits': instance.nbHits, - 'nbPages': instance.nbPages, - 'hitsPerPage': instance.hitsPerPage, - }; +Map _$SearchPaginationToJson(SearchPagination instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); + return val; +} diff --git a/packages/algoliasearch/lib/src/model/search_response.dart b/packages/algoliasearch/lib/src/model/search_response.dart index 4f74974..278b97c 100644 --- a/packages/algoliasearch/lib/src/model/search_response.dart +++ b/packages/algoliasearch/lib/src/model/search_response.dart @@ -39,10 +39,10 @@ final class SearchResponse { this.userData, this.queryID, this.automaticInsights, - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, required this.hits, required this.query, required this.params, @@ -152,21 +152,21 @@ final class SearchResponse { /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. @JsonKey(name: r'hits') diff --git a/packages/algoliasearch/lib/src/model/search_response.g.dart b/packages/algoliasearch/lib/src/model/search_response.g.dart index aa90e9a..524c0e2 100644 --- a/packages/algoliasearch/lib/src/model/search_response.g.dart +++ b/packages/algoliasearch/lib/src/model/search_response.g.dart @@ -67,11 +67,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => queryID: $checkedConvert('queryID', (v) => v as String?), automaticInsights: $checkedConvert('_automaticInsights', (v) => v as bool?), - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -123,10 +123,10 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); writeNotNull('_automaticInsights', instance.automaticInsights); - val['page'] = instance.page; - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; - val['hitsPerPage'] = instance.hitsPerPage; + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); val['hits'] = instance.hits.map((e) => e.toJson()).toList(); val['query'] = instance.query; val['params'] = instance.params; diff --git a/packages/client_recommend/lib/src/model/recommendations_results.dart b/packages/client_recommend/lib/src/model/recommendations_results.dart index 3aedf08..6b13f49 100644 --- a/packages/client_recommend/lib/src/model/recommendations_results.dart +++ b/packages/client_recommend/lib/src/model/recommendations_results.dart @@ -38,10 +38,10 @@ final class RecommendationsResults { this.userData, this.queryID, this.automaticInsights, - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, required this.hits, }); @@ -149,21 +149,21 @@ final class RecommendationsResults { /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; /// One of types: /// - [RecommendHit] diff --git a/packages/client_recommend/lib/src/model/recommendations_results.g.dart b/packages/client_recommend/lib/src/model/recommendations_results.g.dart index 1f705fe..1f239ed 100644 --- a/packages/client_recommend/lib/src/model/recommendations_results.g.dart +++ b/packages/client_recommend/lib/src/model/recommendations_results.g.dart @@ -68,11 +68,11 @@ RecommendationsResults _$RecommendationsResultsFromJson( queryID: $checkedConvert('queryID', (v) => v as String?), automaticInsights: $checkedConvert('_automaticInsights', (v) => v as bool?), - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), hits: $checkedConvert('hits', (v) => v as List), ); return val; @@ -119,10 +119,10 @@ Map _$RecommendationsResultsToJson( writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); writeNotNull('_automaticInsights', instance.automaticInsights); - val['page'] = instance.page; - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; - val['hitsPerPage'] = instance.hitsPerPage; + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); val['hits'] = instance.hits.toList(); return val; } diff --git a/packages/client_recommend/lib/src/model/search_pagination.dart b/packages/client_recommend/lib/src/model/search_pagination.dart index 4c7eb08..60a6194 100644 --- a/packages/client_recommend/lib/src/model/search_pagination.dart +++ b/packages/client_recommend/lib/src/model/search_pagination.dart @@ -9,30 +9,30 @@ part 'search_pagination.g.dart'; final class SearchPagination { /// Returns a new [SearchPagination] instance. const SearchPagination({ - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, }); /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; @override bool operator ==(Object other) => diff --git a/packages/client_recommend/lib/src/model/search_pagination.g.dart b/packages/client_recommend/lib/src/model/search_pagination.g.dart index b58a96c..fc0b00e 100644 --- a/packages/client_recommend/lib/src/model/search_pagination.g.dart +++ b/packages/client_recommend/lib/src/model/search_pagination.g.dart @@ -12,20 +12,28 @@ SearchPagination _$SearchPaginationFromJson(Map json) => json, ($checkedConvert) { final val = SearchPagination( - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), ); return val; }, ); -Map _$SearchPaginationToJson(SearchPagination instance) => - { - 'page': instance.page, - 'nbHits': instance.nbHits, - 'nbPages': instance.nbPages, - 'hitsPerPage': instance.hitsPerPage, - }; +Map _$SearchPaginationToJson(SearchPagination instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); + return val; +} diff --git a/packages/client_search/lib/src/model/search_pagination.dart b/packages/client_search/lib/src/model/search_pagination.dart index 4c7eb08..60a6194 100644 --- a/packages/client_search/lib/src/model/search_pagination.dart +++ b/packages/client_search/lib/src/model/search_pagination.dart @@ -9,30 +9,30 @@ part 'search_pagination.g.dart'; final class SearchPagination { /// Returns a new [SearchPagination] instance. const SearchPagination({ - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, }); /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; @override bool operator ==(Object other) => diff --git a/packages/client_search/lib/src/model/search_pagination.g.dart b/packages/client_search/lib/src/model/search_pagination.g.dart index b58a96c..fc0b00e 100644 --- a/packages/client_search/lib/src/model/search_pagination.g.dart +++ b/packages/client_search/lib/src/model/search_pagination.g.dart @@ -12,20 +12,28 @@ SearchPagination _$SearchPaginationFromJson(Map json) => json, ($checkedConvert) { final val = SearchPagination( - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), ); return val; }, ); -Map _$SearchPaginationToJson(SearchPagination instance) => - { - 'page': instance.page, - 'nbHits': instance.nbHits, - 'nbPages': instance.nbPages, - 'hitsPerPage': instance.hitsPerPage, - }; +Map _$SearchPaginationToJson(SearchPagination instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); + return val; +} diff --git a/packages/client_search/lib/src/model/search_response.dart b/packages/client_search/lib/src/model/search_response.dart index 20f3258..b60065d 100644 --- a/packages/client_search/lib/src/model/search_response.dart +++ b/packages/client_search/lib/src/model/search_response.dart @@ -39,10 +39,10 @@ final class SearchResponse { this.userData, this.queryID, this.automaticInsights, - required this.page, - required this.nbHits, - required this.nbPages, - required this.hitsPerPage, + this.page, + this.nbHits, + this.nbPages, + this.hitsPerPage, required this.hits, required this.query, required this.params, @@ -152,21 +152,21 @@ final class SearchResponse { /// Page of search results to retrieve. // minimum: 0 @JsonKey(name: r'page') - final int page; + final int? page; /// Number of results (hits). @JsonKey(name: r'nbHits') - final int nbHits; + final int? nbHits; /// Number of pages of results. @JsonKey(name: r'nbPages') - final int nbPages; + final int? nbPages; /// Number of hits per page. // minimum: 1 // maximum: 1000 @JsonKey(name: r'hitsPerPage') - final int hitsPerPage; + final int? hitsPerPage; /// Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. @JsonKey(name: r'hits') diff --git a/packages/client_search/lib/src/model/search_response.g.dart b/packages/client_search/lib/src/model/search_response.g.dart index aa90e9a..524c0e2 100644 --- a/packages/client_search/lib/src/model/search_response.g.dart +++ b/packages/client_search/lib/src/model/search_response.g.dart @@ -67,11 +67,11 @@ SearchResponse _$SearchResponseFromJson(Map json) => queryID: $checkedConvert('queryID', (v) => v as String?), automaticInsights: $checkedConvert('_automaticInsights', (v) => v as bool?), - page: $checkedConvert('page', (v) => (v as num).toInt()), - nbHits: $checkedConvert('nbHits', (v) => (v as num).toInt()), - nbPages: $checkedConvert('nbPages', (v) => (v as num).toInt()), + page: $checkedConvert('page', (v) => (v as num?)?.toInt()), + nbHits: $checkedConvert('nbHits', (v) => (v as num?)?.toInt()), + nbPages: $checkedConvert('nbPages', (v) => (v as num?)?.toInt()), hitsPerPage: - $checkedConvert('hitsPerPage', (v) => (v as num).toInt()), + $checkedConvert('hitsPerPage', (v) => (v as num?)?.toInt()), hits: $checkedConvert( 'hits', (v) => (v as List) @@ -123,10 +123,10 @@ Map _$SearchResponseToJson(SearchResponse instance) { writeNotNull('userData', instance.userData); writeNotNull('queryID', instance.queryID); writeNotNull('_automaticInsights', instance.automaticInsights); - val['page'] = instance.page; - val['nbHits'] = instance.nbHits; - val['nbPages'] = instance.nbPages; - val['hitsPerPage'] = instance.hitsPerPage; + writeNotNull('page', instance.page); + writeNotNull('nbHits', instance.nbHits); + writeNotNull('nbPages', instance.nbPages); + writeNotNull('hitsPerPage', instance.hitsPerPage); val['hits'] = instance.hits.map((e) => e.toJson()).toList(); val['query'] = instance.query; val['params'] = instance.params; diff --git a/packages/client_search/lib/src/model/user_highlight_result.dart b/packages/client_search/lib/src/model/user_highlight_result.dart index 0cc1b75..18f699f 100644 --- a/packages/client_search/lib/src/model/user_highlight_result.dart +++ b/packages/client_search/lib/src/model/user_highlight_result.dart @@ -14,16 +14,18 @@ final class UserHighlightResult { }); /// One of types: - /// - [Map] /// - [List] + /// - [List>] + /// - [List>] /// - [HighlightResultOption] /// - [Map] @JsonKey(name: r'userID') final dynamic userID; /// One of types: - /// - [Map] /// - [List] + /// - [List>] + /// - [List>] /// - [HighlightResultOption] /// - [Map] @JsonKey(name: r'clusterName')