algolia 3.39.0 → 3.40.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/issue.yml +1 -1
  3. data/.github/workflows/release.yml +1 -1
  4. data/CHANGELOG.md +21 -0
  5. data/Gemfile.lock +1 -1
  6. data/lib/algolia/api/abtesting_client.rb +16 -0
  7. data/lib/algolia/api/abtesting_v3_client.rb +16 -0
  8. data/lib/algolia/api/analytics_client.rb +100 -0
  9. data/lib/algolia/api/composition_client.rb +83 -0
  10. data/lib/algolia/api/ingestion_client.rb +230 -0
  11. data/lib/algolia/api/insights_client.rb +20 -0
  12. data/lib/algolia/api/monitoring_client.rb +36 -0
  13. data/lib/algolia/api/personalization_client.rb +24 -0
  14. data/lib/algolia/api/query_suggestions_client.rb +36 -0
  15. data/lib/algolia/api/recommend_client.rb +44 -0
  16. data/lib/algolia/api/search_client.rb +550 -22
  17. data/lib/algolia/chunked_helper_options.rb +15 -0
  18. data/lib/algolia/configuration.rb +3 -1
  19. data/lib/algolia/models/abtesting/ab_test.rb +5 -0
  20. data/lib/algolia/models/ingestion/destination_update.rb +2 -11
  21. data/lib/algolia/models/ingestion/destination_update_input.rb +228 -0
  22. data/lib/algolia/models/query-suggestions/configuration.rb +1 -0
  23. data/lib/algolia/models/query-suggestions/configuration_response.rb +1 -0
  24. data/lib/algolia/models/query-suggestions/configuration_with_index.rb +1 -0
  25. data/lib/algolia/models/query-suggestions/source_index.rb +4 -0
  26. data/lib/algolia/models/recommend/fallback_params.rb +2 -1
  27. data/lib/algolia/models/recommend/recommend_search_params.rb +2 -1
  28. data/lib/algolia/models/search/browse_params_object.rb +2 -1
  29. data/lib/algolia/models/search/consequence_params.rb +2 -1
  30. data/lib/algolia/models/search/fetched_index.rb +25 -4
  31. data/lib/algolia/models/search/fetched_index_ab_test.rb +253 -0
  32. data/lib/algolia/models/search/fetched_index_ab_test_target.rb +210 -0
  33. data/lib/algolia/models/search/fetched_index_ab_test_variant.rb +242 -0
  34. data/lib/algolia/models/search/index_settings.rb +2 -1
  35. data/lib/algolia/models/search/search_for_facets.rb +2 -1
  36. data/lib/algolia/models/search/search_for_hits.rb +2 -1
  37. data/lib/algolia/models/search/search_params_object.rb +2 -1
  38. data/lib/algolia/models/search/search_response_partial.rb +587 -0
  39. data/lib/algolia/models/search/search_result.rb +2 -1
  40. data/lib/algolia/models/search/settings_response.rb +2 -1
  41. data/lib/algolia/version.rb +1 -1
  42. data/lib/algolia.rb +1 -2
  43. metadata +8 -2
@@ -0,0 +1,15 @@
1
+ module Algolia
2
+ # Optional configuration for chunked helpers that batch records and poll for task completion.
3
+ class ChunkedHelperOptions
4
+ DEFAULT_MAX_RETRIES = 100
5
+ attr_reader :max_retries
6
+
7
+ def initialize(max_retries: DEFAULT_MAX_RETRIES)
8
+ @max_retries = max_retries
9
+ end
10
+
11
+ def self.resolve(options)
12
+ options || new
13
+ end
14
+ end
15
+ end
@@ -12,7 +12,8 @@ module Algolia
12
12
  :write_timeout,
13
13
  :connect_timeout,
14
14
  :compression_type,
15
- :requester
15
+ :requester,
16
+ :transformation_options
16
17
  )
17
18
 
18
19
  # Set this to false to skip client side validation in the operation.
@@ -30,6 +31,7 @@ module Algolia
30
31
  @write_timeout = opts[:write_timeout]
31
32
  @compression_type = opts[:compression_type] || "none"
32
33
  @requester = opts[:requester]
34
+ @transformation_options = opts[:transformation_options]
33
35
 
34
36
  @user_agent = UserAgent.new.add(client_name, VERSION)
35
37
 
@@ -11,14 +11,19 @@ module Algolia
11
11
  # Unique A/B test identifier.
12
12
  attr_accessor :ab_test_id
13
13
 
14
+ # A/B test significance calculated from click events. Values of 0.95 or higher can be considered significant, that is, the difference between A and B variants is _not_ due to random variations. Lower values have a.
14
15
  attr_accessor :click_significance
15
16
 
17
+ # A/B test significance calculated from conversion events. Values of 0.95 or higher can be considered significant, that is, the difference between A and B variants is _not_ due to random variations.
16
18
  attr_accessor :conversion_significance
17
19
 
20
+ # A/B test significance calculated from add-to-cart events. Values of 0.95 or higher can be considered significant, that is, the difference between A and B variants is _not_ due to random variations.
18
21
  attr_accessor :add_to_cart_significance
19
22
 
23
+ # A/B test significance calculated from purchase events. Values of 0.95 or higher can be considered significant, that is, the difference between A and B variants is _not_ due to random variations.
20
24
  attr_accessor :purchase_significance
21
25
 
26
+ # A/B test significance calculated from revenue data. Values of 0.95 or higher can be considered significant, that is, the difference between A and B variants is _not_ due to random variations.
22
27
  attr_accessor :revenue_significance
23
28
 
24
29
  # Date and time when the A/B test was last updated, in RFC 3339 format.
@@ -9,8 +9,6 @@ module Algolia
9
9
  module Ingestion
10
10
  # API request body for updating a destination.
11
11
  class DestinationUpdate
12
- attr_accessor :type
13
-
14
12
  # Descriptive name for the resource.
15
13
  attr_accessor :name
16
14
 
@@ -24,7 +22,6 @@ module Algolia
24
22
  # Attribute mapping from ruby-style variable name to JSON key.
25
23
  def self.attribute_map
26
24
  {
27
- :type => :type,
28
25
  :name => :name,
29
26
  :input => :input,
30
27
  :authentication_id => :authenticationID,
@@ -35,9 +32,8 @@ module Algolia
35
32
  # Attribute type mapping.
36
33
  def self.types_mapping
37
34
  {
38
- :type => :"DestinationType",
39
35
  :name => :"String",
40
- :input => :"DestinationInput",
36
+ :input => :"DestinationUpdateInput",
41
37
  :authentication_id => :"String",
42
38
  :transformation_ids => :"Array<String>"
43
39
  }
@@ -73,10 +69,6 @@ module Algolia
73
69
  h[k.to_sym] = v
74
70
  }
75
71
 
76
- if attributes.key?(:type)
77
- self.type = attributes[:type]
78
- end
79
-
80
72
  if attributes.key?(:name)
81
73
  self.name = attributes[:name]
82
74
  end
@@ -101,7 +93,6 @@ module Algolia
101
93
  def ==(other)
102
94
  return true if self.equal?(other)
103
95
  self.class == other.class &&
104
- type == other.type &&
105
96
  name == other.name &&
106
97
  input == other.input &&
107
98
  authentication_id == other.authentication_id &&
@@ -117,7 +108,7 @@ module Algolia
117
108
  # Calculates hash code according to all attributes.
118
109
  # @return [Integer] Hash code
119
110
  def hash
120
- [type, name, input, authentication_id, transformation_ids].hash
111
+ [name, input, authentication_id, transformation_ids].hash
121
112
  end
122
113
 
123
114
  # Builds the object from hash
@@ -0,0 +1,228 @@
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 Ingestion
10
+ class DestinationUpdateInput
11
+ # Algolia index name (case-sensitive).
12
+ attr_accessor :index_name
13
+
14
+ attr_accessor :record_type
15
+
16
+ # Attributes from your source to exclude from Algolia records. Not all your data attributes will be useful for searching. Keeping your Algolia records small increases indexing and search performance. - Exclude nested attributes with `.` notation. For example, `foo.bar` indexes the `foo` attribute and all its children **except** the `bar` attribute. - Exclude attributes from arrays with `[i]`, where `i` is the index of the array element. For example, `foo.[0].bar` only excludes the `bar` attribute from the first element of the `foo` array, but indexes the complete `foo` attribute for all other elements. Use `*` as wildcard: `foo.[*].bar` excludes `bar` from all elements of the `foo` array.
17
+ attr_accessor :attributes_to_exclude
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :index_name => :indexName,
23
+ :record_type => :recordType,
24
+ :attributes_to_exclude => :attributesToExclude
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.types_mapping
30
+ {
31
+ :index_name => :"String",
32
+ :record_type => :"RecordType",
33
+ :attributes_to_exclude => :"Array<String>"
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::DestinationUpdateInput` 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::DestinationUpdateInput`. 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?(:index_name)
68
+ self.index_name = attributes[:index_name]
69
+ end
70
+
71
+ if attributes.key?(:record_type)
72
+ self.record_type = attributes[:record_type]
73
+ end
74
+
75
+ if attributes.key?(:attributes_to_exclude)
76
+ if (value = attributes[:attributes_to_exclude]).is_a?(Array)
77
+ self.attributes_to_exclude = value
78
+ end
79
+ end
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(other)
85
+ return true if self.equal?(other)
86
+ self.class == other.class &&
87
+ index_name == other.index_name &&
88
+ record_type == other.record_type &&
89
+ attributes_to_exclude == other.attributes_to_exclude
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(other)
95
+ self == other
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [index_name, record_type, attributes_to_exclude].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ attributes = attributes.transform_keys(&:to_sym)
110
+ transformed_hash = {}
111
+ types_mapping.each_pair do |key, type|
112
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
113
+ transformed_hash[key.to_sym] = nil
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[attribute_map[key]].is_a?(Array)
118
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
119
+ _deserialize(::Regexp.last_match(1), v)
120
+ }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ # model
168
+ else
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Algolia::Ingestion.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
172
+ .build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ def to_json(*_args)
189
+ to_hash.to_json
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to?(:to_hash)
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
@@ -14,6 +14,7 @@ module Algolia
14
14
 
15
15
  attr_accessor :languages
16
16
 
17
+ # Words or regular expressions to exclude from the suggestions.
17
18
  attr_accessor :exclude
18
19
 
19
20
  # Whether to turn on personalized query suggestions.
@@ -20,6 +20,7 @@ module Algolia
20
20
 
21
21
  attr_accessor :languages
22
22
 
23
+ # Words or regular expressions to exclude from the suggestions.
23
24
  attr_accessor :exclude
24
25
 
25
26
  # Whether to turn on personalized query suggestions.
@@ -14,6 +14,7 @@ module Algolia
14
14
 
15
15
  attr_accessor :languages
16
16
 
17
+ # Words or regular expressions to exclude from the suggestions.
17
18
  attr_accessor :exclude
18
19
 
19
20
  # Whether to turn on personalized query suggestions.
@@ -15,8 +15,10 @@ module Algolia
15
15
  # If true, Query Suggestions uses all replica indices to find popular searches. If false, only the primary index is used.
16
16
  attr_accessor :replicas
17
17
 
18
+ # Analytics tags for filtering the popular searches. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments).
18
19
  attr_accessor :analytics_tags
19
20
 
21
+ # Facets to use as top categories with your suggestions. If provided, Query Suggestions adds the top facet values to each suggestion.
20
22
  attr_accessor :facets
21
23
 
22
24
  # Minimum number of hits required to be included as a suggestion. A search query must at least generate `minHits` search results to be included in the Query Suggestions index.
@@ -25,8 +27,10 @@ module Algolia
25
27
  # Minimum letters required to be included as a suggestion. A search query must be at least `minLetters` long to be included in the Query Suggestions index.
26
28
  attr_accessor :min_letters
27
29
 
30
+ # Facets used for generating query suggestions from facet values. For example, if you set `generate: [\"color\", \"brand\"]`, combinations from the facet values are added as query suggestions, such as \"blue adidas\", \"red adidas\", \"blue nike\", \"red nike\", etc. You can include nested lists.
28
31
  attr_accessor :generate
29
32
 
33
+ # Algolia indices with popular searches to use as query suggestions. Records of these indices must have these attributes: - `query`: search query which will be added as a suggestion - `count`: measure of popularity of that search query For example, you can export popular searches from an external analytics provider, such as Google Analytics or Adobe Analytics, and feed this data into an Algolia index. You can use this index to generate query suggestions until your Algolia Analytics has collected enough data.
30
34
  attr_accessor :external
31
35
 
32
36
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -444,7 +444,8 @@ module Algolia
444
444
  [
445
445
  :inside_bounding_box,
446
446
  :user_data,
447
- :optional_words
447
+ :optional_words,
448
+ :re_ranking_apply_filter
448
449
  ]
449
450
  )
450
451
  end
@@ -445,7 +445,8 @@ module Algolia
445
445
  [
446
446
  :inside_bounding_box,
447
447
  :user_data,
448
- :optional_words
448
+ :optional_words,
449
+ :re_ranking_apply_filter
449
450
  ]
450
451
  )
451
452
  end
@@ -376,7 +376,8 @@ module Algolia
376
376
  Set.new(
377
377
  [
378
378
  :inside_bounding_box,
379
- :optional_words
379
+ :optional_words,
380
+ :re_ranking_apply_filter
380
381
  ]
381
382
  )
382
383
  end
@@ -378,7 +378,8 @@ module Algolia
378
378
  Set.new(
379
379
  [
380
380
  :inside_bounding_box,
381
- :optional_words
381
+ :optional_words,
382
+ :re_ranking_apply_filter
382
383
  ]
383
384
  )
384
385
  end
@@ -44,6 +44,11 @@ module Algolia
44
44
  # Only present if the index is a [virtual replica](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-an-index-alphabetically/#virtual-replicas).
45
45
  attr_accessor :virtual
46
46
 
47
+ attr_accessor :ab_test
48
+
49
+ # Name of the index that owns the A/B test configuration. Only present when this index participates in an A/B test configured on another index.
50
+ attr_accessor :source_ab_test
51
+
47
52
  # Attribute mapping from ruby-style variable name to JSON key.
48
53
  def self.attribute_map
49
54
  {
@@ -58,7 +63,9 @@ module Algolia
58
63
  :pending_task => :pendingTask,
59
64
  :primary => :primary,
60
65
  :replicas => :replicas,
61
- :virtual => :virtual
66
+ :virtual => :virtual,
67
+ :ab_test => :abTest,
68
+ :source_ab_test => :sourceABTest
62
69
  }
63
70
  end
64
71
 
@@ -76,7 +83,9 @@ module Algolia
76
83
  :pending_task => :"Boolean",
77
84
  :primary => :"String",
78
85
  :replicas => :"Array<String>",
79
- :virtual => :"Boolean"
86
+ :virtual => :"Boolean",
87
+ :ab_test => :"FetchedIndexAbTest",
88
+ :source_ab_test => :"String"
80
89
  }
81
90
  end
82
91
 
@@ -177,6 +186,14 @@ module Algolia
177
186
  if attributes.key?(:virtual)
178
187
  self.virtual = attributes[:virtual]
179
188
  end
189
+
190
+ if attributes.key?(:ab_test)
191
+ self.ab_test = attributes[:ab_test]
192
+ end
193
+
194
+ if attributes.key?(:source_ab_test)
195
+ self.source_ab_test = attributes[:source_ab_test]
196
+ end
180
197
  end
181
198
 
182
199
  # Checks equality by comparing each attribute.
@@ -195,7 +212,9 @@ module Algolia
195
212
  pending_task == other.pending_task &&
196
213
  primary == other.primary &&
197
214
  replicas == other.replicas &&
198
- virtual == other.virtual
215
+ virtual == other.virtual &&
216
+ ab_test == other.ab_test &&
217
+ source_ab_test == other.source_ab_test
199
218
  end
200
219
 
201
220
  # @see the `==` method
@@ -219,7 +238,9 @@ module Algolia
219
238
  pending_task,
220
239
  primary,
221
240
  replicas,
222
- virtual
241
+ virtual,
242
+ ab_test,
243
+ source_ab_test
223
244
  ].hash
224
245
  end
225
246