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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc3e5a8f05ae1aec49daf5a6d57ce82012c9f0bd8d97491f80af9de068c77b4d
4
- data.tar.gz: 20de9175b058d3f5b46d0a3d675ab8bc0902db0e94fffafcbf4992a2740ea91b
3
+ metadata.gz: f77bf84313db0abf2e0ab5356eb7e4e467847a95b6fccd7525af505c9a36a03b
4
+ data.tar.gz: 21160bde664c846a9ea521cc0958a26e712c9b6a073c1fa2d387240cb5f61da7
5
5
  SHA512:
6
- metadata.gz: 507dc3326da3951a9a4c7ef68514ef8e65d42b90f8a7824a783187e5309e694bb163e1fcc151f4e270a434c84ad965ec318f993ec924b454fff54d88a6c7c4ff
7
- data.tar.gz: 1f77a1c75b00f255bed2a80759af9a5870618e372e3c9484a519c7f196f7e21a69b717a0fd8ac79dfd641434aa712a9d77d303f886fcc1bb2a841f2d4925329b
6
+ metadata.gz: 507469790e2f77f9e7815ba593a272af8ef9ba7aef78f0d1c8629516fe5637af8d632e009ebadc86e58e1d14420db1f4939905ef7517d9918c9675f3655443e1
7
+ data.tar.gz: 916f2b0afcf839b4ab383ab208328e2ff526ff8202424bcd4958a81f627ff0060b9f4dfa0e17c357d52e706e97b08c844682e09cc6c995892a9974837fb0e8b1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [3.0.0.beta.13](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.12...3.0.0.beta.13)
2
+
3
+ - [ac0cadb8a](https://github.com/algolia/api-clients-automation/commit/ac0cadb8a) feat(specs): add transformation copilot to ingestion ([#3479](https://github.com/algolia/api-clients-automation/pull/3479)) by [@Fluf22](https://github.com/Fluf22/)
4
+ - [08a04dec8](https://github.com/algolia/api-clients-automation/commit/08a04dec8) fix(specs): ingestion destination reject indexPrefix ([#3478](https://github.com/algolia/api-clients-automation/pull/3478)) by [@shortcuts](https://github.com/shortcuts/)
5
+ - [cdd673d33](https://github.com/algolia/api-clients-automation/commit/cdd673d33) fix(specs): ingestion destinations and transformations ([#3477](https://github.com/algolia/api-clients-automation/pull/3477)) by [@shortcuts](https://github.com/shortcuts/)
6
+ - [b4742be76](https://github.com/algolia/api-clients-automation/commit/b4742be76) fix(clients): move the license to the root ([#3457](https://github.com/algolia/api-clients-automation/pull/3457)) by [@millotp](https://github.com/millotp/)
7
+ - [e5d14171c](https://github.com/algolia/api-clients-automation/commit/e5d14171c) fix(specs): dictionary entry for stopwords has type property ([#3456](https://github.com/algolia/api-clients-automation/pull/3456)) by [@kai687](https://github.com/kai687/)
8
+ - [7af1e75e9](https://github.com/algolia/api-clients-automation/commit/7af1e75e9) fix(specs): body is not required in multiple batch request ([#3454](https://github.com/algolia/api-clients-automation/pull/3454)) by [@kai687](https://github.com/kai687/)
9
+ - [b90bef261](https://github.com/algolia/api-clients-automation/commit/b90bef261) feat(specs): add runSource endpoint ([#3453](https://github.com/algolia/api-clients-automation/pull/3453)) by [@millotp](https://github.com/millotp/)
10
+ - [27679b7fd](https://github.com/algolia/api-clients-automation/commit/27679b7fd) chore(clients): remove mention of GA ([#3452](https://github.com/algolia/api-clients-automation/pull/3452)) by [@millotp](https://github.com/millotp/)
11
+
1
12
  ## [3.0.0.beta.12](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.11...3.0.0.beta.12)
2
13
 
3
14
  - [e982ddf0a](https://github.com/algolia/api-clients-automation/commit/e982ddf0a) fix(specs): built-in ops accept also int ([#3450](https://github.com/algolia/api-clients-automation/pull/3450)) by [@kai687](https://github.com/kai687/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.0.0.beta.12)
4
+ algolia (3.0.0.beta.13)
5
5
  base64 (>= 0.2.0, < 1)
6
6
  faraday (>= 1.0.1, < 3.0)
7
7
  faraday-net_http_persistent (>= 0.15, < 3)
@@ -2163,19 +2163,91 @@ module Algolia
2163
2163
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::ListTasksResponseV1")
2164
2164
  end
2165
2165
 
2166
+ # Retrieves a list of existing LLM transformation helpers.
2167
+ #
2168
+ # Required API Key ACLs:
2169
+ # - addObject
2170
+ # - deleteIndex
2171
+ # - editSettings
2172
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2173
+ # @return [Http::Response] the response
2174
+ def list_transformation_models_with_http_info(request_options = {})
2175
+ path = "/1/transformations/copilot"
2176
+ query_params = {}
2177
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
2178
+ header_params = {}
2179
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
2180
+
2181
+ post_body = request_options[:debug_body]
2182
+
2183
+ new_options = request_options.merge(
2184
+ :operation => :"IngestionClient.list_transformation_models",
2185
+ :header_params => header_params,
2186
+ :query_params => query_params,
2187
+ :body => post_body,
2188
+ :use_read_transporter => false
2189
+ )
2190
+
2191
+ @api_client.call_api(:GET, path, new_options)
2192
+ end
2193
+
2194
+ # Retrieves a list of existing LLM transformation helpers.
2195
+ #
2196
+ # Required API Key ACLs:
2197
+ # - addObject
2198
+ # - deleteIndex
2199
+ # - editSettings
2200
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2201
+ # @return [TransformationModels]
2202
+ def list_transformation_models(request_options = {})
2203
+ response = list_transformation_models_with_http_info(request_options)
2204
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::TransformationModels")
2205
+ end
2206
+
2166
2207
  # Retrieves a list of transformations.
2167
2208
  #
2168
2209
  # Required API Key ACLs:
2169
2210
  # - addObject
2170
2211
  # - deleteIndex
2171
2212
  # - editSettings
2213
+ # @param items_per_page [Integer] Number of items per page. (default to 10)
2214
+ # @param page [Integer] Page number of the paginated API response.
2172
2215
  # @param sort [SortKeys] Property by which to sort the list. (default to 'desc')
2173
2216
  # @param order [OrderKeys] Sort order of the response, ascending or descending. (default to 'desc')
2174
2217
  # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2175
2218
  # @return [Http::Response] the response
2176
- def list_transformations_with_http_info(sort = nil, order = nil, request_options = {})
2219
+ def list_transformations_with_http_info(
2220
+ items_per_page = nil,
2221
+ page = nil,
2222
+ sort = nil,
2223
+ order = nil,
2224
+ request_options = {}
2225
+ )
2226
+ if @api_client.config.client_side_validation && !items_per_page.nil? && items_per_page > 100
2227
+ raise(
2228
+ ArgumentError,
2229
+ "invalid value for \"\"items_per_page\"\" when calling IngestionClient.list_transformations, must be smaller than or equal to 100."
2230
+ )
2231
+ end
2232
+
2233
+ if @api_client.config.client_side_validation && !items_per_page.nil? && items_per_page < 1
2234
+ raise(
2235
+ ArgumentError,
2236
+ "invalid value for \"\"items_per_page\"\" when calling IngestionClient.list_transformations, must be greater than or equal to 1."
2237
+ )
2238
+ end
2239
+
2240
+ if @api_client.config.client_side_validation && !page.nil? && page < 1
2241
+ raise(
2242
+ ArgumentError,
2243
+ "invalid value for \"\"page\"\" when calling IngestionClient.list_transformations, must be greater than or equal to 1."
2244
+ )
2245
+ end
2246
+
2177
2247
  path = "/1/transformations"
2178
2248
  query_params = {}
2249
+ query_params[:itemsPerPage] = items_per_page unless items_per_page.nil?
2250
+ query_params[:page] = page unless page.nil?
2179
2251
  query_params[:sort] = sort unless sort.nil?
2180
2252
  query_params[:order] = order unless order.nil?
2181
2253
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
@@ -2201,12 +2273,14 @@ module Algolia
2201
2273
  # - addObject
2202
2274
  # - deleteIndex
2203
2275
  # - editSettings
2276
+ # @param items_per_page [Integer] Number of items per page. (default to 10)
2277
+ # @param page [Integer] Page number of the paginated API response.
2204
2278
  # @param sort [SortKeys] Property by which to sort the list. (default to 'desc')
2205
2279
  # @param order [OrderKeys] Sort order of the response, ascending or descending. (default to 'desc')
2206
2280
  # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2207
2281
  # @return [ListTransformationsResponse]
2208
- def list_transformations(sort = nil, order = nil, request_options = {})
2209
- response = list_transformations_with_http_info(sort, order, request_options)
2282
+ def list_transformations(items_per_page = nil, page = nil, sort = nil, order = nil, request_options = {})
2283
+ response = list_transformations_with_http_info(items_per_page, page, sort, order, request_options)
2210
2284
  @api_client.deserialize(
2211
2285
  response.body,
2212
2286
  request_options[:debug_return_type] || "Ingestion::ListTransformationsResponse"
@@ -2267,6 +2341,56 @@ module Algolia
2267
2341
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::RunResponse")
2268
2342
  end
2269
2343
 
2344
+ # Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
2345
+ #
2346
+ # Required API Key ACLs:
2347
+ # - addObject
2348
+ # - deleteIndex
2349
+ # - editSettings
2350
+ # @param source_id [String] Unique identifier of a source. (required)
2351
+ # @param run_source_payload [RunSourcePayload]
2352
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2353
+ # @return [Http::Response] the response
2354
+ def run_source_with_http_info(source_id, run_source_payload = nil, request_options = {})
2355
+ # verify the required parameter 'source_id' is set
2356
+ if @api_client.config.client_side_validation && source_id.nil?
2357
+ raise ArgumentError, "Parameter `source_id` is required when calling `run_source`."
2358
+ end
2359
+
2360
+ path = "/1/sources/{sourceID}/run".sub("{" + "sourceID" + "}", Transport.encode_uri(source_id.to_s))
2361
+ query_params = {}
2362
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
2363
+ header_params = {}
2364
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
2365
+
2366
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(run_source_payload)
2367
+
2368
+ new_options = request_options.merge(
2369
+ :operation => :"IngestionClient.run_source",
2370
+ :header_params => header_params,
2371
+ :query_params => query_params,
2372
+ :body => post_body,
2373
+ :use_read_transporter => false
2374
+ )
2375
+
2376
+ @api_client.call_api(:POST, path, new_options)
2377
+ end
2378
+
2379
+ # Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
2380
+ #
2381
+ # Required API Key ACLs:
2382
+ # - addObject
2383
+ # - deleteIndex
2384
+ # - editSettings
2385
+ # @param source_id [String] Unique identifier of a source. (required)
2386
+ # @param run_source_payload [RunSourcePayload]
2387
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2388
+ # @return [RunSourceResponse]
2389
+ def run_source(source_id, run_source_payload = nil, request_options = {})
2390
+ response = run_source_with_http_info(source_id, run_source_payload, request_options)
2391
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::RunSourceResponse")
2392
+ end
2393
+
2270
2394
  # Runs a task. You can check the status of task runs with the observability endpoints.
2271
2395
  #
2272
2396
  # Required API Key ACLs:
@@ -26,6 +26,8 @@ module Algolia
26
26
  # Universally unique identifier (UUID) of an authentication resource.
27
27
  attr_accessor :authentication_id
28
28
 
29
+ attr_accessor :transformation_ids
30
+
29
31
  class EnumAttributeValidator
30
32
  attr_reader :datatype
31
33
  attr_reader :allowable_values
@@ -57,7 +59,8 @@ module Algolia
57
59
  :input => :input,
58
60
  :created_at => :createdAt,
59
61
  :updated_at => :updatedAt,
60
- :authentication_id => :authenticationID
62
+ :authentication_id => :authenticationID,
63
+ :transformation_ids => :transformationIDs
61
64
  }
62
65
  end
63
66
 
@@ -75,7 +78,8 @@ module Algolia
75
78
  :input => :"DestinationInput",
76
79
  :created_at => :"String",
77
80
  :updated_at => :"String",
78
- :authentication_id => :"String"
81
+ :authentication_id => :"String",
82
+ :transformation_ids => :"Array<String>"
79
83
  }
80
84
  end
81
85
 
@@ -146,6 +150,12 @@ module Algolia
146
150
  if attributes.key?(:authentication_id)
147
151
  self.authentication_id = attributes[:authentication_id]
148
152
  end
153
+
154
+ if attributes.key?(:transformation_ids)
155
+ if (value = attributes[:transformation_ids]).is_a?(Array)
156
+ self.transformation_ids = value
157
+ end
158
+ end
149
159
  end
150
160
 
151
161
  # Checks equality by comparing each attribute.
@@ -159,7 +169,8 @@ module Algolia
159
169
  input == other.input &&
160
170
  created_at == other.created_at &&
161
171
  updated_at == other.updated_at &&
162
- authentication_id == other.authentication_id
172
+ authentication_id == other.authentication_id &&
173
+ transformation_ids == other.transformation_ids
163
174
  end
164
175
 
165
176
  # @see the `==` method
@@ -171,7 +182,7 @@ module Algolia
171
182
  # Calculates hash code according to all attributes.
172
183
  # @return [Integer] Hash code
173
184
  def hash
174
- [destination_id, type, name, input, created_at, updated_at, authentication_id].hash
185
+ [destination_id, type, name, input, created_at, updated_at, authentication_id, transformation_ids].hash
175
186
  end
176
187
 
177
188
  # Builds the object from hash
@@ -17,6 +17,8 @@ module Algolia
17
17
  # Universally unique identifier (UUID) of an authentication resource.
18
18
  attr_accessor :authentication_id
19
19
 
20
+ attr_accessor :transformation_ids
21
+
20
22
  class EnumAttributeValidator
21
23
  attr_reader :datatype
22
24
  attr_reader :allowable_values
@@ -45,7 +47,8 @@ module Algolia
45
47
  :type => :type,
46
48
  :name => :name,
47
49
  :input => :input,
48
- :authentication_id => :authenticationID
50
+ :authentication_id => :authenticationID,
51
+ :transformation_ids => :transformationIDs
49
52
  }
50
53
  end
51
54
 
@@ -60,7 +63,8 @@ module Algolia
60
63
  :type => :"DestinationType",
61
64
  :name => :"String",
62
65
  :input => :"DestinationInput",
63
- :authentication_id => :"String"
66
+ :authentication_id => :"String",
67
+ :transformation_ids => :"Array<String>"
64
68
  }
65
69
  end
66
70
 
@@ -115,6 +119,12 @@ module Algolia
115
119
  if attributes.key?(:authentication_id)
116
120
  self.authentication_id = attributes[:authentication_id]
117
121
  end
122
+
123
+ if attributes.key?(:transformation_ids)
124
+ if (value = attributes[:transformation_ids]).is_a?(Array)
125
+ self.transformation_ids = value
126
+ end
127
+ end
118
128
  end
119
129
 
120
130
  # Checks equality by comparing each attribute.
@@ -125,7 +135,8 @@ module Algolia
125
135
  type == other.type &&
126
136
  name == other.name &&
127
137
  input == other.input &&
128
- authentication_id == other.authentication_id
138
+ authentication_id == other.authentication_id &&
139
+ transformation_ids == other.transformation_ids
129
140
  end
130
141
 
131
142
  # @see the `==` method
@@ -137,7 +148,7 @@ module Algolia
137
148
  # Calculates hash code according to all attributes.
138
149
  # @return [Integer] Hash code
139
150
  def hash
140
- [type, name, input, authentication_id].hash
151
+ [type, name, input, authentication_id, transformation_ids].hash
141
152
  end
142
153
 
143
154
  # Builds the object from hash
@@ -10,8 +10,7 @@ module Algolia
10
10
  # List of class defined in oneOf (OpenAPI v3)
11
11
  def openapi_one_of
12
12
  [
13
- :"DestinationIndexName",
14
- :"DestinationIndexPrefix"
13
+ :"DestinationIndexName"
15
14
  ]
16
15
  end
17
16
 
@@ -17,6 +17,8 @@ module Algolia
17
17
  # Universally unique identifier (UUID) of an authentication resource.
18
18
  attr_accessor :authentication_id
19
19
 
20
+ attr_accessor :transformation_ids
21
+
20
22
  class EnumAttributeValidator
21
23
  attr_reader :datatype
22
24
  attr_reader :allowable_values
@@ -45,7 +47,8 @@ module Algolia
45
47
  :type => :type,
46
48
  :name => :name,
47
49
  :input => :input,
48
- :authentication_id => :authenticationID
50
+ :authentication_id => :authenticationID,
51
+ :transformation_ids => :transformationIDs
49
52
  }
50
53
  end
51
54
 
@@ -60,7 +63,8 @@ module Algolia
60
63
  :type => :"DestinationType",
61
64
  :name => :"String",
62
65
  :input => :"DestinationInput",
63
- :authentication_id => :"String"
66
+ :authentication_id => :"String",
67
+ :transformation_ids => :"Array<String>"
64
68
  }
65
69
  end
66
70
 
@@ -109,6 +113,12 @@ module Algolia
109
113
  if attributes.key?(:authentication_id)
110
114
  self.authentication_id = attributes[:authentication_id]
111
115
  end
116
+
117
+ if attributes.key?(:transformation_ids)
118
+ if (value = attributes[:transformation_ids]).is_a?(Array)
119
+ self.transformation_ids = value
120
+ end
121
+ end
112
122
  end
113
123
 
114
124
  # Checks equality by comparing each attribute.
@@ -119,7 +129,8 @@ module Algolia
119
129
  type == other.type &&
120
130
  name == other.name &&
121
131
  input == other.input &&
122
- authentication_id == other.authentication_id
132
+ authentication_id == other.authentication_id &&
133
+ transformation_ids == other.transformation_ids
123
134
  end
124
135
 
125
136
  # @see the `==` method
@@ -131,7 +142,7 @@ module Algolia
131
142
  # Calculates hash code according to all attributes.
132
143
  # @return [Integer] Hash code
133
144
  def hash
134
- [type, name, input, authentication_id].hash
145
+ [type, name, input, authentication_id, transformation_ids].hash
135
146
  end
136
147
 
137
148
  # 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 Ingestion
8
+ class EntityType
9
+ PRODUCT = "product".freeze
10
+ COLLECTION = "collection".freeze
11
+
12
+ def self.all_vars
13
+ @all_vars ||= [PRODUCT, COLLECTION].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 EntityType.all_vars.include?(value)
28
+ raise "Invalid ENUM value #{value} for class #EntityType"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,254 @@
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