algolia 3.0.0.beta.12 → 3.0.0.beta.13

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