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,238 @@
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 FilterDefinition
11
+ # Domain the field belongs to.
12
+ attr_accessor :domain
13
+
14
+ # Field to filter on. With no `operator`, the field must be boolean.
15
+ attr_accessor :kind
16
+
17
+ # Comparison operator applied to a filter field, one of: `=`, `!=`, `>`, `<`, `>=`, `<=`, `IN`, `TAG_TREE`, `CONTAINS`, `STARTS_WITH`, `CONTAINS_PREFIX`. Requires a `parameter` to carry the operand.
18
+ attr_accessor :operator
19
+
20
+ attr_accessor :parameter
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :domain => :domain,
26
+ :kind => :kind,
27
+ :operator => :operator,
28
+ :parameter => :parameter
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.types_mapping
34
+ {
35
+ :domain => :"String",
36
+ :kind => :"String",
37
+ :operator => :"String",
38
+ :parameter => :"ParameterReference"
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new(
45
+ []
46
+ )
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ raise(
54
+ ArgumentError,
55
+ "The input argument (attributes) must be a hash in `Algolia::FilterDefinition` initialize method"
56
+ )
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ raise(
63
+ ArgumentError,
64
+ "`#{k}` is not a valid attribute in `Algolia::FilterDefinition`. Please check the name to make sure it's valid. List of attributes: " +
65
+ self.class.attribute_map.keys.inspect
66
+ )
67
+ end
68
+
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:domain)
73
+ self.domain = attributes[:domain]
74
+ end
75
+
76
+ if attributes.key?(:kind)
77
+ self.kind = attributes[:kind]
78
+ else
79
+ self.kind = nil
80
+ end
81
+
82
+ if attributes.key?(:operator)
83
+ self.operator = attributes[:operator]
84
+ end
85
+
86
+ if attributes.key?(:parameter)
87
+ self.parameter = attributes[:parameter]
88
+ end
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(other)
94
+ return true if self.equal?(other)
95
+ self.class == other.class &&
96
+ domain == other.domain &&
97
+ kind == other.kind &&
98
+ operator == other.operator &&
99
+ parameter == other.parameter
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(other)
105
+ self == other
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [domain, kind, operator, parameter].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ transformed_hash = {}
121
+ types_mapping.each_pair do |key, type|
122
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
123
+ transformed_hash[key.to_sym] = nil
124
+ elsif type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[attribute_map[key]].is_a?(Array)
128
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
129
+ _deserialize(::Regexp.last_match(1), v)
130
+ }
131
+ end
132
+ elsif !attributes[attribute_map[key]].nil?
133
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
134
+ end
135
+ end
136
+
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def self._deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ # model
178
+ else
179
+ # models (e.g. Pet) or oneOf
180
+ klass = Algolia::Analytics.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
182
+ .build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ def to_json(*_args)
199
+ to_hash.to_json
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to?(:to_hash)
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,230 @@
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 OrderDefinition
11
+ # Domain the field belongs to.
12
+ attr_accessor :domain
13
+
14
+ # Field to sort by. Must appear in `metrics` or `groupBy`.
15
+ attr_accessor :kind
16
+
17
+ attr_accessor :direction
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :domain => :domain,
23
+ :kind => :kind,
24
+ :direction => :direction
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.types_mapping
30
+ {
31
+ :domain => :"String",
32
+ :kind => :"String",
33
+ :direction => :"OrderDirection"
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new(
40
+ []
41
+ )
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ raise(
49
+ ArgumentError,
50
+ "The input argument (attributes) must be a hash in `Algolia::OrderDefinition` initialize method"
51
+ )
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ raise(
58
+ ArgumentError,
59
+ "`#{k}` is not a valid attribute in `Algolia::OrderDefinition`. Please check the name to make sure it's valid. List of attributes: " +
60
+ self.class.attribute_map.keys.inspect
61
+ )
62
+ end
63
+
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:domain)
68
+ self.domain = attributes[:domain]
69
+ end
70
+
71
+ if attributes.key?(:kind)
72
+ self.kind = attributes[:kind]
73
+ else
74
+ self.kind = nil
75
+ end
76
+
77
+ if attributes.key?(:direction)
78
+ self.direction = attributes[:direction]
79
+ else
80
+ self.direction = nil
81
+ end
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(other)
87
+ return true if self.equal?(other)
88
+ self.class == other.class &&
89
+ domain == other.domain &&
90
+ kind == other.kind &&
91
+ direction == other.direction
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(other)
97
+ self == other
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [domain, kind, direction].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ types_mapping.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash[key.to_sym] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
121
+ _deserialize(::Regexp.last_match(1), v)
122
+ }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ # model
170
+ else
171
+ # models (e.g. Pet) or oneOf
172
+ klass = Algolia::Analytics.const_get(type)
173
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
174
+ .build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ def to_json(*_args)
191
+ to_hash.to_json
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to?(:to_hash)
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,34 @@
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 OrderDirection
11
+ ASC = "asc".freeze
12
+ DESC = "desc".freeze
13
+
14
+ def self.all_vars
15
+ @all_vars ||= [ASC, DESC].freeze
16
+ end
17
+
18
+ # Builds the enum from string
19
+ # @param [String] The enum value in the form of the string
20
+ # @return [String] The enum value
21
+ def self.build_from_hash(value)
22
+ new.build_from_hash(value)
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def build_from_hash(value)
29
+ return value if OrderDirection.all_vars.include?(value)
30
+ raise "Invalid ENUM value #{value} for class #OrderDirection"
31
+ end
32
+ end
33
+ end
34
+ end