algolia 3.42.3 → 3.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/do-not-edit-this-repository.yml +1 -1
  3. data/.github/workflows/issue.yml +7 -5
  4. data/.github/workflows/release.yml +4 -4
  5. data/CHANGELOG.md +29 -0
  6. data/Gemfile.lock +2 -2
  7. data/lib/algolia/api/abtesting_client.rb +20 -13
  8. data/lib/algolia/api/abtesting_v3_client.rb +2 -1
  9. data/lib/algolia/api/agent_studio_client.rb +2 -1
  10. data/lib/algolia/api/analytics_client.rb +223 -1
  11. data/lib/algolia/api/composition_client.rb +2 -1
  12. data/lib/algolia/api/ingestion_client.rb +2 -1
  13. data/lib/algolia/api/insights_client.rb +2 -1
  14. data/lib/algolia/api/monitoring_client.rb +2 -1
  15. data/lib/algolia/api/personalization_client.rb +2 -1
  16. data/lib/algolia/api/query_suggestions_client.rb +2 -1
  17. data/lib/algolia/api/recommend_client.rb +2 -1
  18. data/lib/algolia/api/search_client.rb +124 -20
  19. data/lib/algolia/api_client.rb +10 -2
  20. data/lib/algolia/chunked_helper_options.rb +1 -0
  21. data/lib/algolia/configuration.rb +10 -2
  22. data/lib/algolia/error.rb +20 -3
  23. data/lib/algolia/models/abtesting-v3/ab_test.rb +7 -19
  24. data/lib/algolia/models/abtesting-v3/decision.rb +219 -0
  25. data/lib/algolia/models/analytics/bin_edge.rb +109 -0
  26. data/lib/algolia/models/analytics/catalog.rb +208 -0
  27. data/lib/algolia/models/analytics/catalog_entry.rb +249 -0
  28. data/lib/algolia/models/analytics/distribution_definition.rb +243 -0
  29. data/lib/algolia/models/analytics/distribution_payload.rb +247 -0
  30. data/lib/algolia/models/analytics/domain_catalog.rb +253 -0
  31. data/lib/algolia/models/analytics/field_reference.rb +219 -0
  32. data/lib/algolia/models/analytics/filter_definition.rb +238 -0
  33. data/lib/algolia/models/analytics/order_definition.rb +230 -0
  34. data/lib/algolia/models/analytics/order_direction.rb +34 -0
  35. data/lib/algolia/models/analytics/parameter_definition.rb +230 -0
  36. data/lib/algolia/models/analytics/parameter_reference.rb +219 -0
  37. data/lib/algolia/models/analytics/parameter_value.rb +111 -0
  38. data/lib/algolia/models/analytics/scalar_payload.rb +247 -0
  39. data/lib/algolia/models/analytics/series.rb +234 -0
  40. data/lib/algolia/models/analytics/series_date.rb +223 -0
  41. data/lib/algolia/models/analytics/table_payload.rb +292 -0
  42. data/lib/algolia/models/analytics/table_response.rb +211 -0
  43. data/lib/algolia/models/analytics/timeseries_payload.rb +279 -0
  44. data/lib/algolia/models/analytics/timeseries_response.rb +213 -0
  45. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +1 -1
  46. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +1 -1
  47. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +1 -1
  48. data/lib/algolia/models/insights/events_items.rb +1 -0
  49. data/lib/algolia/models/insights/instantsearch.rb +269 -0
  50. data/lib/algolia/models/insights/instantsearch_event.rb +33 -0
  51. data/lib/algolia/models/search/log.rb +11 -0
  52. data/lib/algolia/transport/http/http_requester.rb +2 -2
  53. data/lib/algolia/transport/request_id.rb +49 -0
  54. data/lib/algolia/transport/transport.rb +79 -8
  55. data/lib/algolia/version.rb +1 -1
  56. data/lib/algolia.rb +1 -0
  57. metadata +26 -2
@@ -0,0 +1,249 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Analytics
10
+ class CatalogEntry
11
+ # Field identifier.
12
+ attr_accessor :kind
13
+
14
+ # Human-readable description of the field.
15
+ attr_accessor :description
16
+
17
+ # Root stages the field depends on. Two fields are combinable in one query only when their roots intersect.
18
+ attr_accessor :roots
19
+
20
+ # Public ACL identifiers required to read the field, for example `clickAnalyticsEnabled`.
21
+ attr_accessor :requires
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :kind => :kind,
27
+ :description => :description,
28
+ :roots => :roots,
29
+ :requires => :requires
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.types_mapping
35
+ {
36
+ :kind => :"String",
37
+ :description => :"String",
38
+ :roots => :"Array<String>",
39
+ :requires => :"Array<String>"
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new(
46
+ []
47
+ )
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ raise(
55
+ ArgumentError,
56
+ "The input argument (attributes) must be a hash in `Algolia::CatalogEntry` initialize method"
57
+ )
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ raise(
64
+ ArgumentError,
65
+ "`#{k}` is not a valid attribute in `Algolia::CatalogEntry`. Please check the name to make sure it's valid. List of attributes: " +
66
+ self.class.attribute_map.keys.inspect
67
+ )
68
+ end
69
+
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:kind)
74
+ self.kind = attributes[:kind]
75
+ else
76
+ self.kind = nil
77
+ end
78
+
79
+ if attributes.key?(:description)
80
+ self.description = attributes[:description]
81
+ else
82
+ self.description = nil
83
+ end
84
+
85
+ if attributes.key?(:roots)
86
+ if (value = attributes[:roots]).is_a?(Array)
87
+ self.roots = value
88
+ end
89
+ else
90
+ self.roots = nil
91
+ end
92
+
93
+ if attributes.key?(:requires)
94
+ if (value = attributes[:requires]).is_a?(Array)
95
+ self.requires = value
96
+ end
97
+ else
98
+ self.requires = nil
99
+ end
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(other)
105
+ return true if self.equal?(other)
106
+ self.class == other.class &&
107
+ kind == other.kind &&
108
+ description == other.description &&
109
+ roots == other.roots &&
110
+ requires == other.requires
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(other)
116
+ self == other
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [kind, description, roots, requires].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ types_mapping.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash[key.to_sym] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
140
+ _deserialize(::Regexp.last_match(1), v)
141
+ }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+
148
+ new(transformed_hash)
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def self._deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ # model
189
+ else
190
+ # models (e.g. Pet) or oneOf
191
+ klass = Algolia::Analytics.const_get(type)
192
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
193
+ .build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ def to_json(*_args)
210
+ to_hash.to_json
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to?(:to_hash)
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+ end
248
+ end
249
+ end
@@ -0,0 +1,243 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Analytics
10
+ class DistributionDefinition
11
+ # Domain the field belongs to.
12
+ attr_accessor :domain
13
+
14
+ # Numeric field to bucket into a histogram.
15
+ attr_accessor :kind
16
+
17
+ # Set to true for continuous kinds; use float bins.
18
+ attr_accessor :continuous
19
+
20
+ # Bin edges.
21
+ attr_accessor :bins
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :domain => :domain,
27
+ :kind => :kind,
28
+ :continuous => :continuous,
29
+ :bins => :bins
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.types_mapping
35
+ {
36
+ :domain => :"String",
37
+ :kind => :"String",
38
+ :continuous => :"Boolean",
39
+ :bins => :"Array<BinEdge>"
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new(
46
+ []
47
+ )
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ raise(
55
+ ArgumentError,
56
+ "The input argument (attributes) must be a hash in `Algolia::DistributionDefinition` initialize method"
57
+ )
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ raise(
64
+ ArgumentError,
65
+ "`#{k}` is not a valid attribute in `Algolia::DistributionDefinition`. Please check the name to make sure it's valid. List of attributes: " +
66
+ self.class.attribute_map.keys.inspect
67
+ )
68
+ end
69
+
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:domain)
74
+ self.domain = attributes[:domain]
75
+ end
76
+
77
+ if attributes.key?(:kind)
78
+ self.kind = attributes[:kind]
79
+ else
80
+ self.kind = nil
81
+ end
82
+
83
+ if attributes.key?(:continuous)
84
+ self.continuous = attributes[:continuous]
85
+ end
86
+
87
+ if attributes.key?(:bins)
88
+ if (value = attributes[:bins]).is_a?(Array)
89
+ self.bins = value
90
+ end
91
+ else
92
+ self.bins = nil
93
+ end
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(other)
99
+ return true if self.equal?(other)
100
+ self.class == other.class &&
101
+ domain == other.domain &&
102
+ kind == other.kind &&
103
+ continuous == other.continuous &&
104
+ bins == other.bins
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(other)
110
+ self == other
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [domain, kind, continuous, bins].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ types_mapping.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash[key.to_sym] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
134
+ _deserialize(::Regexp.last_match(1), v)
135
+ }
136
+ end
137
+ elsif !attributes[attribute_map[key]].nil?
138
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
139
+ end
140
+ end
141
+
142
+ new(transformed_hash)
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def self._deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ # model
183
+ else
184
+ # models (e.g. Pet) or oneOf
185
+ klass = Algolia::Analytics.const_get(type)
186
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
187
+ .build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ def to_json(*_args)
204
+ to_hash.to_json
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to?(:to_hash)
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+ end
242
+ end
243
+ end