hatchet-sdk 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/hatchet/clients/rest/.openapi-generator/FILES +24 -0
  4. data/lib/hatchet/clients/rest/README.md +31 -1
  5. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/durable_tasks_api.rb +113 -0
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/feature_flags_api.rb +107 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/log_api.rb +156 -52
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/observability_api.rb +114 -0
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/rate_limits_api.rb +78 -0
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/task_api.rb +71 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +3 -0
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/worker_api.rb +9 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_api.rb +170 -0
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +94 -0
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api_model_base.rb +88 -0
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +44 -4
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/feature_flag_evaluation_result.rb +238 -0
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/feature_flag_id.rb +41 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span.rb +525 -0
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span_kind.rb +44 -0
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span_list.rb +242 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_status_code.rb +41 -0
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/task_status_stat.rb +13 -4
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant.rb +24 -4
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +14 -4
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/trigger_run_result.rb +256 -0
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_additional_metadata_operator.rb +40 -0
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_branch_durable_task_request.rb +310 -0
  29. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_branch_durable_task_response.rb +310 -0
  30. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_api_key.rb +14 -4
  31. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_base.rb +14 -4
  32. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_basic_auth.rb +14 -4
  33. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_hmac.rb +14 -4
  34. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_event_log_entry.rb +470 -0
  35. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_event_log_kind.rb +41 -0
  36. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_wait_condition.rb +286 -0
  37. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_wait_condition_kind.rb +41 -0
  38. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line.rb +49 -1
  39. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_logs_point_metric.rb +341 -0
  40. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_logs_point_metrics.rb +222 -0
  41. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_restore_task_response.rb +237 -0
  42. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_running_detail_count.rb +265 -0
  43. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_running_filter.rb +41 -0
  44. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_type.rb +3 -1
  45. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_run_metric.rb +13 -4
  46. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +34 -4
  47. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_timing.rb +11 -1
  48. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_trigger_workflow_run_request.rb +14 -4
  49. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_webhook_request.rb +14 -4
  50. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_wait_item.rb +280 -0
  51. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook.rb +14 -4
  52. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker.rb +1 -13
  53. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_status.rb +41 -0
  54. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_idempotency.rb +265 -0
  55. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_task.rb +393 -0
  56. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_task_desired_worker_label.rb +288 -0
  57. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_task_rate_limit.rb +271 -0
  58. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +24 -0
  59. data/lib/hatchet/contracts/v1/workflows_pb.rb +3 -1
  60. data/lib/hatchet/idempotency.rb +35 -1
  61. data/lib/hatchet/version.rb +1 -1
  62. data/lib/hatchet/workflow.rb +2 -2
  63. data/sig/hatchet/idempotency.rbs +8 -0
  64. metadata +31 -2
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class WorkerStatus
18
+ ACTIVE = "ACTIVE".freeze
19
+ INACTIVE = "INACTIVE".freeze
20
+ PAUSED = "PAUSED".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [ACTIVE, INACTIVE, PAUSED].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if WorkerStatus.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #WorkerStatus"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class WorkflowVersionIdempotency
18
+ # The CEL expression used to compute the idempotency key.
19
+ attr_accessor :expression
20
+
21
+ # The time-to-live of the idempotency key, in milliseconds.
22
+ attr_accessor :ttl_ms
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'expression' => :'expression',
28
+ :'ttl_ms' => :'ttlMs'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'expression' => :'String',
46
+ :'ttl_ms' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::WorkflowVersionIdempotency` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::WorkflowVersionIdempotency`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'expression')
73
+ self.expression = attributes[:'expression']
74
+ else
75
+ self.expression = nil
76
+ end
77
+
78
+ if attributes.key?(:'ttl_ms')
79
+ self.ttl_ms = attributes[:'ttl_ms']
80
+ else
81
+ self.ttl_ms = nil
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @expression.nil?
91
+ invalid_properties.push('invalid value for "expression", expression cannot be nil.')
92
+ end
93
+
94
+ if @ttl_ms.nil?
95
+ invalid_properties.push('invalid value for "ttl_ms", ttl_ms cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @expression.nil?
106
+ return false if @ttl_ms.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] expression Value to be assigned
112
+ def expression=(expression)
113
+ if expression.nil?
114
+ fail ArgumentError, 'expression cannot be nil'
115
+ end
116
+
117
+ @expression = expression
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] ttl_ms Value to be assigned
122
+ def ttl_ms=(ttl_ms)
123
+ if ttl_ms.nil?
124
+ fail ArgumentError, 'ttl_ms cannot be nil'
125
+ end
126
+
127
+ @ttl_ms = ttl_ms
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ expression == o.expression &&
136
+ ttl_ms == o.ttl_ms
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [expression, ttl_ms].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def self._deserialize(type, value)
179
+ case type.to_sym
180
+ when :Time
181
+ Time.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ # models (e.g. Pet) or oneOf
212
+ klass = HatchetSdkRest.const_get(type)
213
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+
265
+ end
@@ -0,0 +1,393 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class WorkflowVersionTask
18
+ # The readable id of the task.
19
+ attr_accessor :readable_id
20
+
21
+ # The action id of the task.
22
+ attr_accessor :action
23
+
24
+ # The readable ids of the tasks that this task depends on (its DAG parents).
25
+ attr_accessor :parents
26
+
27
+ # The number of retries for the task.
28
+ attr_accessor :retries
29
+
30
+ # The execution timeout of the task.
31
+ attr_accessor :timeout
32
+
33
+ # The scheduling timeout of the task.
34
+ attr_accessor :schedule_timeout
35
+
36
+ # The retry backoff factor for the task.
37
+ attr_accessor :retry_backoff_factor
38
+
39
+ # The maximum retry backoff, in seconds.
40
+ attr_accessor :retry_backoff_max_seconds
41
+
42
+ # Whether the task is durable.
43
+ attr_accessor :is_durable
44
+
45
+ attr_accessor :rate_limits
46
+
47
+ attr_accessor :desired_worker_labels
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'readable_id' => :'readableId',
53
+ :'action' => :'action',
54
+ :'parents' => :'parents',
55
+ :'retries' => :'retries',
56
+ :'timeout' => :'timeout',
57
+ :'schedule_timeout' => :'scheduleTimeout',
58
+ :'retry_backoff_factor' => :'retryBackoffFactor',
59
+ :'retry_backoff_max_seconds' => :'retryBackoffMaxSeconds',
60
+ :'is_durable' => :'isDurable',
61
+ :'rate_limits' => :'rateLimits',
62
+ :'desired_worker_labels' => :'desiredWorkerLabels'
63
+ }
64
+ end
65
+
66
+ # Returns attribute mapping this model knows about
67
+ def self.acceptable_attribute_map
68
+ attribute_map
69
+ end
70
+
71
+ # Returns all the JSON keys this model knows about
72
+ def self.acceptable_attributes
73
+ acceptable_attribute_map.values
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'readable_id' => :'String',
80
+ :'action' => :'String',
81
+ :'parents' => :'Array<String>',
82
+ :'retries' => :'Integer',
83
+ :'timeout' => :'String',
84
+ :'schedule_timeout' => :'String',
85
+ :'retry_backoff_factor' => :'Float',
86
+ :'retry_backoff_max_seconds' => :'Integer',
87
+ :'is_durable' => :'Boolean',
88
+ :'rate_limits' => :'Array<WorkflowVersionTaskRateLimit>',
89
+ :'desired_worker_labels' => :'Array<WorkflowVersionTaskDesiredWorkerLabel>'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ ])
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::WorkflowVersionTask` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ acceptable_attribute_map = self.class.acceptable_attribute_map
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!acceptable_attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::WorkflowVersionTask`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'readable_id')
116
+ self.readable_id = attributes[:'readable_id']
117
+ else
118
+ self.readable_id = nil
119
+ end
120
+
121
+ if attributes.key?(:'action')
122
+ self.action = attributes[:'action']
123
+ else
124
+ self.action = nil
125
+ end
126
+
127
+ if attributes.key?(:'parents')
128
+ if (value = attributes[:'parents']).is_a?(Array)
129
+ self.parents = value
130
+ end
131
+ else
132
+ self.parents = nil
133
+ end
134
+
135
+ if attributes.key?(:'retries')
136
+ self.retries = attributes[:'retries']
137
+ else
138
+ self.retries = nil
139
+ end
140
+
141
+ if attributes.key?(:'timeout')
142
+ self.timeout = attributes[:'timeout']
143
+ end
144
+
145
+ if attributes.key?(:'schedule_timeout')
146
+ self.schedule_timeout = attributes[:'schedule_timeout']
147
+ end
148
+
149
+ if attributes.key?(:'retry_backoff_factor')
150
+ self.retry_backoff_factor = attributes[:'retry_backoff_factor']
151
+ end
152
+
153
+ if attributes.key?(:'retry_backoff_max_seconds')
154
+ self.retry_backoff_max_seconds = attributes[:'retry_backoff_max_seconds']
155
+ end
156
+
157
+ if attributes.key?(:'is_durable')
158
+ self.is_durable = attributes[:'is_durable']
159
+ end
160
+
161
+ if attributes.key?(:'rate_limits')
162
+ if (value = attributes[:'rate_limits']).is_a?(Array)
163
+ self.rate_limits = value
164
+ end
165
+ end
166
+
167
+ if attributes.key?(:'desired_worker_labels')
168
+ if (value = attributes[:'desired_worker_labels']).is_a?(Array)
169
+ self.desired_worker_labels = value
170
+ end
171
+ end
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properties with the reasons
176
+ def list_invalid_properties
177
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
178
+ invalid_properties = Array.new
179
+ if @readable_id.nil?
180
+ invalid_properties.push('invalid value for "readable_id", readable_id cannot be nil.')
181
+ end
182
+
183
+ if @action.nil?
184
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
185
+ end
186
+
187
+ if @parents.nil?
188
+ invalid_properties.push('invalid value for "parents", parents cannot be nil.')
189
+ end
190
+
191
+ if @retries.nil?
192
+ invalid_properties.push('invalid value for "retries", retries cannot be nil.')
193
+ end
194
+
195
+ invalid_properties
196
+ end
197
+
198
+ # Check to see if the all the properties in the model are valid
199
+ # @return true if the model is valid
200
+ def valid?
201
+ warn '[DEPRECATED] the `valid?` method is obsolete'
202
+ return false if @readable_id.nil?
203
+ return false if @action.nil?
204
+ return false if @parents.nil?
205
+ return false if @retries.nil?
206
+ true
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] readable_id Value to be assigned
211
+ def readable_id=(readable_id)
212
+ if readable_id.nil?
213
+ fail ArgumentError, 'readable_id cannot be nil'
214
+ end
215
+
216
+ @readable_id = readable_id
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] action Value to be assigned
221
+ def action=(action)
222
+ if action.nil?
223
+ fail ArgumentError, 'action cannot be nil'
224
+ end
225
+
226
+ @action = action
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] parents Value to be assigned
231
+ def parents=(parents)
232
+ if parents.nil?
233
+ fail ArgumentError, 'parents cannot be nil'
234
+ end
235
+
236
+ @parents = parents
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] retries Value to be assigned
241
+ def retries=(retries)
242
+ if retries.nil?
243
+ fail ArgumentError, 'retries cannot be nil'
244
+ end
245
+
246
+ @retries = retries
247
+ end
248
+
249
+ # Checks equality by comparing each attribute.
250
+ # @param [Object] Object to be compared
251
+ def ==(o)
252
+ return true if self.equal?(o)
253
+ self.class == o.class &&
254
+ readable_id == o.readable_id &&
255
+ action == o.action &&
256
+ parents == o.parents &&
257
+ retries == o.retries &&
258
+ timeout == o.timeout &&
259
+ schedule_timeout == o.schedule_timeout &&
260
+ retry_backoff_factor == o.retry_backoff_factor &&
261
+ retry_backoff_max_seconds == o.retry_backoff_max_seconds &&
262
+ is_durable == o.is_durable &&
263
+ rate_limits == o.rate_limits &&
264
+ desired_worker_labels == o.desired_worker_labels
265
+ end
266
+
267
+ # @see the `==` method
268
+ # @param [Object] Object to be compared
269
+ def eql?(o)
270
+ self == o
271
+ end
272
+
273
+ # Calculates hash code according to all attributes.
274
+ # @return [Integer] Hash code
275
+ def hash
276
+ [readable_id, action, parents, retries, timeout, schedule_timeout, retry_backoff_factor, retry_backoff_max_seconds, is_durable, rate_limits, desired_worker_labels].hash
277
+ end
278
+
279
+ # Builds the object from hash
280
+ # @param [Hash] attributes Model attributes in the form of hash
281
+ # @return [Object] Returns the model itself
282
+ def self.build_from_hash(attributes)
283
+ return nil unless attributes.is_a?(Hash)
284
+ attributes = attributes.transform_keys(&:to_sym)
285
+ transformed_hash = {}
286
+ openapi_types.each_pair do |key, type|
287
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
288
+ transformed_hash["#{key}"] = nil
289
+ elsif type =~ /\AArray<(.*)>/i
290
+ # check to ensure the input is an array given that the attribute
291
+ # is documented as an array but the input is not
292
+ if attributes[attribute_map[key]].is_a?(Array)
293
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
294
+ end
295
+ elsif !attributes[attribute_map[key]].nil?
296
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
297
+ end
298
+ end
299
+ new(transformed_hash)
300
+ end
301
+
302
+ # Deserializes the data based on type
303
+ # @param string type Data type
304
+ # @param string value Value to be deserialized
305
+ # @return [Object] Deserialized data
306
+ def self._deserialize(type, value)
307
+ case type.to_sym
308
+ when :Time
309
+ Time.parse(value)
310
+ when :Date
311
+ Date.parse(value)
312
+ when :String
313
+ value.to_s
314
+ when :Integer
315
+ value.to_i
316
+ when :Float
317
+ value.to_f
318
+ when :Boolean
319
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
320
+ true
321
+ else
322
+ false
323
+ end
324
+ when :Object
325
+ # generic object (usually a Hash), return directly
326
+ value
327
+ when /\AArray<(?<inner_type>.+)>\z/
328
+ inner_type = Regexp.last_match[:inner_type]
329
+ value.map { |v| _deserialize(inner_type, v) }
330
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
331
+ k_type = Regexp.last_match[:k_type]
332
+ v_type = Regexp.last_match[:v_type]
333
+ {}.tap do |hash|
334
+ value.each do |k, v|
335
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
336
+ end
337
+ end
338
+ else # model
339
+ # models (e.g. Pet) or oneOf
340
+ klass = HatchetSdkRest.const_get(type)
341
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
342
+ end
343
+ end
344
+
345
+ # Returns the string representation of the object
346
+ # @return [String] String presentation of the object
347
+ def to_s
348
+ to_hash.to_s
349
+ end
350
+
351
+ # to_body is an alias to to_hash (backward compatibility)
352
+ # @return [Hash] Returns the object in the form of hash
353
+ def to_body
354
+ to_hash
355
+ end
356
+
357
+ # Returns the object in the form of hash
358
+ # @return [Hash] Returns the object in the form of hash
359
+ def to_hash
360
+ hash = {}
361
+ self.class.attribute_map.each_pair do |attr, param|
362
+ value = self.send(attr)
363
+ if value.nil?
364
+ is_nullable = self.class.openapi_nullable.include?(attr)
365
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
366
+ end
367
+
368
+ hash[param] = _to_hash(value)
369
+ end
370
+ hash
371
+ end
372
+
373
+ # Outputs non-array value in the form of hash
374
+ # For object, use to_hash. Otherwise, just return the value
375
+ # @param [Object] value Any valid value
376
+ # @return [Hash] Returns the value in the form of hash
377
+ def _to_hash(value)
378
+ if value.is_a?(Array)
379
+ value.compact.map { |v| _to_hash(v) }
380
+ elsif value.is_a?(Hash)
381
+ {}.tap do |hash|
382
+ value.each { |k, v| hash[k] = _to_hash(v) }
383
+ end
384
+ elsif value.respond_to? :to_hash
385
+ value.to_hash
386
+ else
387
+ value
388
+ end
389
+ end
390
+
391
+ end
392
+
393
+ end