algolia 3.45.0 → 3.46.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +2 -2
- data/AGENTS.md +0 -24
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/abtesting_v3_client.rb +196 -7
- data/lib/algolia/api/agent_studio_client.rb +244 -6
- data/lib/algolia/api/recommend_client.rb +2 -2
- data/lib/algolia/api/search_client.rb +17 -3
- data/lib/algolia/configuration.rb +8 -0
- data/lib/algolia/defaults.rb +8 -0
- data/lib/algolia/models/abtesting-v3/ab_test.rb +25 -1
- data/lib/algolia/models/abtesting-v3/ab_test_configuration.rb +22 -4
- data/lib/algolia/models/abtesting-v3/ab_test_settings_response.rb +224 -0
- data/lib/algolia/models/abtesting-v3/add_ab_tests_request.rb +11 -1
- data/lib/algolia/models/abtesting-v3/analysis_method.rb +34 -0
- data/lib/algolia/models/abtesting-v3/bayesian_metric_result.rb +237 -0
- data/lib/algolia/models/abtesting-v3/evidence_status.rb +37 -0
- data/lib/algolia/models/abtesting-v3/feature_settings.rb +224 -0
- data/lib/algolia/models/abtesting-v3/metric_evidence.rb +209 -0
- data/lib/algolia/models/abtesting-v3/metric_metadata.rb +1 -1
- data/lib/algolia/models/abtesting-v3/metric_name.rb +7 -1
- data/lib/algolia/models/abtesting-v3/metric_result.rb +18 -8
- data/lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb +1 -1
- data/lib/algolia/models/abtesting-v3/primary_metric.rb +37 -0
- data/lib/algolia/models/abtesting-v3/save_settings_request.rb +208 -0
- data/lib/algolia/models/abtesting-v3/variant_settings.rb +293 -0
- data/lib/algolia/models/agent-studio/agent_completion_algolia_params.rb +16 -4
- data/lib/algolia/models/agent-studio/agent_completion_request.rb +1 -3
- data/lib/algolia/models/agent-studio/agent_completion_request_union.rb +108 -0
- data/lib/algolia/models/agent-studio/agent_test_configuration.rb +1 -1
- data/lib/algolia/models/agent-studio/agent_with_version_response.rb +1 -1
- data/lib/algolia/models/agent-studio/agui_completion_request.rb +265 -0
- data/lib/algolia/models/agent-studio/agui_resume.rb +231 -0
- data/lib/algolia/models/agent-studio/algolia_grouped_results_compat_tool_config.rb +268 -0
- data/lib/algolia/models/agent-studio/{algolia_display_results_tool_config.rb → algolia_grouped_results_tool_config.rb} +30 -16
- data/lib/algolia/models/agent-studio/{algolia_recommend_tool_config_input.rb → algolia_recommend_tool_config.rb} +3 -3
- data/lib/algolia/models/agent-studio/algolia_search_tool_config.rb +22 -4
- data/lib/algolia/models/agent-studio/assistant_message_agui.rb +280 -0
- data/lib/algolia/models/agent-studio/assistant_message_v4.rb +1 -0
- data/lib/algolia/models/agent-studio/assistant_message_v5.rb +3 -1
- data/lib/algolia/models/agent-studio/assistant_part_v5.rb +2 -0
- data/lib/algolia/models/agent-studio/azure_open_ai_provider_input.rb +1 -1
- data/lib/algolia/models/agent-studio/boolean_param.rb +220 -0
- data/lib/algolia/models/agent-studio/client_side_tool_config.rb +14 -4
- data/lib/algolia/models/agent-studio/compaction_stats.rb +271 -0
- data/lib/algolia/models/agent-studio/compatibility_mode.rb +2 -1
- data/lib/algolia/models/agent-studio/context_compact_request.rb +263 -0
- data/lib/algolia/models/agent-studio/context_response.rb +231 -0
- data/lib/algolia/models/agent-studio/context_stats.rb +258 -0
- data/lib/algolia/models/agent-studio/context_trim_request.rb +239 -0
- data/lib/algolia/models/agent-studio/conversation_base_response.rb +16 -5
- data/lib/algolia/models/agent-studio/conversation_full_response.rb +26 -5
- data/lib/algolia/models/agent-studio/data_guardrail_violation_part_v5.rb +218 -0
- data/lib/algolia/models/agent-studio/data_part_v5.rb +220 -0
- data/lib/algolia/models/agent-studio/facet_filters_union_search_parameters_overrides.rb +108 -0
- data/lib/algolia/models/agent-studio/feedback_update_request.rb +253 -0
- data/lib/algolia/models/agent-studio/forwarded_props.rb +226 -0
- data/lib/algolia/models/agent-studio/function_call_agui.rb +219 -0
- data/lib/algolia/models/agent-studio/guardrail_outcome.rb +231 -0
- data/lib/algolia/models/agent-studio/guardrail_violation_data_v5.rb +230 -0
- data/lib/algolia/models/agent-studio/impact_analytics.rb +242 -0
- data/lib/algolia/models/agent-studio/index_search_parameters.rb +11 -1
- data/lib/algolia/models/agent-studio/input_union.rb +113 -0
- data/lib/algolia/models/agent-studio/items_union.rb +132 -0
- data/lib/algolia/models/agent-studio/items_union_agui_completion_request.rb +123 -0
- data/lib/algolia/models/agent-studio/managed_provider_response_input.rb +209 -0
- data/lib/algolia/models/agent-studio/mcp_server_tool_config.rb +1 -1
- data/lib/algolia/models/agent-studio/memory_record.rb +4 -4
- data/lib/algolia/models/agent-studio/message_event.rb +231 -0
- data/lib/algolia/models/agent-studio/message_part_assistant_message_agui.rb +123 -0
- data/lib/algolia/models/agent-studio/message_response.rb +87 -5
- data/lib/algolia/models/agent-studio/mode_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/one_of_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/open_ai_compatible_provider_input.rb +1 -1
- data/lib/algolia/models/agent-studio/paginated_conversations_response.rb +13 -4
- data/lib/algolia/models/agent-studio/provider_authentication_response.rb +14 -5
- data/lib/algolia/models/agent-studio/provider_input.rb +2 -1
- data/lib/algolia/models/agent-studio/provider_input_nullable.rb +2 -1
- data/lib/algolia/models/agent-studio/provider_name.rb +2 -1
- data/lib/algolia/models/agent-studio/reasoning_message_agui.rb +239 -0
- data/lib/algolia/models/agent-studio/reasoning_part_agui.rb +228 -0
- data/lib/algolia/models/agent-studio/search_parameters.rb +1 -1
- data/lib/algolia/models/agent-studio/search_parameters_overrides.rb +80 -5
- data/lib/algolia/models/agent-studio/status_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/task_kind.rb +33 -0
- data/lib/algolia/models/agent-studio/task_request.rb +240 -0
- data/lib/algolia/models/agent-studio/task_response.rb +211 -0
- data/lib/algolia/models/agent-studio/text_part_agui.rb +219 -0
- data/lib/algolia/models/agent-studio/tool_approval_agui.rb +228 -0
- data/lib/algolia/models/agent-studio/tool_approval_request_part.rb +15 -5
- data/lib/algolia/models/agent-studio/tool_call_agui.rb +237 -0
- data/lib/algolia/models/agent-studio/tool_call_part.rb +13 -1
- data/lib/algolia/models/agent-studio/tool_call_part_agui.rb +272 -0
- data/lib/algolia/models/agent-studio/tool_call_result_part_agui.rb +250 -0
- data/lib/algolia/models/agent-studio/tool_config_input.rb +2 -5
- data/lib/algolia/models/agent-studio/{tool_config.rb → tool_config_or_boolean_union.rb} +1 -1
- data/lib/algolia/models/agent-studio/tool_config_output.rb +126 -0
- data/lib/algolia/models/agent-studio/tool_invocation_v4.rb +10 -2
- data/lib/algolia/models/agent-studio/tool_message_agui.rb +259 -0
- data/lib/algolia/models/agent-studio/tool_part_v5.rb +47 -2
- data/lib/algolia/models/agent-studio/tool_result_part.rb +57 -5
- data/lib/algolia/models/agent-studio/unknown_tool_config.rb +1 -1
- data/lib/algolia/models/agent-studio/user_message_agui.rb +261 -0
- data/lib/algolia/models/agent-studio/user_message_metadata_agui.rb +208 -0
- data/lib/algolia/models/agent-studio/user_message_metadata_v5.rb +4 -2
- data/lib/algolia/models/agent-studio/user_message_v4.rb +4 -1
- data/lib/algolia/models/agent-studio/user_message_v5.rb +4 -1
- data/lib/algolia/models/agent-studio/validation_error.rb +5 -25
- data/lib/algolia/models/agent-studio/xai_provider_input.rb +220 -0
- data/lib/algolia/models/analytics/catalog_entry.rb +1 -1
- data/lib/algolia/models/composition/base_injection_query_parameters.rb +18 -18
- data/lib/algolia/models/composition/distinct.rb +1 -1
- data/lib/algolia/models/composition/external_provider.rb +209 -0
- data/lib/algolia/models/composition/external_provider_ordering.rb +34 -0
- data/lib/algolia/models/composition/hit_metadata.rb +2 -2
- data/lib/algolia/models/composition/injected_item_external.rb +21 -14
- data/lib/algolia/models/composition/injected_item_external_provider.rb +258 -0
- data/lib/algolia/models/composition/injected_item_external_provider_source.rb +216 -0
- data/lib/algolia/models/composition/injected_item_hits_metadata.rb +1 -1
- data/lib/algolia/models/composition/{recommend.rb → injected_item_recommend.rb} +10 -3
- data/lib/algolia/models/composition/injected_item_recommend_source.rb +1 -1
- data/lib/algolia/models/composition/injected_item_search.rb +8 -1
- data/lib/algolia/models/composition/injected_item_source.rb +1 -0
- data/lib/algolia/models/composition/injection_main_external_provider.rb +258 -0
- data/lib/algolia/models/composition/injection_main_external_provider_source.rb +216 -0
- data/lib/algolia/models/composition/{main_recommend.rb → injection_main_recommend.rb} +10 -3
- data/lib/algolia/models/composition/injection_main_recommend_source.rb +1 -1
- data/lib/algolia/models/composition/{main_search.rb → injection_main_search.rb} +11 -4
- data/lib/algolia/models/composition/injection_main_search_source.rb +1 -1
- data/lib/algolia/models/composition/injection_main_source.rb +1 -0
- data/lib/algolia/models/composition/main_injection_query_parameters.rb +22 -22
- data/lib/algolia/models/composition/optional_words.rb +1 -1
- data/lib/algolia/models/composition/params.rb +6 -6
- data/lib/algolia/models/composition/processing_error.rb +209 -0
- data/lib/algolia/models/composition/request_body.rb +13 -4
- data/lib/algolia/models/composition/result_card.rb +208 -0
- data/lib/algolia/models/composition/search_response.rb +16 -4
- data/lib/algolia/models/composition/widgets.rb +13 -4
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +11 -0
- data/lib/algolia/models/recommend/distinct.rb +1 -1
- data/lib/algolia/models/recommend/fallback_params.rb +26 -26
- data/lib/algolia/models/recommend/optional_words.rb +1 -1
- data/lib/algolia/models/recommend/recommend_search_params.rb +26 -26
- data/lib/algolia/models/recommend/result_card.rb +208 -0
- data/lib/algolia/models/recommend/widgets.rb +13 -4
- data/lib/algolia/models/search/api_key.rb +2 -2
- data/lib/algolia/models/search/attribute_criteria_computed_by.rb +35 -0
- data/lib/algolia/models/search/browse_params_object.rb +35 -25
- data/lib/algolia/models/search/consequence_params.rb +35 -25
- data/lib/algolia/models/search/distinct.rb +1 -1
- data/lib/algolia/models/search/get_api_key_response.rb +2 -2
- data/lib/algolia/models/search/index_settings.rb +28 -18
- data/lib/algolia/models/search/optional_words.rb +1 -1
- data/lib/algolia/models/search/result_card.rb +208 -0
- data/lib/algolia/models/search/search_for_facets.rb +35 -25
- data/lib/algolia/models/search/search_for_hits.rb +35 -25
- data/lib/algolia/models/search/search_params_object.rb +35 -25
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
- data/lib/algolia/models/search/settings_response.rb +28 -18
- data/lib/algolia/models/search/widgets.rb +13 -4
- data/lib/algolia/transport/transport.rb +82 -10
- data/lib/algolia/version.rb +1 -1
- metadata +72 -8
|
@@ -0,0 +1,220 @@
|
|
|
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 AgentStudio
|
|
10
|
+
# xAI (Grok)-specific provider input. api_key only, with an optional base_url override (defaults to https://api.x.ai/v1 at completion time). An unusable base_url fails when you create the provider, not at completion.
|
|
11
|
+
class XAIProviderInput
|
|
12
|
+
attr_accessor :api_key
|
|
13
|
+
|
|
14
|
+
attr_accessor :base_url
|
|
15
|
+
|
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
17
|
+
def self.attribute_map
|
|
18
|
+
{
|
|
19
|
+
:api_key => :apiKey,
|
|
20
|
+
:base_url => :baseUrl
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Attribute type mapping.
|
|
25
|
+
def self.types_mapping
|
|
26
|
+
{
|
|
27
|
+
:api_key => :"String",
|
|
28
|
+
:base_url => :"String"
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# List of attributes with nullable: true
|
|
33
|
+
def self.openapi_nullable
|
|
34
|
+
Set.new(
|
|
35
|
+
[
|
|
36
|
+
:base_url
|
|
37
|
+
]
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Initializes the object
|
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
43
|
+
def initialize(attributes = {})
|
|
44
|
+
if (!attributes.is_a?(Hash))
|
|
45
|
+
raise(
|
|
46
|
+
ArgumentError,
|
|
47
|
+
"The input argument (attributes) must be a hash in `Algolia::XAIProviderInput` initialize method"
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
54
|
+
raise(
|
|
55
|
+
ArgumentError,
|
|
56
|
+
"`#{k}` is not a valid attribute in `Algolia::XAIProviderInput`. Please check the name to make sure it's valid. List of attributes: " +
|
|
57
|
+
self.class.attribute_map.keys.inspect
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if attributes.key?(:api_key)
|
|
65
|
+
self.api_key = attributes[:api_key]
|
|
66
|
+
else
|
|
67
|
+
self.api_key = nil
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:base_url)
|
|
71
|
+
self.base_url = attributes[:base_url]
|
|
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 self.equal?(other)
|
|
79
|
+
self.class == other.class &&
|
|
80
|
+
api_key == other.api_key &&
|
|
81
|
+
base_url == other.base_url
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# @see the `==` method
|
|
85
|
+
# @param [Object] Object to be compared
|
|
86
|
+
def eql?(other)
|
|
87
|
+
self == other
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Calculates hash code according to all attributes.
|
|
91
|
+
# @return [Integer] Hash code
|
|
92
|
+
def hash
|
|
93
|
+
[api_key, base_url].hash
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Builds the object from hash
|
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
98
|
+
# @return [Object] Returns the model itself
|
|
99
|
+
def self.build_from_hash(attributes)
|
|
100
|
+
return nil unless attributes.is_a?(Hash)
|
|
101
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
102
|
+
transformed_hash = {}
|
|
103
|
+
types_mapping.each_pair do |key, type|
|
|
104
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
105
|
+
transformed_hash[key.to_sym] = nil
|
|
106
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
107
|
+
# check to ensure the input is an array given that the attribute
|
|
108
|
+
# is documented as an array but the input is not
|
|
109
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
110
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
111
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
112
|
+
}
|
|
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
|
+
|
|
119
|
+
new(transformed_hash)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Deserializes the data based on type
|
|
123
|
+
# @param string type Data type
|
|
124
|
+
# @param string value Value to be deserialized
|
|
125
|
+
# @return [Object] Deserialized data
|
|
126
|
+
def self._deserialize(type, value)
|
|
127
|
+
case type.to_sym
|
|
128
|
+
when :Time
|
|
129
|
+
Time.parse(value)
|
|
130
|
+
when :Date
|
|
131
|
+
Date.parse(value)
|
|
132
|
+
when :String
|
|
133
|
+
value.to_s
|
|
134
|
+
when :Integer
|
|
135
|
+
value.to_i
|
|
136
|
+
when :Float
|
|
137
|
+
value.to_f
|
|
138
|
+
when :Boolean
|
|
139
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
140
|
+
true
|
|
141
|
+
else
|
|
142
|
+
false
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
when :Object
|
|
146
|
+
# generic object (usually a Hash), return directly
|
|
147
|
+
value
|
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
|
154
|
+
{}.tap do |hash|
|
|
155
|
+
value.each do |k, v|
|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
# model
|
|
160
|
+
else
|
|
161
|
+
# models (e.g. Pet) or oneOf
|
|
162
|
+
klass = Algolia::AgentStudio.const_get(type)
|
|
163
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
164
|
+
.build_from_hash(value)
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Returns the string representation of the object
|
|
169
|
+
# @return [String] String presentation of the object
|
|
170
|
+
def to_s
|
|
171
|
+
to_hash.to_s
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
|
176
|
+
def to_body
|
|
177
|
+
to_hash
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def to_json(*_args)
|
|
181
|
+
to_hash.to_json
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the object in the form of hash
|
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
|
186
|
+
def to_hash
|
|
187
|
+
hash = {}
|
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
189
|
+
value = send(attr)
|
|
190
|
+
if value.nil?
|
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
hash[param] = _to_hash(value)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Outputs non-array value in the form of hash
|
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
203
|
+
# @param [Object] value Any valid value
|
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
|
205
|
+
def _to_hash(value)
|
|
206
|
+
if value.is_a?(Array)
|
|
207
|
+
value.map { |v| _to_hash(v) }
|
|
208
|
+
elsif value.is_a?(Hash)
|
|
209
|
+
{}.tap do |hash|
|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
211
|
+
end
|
|
212
|
+
elsif value.respond_to?(:to_hash)
|
|
213
|
+
value.to_hash
|
|
214
|
+
else
|
|
215
|
+
value
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
end
|
|
@@ -17,7 +17,7 @@ module Algolia
|
|
|
17
17
|
# Root stages the field depends on. Two fields are combinable in one query only when their roots intersect.
|
|
18
18
|
attr_accessor :roots
|
|
19
19
|
|
|
20
|
-
# Public ACL identifiers required to read the field, for example `
|
|
20
|
+
# Public ACL identifiers required to read the field, for example `revenueAnalyticsEnabled`.
|
|
21
21
|
attr_accessor :requires
|
|
22
22
|
|
|
23
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -8,37 +8,37 @@ require "time"
|
|
|
8
8
|
module Algolia
|
|
9
9
|
module Composition
|
|
10
10
|
class BaseInjectionQueryParameters
|
|
11
|
-
# Whether to support phrase matching and excluding words from search queries Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
|
11
|
+
# Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
|
12
12
|
attr_accessor :advanced_syntax
|
|
13
13
|
|
|
14
|
-
# Advanced search syntax features you want to support - `exactPhrase`. Phrases in quotes must match exactly. For example, `sparkly blue \"iPhone case\"` only returns records with the exact string \"iPhone case\" - `excludeWords`. Query words prefixed with a `-` must not occur in a record. For example, `search -engine` matches records that contain \"search\" but not \"engine\" This setting only has an effect if `advancedSyntax` is true.
|
|
14
|
+
# Advanced search syntax features you want to support. - `exactPhrase`. Phrases in quotes must match exactly. For example, `sparkly blue \"iPhone case\"` only returns records with the exact string \"iPhone case\". - `excludeWords`. Query words prefixed with a `-` must not occur in a record. For example, `search -engine` matches records that contain \"search\" but not \"engine\". This setting only has an effect if `advancedSyntax` is true.
|
|
15
15
|
attr_accessor :advanced_syntax_features
|
|
16
16
|
|
|
17
|
-
# Whether to allow typos on numbers in the search query Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers.
|
|
17
|
+
# Whether to allow typos on numbers in the search query. Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers.
|
|
18
18
|
attr_accessor :allow_typos_on_numeric_tokens
|
|
19
19
|
|
|
20
|
-
# Determine which plurals and synonyms should be considered an exact matches By default, Algolia treats singular and plural forms of a word, and single-word synonyms, as [exact](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#exact) matches when searching. For example - \"swimsuit\" and \"swimsuits\" are treated the same - \"swimsuit\" and \"swimwear\" are treated the same (if they are [synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#regular-synonyms)) - `ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches - `singleWordSynonym`. Single-word synonyms, such as \"NY\" = \"NYC\", are considered exact matches - `multiWordsSynonym`. Multi-word synonyms, such as \"NY\" = \"New York\", are considered exact matches.
|
|
20
|
+
# Determine which plurals and synonyms should be considered an exact matches. By default, Algolia treats singular and plural forms of a word, and single-word synonyms, as [exact](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#exact) matches when searching. For example: - \"swimsuit\" and \"swimsuits\" are treated the same. - \"swimsuit\" and \"swimwear\" are treated the same (if they are [synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#regular-synonyms)). - `ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches. - `singleWordSynonym`. Single-word synonyms, such as \"NY\" = \"NYC\", are considered exact matches. - `multiWordsSynonym`. Multi-word synonyms, such as \"NY\" = \"New York\", are considered exact matches.
|
|
21
21
|
attr_accessor :alternatives_as_exact
|
|
22
22
|
|
|
23
|
-
# Whether the best matching attribute should be determined by minimum proximity This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting.
|
|
23
|
+
# Whether the best matching attribute should be determined by minimum proximity. This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting. Prefer `attributeCriteriaComputedBy`, which expresses the same two behaviors and adds the `sum` strategy. If you set both, `attributeCriteriaComputedBy` takes precedence.
|
|
24
24
|
attr_accessor :attribute_criteria_computed_by_min_proximity
|
|
25
25
|
|
|
26
|
-
# Attributes to highlight By default, all searchable attributes are highlighted. Use `*` to highlight all attributes or use an empty array `[]` to turn off highlighting. Attribute names are case-sensitive With highlighting, strings that match the search query are surrounded by HTML tags defined by `highlightPreTag` and `highlightPostTag`. You can use this to visually highlight matching parts of a search query in your UI For more information, see [Highlighting and snippeting](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js).
|
|
26
|
+
# Attributes to highlight. By default, all searchable attributes are highlighted. Use `*` to highlight all attributes or use an empty array `[]` to turn off highlighting. Attribute names are case-sensitive With highlighting, strings that match the search query are surrounded by HTML tags defined by `highlightPreTag` and `highlightPostTag`. You can use this to visually highlight matching parts of a search query in your UI For more information, see [Highlighting and snippeting](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js).
|
|
27
27
|
attr_accessor :attributes_to_highlight
|
|
28
28
|
|
|
29
|
-
# Attributes to include in the API response To reduce the size of your response, you can retrieve only some of the attributes. Attribute names are case-sensitive - `*` retrieves all attributes, except attributes included in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the `*`: `[\"*\", \"-ATTRIBUTE\"]`. - The `objectID` attribute is always included.
|
|
29
|
+
# Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. Attribute names are case-sensitive - `*` retrieves all attributes, except attributes included in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the `*`: `[\"*\", \"-ATTRIBUTE\"]`. - The `objectID` attribute is always included.
|
|
30
30
|
attr_accessor :attributes_to_retrieve
|
|
31
31
|
|
|
32
32
|
# Attributes for which to enable snippets. Attribute names are case-sensitive Snippets provide additional context to matched words. If you enable snippets, they include 10 words, including the matched word. The matched word will also be wrapped by HTML tags for highlighting. You can adjust the number of words with the following notation: `ATTRIBUTE:NUMBER`, where `NUMBER` is the number of words to be extracted.
|
|
33
33
|
attr_accessor :attributes_to_snippet
|
|
34
34
|
|
|
35
|
-
# Whether to include a `queryID` attribute in the response The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/doc/guides/sending-events/getting-started).
|
|
35
|
+
# Whether to include a `queryID` attribute in the response. The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/doc/guides/sending-events/getting-started).
|
|
36
36
|
attr_accessor :click_analytics
|
|
37
37
|
|
|
38
38
|
# Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.
|
|
39
39
|
attr_accessor :disable_exact_on_attributes
|
|
40
40
|
|
|
41
|
-
# Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance). Attribute names are case-sensitive Returning only exact matches can help when - [Searching in hyphenated attributes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/how-to/how-to-search-in-hyphenated-attributes). - Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions Consider alternatives such as `disableTypoToleranceOnWords` or adding synonyms if your attributes have intentional unusual spellings that might look like typos.
|
|
41
|
+
# Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance). Attribute names are case-sensitive Returning only exact matches can help when - [Searching in hyphenated attributes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/how-to/how-to-search-in-hyphenated-attributes). - Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions. Consider alternatives such as `disableTypoToleranceOnWords` or adding synonyms if your attributes have intentional unusual spellings that might look like typos.
|
|
42
42
|
attr_accessor :disable_typo_tolerance_on_attributes
|
|
43
43
|
|
|
44
44
|
attr_accessor :distinct
|
|
@@ -49,7 +49,7 @@ module Algolia
|
|
|
49
49
|
# Whether to enable Personalization.
|
|
50
50
|
attr_accessor :enable_personalization
|
|
51
51
|
|
|
52
|
-
# Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.
|
|
52
|
+
# Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking). This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.
|
|
53
53
|
attr_accessor :enable_re_ranking
|
|
54
54
|
|
|
55
55
|
# Whether to enable rules.
|
|
@@ -73,16 +73,16 @@ module Algolia
|
|
|
73
73
|
|
|
74
74
|
attr_accessor :ignore_plurals
|
|
75
75
|
|
|
76
|
-
# Minimum proximity score for two matching words This adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity) by equally scoring matches that are farther apart For example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score.
|
|
76
|
+
# Minimum proximity score for two matching words. This adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity) by equally scoring matches that are farther apart For example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score.
|
|
77
77
|
attr_accessor :min_proximity
|
|
78
78
|
|
|
79
|
-
# Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#
|
|
79
|
+
# Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configure-word-size-threshold-for-typos).
|
|
80
80
|
attr_accessor :min_word_sizefor1_typo
|
|
81
81
|
|
|
82
|
-
# Minimum number of characters a word in the search query must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#
|
|
82
|
+
# Minimum number of characters a word in the search query must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configure-word-size-threshold-for-typos).
|
|
83
83
|
attr_accessor :min_word_sizefor2_typos
|
|
84
84
|
|
|
85
|
-
# ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches) - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.
|
|
85
|
+
# ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches). - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.
|
|
86
86
|
attr_accessor :natural_languages
|
|
87
87
|
|
|
88
88
|
attr_accessor :numeric_filters
|
|
@@ -94,7 +94,7 @@ module Algolia
|
|
|
94
94
|
# Whether to include this search when calculating processing-time percentiles.
|
|
95
95
|
attr_accessor :percentile_computation
|
|
96
96
|
|
|
97
|
-
# Impact that Personalization should have on this search The higher this value is, the more Personalization determines the ranking compared to other factors. For more information, see [Understanding Personalization impact](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).
|
|
97
|
+
# Impact that Personalization should have on this search. The higher this value is, the more Personalization determines the ranking compared to other factors. For more information, see [Understanding Personalization impact](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).
|
|
98
98
|
attr_accessor :personalization_impact
|
|
99
99
|
|
|
100
100
|
# Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, place the CJK language **first**. **Always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations).
|
|
@@ -106,10 +106,10 @@ module Algolia
|
|
|
106
106
|
|
|
107
107
|
attr_accessor :remove_words_if_no_results
|
|
108
108
|
|
|
109
|
-
# Whether to replace a highlighted word with the matched synonym By default, the original words are highlighted even if a synonym matches. For example, with `home` as a synonym for `house` and a search for `home`, records matching either \"home\" or \"house\" are included in the search results, and either \"home\" or \"house\" are highlighted With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurrences of \"house\" are replaced by \"home\" in the highlighted response.
|
|
109
|
+
# Whether to replace a highlighted word with the matched synonym. By default, the original words are highlighted even if a synonym matches. For example, with `home` as a synonym for `house` and a search for `home`, records matching either \"home\" or \"house\" are included in the search results, and either \"home\" or \"house\" are highlighted With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurrences of \"house\" are replaced by \"home\" in the highlighted response.
|
|
110
110
|
attr_accessor :replace_synonyms_in_highlight
|
|
111
111
|
|
|
112
|
-
# Properties to include in the API response of search and browse requests By default, all response properties are included. To reduce the response size, you can select which properties should be included An empty list may lead to an empty API response (except properties you can't exclude) You can't exclude these properties: `message`, `warning`, `cursor`, `abTestVariantID`, or any property added by setting `getRankingInfo` to true Your search depends on the `hits` field. If you omit this field, searches won't return any results. Your UI might also depend on other properties, for example, for pagination. Before restricting the response size, check the impact on your search experience.
|
|
112
|
+
# Properties to include in the API response of search and browse requests. By default, all response properties are included. To reduce the response size, you can select which properties should be included An empty list may lead to an empty API response (except properties you can't exclude) You can't exclude these properties: `message`, `warning`, `cursor`, `abTestVariantID`, or any property added by setting `getRankingInfo` to true Your search depends on the `hits` field. If you omit this field, searches won't return any results. Your UI might also depend on other properties, for example, for pagination. Before restricting the response size, check the impact on your search experience.
|
|
113
113
|
attr_accessor :response_fields
|
|
114
114
|
|
|
115
115
|
# Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted.
|
|
@@ -118,7 +118,7 @@ module Algolia
|
|
|
118
118
|
# Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive.
|
|
119
119
|
attr_accessor :restrict_searchable_attributes
|
|
120
120
|
|
|
121
|
-
# Assigns a rule context to the search query [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#
|
|
121
|
+
# Assigns a rule context to the search query. [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#assign-context) are strings that you can use to trigger matching rules.
|
|
122
122
|
attr_accessor :rule_contexts
|
|
123
123
|
|
|
124
124
|
# String used as an ellipsis indicator when a snippet is truncated.
|
|
@@ -7,7 +7,7 @@ require "time"
|
|
|
7
7
|
|
|
8
8
|
module Algolia
|
|
9
9
|
module Composition
|
|
10
|
-
# Determines how many records of a group are included in the search results. Records with the same value for the `attributeForDistinct` attribute are considered a group. The `distinct` setting controls how many members of the group are returned. This is useful for [deduplication and grouping](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#
|
|
10
|
+
# Determines how many records of a group are included in the search results. Records with the same value for the `attributeForDistinct` attribute are considered a group. The `distinct` setting controls how many members of the group are returned. This is useful for [deduplication and grouping](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#deduplicate-results-with-distinct). The `distinct` setting is ignored if `attributeForDistinct` is not set.
|
|
11
11
|
module Distinct
|
|
12
12
|
class << self
|
|
13
13
|
# List of class defined in oneOf (OpenAPI v3)
|
|
@@ -0,0 +1,209 @@
|
|
|
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 Composition
|
|
10
|
+
class ExternalProvider
|
|
11
|
+
# Values for non-prefixed configuration placeholders, overriding the composition source's `configurationParams` and the configuration's `defaults`.
|
|
12
|
+
attr_accessor :configuration_params
|
|
13
|
+
|
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
15
|
+
def self.attribute_map
|
|
16
|
+
{
|
|
17
|
+
:configuration_params => :configurationParams
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Attribute type mapping.
|
|
22
|
+
def self.types_mapping
|
|
23
|
+
{
|
|
24
|
+
:configuration_params => :"Hash<String, Object>"
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# List of attributes with nullable: true
|
|
29
|
+
def self.openapi_nullable
|
|
30
|
+
Set.new(
|
|
31
|
+
[]
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Initializes the object
|
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
37
|
+
def initialize(attributes = {})
|
|
38
|
+
if (!attributes.is_a?(Hash))
|
|
39
|
+
raise(
|
|
40
|
+
ArgumentError,
|
|
41
|
+
"The input argument (attributes) must be a hash in `Algolia::ExternalProvider` initialize method"
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
47
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
48
|
+
raise(
|
|
49
|
+
ArgumentError,
|
|
50
|
+
"`#{k}` is not a valid attribute in `Algolia::ExternalProvider`. Please check the name to make sure it's valid. List of attributes: " +
|
|
51
|
+
self.class.attribute_map.keys.inspect
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
h[k.to_sym] = v
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if attributes.key?(:configuration_params)
|
|
59
|
+
if (value = attributes[:configuration_params]).is_a?(Hash)
|
|
60
|
+
self.configuration_params = value
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Checks equality by comparing each attribute.
|
|
66
|
+
# @param [Object] Object to be compared
|
|
67
|
+
def ==(other)
|
|
68
|
+
return true if self.equal?(other)
|
|
69
|
+
self.class == other.class &&
|
|
70
|
+
configuration_params == other.configuration_params
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# @see the `==` method
|
|
74
|
+
# @param [Object] Object to be compared
|
|
75
|
+
def eql?(other)
|
|
76
|
+
self == other
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Calculates hash code according to all attributes.
|
|
80
|
+
# @return [Integer] Hash code
|
|
81
|
+
def hash
|
|
82
|
+
[configuration_params].hash
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Builds the object from hash
|
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
87
|
+
# @return [Object] Returns the model itself
|
|
88
|
+
def self.build_from_hash(attributes)
|
|
89
|
+
return nil unless attributes.is_a?(Hash)
|
|
90
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
91
|
+
transformed_hash = {}
|
|
92
|
+
types_mapping.each_pair do |key, type|
|
|
93
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
94
|
+
transformed_hash[key.to_sym] = nil
|
|
95
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
96
|
+
# check to ensure the input is an array given that the attribute
|
|
97
|
+
# is documented as an array but the input is not
|
|
98
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
99
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
100
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
101
|
+
}
|
|
102
|
+
end
|
|
103
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
104
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
new(transformed_hash)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Deserializes the data based on type
|
|
112
|
+
# @param string type Data type
|
|
113
|
+
# @param string value Value to be deserialized
|
|
114
|
+
# @return [Object] Deserialized data
|
|
115
|
+
def self._deserialize(type, value)
|
|
116
|
+
case type.to_sym
|
|
117
|
+
when :Time
|
|
118
|
+
Time.parse(value)
|
|
119
|
+
when :Date
|
|
120
|
+
Date.parse(value)
|
|
121
|
+
when :String
|
|
122
|
+
value.to_s
|
|
123
|
+
when :Integer
|
|
124
|
+
value.to_i
|
|
125
|
+
when :Float
|
|
126
|
+
value.to_f
|
|
127
|
+
when :Boolean
|
|
128
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
129
|
+
true
|
|
130
|
+
else
|
|
131
|
+
false
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
when :Object
|
|
135
|
+
# generic object (usually a Hash), return directly
|
|
136
|
+
value
|
|
137
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
138
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
139
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
140
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
141
|
+
k_type = Regexp.last_match[:k_type]
|
|
142
|
+
v_type = Regexp.last_match[:v_type]
|
|
143
|
+
{}.tap do |hash|
|
|
144
|
+
value.each do |k, v|
|
|
145
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
# model
|
|
149
|
+
else
|
|
150
|
+
# models (e.g. Pet) or oneOf
|
|
151
|
+
klass = Algolia::Composition.const_get(type)
|
|
152
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
153
|
+
.build_from_hash(value)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Returns the string representation of the object
|
|
158
|
+
# @return [String] String presentation of the object
|
|
159
|
+
def to_s
|
|
160
|
+
to_hash.to_s
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
|
165
|
+
def to_body
|
|
166
|
+
to_hash
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def to_json(*_args)
|
|
170
|
+
to_hash.to_json
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Returns the object in the form of hash
|
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
|
175
|
+
def to_hash
|
|
176
|
+
hash = {}
|
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
178
|
+
value = send(attr)
|
|
179
|
+
if value.nil?
|
|
180
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
181
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
hash[param] = _to_hash(value)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
hash
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Outputs non-array value in the form of hash
|
|
191
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
192
|
+
# @param [Object] value Any valid value
|
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
|
194
|
+
def _to_hash(value)
|
|
195
|
+
if value.is_a?(Array)
|
|
196
|
+
value.map { |v| _to_hash(v) }
|
|
197
|
+
elsif value.is_a?(Hash)
|
|
198
|
+
{}.tap do |hash|
|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
200
|
+
end
|
|
201
|
+
elsif value.respond_to?(:to_hash)
|
|
202
|
+
value.to_hash
|
|
203
|
+
else
|
|
204
|
+
value
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
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 Composition
|
|
10
|
+
class ExternalProviderOrdering
|
|
11
|
+
ALGOLIA_DEFINED = "algoliaDefined".freeze
|
|
12
|
+
PROVIDER_DEFINED = "providerDefined".freeze
|
|
13
|
+
|
|
14
|
+
def self.all_vars
|
|
15
|
+
@all_vars ||= [ALGOLIA_DEFINED, PROVIDER_DEFINED].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 ExternalProviderOrdering.all_vars.include?(value)
|
|
30
|
+
raise "Invalid ENUM value #{value} for class #ExternalProviderOrdering"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -7,9 +7,9 @@ require "time"
|
|
|
7
7
|
|
|
8
8
|
module Algolia
|
|
9
9
|
module Composition
|
|
10
|
-
# An object that contains the extra key-value pairs provided in the injectedItem definition.
|
|
10
|
+
# An object that contains the extra key-value pairs provided in the injectedItem definition. Only present on hits inserted by an injectedItem that defines metadata, either in its `metadata` field or sent by an external source.
|
|
11
11
|
class HitMetadata
|
|
12
|
-
# The key of the injectedItem that inserted this metadata.
|
|
12
|
+
# The key of the injectedItem that inserted this metadata. Only present when the injectedItem's `metadata.hits.addItemKey` is `true`.
|
|
13
13
|
attr_accessor :_injected_item_key
|
|
14
14
|
|
|
15
15
|
attr_accessor :additional_properties
|