algolia 3.0.0.alpha.15 → 3.0.0.alpha.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +10 -167
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile.lock +1 -1
  5. data/lib/algolia/api/analytics_client.rb +76 -76
  6. data/lib/algolia/api/ingestion_client.rb +267 -196
  7. data/lib/algolia/api/monitoring_client.rb +49 -49
  8. data/lib/algolia/api/query_suggestions_client.rb +14 -14
  9. data/lib/algolia/api/recommend_client.rb +22 -22
  10. data/lib/algolia/api/search_client.rb +8 -8
  11. data/lib/algolia/api/usage_client.rb +329 -0
  12. data/lib/algolia/models/analytics/get_status_response.rb +1 -1
  13. data/lib/algolia/models/ingestion/auth_algolia.rb +3 -2
  14. data/lib/algolia/models/ingestion/auth_algolia_insights.rb +212 -0
  15. data/lib/algolia/models/{recommend/consequence_query_object.rb → ingestion/auth_algolia_insights_partial.rb} +21 -24
  16. data/lib/algolia/models/ingestion/auth_algolia_partial.rb +3 -2
  17. data/lib/algolia/models/ingestion/auth_api_key.rb +2 -1
  18. data/lib/algolia/models/ingestion/auth_api_key_partial.rb +2 -1
  19. data/lib/algolia/models/ingestion/auth_basic.rb +3 -1
  20. data/lib/algolia/models/ingestion/auth_basic_partial.rb +3 -1
  21. data/lib/algolia/models/ingestion/auth_google_service_account.rb +3 -3
  22. data/lib/algolia/models/ingestion/auth_google_service_account_partial.rb +3 -3
  23. data/lib/algolia/models/ingestion/auth_input.rb +1 -0
  24. data/lib/algolia/models/ingestion/auth_input_partial.rb +1 -0
  25. data/lib/algolia/models/ingestion/auth_o_auth.rb +18 -8
  26. data/lib/algolia/models/ingestion/auth_o_auth_partial.rb +18 -8
  27. data/lib/algolia/models/ingestion/authentication.rb +5 -5
  28. data/lib/algolia/models/ingestion/authentication_create.rb +2 -2
  29. data/lib/algolia/models/ingestion/authentication_create_response.rb +4 -4
  30. data/lib/algolia/models/ingestion/authentication_search.rb +1 -1
  31. data/lib/algolia/models/ingestion/authentication_type.rb +2 -1
  32. data/lib/algolia/models/ingestion/authentication_update.rb +2 -2
  33. data/lib/algolia/models/ingestion/authentication_update_response.rb +4 -4
  34. data/lib/algolia/models/ingestion/big_commerce_channel.rb +2 -2
  35. data/lib/algolia/models/ingestion/big_commerce_metafield.rb +2 -2
  36. data/lib/algolia/models/ingestion/commercetools_custom_fields.rb +1 -1
  37. data/lib/algolia/models/ingestion/delete_response.rb +1 -1
  38. data/lib/algolia/models/ingestion/destination.rb +6 -6
  39. data/lib/algolia/models/ingestion/destination_create.rb +3 -3
  40. data/lib/algolia/models/ingestion/destination_create_response.rb +4 -4
  41. data/lib/algolia/models/ingestion/destination_index_name.rb +2 -2
  42. data/lib/algolia/models/ingestion/destination_index_prefix.rb +1 -1
  43. data/lib/algolia/models/ingestion/destination_search.rb +1 -1
  44. data/lib/algolia/models/ingestion/destination_type.rb +1 -2
  45. data/lib/algolia/models/ingestion/destination_update.rb +3 -3
  46. data/lib/algolia/models/ingestion/destination_update_response.rb +4 -4
  47. data/lib/algolia/models/ingestion/docker_source_discover.rb +2 -2
  48. data/lib/algolia/models/ingestion/event.rb +3 -3
  49. data/lib/algolia/models/ingestion/list_tasks_response.rb +1 -1
  50. data/lib/algolia/models/ingestion/mapping_format_schema.rb +32 -0
  51. data/lib/algolia/models/ingestion/mapping_input.rb +24 -3
  52. data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +3 -3
  53. data/lib/algolia/models/ingestion/on_demand_trigger.rb +2 -2
  54. data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +1 -1
  55. data/lib/algolia/models/ingestion/pagination.rb +65 -0
  56. data/lib/algolia/models/ingestion/platform.rb +2 -1
  57. data/lib/algolia/models/ingestion/run.rb +7 -7
  58. data/lib/algolia/models/ingestion/run_response.rb +3 -3
  59. data/lib/algolia/models/ingestion/schedule_date_utils_input.rb +2 -2
  60. data/lib/algolia/models/ingestion/schedule_trigger.rb +4 -4
  61. data/lib/algolia/models/ingestion/schedule_trigger_input.rb +2 -2
  62. data/lib/algolia/models/ingestion/source.rb +4 -4
  63. data/lib/algolia/models/ingestion/source_big_commerce.rb +1 -1
  64. data/lib/algolia/models/ingestion/source_big_query.rb +5 -5
  65. data/lib/algolia/models/ingestion/source_commercetools.rb +2 -2
  66. data/lib/algolia/models/ingestion/source_create.rb +2 -1
  67. data/lib/algolia/models/ingestion/source_create_response.rb +3 -2
  68. data/lib/algolia/models/ingestion/source_csv.rb +3 -3
  69. data/lib/algolia/models/ingestion/source_docker.rb +3 -3
  70. data/lib/algolia/models/ingestion/source_ga4_big_query_export.rb +3 -3
  71. data/lib/algolia/models/ingestion/source_json.rb +2 -2
  72. data/lib/algolia/models/ingestion/source_type.rb +5 -3
  73. data/lib/algolia/models/ingestion/source_update.rb +2 -1
  74. data/lib/algolia/models/ingestion/source_update_commercetools.rb +2 -3
  75. data/lib/algolia/models/ingestion/source_update_docker.rb +3 -3
  76. data/lib/algolia/models/ingestion/source_update_response.rb +3 -2
  77. data/lib/algolia/models/ingestion/streaming_trigger.rb +1 -1
  78. data/lib/algolia/models/ingestion/streaming_utils_input.rb +1 -1
  79. data/lib/algolia/models/ingestion/subscription_trigger.rb +1 -1
  80. data/lib/algolia/models/ingestion/task.rb +7 -7
  81. data/lib/algolia/models/ingestion/task_create.rb +5 -5
  82. data/lib/algolia/models/ingestion/task_create_response.rb +3 -3
  83. data/lib/algolia/models/ingestion/task_input.rb +1 -0
  84. data/lib/algolia/models/ingestion/task_update.rb +4 -4
  85. data/lib/algolia/models/ingestion/task_update_response.rb +3 -3
  86. data/lib/algolia/models/ingestion/trigger.rb +1 -0
  87. data/lib/algolia/models/ingestion/trigger_update_input.rb +2 -2
  88. data/lib/algolia/models/ingestion/window.rb +3 -3
  89. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +1 -1
  90. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +1 -1
  91. data/lib/algolia/models/insights/clicked_filters.rb +1 -1
  92. data/lib/algolia/models/insights/clicked_object_ids.rb +1 -1
  93. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +1 -1
  94. data/lib/algolia/models/insights/converted_filters.rb +1 -1
  95. data/lib/algolia/models/insights/converted_object_ids.rb +1 -1
  96. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +1 -1
  97. data/lib/algolia/models/insights/purchased_object_ids.rb +1 -1
  98. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +3 -1
  99. data/lib/algolia/models/insights/viewed_filters.rb +1 -1
  100. data/lib/algolia/models/insights/viewed_object_ids.rb +1 -1
  101. data/lib/algolia/models/monitoring/{get_inventory403_response.rb → get_servers403_response.rb} +3 -3
  102. data/lib/algolia/models/monitoring/incidents_inner.rb +1 -1
  103. data/lib/algolia/models/monitoring/probes_metric.rb +1 -1
  104. data/lib/algolia/models/monitoring/server.rb +2 -2
  105. data/lib/algolia/models/monitoring/time_inner.rb +1 -1
  106. data/lib/algolia/models/query-suggestions/app_id.rb +197 -0
  107. data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +4 -4
  108. data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +2 -2
  109. data/lib/algolia/models/query-suggestions/languages.rb +1 -1
  110. data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +2 -3
  111. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +23 -34
  112. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +18 -20
  113. data/lib/algolia/models/query-suggestions/source_index.rb +3 -5
  114. data/lib/algolia/models/recommend/auto_facet_filter.rb +208 -0
  115. data/lib/algolia/models/recommend/base_recommend_request.rb +36 -7
  116. data/lib/algolia/models/recommend/base_search_params.rb +1 -1
  117. data/lib/algolia/models/recommend/base_search_params_without_query.rb +1 -1
  118. data/lib/algolia/models/recommend/bought_together_query.rb +319 -0
  119. data/lib/algolia/models/recommend/condition.rb +12 -62
  120. data/lib/algolia/models/recommend/consequence.rb +32 -54
  121. data/lib/algolia/models/recommend/deleted_at_response.rb +1 -1
  122. data/lib/algolia/models/recommend/{recommended_for_you_query_parameters.rb → fallback_params.rb} +9 -12
  123. data/lib/algolia/models/recommend/{edit_type.rb → fbt_model.rb} +5 -6
  124. data/lib/algolia/models/recommend/{base_trending_facets_query.rb → frequently_bought_together.rb} +20 -18
  125. data/lib/algolia/models/recommend/get_recommendations_params.rb +2 -2
  126. data/lib/algolia/models/recommend/{consequence_hide.rb → hide_consequence_object.rb} +4 -6
  127. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +5 -5
  128. data/lib/algolia/models/recommend/{base_recommendations_query.rb → looking_similar.rb} +6 -15
  129. data/lib/algolia/models/recommend/{anchoring.rb → looking_similar_model.rb} +5 -8
  130. data/lib/algolia/models/recommend/looking_similar_query.rb +328 -0
  131. data/lib/algolia/models/recommend/{params.rb → params_consequence.rb} +26 -28
  132. data/lib/algolia/models/recommend/{promote_object_id.rb → promote_consequence_object.rb} +19 -9
  133. data/lib/algolia/models/recommend/{rule_response.rb → recommend_rule.rb} +13 -18
  134. data/lib/algolia/models/recommend/{rule_response_metadata.rb → recommend_rule_metadata.rb} +5 -4
  135. data/lib/algolia/models/recommend/recommendations_hits.rb +4 -24
  136. data/lib/algolia/models/recommend/recommendations_request.rb +3 -1
  137. data/lib/algolia/models/recommend/recommendations_results.rb +4 -24
  138. data/lib/algolia/models/recommend/{base_recommended_for_you_query.rb → recommended_for_you.rb} +5 -14
  139. data/lib/algolia/models/recommend/recommended_for_you_query.rb +35 -15
  140. data/lib/algolia/models/recommend/{recommendation_models.rb → related_model.rb} +4 -5
  141. data/lib/algolia/models/recommend/{edit.rb → related_products.rb} +27 -24
  142. data/lib/algolia/models/recommend/{recommendations_query.rb → related_query.rb} +39 -19
  143. data/lib/algolia/models/recommend/{consequence_params.rb → search_params.rb} +25 -44
  144. data/lib/algolia/models/recommend/search_params_object.rb +6 -6
  145. data/lib/algolia/models/recommend/search_recommend_rules_params.rb +58 -10
  146. data/lib/algolia/models/recommend/search_recommend_rules_response.rb +2 -2
  147. data/lib/algolia/models/recommend/trending_facet_hit.rb +2 -2
  148. data/lib/algolia/models/recommend/trending_facets.rb +243 -0
  149. data/lib/algolia/models/recommend/trending_facets_query.rb +50 -10
  150. data/lib/algolia/models/recommend/{base_trending_items_query.rb → trending_items.rb} +12 -15
  151. data/lib/algolia/models/recommend/trending_items_query.rb +42 -16
  152. data/lib/algolia/models/search/add_api_key_response.rb +1 -1
  153. data/lib/algolia/models/search/base_get_api_key_response.rb +1 -1
  154. data/lib/algolia/models/search/base_index_settings.rb +4 -4
  155. data/lib/algolia/models/search/base_search_params.rb +1 -1
  156. data/lib/algolia/models/search/base_search_params_without_query.rb +1 -1
  157. data/lib/algolia/models/search/browse_params_object.rb +6 -6
  158. data/lib/algolia/models/search/consequence_params.rb +6 -6
  159. data/lib/algolia/models/search/created_at_response.rb +1 -1
  160. data/lib/algolia/models/search/delete_api_key_response.rb +1 -1
  161. data/lib/algolia/models/search/delete_by_params.rb +1 -1
  162. data/lib/algolia/models/search/delete_source_response.rb +1 -1
  163. data/lib/algolia/models/search/deleted_at_response.rb +1 -1
  164. data/lib/algolia/models/search/fetched_index.rb +1 -1
  165. data/lib/algolia/models/search/get_api_key_response.rb +1 -1
  166. data/lib/algolia/models/search/index_settings.rb +9 -9
  167. data/lib/algolia/models/search/index_settings_as_search_params.rb +5 -5
  168. data/lib/algolia/models/search/log.rb +1 -1
  169. data/lib/algolia/models/search/remove_user_id_response.rb +1 -1
  170. data/lib/algolia/models/search/replace_source_response.rb +1 -1
  171. data/lib/algolia/models/search/save_object_response.rb +1 -1
  172. data/lib/algolia/models/search/save_synonym_response.rb +1 -1
  173. data/lib/algolia/models/search/search_for_facets.rb +6 -6
  174. data/lib/algolia/models/search/search_for_hits.rb +6 -6
  175. data/lib/algolia/models/search/search_params_object.rb +6 -6
  176. data/lib/algolia/models/search/search_user_ids_response.rb +1 -1
  177. data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
  178. data/lib/algolia/models/search/update_api_key_response.rb +1 -1
  179. data/lib/algolia/models/search/updated_at_response.rb +1 -1
  180. data/lib/algolia/models/search/updated_at_with_object_id_response.rb +1 -1
  181. data/lib/algolia/models/search/updated_rule_response.rb +1 -1
  182. data/lib/algolia/models/search/user_hit.rb +1 -1
  183. data/lib/algolia/models/search/user_id.rb +1 -1
  184. data/lib/algolia/models/usage/error_base.rb +205 -0
  185. data/lib/algolia/models/usage/get_usage200_response.rb +198 -0
  186. data/lib/algolia/models/usage/get_usage200_response_statistics_inner.rb +206 -0
  187. data/lib/algolia/models/{recommend/base_recommended_for_you_query_parameters.rb → usage/get_usage400_response.rb} +13 -14
  188. data/lib/algolia/models/usage/get_usage400_response_error.rb +216 -0
  189. data/lib/algolia/models/usage/get_usage400_response_error_errors_inner.rb +225 -0
  190. data/lib/algolia/models/usage/granularity.rb +33 -0
  191. data/lib/algolia/models/usage/statistic.rb +116 -0
  192. data/lib/algolia/models/{recommend/promote.rb → usage/statistic_value.rb} +5 -5
  193. data/lib/algolia/version.rb +1 -1
  194. metadata +37 -26
  195. data/lib/algolia/models/recommend/automatic_facet_filter.rb +0 -220
  196. data/lib/algolia/models/recommend/automatic_facet_filters.rb +0 -97
  197. data/lib/algolia/models/recommend/consequence_query.rb +0 -97
  198. data/lib/algolia/models/recommend/promote_object_ids.rb +0 -228
@@ -5,15 +5,14 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- # Rule object.
9
- class RuleResponse
8
+ # Recommend rule.
9
+ class RecommendRule
10
10
  attr_accessor :_metadata
11
11
 
12
- # Unique identifier for a rule object.
12
+ # Unique identifier of a rule object.
13
13
  attr_accessor :object_id
14
14
 
15
- # [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.
16
- attr_accessor :conditions
15
+ attr_accessor :condition
17
16
 
18
17
  attr_accessor :consequence
19
18
 
@@ -28,7 +27,7 @@ module Algolia
28
27
  {
29
28
  :_metadata => :_metadata,
30
29
  :object_id => :objectID,
31
- :conditions => :conditions,
30
+ :condition => :condition,
32
31
  :consequence => :consequence,
33
32
  :description => :description,
34
33
  :enabled => :enabled
@@ -43,9 +42,9 @@ module Algolia
43
42
  # Attribute type mapping.
44
43
  def self.types_mapping
45
44
  {
46
- :_metadata => :RuleResponseMetadata,
45
+ :_metadata => :RecommendRuleMetadata,
47
46
  :object_id => :String,
48
- :conditions => :'Array<Condition>',
47
+ :condition => :Condition,
49
48
  :consequence => :Consequence,
50
49
  :description => :String,
51
50
  :enabled => :Boolean
@@ -61,14 +60,14 @@ module Algolia
61
60
  # @param [Hash] attributes Model attributes in the form of hash
62
61
  def initialize(attributes = {})
63
62
  unless attributes.is_a?(Hash)
64
- raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RuleResponse` initialize method"
63
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RecommendRule` initialize method"
65
64
  end
66
65
 
67
66
  # check to see if the attribute exists and convert string to symbol for hash key
68
67
  attributes = attributes.each_with_object({}) do |(k, v), h|
69
68
  unless self.class.attribute_map.key?(k.to_sym)
70
69
  raise ArgumentError,
71
- "`#{k}` is not a valid attribute in `Algolia::RuleResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ "`#{k}` is not a valid attribute in `Algolia::RecommendRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
71
  end
73
72
 
74
73
  h[k.to_sym] = v
@@ -80,14 +79,10 @@ module Algolia
80
79
 
81
80
  if attributes.key?(:object_id)
82
81
  self.object_id = attributes[:object_id]
83
- else
84
- self.object_id = nil
85
82
  end
86
83
 
87
- if attributes.key?(:conditions)
88
- if (value = attributes[:conditions]).is_a?(Array)
89
- self.conditions = value
90
- end
84
+ if attributes.key?(:condition)
85
+ self.condition = attributes[:condition]
91
86
  end
92
87
 
93
88
  if attributes.key?(:consequence)
@@ -111,7 +106,7 @@ module Algolia
111
106
  self.class == other.class &&
112
107
  _metadata == other._metadata &&
113
108
  object_id == other.object_id &&
114
- conditions == other.conditions &&
109
+ condition == other.condition &&
115
110
  consequence == other.consequence &&
116
111
  description == other.description &&
117
112
  enabled == other.enabled
@@ -126,7 +121,7 @@ module Algolia
126
121
  # Calculates hash code according to all attributes.
127
122
  # @return [Integer] Hash code
128
123
  def hash
129
- [_metadata, object_id, conditions, consequence, description, enabled].hash
124
+ [_metadata, object_id, condition, consequence, description, enabled].hash
130
125
  end
131
126
 
132
127
  # Builds the object from hash
@@ -5,8 +5,9 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- class RuleResponseMetadata
9
- # Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
8
+ # Rule metadata.
9
+ class RecommendRuleMetadata
10
+ # Date and time when the object was updated, in RFC 3339 format.
10
11
  attr_accessor :last_update
11
12
 
12
13
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -37,14 +38,14 @@ module Algolia
37
38
  # @param [Hash] attributes Model attributes in the form of hash
38
39
  def initialize(attributes = {})
39
40
  unless attributes.is_a?(Hash)
40
- raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RuleResponseMetadata` initialize method"
41
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RecommendRuleMetadata` initialize method"
41
42
  end
42
43
 
43
44
  # check to see if the attribute exists and convert string to symbol for hash key
44
45
  attributes = attributes.each_with_object({}) do |(k, v), h|
45
46
  unless self.class.attribute_map.key?(k.to_sym)
46
47
  raise ArgumentError,
47
- "`#{k}` is not a valid attribute in `Algolia::RuleResponseMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
+ "`#{k}` is not a valid attribute in `Algolia::RecommendRuleMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
49
  end
49
50
 
50
51
  h[k.to_sym] = v
@@ -8,18 +8,10 @@ module Algolia
8
8
  class RecommendationsHits
9
9
  attr_accessor :hits
10
10
 
11
- # Search query.
12
- attr_accessor :query
13
-
14
- # URL-encoded string of all search parameters.
15
- attr_accessor :params
16
-
17
11
  # Attribute mapping from ruby-style variable name to JSON key.
18
12
  def self.attribute_map
19
13
  {
20
- :hits => :hits,
21
- :query => :query,
22
- :params => :params
14
+ :hits => :hits
23
15
  }
24
16
  end
25
17
 
@@ -31,9 +23,7 @@ module Algolia
31
23
  # Attribute type mapping.
32
24
  def self.types_mapping
33
25
  {
34
- :hits => :'Array<RecommendationsHit>',
35
- :query => :String,
36
- :params => :String
26
+ :hits => :'Array<RecommendationsHit>'
37
27
  }
38
28
  end
39
29
 
@@ -66,14 +56,6 @@ module Algolia
66
56
  else
67
57
  self.hits = nil
68
58
  end
69
-
70
- if attributes.key?(:query)
71
- self.query = attributes[:query]
72
- end
73
-
74
- if attributes.key?(:params)
75
- self.params = attributes[:params]
76
- end
77
59
  end
78
60
 
79
61
  # Checks equality by comparing each attribute.
@@ -82,9 +64,7 @@ module Algolia
82
64
  return true if equal?(other)
83
65
 
84
66
  self.class == other.class &&
85
- hits == other.hits &&
86
- query == other.query &&
87
- params == other.params
67
+ hits == other.hits
88
68
  end
89
69
 
90
70
  # @see the `==` method
@@ -96,7 +76,7 @@ module Algolia
96
76
  # Calculates hash code according to all attributes.
97
77
  # @return [Integer] Hash code
98
78
  def hash
99
- [hits, query, params].hash
79
+ [hits].hash
100
80
  end
101
81
 
102
82
  # Builds the object from hash
@@ -10,8 +10,10 @@ module Algolia
10
10
  # List of class defined in oneOf (OpenAPI v3)
11
11
  def openapi_one_of
12
12
  [
13
- :RecommendationsQuery,
13
+ :BoughtTogetherQuery,
14
+ :LookingSimilarQuery,
14
15
  :RecommendedForYouQuery,
16
+ :RelatedQuery,
15
17
  :TrendingFacetsQuery,
16
18
  :TrendingItemsQuery
17
19
  ]
@@ -89,12 +89,6 @@ module Algolia
89
89
 
90
90
  attr_accessor :hits
91
91
 
92
- # Search query.
93
- attr_accessor :query
94
-
95
- # URL-encoded string of all search parameters.
96
- attr_accessor :params
97
-
98
92
  # Attribute mapping from ruby-style variable name to JSON key.
99
93
  def self.attribute_map
100
94
  {
@@ -126,9 +120,7 @@ module Algolia
126
120
  :server_used => :serverUsed,
127
121
  :user_data => :userData,
128
122
  :query_id => :queryID,
129
- :hits => :hits,
130
- :query => :query,
131
- :params => :params
123
+ :hits => :hits
132
124
  }
133
125
  end
134
126
 
@@ -168,9 +160,7 @@ module Algolia
168
160
  :server_used => :String,
169
161
  :user_data => :Object,
170
162
  :query_id => :String,
171
- :hits => :'Array<RecommendationsHit>',
172
- :query => :String,
173
- :params => :String
163
+ :hits => :'Array<RecommendationsHit>'
174
164
  }
175
165
  end
176
166
 
@@ -337,14 +327,6 @@ module Algolia
337
327
  else
338
328
  self.hits = nil
339
329
  end
340
-
341
- if attributes.key?(:query)
342
- self.query = attributes[:query]
343
- end
344
-
345
- if attributes.key?(:params)
346
- self.params = attributes[:params]
347
- end
348
330
  end
349
331
 
350
332
  # Custom attribute writer method with validation
@@ -442,9 +424,7 @@ module Algolia
442
424
  server_used == other.server_used &&
443
425
  user_data == other.user_data &&
444
426
  query_id == other.query_id &&
445
- hits == other.hits &&
446
- query == other.query &&
447
- params == other.params
427
+ hits == other.hits
448
428
  end
449
429
 
450
430
  # @see the `==` method
@@ -457,7 +437,7 @@ module Algolia
457
437
  # @return [Integer] Hash code
458
438
  def hash
459
439
  [ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats,
460
- hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits, query, params].hash
440
+ hits_per_page, index, index_used, message, nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, query_id, hits].hash
461
441
  end
462
442
 
463
443
  # Builds the object from hash
@@ -5,11 +5,9 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- class BaseRecommendedForYouQuery
8
+ class RecommendedForYou
9
9
  attr_accessor :model
10
10
 
11
- attr_accessor :query_parameters
12
-
13
11
  attr_accessor :fallback_parameters
14
12
 
15
13
  class EnumAttributeValidator
@@ -38,7 +36,6 @@ module Algolia
38
36
  def self.attribute_map
39
37
  {
40
38
  :model => :model,
41
- :query_parameters => :queryParameters,
42
39
  :fallback_parameters => :fallbackParameters
43
40
  }
44
41
  end
@@ -52,8 +49,7 @@ module Algolia
52
49
  def self.types_mapping
53
50
  {
54
51
  :model => :RecommendedForYouModel,
55
- :query_parameters => :RecommendedForYouQueryParameters,
56
- :fallback_parameters => :RecommendedForYouQueryParameters
52
+ :fallback_parameters => :FallbackParams
57
53
  }
58
54
  end
59
55
 
@@ -66,14 +62,14 @@ module Algolia
66
62
  # @param [Hash] attributes Model attributes in the form of hash
67
63
  def initialize(attributes = {})
68
64
  unless attributes.is_a?(Hash)
69
- raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::BaseRecommendedForYouQuery` initialize method"
65
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RecommendedForYou` initialize method"
70
66
  end
71
67
 
72
68
  # check to see if the attribute exists and convert string to symbol for hash key
73
69
  attributes = attributes.each_with_object({}) do |(k, v), h|
74
70
  unless self.class.attribute_map.key?(k.to_sym)
75
71
  raise ArgumentError,
76
- "`#{k}` is not a valid attribute in `Algolia::BaseRecommendedForYouQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ "`#{k}` is not a valid attribute in `Algolia::RecommendedForYou`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
73
  end
78
74
 
79
75
  h[k.to_sym] = v
@@ -85,10 +81,6 @@ module Algolia
85
81
  self.model = nil
86
82
  end
87
83
 
88
- if attributes.key?(:query_parameters)
89
- self.query_parameters = attributes[:query_parameters]
90
- end
91
-
92
84
  if attributes.key?(:fallback_parameters)
93
85
  self.fallback_parameters = attributes[:fallback_parameters]
94
86
  end
@@ -101,7 +93,6 @@ module Algolia
101
93
 
102
94
  self.class == other.class &&
103
95
  model == other.model &&
104
- query_parameters == other.query_parameters &&
105
96
  fallback_parameters == other.fallback_parameters
106
97
  end
107
98
 
@@ -114,7 +105,7 @@ module Algolia
114
105
  # Calculates hash code according to all attributes.
115
106
  # @return [Integer] Hash code
116
107
  def hash
117
- [model, query_parameters, fallback_parameters].hash
108
+ [model, fallback_parameters].hash
118
109
  end
119
110
 
120
111
  # Builds the object from hash
@@ -9,16 +9,16 @@ module Algolia
9
9
  # Index name.
10
10
  attr_accessor :index_name
11
11
 
12
- # 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.
12
+ # Minimum score a recommendation must have to be included in the response.
13
13
  attr_accessor :threshold
14
14
 
15
- # Maximum number of recommendations to retrieve. If 0, all recommendations will be returned.
15
+ # Maximum number of recommendations to retrieve. By default, all recommendations are returned and no fallback request is made. Depending on the available recommendations and the other request parameters, the actual number of recommendations may be lower than this value.
16
16
  attr_accessor :max_recommendations
17
17
 
18
- attr_accessor :model
19
-
20
18
  attr_accessor :query_parameters
21
19
 
20
+ attr_accessor :model
21
+
22
22
  attr_accessor :fallback_parameters
23
23
 
24
24
  class EnumAttributeValidator
@@ -49,8 +49,8 @@ module Algolia
49
49
  :index_name => :indexName,
50
50
  :threshold => :threshold,
51
51
  :max_recommendations => :maxRecommendations,
52
- :model => :model,
53
52
  :query_parameters => :queryParameters,
53
+ :model => :model,
54
54
  :fallback_parameters => :fallbackParameters
55
55
  }
56
56
  end
@@ -64,11 +64,11 @@ module Algolia
64
64
  def self.types_mapping
65
65
  {
66
66
  :index_name => :String,
67
- :threshold => :Integer,
67
+ :threshold => :Float,
68
68
  :max_recommendations => :Integer,
69
+ :query_parameters => :SearchParams,
69
70
  :model => :RecommendedForYouModel,
70
- :query_parameters => :RecommendedForYouQueryParameters,
71
- :fallback_parameters => :RecommendedForYouQueryParameters
71
+ :fallback_parameters => :FallbackParams
72
72
  }
73
73
  end
74
74
 
@@ -81,7 +81,7 @@ module Algolia
81
81
  def self.openapi_all_of
82
82
  [
83
83
  :BaseRecommendRequest,
84
- :BaseRecommendedForYouQuery
84
+ :RecommendedForYou
85
85
  ]
86
86
  end
87
87
 
@@ -110,22 +110,24 @@ module Algolia
110
110
 
111
111
  if attributes.key?(:threshold)
112
112
  self.threshold = attributes[:threshold]
113
+ else
114
+ self.threshold = nil
113
115
  end
114
116
 
115
117
  if attributes.key?(:max_recommendations)
116
118
  self.max_recommendations = attributes[:max_recommendations]
117
119
  end
118
120
 
121
+ if attributes.key?(:query_parameters)
122
+ self.query_parameters = attributes[:query_parameters]
123
+ end
124
+
119
125
  if attributes.key?(:model)
120
126
  self.model = attributes[:model]
121
127
  else
122
128
  self.model = nil
123
129
  end
124
130
 
125
- if attributes.key?(:query_parameters)
126
- self.query_parameters = attributes[:query_parameters]
127
- end
128
-
129
131
  if attributes.key?(:fallback_parameters)
130
132
  self.fallback_parameters = attributes[:fallback_parameters]
131
133
  end
@@ -149,6 +151,24 @@ module Algolia
149
151
  @threshold = threshold
150
152
  end
151
153
 
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] max_recommendations Value to be assigned
156
+ def max_recommendations=(max_recommendations)
157
+ if max_recommendations.nil?
158
+ raise ArgumentError, 'max_recommendations cannot be nil'
159
+ end
160
+
161
+ if max_recommendations > 1000
162
+ raise ArgumentError, 'invalid value for "max_recommendations", must be smaller than or equal to 1000.'
163
+ end
164
+
165
+ if max_recommendations < 1
166
+ raise ArgumentError, 'invalid value for "max_recommendations", must be greater than or equal to 1.'
167
+ end
168
+
169
+ @max_recommendations = max_recommendations
170
+ end
171
+
152
172
  # Checks equality by comparing each attribute.
153
173
  # @param [Object] Object to be compared
154
174
  def ==(other)
@@ -158,8 +178,8 @@ module Algolia
158
178
  index_name == other.index_name &&
159
179
  threshold == other.threshold &&
160
180
  max_recommendations == other.max_recommendations &&
161
- model == other.model &&
162
181
  query_parameters == other.query_parameters &&
182
+ model == other.model &&
163
183
  fallback_parameters == other.fallback_parameters
164
184
  end
165
185
 
@@ -172,7 +192,7 @@ module Algolia
172
192
  # Calculates hash code according to all attributes.
173
193
  # @return [Integer] Hash code
174
194
  def hash
175
- [index_name, threshold, max_recommendations, model, query_parameters, fallback_parameters].hash
195
+ [index_name, threshold, max_recommendations, query_parameters, model, fallback_parameters].hash
176
196
  end
177
197
 
178
198
  # Builds the object from hash
@@ -5,12 +5,11 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- class RecommendationModels
8
+ class RelatedModel
9
9
  RELATED_PRODUCTS = "related-products".freeze
10
- BOUGHT_TOGETHER = "bought-together".freeze
11
10
 
12
11
  def self.all_vars
13
- @all_vars ||= [RELATED_PRODUCTS, BOUGHT_TOGETHER].freeze
12
+ @all_vars ||= [RELATED_PRODUCTS].freeze
14
13
  end
15
14
 
16
15
  # Builds the enum from string
@@ -24,9 +23,9 @@ module Algolia
24
23
  # @param [String] The enum value in the form of the string
25
24
  # @return [String] The enum value
26
25
  def build_from_hash(value)
27
- return value if RecommendationModels.all_vars.include?(value)
26
+ return value if RelatedModel.all_vars.include?(value)
28
27
 
29
- raise "Invalid ENUM value #{value} for class #RecommendationModels"
28
+ raise "Invalid ENUM value #{value} for class #RelatedModel"
30
29
  end
31
30
  end
32
31
  end
@@ -5,14 +5,13 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- class Edit
9
- attr_accessor :type
8
+ class RelatedProducts
9
+ attr_accessor :model
10
10
 
11
- # Text or patterns to remove from the query string.
12
- attr_accessor :delete
11
+ # Unique record identifier.
12
+ attr_accessor :object_id
13
13
 
14
- # Text to be added in place of the deleted text inside the query string.
15
- attr_accessor :insert
14
+ attr_accessor :fallback_parameters
16
15
 
17
16
  class EnumAttributeValidator
18
17
  attr_reader :datatype
@@ -39,9 +38,9 @@ module Algolia
39
38
  # Attribute mapping from ruby-style variable name to JSON key.
40
39
  def self.attribute_map
41
40
  {
42
- :type => :type,
43
- :delete => :delete,
44
- :insert => :insert
41
+ :model => :model,
42
+ :object_id => :objectID,
43
+ :fallback_parameters => :fallbackParameters
45
44
  }
46
45
  end
47
46
 
@@ -53,9 +52,9 @@ module Algolia
53
52
  # Attribute type mapping.
54
53
  def self.types_mapping
55
54
  {
56
- :type => :EditType,
57
- :delete => :String,
58
- :insert => :String
55
+ :model => :RelatedModel,
56
+ :object_id => :String,
57
+ :fallback_parameters => :FallbackParams
59
58
  }
60
59
  end
61
60
 
@@ -68,29 +67,33 @@ module Algolia
68
67
  # @param [Hash] attributes Model attributes in the form of hash
69
68
  def initialize(attributes = {})
70
69
  unless attributes.is_a?(Hash)
71
- raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Edit` initialize method"
70
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RelatedProducts` initialize method"
72
71
  end
73
72
 
74
73
  # check to see if the attribute exists and convert string to symbol for hash key
75
74
  attributes = attributes.each_with_object({}) do |(k, v), h|
76
75
  unless self.class.attribute_map.key?(k.to_sym)
77
76
  raise ArgumentError,
78
- "`#{k}` is not a valid attribute in `Algolia::Edit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ "`#{k}` is not a valid attribute in `Algolia::RelatedProducts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
78
  end
80
79
 
81
80
  h[k.to_sym] = v
82
81
  end
83
82
 
84
- if attributes.key?(:type)
85
- self.type = attributes[:type]
83
+ if attributes.key?(:model)
84
+ self.model = attributes[:model]
85
+ else
86
+ self.model = nil
86
87
  end
87
88
 
88
- if attributes.key?(:delete)
89
- self.delete = attributes[:delete]
89
+ if attributes.key?(:object_id)
90
+ self.object_id = attributes[:object_id]
91
+ else
92
+ self.object_id = nil
90
93
  end
91
94
 
92
- if attributes.key?(:insert)
93
- self.insert = attributes[:insert]
95
+ if attributes.key?(:fallback_parameters)
96
+ self.fallback_parameters = attributes[:fallback_parameters]
94
97
  end
95
98
  end
96
99
 
@@ -100,9 +103,9 @@ module Algolia
100
103
  return true if equal?(other)
101
104
 
102
105
  self.class == other.class &&
103
- type == other.type &&
104
- delete == other.delete &&
105
- insert == other.insert
106
+ model == other.model &&
107
+ object_id == other.object_id &&
108
+ fallback_parameters == other.fallback_parameters
106
109
  end
107
110
 
108
111
  # @see the `==` method
@@ -114,7 +117,7 @@ module Algolia
114
117
  # Calculates hash code according to all attributes.
115
118
  # @return [Integer] Hash code
116
119
  def hash
117
- [type, delete, insert].hash
120
+ [model, object_id, fallback_parameters].hash
118
121
  end
119
122
 
120
123
  # Builds the object from hash