algolia 3.16.0 → 3.17.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 432beb021b2f7908ad448bfc26d2f28512b4f821c6b7bf0db59eeb4b6a1c4b29
4
- data.tar.gz: 7706d8f947136a530827db3eeb5f44135a012216698f8a9494a4f547571a93e5
3
+ metadata.gz: 521adda141013797559fd8a63d02d994dee5f1a27b34c48bbab39662b91bd881
4
+ data.tar.gz: 3eda8b67c4f45021d8f568c8982e5123b1812150e655aea093fe0beb1f29f32d
5
5
  SHA512:
6
- metadata.gz: 14b6ce6fd8f4e7692e9b2b5f97b1a853195f07337fa9586effb1dca87518245db4e573e2dc5220263afc2d3892a8ffa536a970cf430ff4b70b5a3b96d4d26ed6
7
- data.tar.gz: c1071fe5fe9a40c643ff7ba59c8d79f7cc5c0bb22d4d8b19420921107257730db528e0fc7e880f09c67241c4df7ebf5e842dd8dc9b5f79381a8a172c3b73cdbc
6
+ metadata.gz: 1b545493edbbf9c2a00917a13bd5fa5f2bc976a32133c712492d66d18a715bcb10a9e483fcd252c954ca67f7c191ff781e0581060461c2cff1b09f8917eda610
7
+ data.tar.gz: 2f6a075730cba33eb21bbdced80c7c2f99242f356535f713bfe4acfa9f4bdad1edbd4671a5c8dfcae16beeaed757c53b259865b830ed7ee5457a4570d071c6dd
@@ -21,7 +21,7 @@ jobs:
21
21
  - name: Install Ruby
22
22
  uses: ruby/setup-ruby@v1
23
23
  with:
24
- ruby-version: 3.4.3
24
+ ruby-version: 3.4.4
25
25
  bundler-cache: true
26
26
 
27
27
  - uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [3.17.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.16.0...3.17.0)
2
+
3
+ - [9db03b532b](https://github.com/algolia/api-clients-automation/commit/9db03b532b) fix(specs): typo ([#4854](https://github.com/algolia/api-clients-automation/pull/4854)) by [@kai687](https://github.com/kai687/)
4
+ - [db02a51d50](https://github.com/algolia/api-clients-automation/commit/db02a51d50) chore(deps): dependencies 2025-05-19 ([#4853](https://github.com/algolia/api-clients-automation/pull/4853)) by [@algolia-bot](https://github.com/algolia-bot/)
5
+ - [90b49b1e1b](https://github.com/algolia/api-clients-automation/commit/90b49b1e1b) feat(specs): add global push endpoint ([#4855](https://github.com/algolia/api-clients-automation/pull/4855)) by [@shortcuts](https://github.com/shortcuts/)
6
+ - [cf416e6b91](https://github.com/algolia/api-clients-automation/commit/cf416e6b91) fix(specs): updated watchResponse ([#4879](https://github.com/algolia/api-clients-automation/pull/4879)) by [@shortcuts](https://github.com/shortcuts/)
7
+ - [06ad06e4a8](https://github.com/algolia/api-clients-automation/commit/06ad06e4a8) feat(specs): update transformation specs for no-code ([#4901](https://github.com/algolia/api-clients-automation/pull/4901)) by [@mehmetaligok](https://github.com/mehmetaligok/)
8
+ - [4ec0e13e28](https://github.com/algolia/api-clients-automation/commit/4ec0e13e28) fix(specs): more indexing actions to push ([#4930](https://github.com/algolia/api-clients-automation/pull/4930)) by [@shortcuts](https://github.com/shortcuts/)
9
+ - [1951e4d127](https://github.com/algolia/api-clients-automation/commit/1951e4d127) fix(specs): wrong ACL for getSettings ([#4933](https://github.com/algolia/api-clients-automation/pull/4933)) by [@kai687](https://github.com/kai687/)
10
+
1
11
  ## [3.16.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.15.5...3.16.0)
2
12
 
3
13
  - [bebb56e0b9](https://github.com/algolia/api-clients-automation/commit/bebb56e0b9) fix(specs): add x-acl to insights endpoints ([#4822](https://github.com/algolia/api-clients-automation/pull/4822)) 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.16.0)
4
+ algolia (3.17.0)
5
5
  base64 (>= 0.2.0, < 1)
6
6
  faraday (>= 1.0.1, < 3.0)
7
7
  faraday-net_http_persistent (>= 0.15, < 3)
@@ -2138,14 +2138,73 @@ module Algolia
2138
2138
  )
2139
2139
  end
2140
2140
 
2141
- # Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
2141
+ # Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `pushTask`, but requires an `indexName` instead of a `taskID`. If zero or many tasks are found, an error will be returned.
2142
+ #
2143
+ # Required API Key ACLs:
2144
+ # - addObject
2145
+ # - deleteIndex
2146
+ # - editSettings
2147
+ # @param index_name [String] Name of the index on which to perform the operation. (required)
2148
+ # @param push_task_payload [PushTaskPayload] (required)
2149
+ # @param watch [Boolean] When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
2150
+ # @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)
2151
+ # @return [Http::Response] the response
2152
+ def push_with_http_info(index_name, push_task_payload, watch = nil, request_options = {})
2153
+ # verify the required parameter 'index_name' is set
2154
+ if @api_client.config.client_side_validation && index_name.nil?
2155
+ raise ArgumentError, "Parameter `index_name` is required when calling `push`."
2156
+ end
2157
+ # verify the required parameter 'push_task_payload' is set
2158
+ if @api_client.config.client_side_validation && push_task_payload.nil?
2159
+ raise ArgumentError, "Parameter `push_task_payload` is required when calling `push`."
2160
+ end
2161
+
2162
+ path = "/1/push/{indexName}".sub("{" + "indexName" + "}", Transport.encode_uri(index_name.to_s))
2163
+ query_params = {}
2164
+ query_params[:watch] = watch unless watch.nil?
2165
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
2166
+ header_params = {}
2167
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
2168
+ request_options[:timeout] ||= 180000
2169
+ request_options[:connect_timeout] ||= 180000
2170
+
2171
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(push_task_payload)
2172
+
2173
+ new_options = request_options.merge(
2174
+ :operation => :"IngestionClient.push",
2175
+ :header_params => header_params,
2176
+ :query_params => query_params,
2177
+ :body => post_body,
2178
+ :use_read_transporter => false
2179
+ )
2180
+
2181
+ @api_client.call_api(:POST, path, new_options)
2182
+ end
2183
+
2184
+ # Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `pushTask`, but requires an `indexName` instead of a `taskID`. If zero or many tasks are found, an error will be returned.
2185
+ #
2186
+ # Required API Key ACLs:
2187
+ # - addObject
2188
+ # - deleteIndex
2189
+ # - editSettings
2190
+ # @param index_name [String] Name of the index on which to perform the operation. (required)
2191
+ # @param push_task_payload [PushTaskPayload] (required)
2192
+ # @param watch [Boolean] When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
2193
+ # @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)
2194
+ # @return [WatchResponse]
2195
+ def push(index_name, push_task_payload, watch = nil, request_options = {})
2196
+ response = push_with_http_info(index_name, push_task_payload, watch, request_options)
2197
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::WatchResponse")
2198
+ end
2199
+
2200
+ # Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `push`, but requires a `taskID` instead of a `indexName`, which is useful when many `destinations` target the same `indexName`.
2142
2201
  #
2143
2202
  # Required API Key ACLs:
2144
2203
  # - addObject
2145
2204
  # - deleteIndex
2146
2205
  # - editSettings
2147
2206
  # @param task_id [String] Unique identifier of a task. (required)
2148
- # @param push_task_payload [PushTaskPayload] Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. (required)
2207
+ # @param push_task_payload [PushTaskPayload] (required)
2149
2208
  # @param watch [Boolean] When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
2150
2209
  # @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)
2151
2210
  # @return [Http::Response] the response
@@ -2181,14 +2240,14 @@ module Algolia
2181
2240
  @api_client.call_api(:POST, path, new_options)
2182
2241
  end
2183
2242
 
2184
- # Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
2243
+ # Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `push`, but requires a `taskID` instead of a `indexName`, which is useful when many `destinations` target the same `indexName`.
2185
2244
  #
2186
2245
  # Required API Key ACLs:
2187
2246
  # - addObject
2188
2247
  # - deleteIndex
2189
2248
  # - editSettings
2190
2249
  # @param task_id [String] Unique identifier of a task. (required)
2191
- # @param push_task_payload [PushTaskPayload] Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. (required)
2250
+ # @param push_task_payload [PushTaskPayload] (required)
2192
2251
  # @param watch [Boolean] When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
2193
2252
  # @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)
2194
2253
  # @return [WatchResponse]
@@ -1501,7 +1501,7 @@ module Algolia
1501
1501
  # Retrieves an object with non-null index settings.
1502
1502
  #
1503
1503
  # Required API Key ACLs:
1504
- # - search
1504
+ # - settings
1505
1505
  # @param index_name [String] Name of the index on which to perform the operation. (required)
1506
1506
  # @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)
1507
1507
  # @return [Http::Response] the response
@@ -1533,7 +1533,7 @@ module Algolia
1533
1533
  # Retrieves an object with non-null index settings.
1534
1534
  #
1535
1535
  # Required API Key ACLs:
1536
- # - search
1536
+ # - settings
1537
1537
  # @param index_name [String] Name of the index on which to perform the operation. (required)
1538
1538
  # @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)
1539
1539
  # @return [SettingsResponse]
@@ -14,9 +14,13 @@ module Algolia
14
14
  # The authentications associated with the current transformation.
15
15
  attr_accessor :authentication_ids
16
16
 
17
- # The source code of the transformation.
17
+ # It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code.
18
18
  attr_accessor :code
19
19
 
20
+ attr_accessor :type
21
+
22
+ attr_accessor :input
23
+
20
24
  # The uniquely identified name of your transformation.
21
25
  attr_accessor :name
22
26
 
@@ -38,6 +42,8 @@ module Algolia
38
42
  :transformation_id => :transformationID,
39
43
  :authentication_ids => :authenticationIDs,
40
44
  :code => :code,
45
+ :type => :type,
46
+ :input => :input,
41
47
  :name => :name,
42
48
  :description => :description,
43
49
  :owner => :owner,
@@ -52,6 +58,8 @@ module Algolia
52
58
  :transformation_id => :"String",
53
59
  :authentication_ids => :"Array<String>",
54
60
  :code => :"String",
61
+ :type => :"TransformationType",
62
+ :input => :"TransformationInput",
55
63
  :name => :"String",
56
64
  :description => :"String",
57
65
  :owner => :"String",
@@ -110,6 +118,14 @@ module Algolia
110
118
  self.code = nil
111
119
  end
112
120
 
121
+ if attributes.key?(:type)
122
+ self.type = attributes[:type]
123
+ end
124
+
125
+ if attributes.key?(:input)
126
+ self.input = attributes[:input]
127
+ end
128
+
113
129
  if attributes.key?(:name)
114
130
  self.name = attributes[:name]
115
131
  else
@@ -145,6 +161,8 @@ module Algolia
145
161
  transformation_id == other.transformation_id &&
146
162
  authentication_ids == other.authentication_ids &&
147
163
  code == other.code &&
164
+ type == other.type &&
165
+ input == other.input &&
148
166
  name == other.name &&
149
167
  description == other.description &&
150
168
  owner == other.owner &&
@@ -161,7 +179,7 @@ module Algolia
161
179
  # Calculates hash code according to all attributes.
162
180
  # @return [Integer] Hash code
163
181
  def hash
164
- [transformation_id, authentication_ids, code, name, description, owner, created_at, updated_at].hash
182
+ [transformation_id, authentication_ids, code, type, input, name, description, owner, created_at, updated_at].hash
165
183
  end
166
184
 
167
185
  # Builds the object from hash
@@ -0,0 +1,212 @@
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 Ingestion
10
+ # Input for a transformation that contains the source code of the transformation.
11
+ class TransformationCode
12
+ # The source code of the transformation.
13
+ attr_accessor :code
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :code => :code
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.types_mapping
24
+ {
25
+ :code => :"String"
26
+ }
27
+ end
28
+
29
+ # List of attributes with nullable: true
30
+ def self.openapi_nullable
31
+ Set.new(
32
+ []
33
+ )
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ if (!attributes.is_a?(Hash))
40
+ raise(
41
+ ArgumentError,
42
+ "The input argument (attributes) must be a hash in `Algolia::TransformationCode` initialize method"
43
+ )
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ raise(
50
+ ArgumentError,
51
+ "`#{k}` is not a valid attribute in `Algolia::TransformationCode`. Please check the name to make sure it's valid. List of attributes: " +
52
+ self.class.attribute_map.keys.inspect
53
+ )
54
+ end
55
+
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:code)
60
+ self.code = attributes[:code]
61
+ else
62
+ self.code = nil
63
+ end
64
+ end
65
+
66
+ # Checks equality by comparing each attribute.
67
+ # @param [Object] Object to be compared
68
+ def ==(other)
69
+ return true if self.equal?(other)
70
+ self.class == other.class &&
71
+ code == other.code
72
+ end
73
+
74
+ # @see the `==` method
75
+ # @param [Object] Object to be compared
76
+ def eql?(other)
77
+ self == other
78
+ end
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Integer] Hash code
82
+ def hash
83
+ [code].hash
84
+ end
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def self.build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+ attributes = attributes.transform_keys(&:to_sym)
92
+ transformed_hash = {}
93
+ types_mapping.each_pair do |key, type|
94
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
95
+ transformed_hash[key.to_sym] = nil
96
+ elsif type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[attribute_map[key]].is_a?(Array)
100
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
101
+ _deserialize(::Regexp.last_match(1), v)
102
+ }
103
+ end
104
+ elsif !attributes[attribute_map[key]].nil?
105
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
106
+ end
107
+ end
108
+
109
+ new(transformed_hash)
110
+ end
111
+
112
+ # Deserializes the data based on type
113
+ # @param string type Data type
114
+ # @param string value Value to be deserialized
115
+ # @return [Object] Deserialized data
116
+ def self._deserialize(type, value)
117
+ case type.to_sym
118
+ when :Time
119
+ Time.parse(value)
120
+ when :Date
121
+ Date.parse(value)
122
+ when :String
123
+ value.to_s
124
+ when :Integer
125
+ value.to_i
126
+ when :Float
127
+ value.to_f
128
+ when :Boolean
129
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
+ true
131
+ else
132
+ false
133
+ end
134
+
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ # model
150
+ else
151
+ # models (e.g. Pet) or oneOf
152
+ klass = Algolia::Ingestion.const_get(type)
153
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
154
+ .build_from_hash(value)
155
+ end
156
+ end
157
+
158
+ # Returns the string representation of the object
159
+ # @return [String] String presentation of the object
160
+ def to_s
161
+ to_hash.to_s
162
+ end
163
+
164
+ # to_body is an alias to to_hash (backward compatibility)
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_body
167
+ to_hash
168
+ end
169
+
170
+ def to_json(*_args)
171
+ to_hash.to_json
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to?(:to_hash)
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end
212
+ end
@@ -9,12 +9,16 @@ module Algolia
9
9
  module Ingestion
10
10
  # API request body for creating a transformation.
11
11
  class TransformationCreate
12
- # The source code of the transformation.
12
+ # It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code.
13
13
  attr_accessor :code
14
14
 
15
15
  # The uniquely identified name of your transformation.
16
16
  attr_accessor :name
17
17
 
18
+ attr_accessor :type
19
+
20
+ attr_accessor :input
21
+
18
22
  # A descriptive name for your transformation of what it does.
19
23
  attr_accessor :description
20
24
 
@@ -26,6 +30,8 @@ module Algolia
26
30
  {
27
31
  :code => :code,
28
32
  :name => :name,
33
+ :type => :type,
34
+ :input => :input,
29
35
  :description => :description,
30
36
  :authentication_ids => :authenticationIDs
31
37
  }
@@ -36,6 +42,8 @@ module Algolia
36
42
  {
37
43
  :code => :"String",
38
44
  :name => :"String",
45
+ :type => :"TransformationType",
46
+ :input => :"TransformationInput",
39
47
  :description => :"String",
40
48
  :authentication_ids => :"Array<String>"
41
49
  }
@@ -73,8 +81,6 @@ module Algolia
73
81
 
74
82
  if attributes.key?(:code)
75
83
  self.code = attributes[:code]
76
- else
77
- self.code = nil
78
84
  end
79
85
 
80
86
  if attributes.key?(:name)
@@ -83,6 +89,18 @@ module Algolia
83
89
  self.name = nil
84
90
  end
85
91
 
92
+ if attributes.key?(:type)
93
+ self.type = attributes[:type]
94
+ else
95
+ self.type = nil
96
+ end
97
+
98
+ if attributes.key?(:input)
99
+ self.input = attributes[:input]
100
+ else
101
+ self.input = nil
102
+ end
103
+
86
104
  if attributes.key?(:description)
87
105
  self.description = attributes[:description]
88
106
  end
@@ -101,6 +119,8 @@ module Algolia
101
119
  self.class == other.class &&
102
120
  code == other.code &&
103
121
  name == other.name &&
122
+ type == other.type &&
123
+ input == other.input &&
104
124
  description == other.description &&
105
125
  authentication_ids == other.authentication_ids
106
126
  end
@@ -114,7 +134,7 @@ module Algolia
114
134
  # Calculates hash code according to all attributes.
115
135
  # @return [Integer] Hash code
116
136
  def hash
117
- [code, name, description, authentication_ids].hash
137
+ [code, name, type, input, description, authentication_ids].hash
118
138
  end
119
139
 
120
140
  # Builds the object from hash
@@ -0,0 +1,110 @@
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 Ingestion
10
+ # The input for the transformation, which can be either code or a no-code configuration.
11
+ module TransformationInput
12
+ class << self
13
+ # List of class defined in oneOf (OpenAPI v3)
14
+ def openapi_one_of
15
+ [
16
+ :"TransformationCode",
17
+ :"TransformationNoCode"
18
+ ]
19
+ end
20
+
21
+ # Builds the object
22
+ # @param [Mixed] Data to be matched against the list of oneOf items
23
+ # @return [Object] Returns the model or the data itself
24
+ def build(data)
25
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
26
+ # Note:
27
+ # - We do not attempt to check whether exactly one item matches.
28
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
29
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
30
+ # - TODO: scalar values are de facto behaving as if they were nullable.
31
+ # - TODO: logging when debugging is set.
32
+ openapi_one_of.each do |klass|
33
+ begin
34
+ # "nullable: true"
35
+ next if klass == :AnyType
36
+ typed_data = find_and_cast_into_type(klass, data)
37
+ return typed_data if typed_data
38
+ # rescue all errors so we keep iterating even if the current item lookup raises
39
+ rescue
40
+ end
41
+ end
42
+
43
+ openapi_one_of.include?(:AnyType) ? data : nil
44
+ end
45
+
46
+ private
47
+
48
+ SchemaMismatchError = Class.new(StandardError)
49
+
50
+ def find_and_cast_into_type(klass, data)
51
+ return if data.nil?
52
+
53
+ case klass.to_s
54
+ when "Boolean"
55
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
56
+ when "Float"
57
+ return data if data.instance_of?(Float)
58
+ when "Integer"
59
+ return data if data.instance_of?(Integer)
60
+ when "Time"
61
+ return Time.parse(data)
62
+ when "Date"
63
+ return Date.parse(data)
64
+ when "String"
65
+ return data if data.instance_of?(String)
66
+ # "type: object"
67
+ when "Object"
68
+ return data if data.instance_of?(Hash)
69
+ # "type: array"
70
+ when /\AArray<(?<sub_type>.+)>\z/
71
+ if data.instance_of?(Array)
72
+ sub_type = Regexp.last_match[:sub_type]
73
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
74
+ end
75
+ # "type: object" with "additionalProperties: { ... }"
76
+ when /\AHash<String, (?<sub_type>.+)>\z/
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ # model
82
+ else
83
+ const = Algolia::Ingestion.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of)
86
+ # nested oneOf model
87
+ model = const.build(data)
88
+ elsif const.respond_to?(:discriminator_attributes)
89
+ if const.discriminator_attributes.all? { |attr| data.key?(attr) }
90
+ model = const.build_from_hash(data)
91
+ end
92
+ else
93
+ # maybe it's an enum, or doens't have discriminators
94
+ model = const.build_from_hash(data)
95
+ end
96
+
97
+ return model if model
98
+ end
99
+ end
100
+
101
+ # if no match by now, raise
102
+ raise
103
+ rescue
104
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
105
+ end
106
+ end
107
+ end
108
+
109
+ end
110
+ end
@@ -0,0 +1,213 @@
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 Ingestion
10
+ # Input for a no-code transformation that contains a series of steps.
11
+ class TransformationNoCode
12
+ attr_accessor :steps
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :steps => :steps
18
+ }
19
+ end
20
+
21
+ # Attribute type mapping.
22
+ def self.types_mapping
23
+ {
24
+ :steps => :"Array<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::TransformationNoCode` 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::TransformationNoCode`. 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?(:steps)
59
+ if (value = attributes[:steps]).is_a?(Array)
60
+ self.steps = value
61
+ end
62
+ else
63
+ self.steps = nil
64
+ end
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(other)
70
+ return true if self.equal?(other)
71
+ self.class == other.class &&
72
+ steps == other.steps
73
+ end
74
+
75
+ # @see the `==` method
76
+ # @param [Object] Object to be compared
77
+ def eql?(other)
78
+ self == other
79
+ end
80
+
81
+ # Calculates hash code according to all attributes.
82
+ # @return [Integer] Hash code
83
+ def hash
84
+ [steps].hash
85
+ end
86
+
87
+ # Builds the object from hash
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ # @return [Object] Returns the model itself
90
+ def self.build_from_hash(attributes)
91
+ return nil unless attributes.is_a?(Hash)
92
+ attributes = attributes.transform_keys(&:to_sym)
93
+ transformed_hash = {}
94
+ types_mapping.each_pair do |key, type|
95
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
96
+ transformed_hash[key.to_sym] = nil
97
+ elsif type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[attribute_map[key]].is_a?(Array)
101
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
102
+ _deserialize(::Regexp.last_match(1), v)
103
+ }
104
+ end
105
+ elsif !attributes[attribute_map[key]].nil?
106
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
107
+ end
108
+ end
109
+
110
+ new(transformed_hash)
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def self._deserialize(type, value)
118
+ case type.to_sym
119
+ when :Time
120
+ Time.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :Boolean
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+
136
+ when :Object
137
+ # generic object (usually a Hash), return directly
138
+ value
139
+ when /\AArray<(?<inner_type>.+)>\z/
140
+ inner_type = Regexp.last_match[:inner_type]
141
+ value.map { |v| _deserialize(inner_type, v) }
142
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
143
+ k_type = Regexp.last_match[:k_type]
144
+ v_type = Regexp.last_match[:v_type]
145
+ {}.tap do |hash|
146
+ value.each do |k, v|
147
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
148
+ end
149
+ end
150
+ # model
151
+ else
152
+ # models (e.g. Pet) or oneOf
153
+ klass = Algolia::Ingestion.const_get(type)
154
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
155
+ .build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ def to_json(*_args)
172
+ to_hash.to_json
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+
189
+ hash
190
+ end
191
+
192
+ # Outputs non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ # @param [Object] value Any valid value
195
+ # @return [Hash] Returns the value in the form of hash
196
+ def _to_hash(value)
197
+ if value.is_a?(Array)
198
+ value.compact.map { |v| _to_hash(v) }
199
+ elsif value.is_a?(Hash)
200
+ {}.tap do |hash|
201
+ value.each { |k, v| hash[k] = _to_hash(v) }
202
+ end
203
+ elsif value.respond_to?(:to_hash)
204
+ value.to_hash
205
+ else
206
+ value
207
+ end
208
+ end
209
+
210
+ end
211
+
212
+ end
213
+ end
@@ -8,7 +8,7 @@ require "time"
8
8
  module Algolia
9
9
  module Ingestion
10
10
  class TransformationTry
11
- # The source code of the transformation.
11
+ # It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code.
12
12
  attr_accessor :code
13
13
 
14
14
  # The record to apply the given code to.
@@ -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 Ingestion
10
+ class TransformationType
11
+ CODE = "code".freeze
12
+ NO_CODE = "noCode".freeze
13
+
14
+ def self.all_vars
15
+ @all_vars ||= [CODE, NO_CODE].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 TransformationType.all_vars.include?(value)
30
+ raise "Invalid ENUM value #{value} for class #TransformationType"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -11,6 +11,9 @@ module Algolia
11
11
  # Universally unique identifier (UUID) of a task run.
12
12
  attr_accessor :run_id
13
13
 
14
+ # Universally unique identifier (UUID) of an event.
15
+ attr_accessor :event_id
16
+
14
17
  # when used with discovering or validating sources, the sampled data of your source is returned.
15
18
  attr_accessor :data
16
19
 
@@ -20,13 +23,18 @@ module Algolia
20
23
  # a message describing the outcome of a validate run.
21
24
  attr_accessor :message
22
25
 
26
+ # Date of creation in RFC 3339 format.
27
+ attr_accessor :created_at
28
+
23
29
  # Attribute mapping from ruby-style variable name to JSON key.
24
30
  def self.attribute_map
25
31
  {
26
32
  :run_id => :runID,
33
+ :event_id => :eventID,
27
34
  :data => :data,
28
35
  :events => :events,
29
- :message => :message
36
+ :message => :message,
37
+ :created_at => :createdAt
30
38
  }
31
39
  end
32
40
 
@@ -34,9 +42,11 @@ module Algolia
34
42
  def self.types_mapping
35
43
  {
36
44
  :run_id => :"String",
45
+ :event_id => :"String",
37
46
  :data => :"Array<Object>",
38
47
  :events => :"Array<Event>",
39
- :message => :"String"
48
+ :message => :"String",
49
+ :created_at => :"String"
40
50
  }
41
51
  end
42
52
 
@@ -76,6 +86,10 @@ module Algolia
76
86
  self.run_id = nil
77
87
  end
78
88
 
89
+ if attributes.key?(:event_id)
90
+ self.event_id = attributes[:event_id]
91
+ end
92
+
79
93
  if attributes.key?(:data)
80
94
  if (value = attributes[:data]).is_a?(Array)
81
95
  self.data = value
@@ -91,6 +105,10 @@ module Algolia
91
105
  if attributes.key?(:message)
92
106
  self.message = attributes[:message]
93
107
  end
108
+
109
+ if attributes.key?(:created_at)
110
+ self.created_at = attributes[:created_at]
111
+ end
94
112
  end
95
113
 
96
114
  # Checks equality by comparing each attribute.
@@ -99,9 +117,11 @@ module Algolia
99
117
  return true if self.equal?(other)
100
118
  self.class == other.class &&
101
119
  run_id == other.run_id &&
120
+ event_id == other.event_id &&
102
121
  data == other.data &&
103
122
  events == other.events &&
104
- message == other.message
123
+ message == other.message &&
124
+ created_at == other.created_at
105
125
  end
106
126
 
107
127
  # @see the `==` method
@@ -113,7 +133,7 @@ module Algolia
113
133
  # Calculates hash code according to all attributes.
114
134
  # @return [Integer] Hash code
115
135
  def hash
116
- [run_id, data, events, message].hash
136
+ [run_id, event_id, data, events, message, created_at].hash
117
137
  end
118
138
 
119
139
  # Builds the object from hash
@@ -10,9 +10,11 @@ module Algolia
10
10
  class TypoToleranceEnum
11
11
  MIN = "min".freeze
12
12
  STRICT = "strict".freeze
13
+ TRUE = "true".freeze
14
+ FALSE = "false".freeze
13
15
 
14
16
  def self.all_vars
15
- @all_vars ||= [MIN, STRICT].freeze
17
+ @all_vars ||= [MIN, STRICT, TRUE, FALSE].freeze
16
18
  end
17
19
 
18
20
  # Builds the enum from string
@@ -10,9 +10,11 @@ module Algolia
10
10
  class TypoToleranceEnum
11
11
  MIN = "min".freeze
12
12
  STRICT = "strict".freeze
13
+ TRUE = "true".freeze
14
+ FALSE = "false".freeze
13
15
 
14
16
  def self.all_vars
15
- @all_vars ||= [MIN, STRICT].freeze
17
+ @all_vars ||= [MIN, STRICT, TRUE, FALSE].freeze
16
18
  end
17
19
 
18
20
  # Builds the enum from string
@@ -3,5 +3,5 @@
3
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
4
 
5
5
  module Algolia
6
- VERSION = "3.16.0"
6
+ VERSION = "3.17.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.0
4
+ version: 3.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
@@ -405,13 +405,17 @@ files:
405
405
  - lib/algolia/models/ingestion/task_update_v1.rb
406
406
  - lib/algolia/models/ingestion/task_v1.rb
407
407
  - lib/algolia/models/ingestion/transformation.rb
408
+ - lib/algolia/models/ingestion/transformation_code.rb
408
409
  - lib/algolia/models/ingestion/transformation_create.rb
409
410
  - lib/algolia/models/ingestion/transformation_create_response.rb
410
411
  - lib/algolia/models/ingestion/transformation_error.rb
412
+ - lib/algolia/models/ingestion/transformation_input.rb
413
+ - lib/algolia/models/ingestion/transformation_no_code.rb
411
414
  - lib/algolia/models/ingestion/transformation_search.rb
412
415
  - lib/algolia/models/ingestion/transformation_sort_keys.rb
413
416
  - lib/algolia/models/ingestion/transformation_try.rb
414
417
  - lib/algolia/models/ingestion/transformation_try_response.rb
418
+ - lib/algolia/models/ingestion/transformation_type.rb
415
419
  - lib/algolia/models/ingestion/transformation_update_response.rb
416
420
  - lib/algolia/models/ingestion/trigger.rb
417
421
  - lib/algolia/models/ingestion/trigger_type.rb