algolia 3.40.0 → 3.41.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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/Bug_report.yml +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile.lock +4 -4
  5. data/lib/algolia/api/agent_studio_client.rb +2364 -0
  6. data/lib/algolia/models/agent-studio/advanced_syntax_features.rb +34 -0
  7. data/lib/algolia/models/agent-studio/agent_completion_algolia_params.rb +221 -0
  8. data/lib/algolia/models/agent-studio/agent_completion_request.rb +247 -0
  9. data/lib/algolia/models/agent-studio/agent_config_create.rb +288 -0
  10. data/lib/algolia/models/agent-studio/agent_config_update.rb +294 -0
  11. data/lib/algolia/models/agent-studio/agent_status.rb +34 -0
  12. data/lib/algolia/models/agent-studio/agent_test_configuration.rb +271 -0
  13. data/lib/algolia/models/agent-studio/agent_with_version_response.rb +370 -0
  14. data/lib/algolia/models/agent-studio/algolia_display_results_tool_config.rb +254 -0
  15. data/lib/algolia/models/agent-studio/algolia_recommend_tool_config_input.rb +242 -0
  16. data/lib/algolia/models/agent-studio/algolia_recommend_tool_index_config.rb +228 -0
  17. data/lib/algolia/models/agent-studio/algolia_search_tool_config.rb +232 -0
  18. data/lib/algolia/models/agent-studio/algolia_search_tool_index_config.rb +249 -0
  19. data/lib/algolia/models/agent-studio/allowed_domain_bulk_delete.rb +212 -0
  20. data/lib/algolia/models/agent-studio/allowed_domain_bulk_insert.rb +212 -0
  21. data/lib/algolia/models/agent-studio/allowed_domain_create.rb +210 -0
  22. data/lib/algolia/models/agent-studio/allowed_domain_list_response.rb +211 -0
  23. data/lib/algolia/models/agent-studio/allowed_domain_response.rb +264 -0
  24. data/lib/algolia/models/agent-studio/alternatives_as_exact.rb +36 -0
  25. data/lib/algolia/models/agent-studio/anthropic_provider_input.rb +220 -0
  26. data/lib/algolia/models/agent-studio/application_config_patch.rb +209 -0
  27. data/lib/algolia/models/agent-studio/application_config_response.rb +208 -0
  28. data/lib/algolia/models/agent-studio/around_precision_union.rb +108 -0
  29. data/lib/algolia/models/agent-studio/around_radius_union.rb +108 -0
  30. data/lib/algolia/models/agent-studio/assistant_message_v4.rb +252 -0
  31. data/lib/algolia/models/agent-studio/assistant_message_v5.rb +228 -0
  32. data/lib/algolia/models/agent-studio/assistant_part_v4.rb +110 -0
  33. data/lib/algolia/models/agent-studio/assistant_part_v5.rb +110 -0
  34. data/lib/algolia/models/agent-studio/azure_open_ai_provider_input.rb +243 -0
  35. data/lib/algolia/models/agent-studio/base_provider_input.rb +209 -0
  36. data/lib/algolia/models/agent-studio/client_side_tool_config.rb +241 -0
  37. data/lib/algolia/models/agent-studio/client_tools_args_schema.rb +228 -0
  38. data/lib/algolia/models/agent-studio/compatibility_mode.rb +34 -0
  39. data/lib/algolia/models/agent-studio/conversation_base_response.rb +355 -0
  40. data/lib/algolia/models/agent-studio/conversation_full_response.rb +369 -0
  41. data/lib/algolia/models/agent-studio/conversation_metadata.rb +209 -0
  42. data/lib/algolia/models/agent-studio/distinct_union.rb +108 -0
  43. data/lib/algolia/models/agent-studio/episode.rb +243 -0
  44. data/lib/algolia/models/agent-studio/error_base.rb +207 -0
  45. data/lib/algolia/models/agent-studio/exact_on_single_word_query.rb +35 -0
  46. data/lib/algolia/models/agent-studio/facet_filters_union.rb +108 -0
  47. data/lib/algolia/models/agent-studio/facets.rb +208 -0
  48. data/lib/algolia/models/agent-studio/facets_param.rb +220 -0
  49. data/lib/algolia/models/agent-studio/facets_union.rb +108 -0
  50. data/lib/algolia/models/agent-studio/feedback_creation_request.rb +251 -0
  51. data/lib/algolia/models/agent-studio/feedback_response.rb +297 -0
  52. data/lib/algolia/models/agent-studio/ignore_plurals_union.rb +108 -0
  53. data/lib/algolia/models/agent-studio/index_search_parameters.rb +267 -0
  54. data/lib/algolia/models/agent-studio/inside_bounding_box_union.rb +108 -0
  55. data/lib/algolia/models/agent-studio/inside_polygon_union.rb +108 -0
  56. data/lib/algolia/models/agent-studio/location_item_union.rb +108 -0
  57. data/lib/algolia/models/agent-studio/mcp_server_tool_config.rb +276 -0
  58. data/lib/algolia/models/agent-studio/mcp_tool_config.rb +218 -0
  59. data/lib/algolia/models/agent-studio/memory_record.rb +368 -0
  60. data/lib/algolia/models/agent-studio/memory_type.rb +34 -0
  61. data/lib/algolia/models/agent-studio/message_part.rb +132 -0
  62. data/lib/algolia/models/agent-studio/message_response.rb +309 -0
  63. data/lib/algolia/models/agent-studio/message_role.rb +34 -0
  64. data/lib/algolia/models/agent-studio/message_v4.rb +117 -0
  65. data/lib/algolia/models/agent-studio/message_v5.rb +117 -0
  66. data/lib/algolia/models/agent-studio/messages_union.rb +108 -0
  67. data/lib/algolia/models/agent-studio/number_param.rb +230 -0
  68. data/lib/algolia/models/agent-studio/number_param_constraint.rb +219 -0
  69. data/lib/algolia/models/agent-studio/numeric_filters_union.rb +108 -0
  70. data/lib/algolia/models/agent-studio/open_ai_compatible_provider_input.rb +232 -0
  71. data/lib/algolia/models/agent-studio/open_ai_provider_input.rb +220 -0
  72. data/lib/algolia/models/agent-studio/optional_filters_union.rb +108 -0
  73. data/lib/algolia/models/agent-studio/optional_words_union.rb +108 -0
  74. data/lib/algolia/models/agent-studio/paginated_agents_response.rb +221 -0
  75. data/lib/algolia/models/agent-studio/paginated_conversations_response.rb +221 -0
  76. data/lib/algolia/models/agent-studio/paginated_provider_authentications_response.rb +221 -0
  77. data/lib/algolia/models/agent-studio/paginated_secret_keys_response.rb +221 -0
  78. data/lib/algolia/models/agent-studio/pagination_metadata.rb +241 -0
  79. data/lib/algolia/models/agent-studio/provider_authentication_create.rb +230 -0
  80. data/lib/algolia/models/agent-studio/provider_authentication_patch.rb +218 -0
  81. data/lib/algolia/models/agent-studio/provider_authentication_response.rb +274 -0
  82. data/lib/algolia/models/agent-studio/provider_input.rb +111 -0
  83. data/lib/algolia/models/agent-studio/provider_input_nullable.rb +111 -0
  84. data/lib/algolia/models/agent-studio/provider_name.rb +38 -0
  85. data/lib/algolia/models/agent-studio/query_type.rb +35 -0
  86. data/lib/algolia/models/agent-studio/re_ranking_apply_filter_union.rb +108 -0
  87. data/lib/algolia/models/agent-studio/reasoning_part.rb +219 -0
  88. data/lib/algolia/models/agent-studio/reasoning_part_v4.rb +217 -0
  89. data/lib/algolia/models/agent-studio/reasoning_part_v5.rb +217 -0
  90. data/lib/algolia/models/agent-studio/remove_stop_words_union.rb +108 -0
  91. data/lib/algolia/models/agent-studio/remove_words_if_no_results.rb +36 -0
  92. data/lib/algolia/models/agent-studio/search_parameters.rb +950 -0
  93. data/lib/algolia/models/agent-studio/search_parameters_overrides.rb +286 -0
  94. data/lib/algolia/models/agent-studio/secret_key_create.rb +222 -0
  95. data/lib/algolia/models/agent-studio/secret_key_patch.rb +223 -0
  96. data/lib/algolia/models/agent-studio/secret_key_response.rb +287 -0
  97. data/lib/algolia/models/agent-studio/start_part.rb +208 -0
  98. data/lib/algolia/models/agent-studio/start_step_part.rb +208 -0
  99. data/lib/algolia/models/agent-studio/step_start_part_v4.rb +206 -0
  100. data/lib/algolia/models/agent-studio/step_start_part_v5.rb +206 -0
  101. data/lib/algolia/models/agent-studio/string_array_param.rb +242 -0
  102. data/lib/algolia/models/agent-studio/string_array_param_constraint.rb +211 -0
  103. data/lib/algolia/models/agent-studio/supported_language.rb +169 -0
  104. data/lib/algolia/models/agent-studio/tag_filters_union.rb +108 -0
  105. data/lib/algolia/models/agent-studio/text_param.rb +220 -0
  106. data/lib/algolia/models/agent-studio/text_part.rb +216 -0
  107. data/lib/algolia/models/agent-studio/text_part_v4.rb +217 -0
  108. data/lib/algolia/models/agent-studio/text_part_v5.rb +217 -0
  109. data/lib/algolia/models/agent-studio/tool_approval_request_part.rb +285 -0
  110. data/lib/algolia/models/agent-studio/tool_call_part.rb +265 -0
  111. data/lib/algolia/models/agent-studio/tool_config.rb +108 -0
  112. data/lib/algolia/models/agent-studio/tool_config_input.rb +129 -0
  113. data/lib/algolia/models/agent-studio/tool_invocation_part_v4.rb +217 -0
  114. data/lib/algolia/models/agent-studio/tool_invocation_v4.rb +309 -0
  115. data/lib/algolia/models/agent-studio/tool_part_v5.rb +309 -0
  116. data/lib/algolia/models/agent-studio/tool_result_output.rb +221 -0
  117. data/lib/algolia/models/agent-studio/tool_result_output_type.rb +37 -0
  118. data/lib/algolia/models/agent-studio/tool_result_part.rb +254 -0
  119. data/lib/algolia/models/agent-studio/tool_state.rb +36 -0
  120. data/lib/algolia/models/agent-studio/typo_tolerance_enum.rb +36 -0
  121. data/lib/algolia/models/agent-studio/typo_tolerance_union.rb +108 -0
  122. data/lib/algolia/models/agent-studio/unknown_tool_config.rb +220 -0
  123. data/lib/algolia/models/agent-studio/user_data_response.rb +223 -0
  124. data/lib/algolia/models/agent-studio/user_message_metadata_v5.rb +209 -0
  125. data/lib/algolia/models/agent-studio/user_message_v4.rb +250 -0
  126. data/lib/algolia/models/agent-studio/user_message_v5.rb +237 -0
  127. data/lib/algolia/models/agent-studio/validation_error.rb +252 -0
  128. data/lib/algolia/models/agent-studio/vote_enum.rb +34 -0
  129. data/lib/algolia/version.rb +1 -1
  130. metadata +125 -1
@@ -0,0 +1,208 @@
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
+ class StartStepPart
11
+ attr_accessor :type
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :type => :type
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.types_mapping
22
+ {
23
+ :type => :"String"
24
+ }
25
+ end
26
+
27
+ # List of attributes with nullable: true
28
+ def self.openapi_nullable
29
+ Set.new(
30
+ []
31
+ )
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ raise(
39
+ ArgumentError,
40
+ "The input argument (attributes) must be a hash in `Algolia::StartStepPart` initialize method"
41
+ )
42
+ end
43
+
44
+ # check to see if the attribute exists and convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h|
46
+ if (!self.class.attribute_map.key?(k.to_sym))
47
+ raise(
48
+ ArgumentError,
49
+ "`#{k}` is not a valid attribute in `Algolia::StartStepPart`. Please check the name to make sure it's valid. List of attributes: " +
50
+ self.class.attribute_map.keys.inspect
51
+ )
52
+ end
53
+
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:type)
58
+ self.type = attributes[:type]
59
+ else
60
+ self.type = nil
61
+ end
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(other)
67
+ return true if self.equal?(other)
68
+ self.class == other.class &&
69
+ type == other.type
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(other)
75
+ self == other
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Integer] Hash code
80
+ def hash
81
+ [type].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def self.build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ attributes = attributes.transform_keys(&:to_sym)
90
+ transformed_hash = {}
91
+ types_mapping.each_pair do |key, type|
92
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
93
+ transformed_hash[key.to_sym] = nil
94
+ elsif type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[attribute_map[key]].is_a?(Array)
98
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
99
+ _deserialize(::Regexp.last_match(1), v)
100
+ }
101
+ end
102
+ elsif !attributes[attribute_map[key]].nil?
103
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
104
+ end
105
+ end
106
+
107
+ new(transformed_hash)
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def self._deserialize(type, value)
115
+ case type.to_sym
116
+ when :Time
117
+ Time.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :Boolean
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ # model
148
+ else
149
+ # models (e.g. Pet) or oneOf
150
+ klass = Algolia::AgentStudio.const_get(type)
151
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
152
+ .build_from_hash(value)
153
+ end
154
+ end
155
+
156
+ # Returns the string representation of the object
157
+ # @return [String] String presentation of the object
158
+ def to_s
159
+ to_hash.to_s
160
+ end
161
+
162
+ # to_body is an alias to to_hash (backward compatibility)
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_body
165
+ to_hash
166
+ end
167
+
168
+ def to_json(*_args)
169
+ to_hash.to_json
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to?(:to_hash)
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,206 @@
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
+ class StepStartPartV4
11
+ attr_accessor :type
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :type => :type
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.types_mapping
22
+ {
23
+ :type => :"String"
24
+ }
25
+ end
26
+
27
+ # List of attributes with nullable: true
28
+ def self.openapi_nullable
29
+ Set.new(
30
+ []
31
+ )
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ raise(
39
+ ArgumentError,
40
+ "The input argument (attributes) must be a hash in `Algolia::StepStartPartV4` initialize method"
41
+ )
42
+ end
43
+
44
+ # check to see if the attribute exists and convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h|
46
+ if (!self.class.attribute_map.key?(k.to_sym))
47
+ raise(
48
+ ArgumentError,
49
+ "`#{k}` is not a valid attribute in `Algolia::StepStartPartV4`. Please check the name to make sure it's valid. List of attributes: " +
50
+ self.class.attribute_map.keys.inspect
51
+ )
52
+ end
53
+
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:type)
58
+ self.type = attributes[:type]
59
+ end
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(other)
65
+ return true if self.equal?(other)
66
+ self.class == other.class &&
67
+ type == other.type
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(other)
73
+ self == other
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Integer] Hash code
78
+ def hash
79
+ [type].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def self.build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ attributes = attributes.transform_keys(&:to_sym)
88
+ transformed_hash = {}
89
+ types_mapping.each_pair do |key, type|
90
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
91
+ transformed_hash[key.to_sym] = nil
92
+ elsif type =~ /\AArray<(.*)>/i
93
+ # check to ensure the input is an array given that the attribute
94
+ # is documented as an array but the input is not
95
+ if attributes[attribute_map[key]].is_a?(Array)
96
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
97
+ _deserialize(::Regexp.last_match(1), v)
98
+ }
99
+ end
100
+ elsif !attributes[attribute_map[key]].nil?
101
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
102
+ end
103
+ end
104
+
105
+ new(transformed_hash)
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def self._deserialize(type, value)
113
+ case type.to_sym
114
+ when :Time
115
+ Time.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+
131
+ when :Object
132
+ # generic object (usually a Hash), return directly
133
+ value
134
+ when /\AArray<(?<inner_type>.+)>\z/
135
+ inner_type = Regexp.last_match[:inner_type]
136
+ value.map { |v| _deserialize(inner_type, v) }
137
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
138
+ k_type = Regexp.last_match[:k_type]
139
+ v_type = Regexp.last_match[:v_type]
140
+ {}.tap do |hash|
141
+ value.each do |k, v|
142
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
143
+ end
144
+ end
145
+ # model
146
+ else
147
+ # models (e.g. Pet) or oneOf
148
+ klass = Algolia::AgentStudio.const_get(type)
149
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
150
+ .build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ # Returns the string representation of the object
155
+ # @return [String] String presentation of the object
156
+ def to_s
157
+ to_hash.to_s
158
+ end
159
+
160
+ # to_body is an alias to to_hash (backward compatibility)
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ def to_json(*_args)
167
+ to_hash.to_json
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = send(attr)
176
+ if value.nil?
177
+ is_nullable = self.class.openapi_nullable.include?(attr)
178
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
179
+ end
180
+
181
+ hash[param] = _to_hash(value)
182
+ end
183
+
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to?(:to_hash)
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
@@ -0,0 +1,206 @@
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
+ class StepStartPartV5
11
+ attr_accessor :type
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :type => :type
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.types_mapping
22
+ {
23
+ :type => :"String"
24
+ }
25
+ end
26
+
27
+ # List of attributes with nullable: true
28
+ def self.openapi_nullable
29
+ Set.new(
30
+ []
31
+ )
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ raise(
39
+ ArgumentError,
40
+ "The input argument (attributes) must be a hash in `Algolia::StepStartPartV5` initialize method"
41
+ )
42
+ end
43
+
44
+ # check to see if the attribute exists and convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h|
46
+ if (!self.class.attribute_map.key?(k.to_sym))
47
+ raise(
48
+ ArgumentError,
49
+ "`#{k}` is not a valid attribute in `Algolia::StepStartPartV5`. Please check the name to make sure it's valid. List of attributes: " +
50
+ self.class.attribute_map.keys.inspect
51
+ )
52
+ end
53
+
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:type)
58
+ self.type = attributes[:type]
59
+ end
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(other)
65
+ return true if self.equal?(other)
66
+ self.class == other.class &&
67
+ type == other.type
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(other)
73
+ self == other
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Integer] Hash code
78
+ def hash
79
+ [type].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def self.build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ attributes = attributes.transform_keys(&:to_sym)
88
+ transformed_hash = {}
89
+ types_mapping.each_pair do |key, type|
90
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
91
+ transformed_hash[key.to_sym] = nil
92
+ elsif type =~ /\AArray<(.*)>/i
93
+ # check to ensure the input is an array given that the attribute
94
+ # is documented as an array but the input is not
95
+ if attributes[attribute_map[key]].is_a?(Array)
96
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
97
+ _deserialize(::Regexp.last_match(1), v)
98
+ }
99
+ end
100
+ elsif !attributes[attribute_map[key]].nil?
101
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
102
+ end
103
+ end
104
+
105
+ new(transformed_hash)
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def self._deserialize(type, value)
113
+ case type.to_sym
114
+ when :Time
115
+ Time.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+
131
+ when :Object
132
+ # generic object (usually a Hash), return directly
133
+ value
134
+ when /\AArray<(?<inner_type>.+)>\z/
135
+ inner_type = Regexp.last_match[:inner_type]
136
+ value.map { |v| _deserialize(inner_type, v) }
137
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
138
+ k_type = Regexp.last_match[:k_type]
139
+ v_type = Regexp.last_match[:v_type]
140
+ {}.tap do |hash|
141
+ value.each do |k, v|
142
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
143
+ end
144
+ end
145
+ # model
146
+ else
147
+ # models (e.g. Pet) or oneOf
148
+ klass = Algolia::AgentStudio.const_get(type)
149
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
150
+ .build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ # Returns the string representation of the object
155
+ # @return [String] String presentation of the object
156
+ def to_s
157
+ to_hash.to_s
158
+ end
159
+
160
+ # to_body is an alias to to_hash (backward compatibility)
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ def to_json(*_args)
167
+ to_hash.to_json
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = send(attr)
176
+ if value.nil?
177
+ is_nullable = self.class.openapi_nullable.include?(attr)
178
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
179
+ end
180
+
181
+ hash[param] = _to_hash(value)
182
+ end
183
+
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to?(:to_hash)
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end