Skip to content

Commit 1ca20b3

Browse files
refactor(specs): re-organise response for Composition API (generated)
algolia/api-clients-automation#5744 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clara Muller <5667350+ClaraMuller@users.noreply.github.com>
1 parent 674255d commit 1ca20b3

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

lib/algolia/models/composition/composition_run_applied_rules.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module Algolia
99
module Composition
1010
class CompositionRunAppliedRules
11-
# Unique record identifier.
11+
# The objectID of the applied composition rule on this query.
1212
attr_accessor :algolia_object_id
1313

1414
# Attribute mapping from ruby-style variable name to JSON key.

lib/algolia/models/composition/composition_run_search_response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module Algolia
99
module Composition
1010
class CompositionRunSearchResponse
11-
# Unique record identifier.
11+
# The objectID of the composition which generated this result set.
1212
attr_accessor :algolia_object_id
1313

1414
attr_accessor :applied_rules

lib/algolia/models/composition/results_injected_item_applied_rules_info_response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module Algolia
99
module Composition
1010
class ResultsInjectedItemAppliedRulesInfoResponse
11-
# Unique record identifier.
11+
# The objectID of the applied index level rule on this injected group.
1212
attr_accessor :algolia_object_id
1313

1414
# Attribute mapping from ruby-style variable name to JSON key.

lib/algolia/models/composition/results_injected_item_info_response.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
module Algolia
99
module Composition
1010
class ResultsInjectedItemInfoResponse
11+
# The key of the injected group.
1112
attr_accessor :key
1213

1314
attr_accessor :applied_rules

lib/algolia/models/composition/search_results_item.rb

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,27 @@ class SearchResultsItem
8383
# Whether automatic events collection is enabled for the application.
8484
attr_accessor :_automatic_insights
8585

86-
# The current page of the results.
87-
attr_accessor :page
86+
# Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
87+
attr_accessor :hits
88+
89+
# Number of hits returned per page.
90+
attr_accessor :hits_per_page
8891

8992
# Number of results (hits).
9093
attr_accessor :nb_hits
9194

9295
# Number of pages of results.
9396
attr_accessor :nb_pages
9497

95-
# Number of hits returned per page.
96-
attr_accessor :hits_per_page
98+
# The current page of the results.
99+
attr_accessor :page
97100

98-
# Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
99-
attr_accessor :hits
101+
# URL-encoded string of all search parameters.
102+
attr_accessor :params
100103

101104
# The search query string.
102105
attr_accessor :query
103106

104-
# URL-encoded string of all search parameters.
105-
attr_accessor :params
106-
107107
attr_accessor :compositions
108108

109109
# Attribute mapping from ruby-style variable name to JSON key.
@@ -135,13 +135,13 @@ def self.attribute_map
135135
:user_data => :userData,
136136
:query_id => :queryID,
137137
:_automatic_insights => :_automaticInsights,
138-
:page => :page,
138+
:hits => :hits,
139+
:hits_per_page => :hitsPerPage,
139140
:nb_hits => :nbHits,
140141
:nb_pages => :nbPages,
141-
:hits_per_page => :hitsPerPage,
142-
:hits => :hits,
143-
:query => :query,
142+
:page => :page,
144143
:params => :params,
144+
:query => :query,
145145
:compositions => :compositions
146146
}
147147
end
@@ -175,13 +175,13 @@ def self.types_mapping
175175
:user_data => :"Object",
176176
:query_id => :"String",
177177
:_automatic_insights => :"Boolean",
178-
:page => :"Integer",
178+
:hits => :"Array<Hit>",
179+
:hits_per_page => :"Integer",
179180
:nb_hits => :"Integer",
180181
:nb_pages => :"Integer",
181-
:hits_per_page => :"Integer",
182-
:hits => :"Array<Hit>",
183-
:query => :"String",
182+
:page => :"Integer",
184183
:params => :"String",
184+
:query => :"String",
185185
:compositions => :"Hash<String, ResultsCompositionInfoResponse>"
186186
}
187187
end
@@ -200,8 +200,7 @@ def self.openapi_all_of
200200
[
201201
:"BaseSearchResponse",
202202
:"ResultsCompositionsResponse",
203-
:"SearchHits",
204-
:"SearchPagination"
203+
:"SearchFields"
205204
]
206205
end
207206

@@ -338,10 +337,18 @@ def initialize(attributes = {})
338337
self._automatic_insights = attributes[:_automatic_insights]
339338
end
340339

341-
if attributes.key?(:page)
342-
self.page = attributes[:page]
340+
if attributes.key?(:hits)
341+
if (value = attributes[:hits]).is_a?(Array)
342+
self.hits = value
343+
end
343344
else
344-
self.page = nil
345+
self.hits = nil
346+
end
347+
348+
if attributes.key?(:hits_per_page)
349+
self.hits_per_page = attributes[:hits_per_page]
350+
else
351+
self.hits_per_page = nil
345352
end
346353

347354
if attributes.key?(:nb_hits)
@@ -356,18 +363,16 @@ def initialize(attributes = {})
356363
self.nb_pages = nil
357364
end
358365

359-
if attributes.key?(:hits_per_page)
360-
self.hits_per_page = attributes[:hits_per_page]
366+
if attributes.key?(:page)
367+
self.page = attributes[:page]
361368
else
362-
self.hits_per_page = nil
369+
self.page = nil
363370
end
364371

365-
if attributes.key?(:hits)
366-
if (value = attributes[:hits]).is_a?(Array)
367-
self.hits = value
368-
end
372+
if attributes.key?(:params)
373+
self.params = attributes[:params]
369374
else
370-
self.hits = nil
375+
self.params = nil
371376
end
372377

373378
if attributes.key?(:query)
@@ -376,12 +381,6 @@ def initialize(attributes = {})
376381
self.query = nil
377382
end
378383

379-
if attributes.key?(:params)
380-
self.params = attributes[:params]
381-
else
382-
self.params = nil
383-
end
384-
385384
if attributes.key?(:compositions)
386385
if (value = attributes[:compositions]).is_a?(Hash)
387386
self.compositions = value
@@ -422,13 +421,13 @@ def ==(other)
422421
user_data == other.user_data &&
423422
query_id == other.query_id &&
424423
_automatic_insights == other._automatic_insights &&
425-
page == other.page &&
424+
hits == other.hits &&
425+
hits_per_page == other.hits_per_page &&
426426
nb_hits == other.nb_hits &&
427427
nb_pages == other.nb_pages &&
428-
hits_per_page == other.hits_per_page &&
429-
hits == other.hits &&
430-
query == other.query &&
428+
page == other.page &&
431429
params == other.params &&
430+
query == other.query &&
432431
compositions == other.compositions
433432
end
434433

@@ -468,13 +467,13 @@ def hash
468467
user_data,
469468
query_id,
470469
_automatic_insights,
471-
page,
470+
hits,
471+
hits_per_page,
472472
nb_hits,
473473
nb_pages,
474-
hits_per_page,
475-
hits,
476-
query,
474+
page,
477475
params,
476+
query,
478477
compositions
479478
].hash
480479
end

0 commit comments

Comments
 (0)