algolia 3.3.2 → 3.3.3

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