algolia 3.0.0.alpha.14 → 3.0.0.alpha.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile.lock +2 -2
  4. data/lib/algolia/api/abtesting_client.rb +4 -4
  5. data/lib/algolia/api/analytics_client.rb +268 -98
  6. data/lib/algolia/api/ingestion_client.rb +271 -200
  7. data/lib/algolia/api/insights_client.rb +4 -4
  8. data/lib/algolia/api/monitoring_client.rb +53 -53
  9. data/lib/algolia/api/personalization_client.rb +4 -4
  10. data/lib/algolia/api/query_suggestions_client.rb +18 -18
  11. data/lib/algolia/api/recommend_client.rb +4 -4
  12. data/lib/algolia/api/search_client.rb +4 -4
  13. data/lib/algolia/models/abtesting/{currencies_value.rb → currency.rb} +3 -3
  14. data/lib/algolia/models/abtesting/variant.rb +2 -5
  15. data/lib/algolia/models/analytics/{click_position.rb → click_positions_inner.rb} +38 -9
  16. data/lib/algolia/models/analytics/currencies_value.rb +208 -0
  17. data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +265 -0
  18. data/lib/algolia/models/analytics/daily_average_clicks.rb +249 -0
  19. data/lib/algolia/models/analytics/{click_through_rate_event.rb → daily_click_through_rates.rb} +24 -14
  20. data/lib/algolia/models/analytics/daily_conversion_rates.rb +265 -0
  21. data/lib/algolia/models/analytics/{no_click_rate_event.rb → daily_no_click_rates.rb} +21 -7
  22. data/lib/algolia/models/analytics/{no_results_rate_event.rb → daily_no_results_rates.rb} +7 -7
  23. data/lib/algolia/models/analytics/{conversion_rate_event.rb → daily_purchase_rates.rb} +18 -22
  24. data/lib/algolia/models/analytics/{average_click_event.rb → daily_revenue.rb} +15 -25
  25. data/lib/algolia/models/analytics/{search_event.rb → daily_searches.rb} +4 -4
  26. data/lib/algolia/models/analytics/{search_no_result_event.rb → daily_searches_no_clicks.rb} +19 -5
  27. data/lib/algolia/models/analytics/{search_no_click_event.rb → daily_searches_no_results.rb} +19 -5
  28. data/lib/algolia/models/analytics/{user_with_date.rb → daily_users.rb} +5 -5
  29. data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +267 -0
  30. data/lib/algolia/models/analytics/get_average_click_position_response.rb +31 -5
  31. data/lib/algolia/models/analytics/get_click_positions_response.rb +6 -6
  32. data/lib/algolia/models/analytics/get_click_through_rate_response.rb +22 -12
  33. data/lib/algolia/models/analytics/get_conversion_rate_response.rb +267 -0
  34. data/lib/algolia/models/analytics/get_no_click_rate_response.rb +19 -5
  35. data/lib/algolia/models/analytics/get_no_results_rate_response.rb +5 -5
  36. data/lib/algolia/models/analytics/{get_conversation_rate_response.rb → get_purchase_rate_response.rb} +19 -23
  37. data/lib/algolia/models/analytics/get_revenue.rb +215 -0
  38. data/lib/algolia/models/analytics/get_searches_count_response.rb +2 -2
  39. data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +2 -2
  40. data/lib/algolia/models/analytics/get_searches_no_results_response.rb +2 -2
  41. data/lib/algolia/models/analytics/get_status_response.rb +4 -2
  42. data/lib/algolia/models/analytics/get_top_countries_response.rb +1 -1
  43. data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +1 -1
  44. data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +23 -2
  45. data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +4 -2
  46. data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +23 -2
  47. data/lib/algolia/models/analytics/get_top_hits_response.rb +2 -1
  48. data/lib/algolia/models/analytics/get_top_searches_response.rb +2 -1
  49. data/lib/algolia/models/analytics/get_users_count_response.rb +3 -3
  50. data/lib/algolia/models/analytics/operator.rb +38 -0
  51. data/lib/algolia/models/analytics/top_country.rb +1 -1
  52. data/lib/algolia/models/analytics/top_hit.rb +1 -1
  53. data/lib/algolia/models/analytics/top_hit_with_analytics.rb +60 -21
  54. data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +437 -0
  55. data/lib/algolia/models/analytics/top_hits_response.rb +1 -1
  56. data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +1 -1
  57. data/lib/algolia/models/analytics/top_hits_response_with_revenue_analytics.rb +201 -0
  58. data/lib/algolia/models/analytics/top_search.rb +2 -2
  59. data/lib/algolia/models/analytics/top_search_with_analytics.rb +99 -17
  60. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +504 -0
  61. data/lib/algolia/models/analytics/top_searches_response.rb +1 -1
  62. data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +1 -1
  63. data/lib/algolia/models/analytics/top_searches_response_with_revenue_analytics.rb +201 -0
  64. data/lib/algolia/models/ingestion/auth_algolia.rb +3 -2
  65. data/lib/algolia/models/ingestion/auth_algolia_partial.rb +3 -2
  66. data/lib/algolia/models/ingestion/auth_api_key.rb +2 -1
  67. data/lib/algolia/models/ingestion/auth_api_key_partial.rb +2 -1
  68. data/lib/algolia/models/ingestion/auth_basic.rb +3 -1
  69. data/lib/algolia/models/ingestion/auth_basic_partial.rb +3 -1
  70. data/lib/algolia/models/ingestion/auth_google_service_account.rb +3 -3
  71. data/lib/algolia/models/ingestion/auth_google_service_account_partial.rb +3 -3
  72. data/lib/algolia/models/ingestion/auth_o_auth.rb +18 -8
  73. data/lib/algolia/models/ingestion/auth_o_auth_partial.rb +18 -8
  74. data/lib/algolia/models/ingestion/authentication.rb +5 -5
  75. data/lib/algolia/models/ingestion/authentication_create.rb +2 -2
  76. data/lib/algolia/models/ingestion/authentication_create_response.rb +4 -4
  77. data/lib/algolia/models/ingestion/authentication_search.rb +1 -1
  78. data/lib/algolia/models/ingestion/authentication_update.rb +2 -2
  79. data/lib/algolia/models/ingestion/authentication_update_response.rb +4 -4
  80. data/lib/algolia/models/ingestion/big_commerce_channel.rb +2 -2
  81. data/lib/algolia/models/ingestion/big_commerce_metafield.rb +2 -2
  82. data/lib/algolia/models/ingestion/commercetools_custom_fields.rb +1 -1
  83. data/lib/algolia/models/ingestion/delete_response.rb +1 -1
  84. data/lib/algolia/models/ingestion/destination.rb +6 -6
  85. data/lib/algolia/models/ingestion/destination_create.rb +3 -3
  86. data/lib/algolia/models/ingestion/destination_create_response.rb +4 -4
  87. data/lib/algolia/models/ingestion/destination_index_name.rb +2 -2
  88. data/lib/algolia/models/ingestion/destination_index_prefix.rb +1 -1
  89. data/lib/algolia/models/ingestion/destination_search.rb +1 -1
  90. data/lib/algolia/models/ingestion/destination_type.rb +1 -2
  91. data/lib/algolia/models/ingestion/destination_update.rb +3 -3
  92. data/lib/algolia/models/ingestion/destination_update_response.rb +4 -4
  93. data/lib/algolia/models/ingestion/docker_source_discover.rb +2 -2
  94. data/lib/algolia/models/ingestion/event.rb +3 -3
  95. data/lib/algolia/models/ingestion/list_tasks_response.rb +1 -1
  96. data/lib/algolia/models/ingestion/mapping_format_schema.rb +32 -0
  97. data/lib/algolia/models/ingestion/mapping_input.rb +24 -3
  98. data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +3 -3
  99. data/lib/algolia/models/ingestion/on_demand_trigger.rb +2 -2
  100. data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +1 -1
  101. data/lib/algolia/models/ingestion/pagination.rb +65 -0
  102. data/lib/algolia/models/ingestion/platform.rb +2 -1
  103. data/lib/algolia/models/ingestion/run.rb +7 -7
  104. data/lib/algolia/models/ingestion/run_response.rb +3 -3
  105. data/lib/algolia/models/ingestion/schedule_date_utils_input.rb +2 -2
  106. data/lib/algolia/models/ingestion/schedule_trigger.rb +4 -4
  107. data/lib/algolia/models/ingestion/schedule_trigger_input.rb +2 -2
  108. data/lib/algolia/models/ingestion/source.rb +4 -4
  109. data/lib/algolia/models/ingestion/source_big_commerce.rb +1 -1
  110. data/lib/algolia/models/ingestion/source_big_query.rb +5 -5
  111. data/lib/algolia/models/ingestion/source_commercetools.rb +2 -2
  112. data/lib/algolia/models/ingestion/source_create.rb +2 -1
  113. data/lib/algolia/models/ingestion/source_create_response.rb +3 -2
  114. data/lib/algolia/models/ingestion/source_csv.rb +3 -3
  115. data/lib/algolia/models/ingestion/source_docker.rb +3 -3
  116. data/lib/algolia/models/ingestion/source_ga4_big_query_export.rb +3 -3
  117. data/lib/algolia/models/ingestion/source_json.rb +2 -2
  118. data/lib/algolia/models/ingestion/source_type.rb +5 -3
  119. data/lib/algolia/models/ingestion/source_update.rb +2 -1
  120. data/lib/algolia/models/ingestion/source_update_commercetools.rb +2 -3
  121. data/lib/algolia/models/ingestion/source_update_docker.rb +3 -3
  122. data/lib/algolia/models/ingestion/source_update_response.rb +3 -2
  123. data/lib/algolia/models/ingestion/streaming_trigger.rb +1 -1
  124. data/lib/algolia/models/ingestion/streaming_utils_input.rb +1 -1
  125. data/lib/algolia/models/ingestion/subscription_trigger.rb +1 -1
  126. data/lib/algolia/models/ingestion/task.rb +7 -7
  127. data/lib/algolia/models/ingestion/task_create.rb +5 -5
  128. data/lib/algolia/models/ingestion/task_create_response.rb +3 -3
  129. data/lib/algolia/models/ingestion/task_input.rb +1 -0
  130. data/lib/algolia/models/ingestion/task_update.rb +4 -4
  131. data/lib/algolia/models/ingestion/task_update_response.rb +3 -3
  132. data/lib/algolia/models/ingestion/trigger.rb +1 -0
  133. data/lib/algolia/models/ingestion/trigger_update_input.rb +2 -2
  134. data/lib/algolia/models/ingestion/window.rb +3 -3
  135. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +2 -0
  136. data/lib/algolia/models/monitoring/{get_inventory403_response.rb → get_servers403_response.rb} +3 -3
  137. data/lib/algolia/models/monitoring/server.rb +2 -2
  138. data/lib/algolia/models/query-suggestions/app_id.rb +197 -0
  139. data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +2 -2
  140. data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +1 -1
  141. data/lib/algolia/models/query-suggestions/languages.rb +1 -1
  142. data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +2 -3
  143. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +23 -34
  144. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +18 -20
  145. data/lib/algolia/models/query-suggestions/source_index.rb +3 -5
  146. data/lib/algolia/version.rb +1 -1
  147. metadata +29 -15
@@ -0,0 +1,215 @@
1
+ # 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.
2
+
3
+ require 'date'
4
+ require 'time'
5
+
6
+ module Algolia
7
+ module Analytics
8
+ class GetRevenue
9
+ # Revenue associated with this search, broken-down by currencies.
10
+ attr_accessor :currencies
11
+
12
+ # Daily revenue.
13
+ attr_accessor :dates
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :currencies => :currencies,
19
+ :dates => :dates
20
+ }
21
+ end
22
+
23
+ # Returns all the JSON keys this model knows about
24
+ def self.acceptable_attributes
25
+ attribute_map.values
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.types_mapping
30
+ {
31
+ :currencies => :'Hash<String, CurrenciesValue>',
32
+ :dates => :'Array<DailyRevenue>'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ unless attributes.is_a?(Hash)
45
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::GetRevenue` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) do |(k, v), h|
50
+ unless self.class.attribute_map.key?(k.to_sym)
51
+ raise ArgumentError,
52
+ "`#{k}` is not a valid attribute in `Algolia::GetRevenue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+
55
+ h[k.to_sym] = v
56
+ end
57
+
58
+ if attributes.key?(:currencies)
59
+ if (value = attributes[:currencies]).is_a?(Hash)
60
+ self.currencies = value
61
+ end
62
+ else
63
+ self.currencies = nil
64
+ end
65
+
66
+ if attributes.key?(:dates)
67
+ if (value = attributes[:dates]).is_a?(Array)
68
+ self.dates = value
69
+ end
70
+ else
71
+ self.dates = nil
72
+ end
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(other)
78
+ return true if equal?(other)
79
+
80
+ self.class == other.class &&
81
+ currencies == other.currencies &&
82
+ dates == other.dates
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(other)
88
+ self == other
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [currencies, dates].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+
103
+ attributes = attributes.transform_keys(&:to_sym)
104
+ transformed_hash = {}
105
+ types_mapping.each_pair do |key, type|
106
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
107
+ transformed_hash[key.to_sym] = nil
108
+ elsif type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[attribute_map[key]].is_a?(Array)
112
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
113
+ end
114
+ elsif !attributes[attribute_map[key]].nil?
115
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
116
+ end
117
+ end
118
+ new(transformed_hash)
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def self._deserialize(type, value)
126
+ case type.to_sym
127
+ when :Time
128
+ Time.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :Boolean
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ # models (e.g. Pet) or oneOf
159
+ klass = Algolia::Analytics.const_get(type)
160
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ def to_json(*_args)
177
+ to_hash.to_json
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end
215
+ end
@@ -9,7 +9,7 @@ module Algolia
9
9
  # Number of occurrences.
10
10
  attr_accessor :count
11
11
 
12
- # Search events with their associated dates and hit counts.
12
+ # Daily number of searches.
13
13
  attr_accessor :dates
14
14
 
15
15
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -29,7 +29,7 @@ module Algolia
29
29
  def self.types_mapping
30
30
  {
31
31
  :count => :Integer,
32
- :dates => :'Array<SearchEvent>'
32
+ :dates => :'Array<DailySearches>'
33
33
  }
34
34
  end
35
35
 
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetSearchesNoClicksResponse
9
- # Searches with no clicks.
9
+ # Searches without any clicks.
10
10
  attr_accessor :searches
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -24,7 +24,7 @@ module Algolia
24
24
  # Attribute type mapping.
25
25
  def self.types_mapping
26
26
  {
27
- :searches => :'Array<SearchNoClickEvent>'
27
+ :searches => :'Array<DailySearchesNoClicks>'
28
28
  }
29
29
  end
30
30
 
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetSearchesNoResultsResponse
9
- # Searches with no results.
9
+ # Searches without results.
10
10
  attr_accessor :searches
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -24,7 +24,7 @@ module Algolia
24
24
  # Attribute type mapping.
25
25
  def self.types_mapping
26
26
  {
27
- :searches => :'Array<SearchNoResultEvent>'
27
+ :searches => :'Array<DailySearchesNoResults>'
28
28
  }
29
29
  end
30
30
 
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetStatusResponse
9
- # Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
9
+ # Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. If null, no update was performed yet.
10
10
  attr_accessor :updated_at
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -30,7 +30,9 @@ module Algolia
30
30
 
31
31
  # List of attributes with nullable: true
32
32
  def self.openapi_nullable
33
- Set.new([])
33
+ Set.new([
34
+ :updated_at
35
+ ])
34
36
  end
35
37
 
36
38
  # Initializes the object
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetTopCountriesResponse
9
- # Countries
9
+ # Countries and number of searches.
10
10
  attr_accessor :countries
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetTopFilterAttributesResponse
9
- # Filterable attributes.
9
+ # Most frequent filters.
10
10
  attr_accessor :attributes
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -9,7 +9,6 @@ module Algolia
9
9
  # Attribute name.
10
10
  attr_accessor :attribute
11
11
 
12
- # Operator.
13
12
  attr_accessor :operator
14
13
 
15
14
  # Attribute value.
@@ -18,6 +17,28 @@ module Algolia
18
17
  # Number of occurrences.
19
18
  attr_accessor :count
20
19
 
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype
22
+ attr_reader :allowable_values
23
+
24
+ def initialize(datatype, allowable_values)
25
+ @allowable_values = allowable_values.map do |value|
26
+ case datatype.to_s
27
+ when /Integer/i
28
+ value.to_i
29
+ when /Float/i
30
+ value.to_f
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+
37
+ def valid?(value)
38
+ !value || allowable_values.include?(value)
39
+ end
40
+ end
41
+
21
42
  # Attribute mapping from ruby-style variable name to JSON key.
22
43
  def self.attribute_map
23
44
  {
@@ -37,7 +58,7 @@ module Algolia
37
58
  def self.types_mapping
38
59
  {
39
60
  :attribute => :String,
40
- :operator => :String,
61
+ :operator => :Operator,
41
62
  :value => :String,
42
63
  :count => :Integer
43
64
  }
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetTopFiltersNoResultsResponse
9
- # Filters with no results.
9
+ # Filters for searches without any results. If null, the search term specified with the `search` parameter is not a search without results, or the `search` parameter is absent from the request.
10
10
  attr_accessor :values
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -30,7 +30,9 @@ module Algolia
30
30
 
31
31
  # List of attributes with nullable: true
32
32
  def self.openapi_nullable
33
- Set.new([])
33
+ Set.new([
34
+ :values
35
+ ])
34
36
  end
35
37
 
36
38
  # Initializes the object
@@ -9,12 +9,33 @@ module Algolia
9
9
  # Attribute name.
10
10
  attr_accessor :attribute
11
11
 
12
- # Operator.
13
12
  attr_accessor :operator
14
13
 
15
14
  # Attribute value.
16
15
  attr_accessor :value
17
16
 
17
+ class EnumAttributeValidator
18
+ attr_reader :datatype
19
+ attr_reader :allowable_values
20
+
21
+ def initialize(datatype, allowable_values)
22
+ @allowable_values = allowable_values.map do |value|
23
+ case datatype.to_s
24
+ when /Integer/i
25
+ value.to_i
26
+ when /Float/i
27
+ value.to_f
28
+ else
29
+ value
30
+ end
31
+ end
32
+ end
33
+
34
+ def valid?(value)
35
+ !value || allowable_values.include?(value)
36
+ end
37
+ end
38
+
18
39
  # Attribute mapping from ruby-style variable name to JSON key.
19
40
  def self.attribute_map
20
41
  {
@@ -33,7 +54,7 @@ module Algolia
33
54
  def self.types_mapping
34
55
  {
35
56
  :attribute => :String,
36
- :operator => :String,
57
+ :operator => :Operator,
37
58
  :value => :String
38
59
  }
39
60
  end
@@ -11,7 +11,8 @@ module Algolia
11
11
  def openapi_one_of
12
12
  [
13
13
  :TopHitsResponse,
14
- :TopHitsResponseWithAnalytics
14
+ :TopHitsResponseWithAnalytics,
15
+ :TopHitsResponseWithRevenueAnalytics
15
16
  ]
16
17
  end
17
18
 
@@ -11,7 +11,8 @@ module Algolia
11
11
  def openapi_one_of
12
12
  [
13
13
  :TopSearchesResponse,
14
- :TopSearchesResponseWithAnalytics
14
+ :TopSearchesResponseWithAnalytics,
15
+ :TopSearchesResponseWithRevenueAnalytics
15
16
  ]
16
17
  end
17
18
 
@@ -6,10 +6,10 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetUsersCountResponse
9
- # Number of occurrences.
9
+ # Number of unique users.
10
10
  attr_accessor :count
11
11
 
12
- # User count.
12
+ # Daily number of unique users.
13
13
  attr_accessor :dates
14
14
 
15
15
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -29,7 +29,7 @@ module Algolia
29
29
  def self.types_mapping
30
30
  {
31
31
  :count => :Integer,
32
- :dates => :'Array<UserWithDate>'
32
+ :dates => :'Array<DailyUsers>'
33
33
  }
34
34
  end
35
35
 
@@ -0,0 +1,38 @@
1
+ # 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.
2
+
3
+ require 'date'
4
+ require 'time'
5
+
6
+ module Algolia
7
+ module Analytics
8
+ class Operator
9
+ APPLY = ":".freeze
10
+ LESS_THAN = "<".freeze
11
+ LESS_EQUALS = "<=".freeze
12
+ EQUALS = "=".freeze
13
+ NOT_EQUALS = "!=".freeze
14
+ GREATER_THAN = ">".freeze
15
+ GREATER_EQUALS = ">=".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [APPLY, LESS_THAN, LESS_EQUALS, EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_EQUALS].freeze
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ return value if Operator.all_vars.include?(value)
33
+
34
+ raise "Invalid ENUM value #{value} for class #Operator"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class TopCountry
9
- # Country.
9
+ # Country code.
10
10
  attr_accessor :country
11
11
 
12
12
  # Number of occurrences.
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class TopHit
9
- # Hit.
9
+ # Object ID of a record that's returned as a search result.
10
10
  attr_accessor :hit
11
11
 
12
12
  # Number of occurrences.
@@ -6,25 +6,25 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class TopHitWithAnalytics
9
- # Hit.
9
+ # Object ID of a record that's returned as a search result.
10
10
  attr_accessor :hit
11
11
 
12
12
  # Number of occurrences.
13
13
  attr_accessor :count
14
14
 
15
- # [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).
15
+ # Click-through rate, calculated as number of tracked searches with at least one click event divided by the number of tracked searches. If null, Algolia didn't receive any search requests with `clickAnalytics` set to true.
16
16
  attr_accessor :click_through_rate
17
17
 
18
- # [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).
18
+ # Conversion rate, calculated as number of tracked searches with at least one conversion event divided by the number of tracked searches. If null, Algolia didn't receive any search requests with `clickAnalytics` set to true.
19
19
  attr_accessor :conversion_rate
20
20
 
21
- # Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`.
22
- attr_accessor :tracked_search_count
21
+ # Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
22
+ attr_accessor :tracked_hit_count
23
23
 
24
- # Number of click events.
24
+ # Number of clicks associated with this search.
25
25
  attr_accessor :click_count
26
26
 
27
- # Number of converted clicks.
27
+ # Number of conversions from this search.
28
28
  attr_accessor :conversion_count
29
29
 
30
30
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -34,7 +34,7 @@ module Algolia
34
34
  :count => :count,
35
35
  :click_through_rate => :clickThroughRate,
36
36
  :conversion_rate => :conversionRate,
37
- :tracked_search_count => :trackedSearchCount,
37
+ :tracked_hit_count => :trackedHitCount,
38
38
  :click_count => :clickCount,
39
39
  :conversion_count => :conversionCount
40
40
  }
@@ -52,7 +52,7 @@ module Algolia
52
52
  :count => :Integer,
53
53
  :click_through_rate => :Float,
54
54
  :conversion_rate => :Float,
55
- :tracked_search_count => :Integer,
55
+ :tracked_hit_count => :Integer,
56
56
  :click_count => :Integer,
57
57
  :conversion_count => :Integer
58
58
  }
@@ -61,7 +61,8 @@ module Algolia
61
61
  # List of attributes with nullable: true
62
62
  def self.openapi_nullable
63
63
  Set.new([
64
- :tracked_search_count
64
+ :click_through_rate,
65
+ :conversion_rate
65
66
  ])
66
67
  end
67
68
 
@@ -106,10 +107,10 @@ module Algolia
106
107
  self.conversion_rate = nil
107
108
  end
108
109
 
109
- if attributes.key?(:tracked_search_count)
110
- self.tracked_search_count = attributes[:tracked_search_count]
110
+ if attributes.key?(:tracked_hit_count)
111
+ self.tracked_hit_count = attributes[:tracked_hit_count]
111
112
  else
112
- self.tracked_search_count = nil
113
+ self.tracked_hit_count = nil
113
114
  end
114
115
 
115
116
  if attributes.key?(:click_count)
@@ -128,21 +129,59 @@ module Algolia
128
129
  # Custom attribute writer method with validation
129
130
  # @param [Object] click_through_rate Value to be assigned
130
131
  def click_through_rate=(click_through_rate)
131
- if click_through_rate.nil?
132
- raise ArgumentError, 'click_through_rate cannot be nil'
133
- end
134
-
135
- if click_through_rate > 1
132
+ if !click_through_rate.nil? && click_through_rate > 1
136
133
  raise ArgumentError, 'invalid value for "click_through_rate", must be smaller than or equal to 1.'
137
134
  end
138
135
 
139
- if click_through_rate < 0
136
+ if !click_through_rate.nil? && click_through_rate < 0
140
137
  raise ArgumentError, 'invalid value for "click_through_rate", must be greater than or equal to 0.'
141
138
  end
142
139
 
143
140
  @click_through_rate = click_through_rate
144
141
  end
145
142
 
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] conversion_rate Value to be assigned
145
+ def conversion_rate=(conversion_rate)
146
+ if !conversion_rate.nil? && conversion_rate > 1
147
+ raise ArgumentError, 'invalid value for "conversion_rate", must be smaller than or equal to 1.'
148
+ end
149
+
150
+ if !conversion_rate.nil? && conversion_rate < 0
151
+ raise ArgumentError, 'invalid value for "conversion_rate", must be greater than or equal to 0.'
152
+ end
153
+
154
+ @conversion_rate = conversion_rate
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] click_count Value to be assigned
159
+ def click_count=(click_count)
160
+ if click_count.nil?
161
+ raise ArgumentError, 'click_count cannot be nil'
162
+ end
163
+
164
+ if click_count < 0
165
+ raise ArgumentError, 'invalid value for "click_count", must be greater than or equal to 0.'
166
+ end
167
+
168
+ @click_count = click_count
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] conversion_count Value to be assigned
173
+ def conversion_count=(conversion_count)
174
+ if conversion_count.nil?
175
+ raise ArgumentError, 'conversion_count cannot be nil'
176
+ end
177
+
178
+ if conversion_count < 0
179
+ raise ArgumentError, 'invalid value for "conversion_count", must be greater than or equal to 0.'
180
+ end
181
+
182
+ @conversion_count = conversion_count
183
+ end
184
+
146
185
  # Checks equality by comparing each attribute.
147
186
  # @param [Object] Object to be compared
148
187
  def ==(other)
@@ -153,7 +192,7 @@ module Algolia
153
192
  count == other.count &&
154
193
  click_through_rate == other.click_through_rate &&
155
194
  conversion_rate == other.conversion_rate &&
156
- tracked_search_count == other.tracked_search_count &&
195
+ tracked_hit_count == other.tracked_hit_count &&
157
196
  click_count == other.click_count &&
158
197
  conversion_count == other.conversion_count
159
198
  end
@@ -167,7 +206,7 @@ module Algolia
167
206
  # Calculates hash code according to all attributes.
168
207
  # @return [Integer] Hash code
169
208
  def hash
170
- [hit, count, click_through_rate, conversion_rate, tracked_search_count, click_count, conversion_count].hash
209
+ [hit, count, click_through_rate, conversion_rate, tracked_hit_count, click_count, conversion_count].hash
171
210
  end
172
211
 
173
212
  # Builds the object from hash