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,525 @@
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 OtelSpan
18
+ attr_accessor :trace_id
19
+
20
+ attr_accessor :span_id
21
+
22
+ attr_accessor :span_name
23
+
24
+ attr_accessor :span_kind
25
+
26
+ attr_accessor :service_name
27
+
28
+ attr_accessor :status_code
29
+
30
+ attr_accessor :duration_ns
31
+
32
+ attr_accessor :created_at
33
+
34
+ attr_accessor :retry_count
35
+
36
+ attr_accessor :parent_span_id
37
+
38
+ attr_accessor :status_message
39
+
40
+ attr_accessor :resource_attributes
41
+
42
+ attr_accessor :span_attributes
43
+
44
+ attr_accessor :scope_name
45
+
46
+ attr_accessor :scope_version
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'trace_id' => :'traceId',
74
+ :'span_id' => :'spanId',
75
+ :'span_name' => :'spanName',
76
+ :'span_kind' => :'spanKind',
77
+ :'service_name' => :'serviceName',
78
+ :'status_code' => :'statusCode',
79
+ :'duration_ns' => :'durationNs',
80
+ :'created_at' => :'createdAt',
81
+ :'retry_count' => :'retryCount',
82
+ :'parent_span_id' => :'parentSpanId',
83
+ :'status_message' => :'statusMessage',
84
+ :'resource_attributes' => :'resourceAttributes',
85
+ :'span_attributes' => :'spanAttributes',
86
+ :'scope_name' => :'scopeName',
87
+ :'scope_version' => :'scopeVersion'
88
+ }
89
+ end
90
+
91
+ # Returns attribute mapping this model knows about
92
+ def self.acceptable_attribute_map
93
+ attribute_map
94
+ end
95
+
96
+ # Returns all the JSON keys this model knows about
97
+ def self.acceptable_attributes
98
+ acceptable_attribute_map.values
99
+ end
100
+
101
+ # Attribute type mapping.
102
+ def self.openapi_types
103
+ {
104
+ :'trace_id' => :'String',
105
+ :'span_id' => :'String',
106
+ :'span_name' => :'String',
107
+ :'span_kind' => :'OtelSpanKind',
108
+ :'service_name' => :'String',
109
+ :'status_code' => :'OtelStatusCode',
110
+ :'duration_ns' => :'Integer',
111
+ :'created_at' => :'Time',
112
+ :'retry_count' => :'Integer',
113
+ :'parent_span_id' => :'String',
114
+ :'status_message' => :'String',
115
+ :'resource_attributes' => :'Hash<String, String>',
116
+ :'span_attributes' => :'Hash<String, String>',
117
+ :'scope_name' => :'String',
118
+ :'scope_version' => :'String'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ ])
126
+ end
127
+
128
+ # Initializes the object
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ def initialize(attributes = {})
131
+ if (!attributes.is_a?(Hash))
132
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::OtelSpan` initialize method"
133
+ end
134
+
135
+ # check to see if the attribute exists and convert string to symbol for hash key
136
+ acceptable_attribute_map = self.class.acceptable_attribute_map
137
+ attributes = attributes.each_with_object({}) { |(k, v), h|
138
+ if (!acceptable_attribute_map.key?(k.to_sym))
139
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::OtelSpan`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
140
+ end
141
+ h[k.to_sym] = v
142
+ }
143
+
144
+ if attributes.key?(:'trace_id')
145
+ self.trace_id = attributes[:'trace_id']
146
+ else
147
+ self.trace_id = nil
148
+ end
149
+
150
+ if attributes.key?(:'span_id')
151
+ self.span_id = attributes[:'span_id']
152
+ else
153
+ self.span_id = nil
154
+ end
155
+
156
+ if attributes.key?(:'span_name')
157
+ self.span_name = attributes[:'span_name']
158
+ else
159
+ self.span_name = nil
160
+ end
161
+
162
+ if attributes.key?(:'span_kind')
163
+ self.span_kind = attributes[:'span_kind']
164
+ else
165
+ self.span_kind = nil
166
+ end
167
+
168
+ if attributes.key?(:'service_name')
169
+ self.service_name = attributes[:'service_name']
170
+ else
171
+ self.service_name = nil
172
+ end
173
+
174
+ if attributes.key?(:'status_code')
175
+ self.status_code = attributes[:'status_code']
176
+ else
177
+ self.status_code = nil
178
+ end
179
+
180
+ if attributes.key?(:'duration_ns')
181
+ self.duration_ns = attributes[:'duration_ns']
182
+ else
183
+ self.duration_ns = nil
184
+ end
185
+
186
+ if attributes.key?(:'created_at')
187
+ self.created_at = attributes[:'created_at']
188
+ else
189
+ self.created_at = nil
190
+ end
191
+
192
+ if attributes.key?(:'retry_count')
193
+ self.retry_count = attributes[:'retry_count']
194
+ else
195
+ self.retry_count = nil
196
+ end
197
+
198
+ if attributes.key?(:'parent_span_id')
199
+ self.parent_span_id = attributes[:'parent_span_id']
200
+ end
201
+
202
+ if attributes.key?(:'status_message')
203
+ self.status_message = attributes[:'status_message']
204
+ end
205
+
206
+ if attributes.key?(:'resource_attributes')
207
+ if (value = attributes[:'resource_attributes']).is_a?(Hash)
208
+ self.resource_attributes = value
209
+ end
210
+ end
211
+
212
+ if attributes.key?(:'span_attributes')
213
+ if (value = attributes[:'span_attributes']).is_a?(Hash)
214
+ self.span_attributes = value
215
+ end
216
+ end
217
+
218
+ if attributes.key?(:'scope_name')
219
+ self.scope_name = attributes[:'scope_name']
220
+ end
221
+
222
+ if attributes.key?(:'scope_version')
223
+ self.scope_version = attributes[:'scope_version']
224
+ end
225
+ end
226
+
227
+ # Show invalid properties with the reasons. Usually used together with valid?
228
+ # @return Array for valid properties with the reasons
229
+ def list_invalid_properties
230
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
231
+ invalid_properties = Array.new
232
+ if @trace_id.nil?
233
+ invalid_properties.push('invalid value for "trace_id", trace_id cannot be nil.')
234
+ end
235
+
236
+ if @span_id.nil?
237
+ invalid_properties.push('invalid value for "span_id", span_id cannot be nil.')
238
+ end
239
+
240
+ if @span_name.nil?
241
+ invalid_properties.push('invalid value for "span_name", span_name cannot be nil.')
242
+ end
243
+
244
+ if @span_kind.nil?
245
+ invalid_properties.push('invalid value for "span_kind", span_kind cannot be nil.')
246
+ end
247
+
248
+ if @service_name.nil?
249
+ invalid_properties.push('invalid value for "service_name", service_name cannot be nil.')
250
+ end
251
+
252
+ if @status_code.nil?
253
+ invalid_properties.push('invalid value for "status_code", status_code cannot be nil.')
254
+ end
255
+
256
+ if @duration_ns.nil?
257
+ invalid_properties.push('invalid value for "duration_ns", duration_ns cannot be nil.')
258
+ end
259
+
260
+ if @created_at.nil?
261
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
262
+ end
263
+
264
+ if @retry_count.nil?
265
+ invalid_properties.push('invalid value for "retry_count", retry_count cannot be nil.')
266
+ end
267
+
268
+ invalid_properties
269
+ end
270
+
271
+ # Check to see if the all the properties in the model are valid
272
+ # @return true if the model is valid
273
+ def valid?
274
+ warn '[DEPRECATED] the `valid?` method is obsolete'
275
+ return false if @trace_id.nil?
276
+ return false if @span_id.nil?
277
+ return false if @span_name.nil?
278
+ return false if @span_kind.nil?
279
+ return false if @service_name.nil?
280
+ return false if @status_code.nil?
281
+ return false if @duration_ns.nil?
282
+ return false if @created_at.nil?
283
+ return false if @retry_count.nil?
284
+ true
285
+ end
286
+
287
+ # Custom attribute writer method with validation
288
+ # @param [Object] trace_id Value to be assigned
289
+ def trace_id=(trace_id)
290
+ if trace_id.nil?
291
+ fail ArgumentError, 'trace_id cannot be nil'
292
+ end
293
+
294
+ @trace_id = trace_id
295
+ end
296
+
297
+ # Custom attribute writer method with validation
298
+ # @param [Object] span_id Value to be assigned
299
+ def span_id=(span_id)
300
+ if span_id.nil?
301
+ fail ArgumentError, 'span_id cannot be nil'
302
+ end
303
+
304
+ @span_id = span_id
305
+ end
306
+
307
+ # Custom attribute writer method with validation
308
+ # @param [Object] span_name Value to be assigned
309
+ def span_name=(span_name)
310
+ if span_name.nil?
311
+ fail ArgumentError, 'span_name cannot be nil'
312
+ end
313
+
314
+ @span_name = span_name
315
+ end
316
+
317
+ # Custom attribute writer method with validation
318
+ # @param [Object] span_kind Value to be assigned
319
+ def span_kind=(span_kind)
320
+ if span_kind.nil?
321
+ fail ArgumentError, 'span_kind cannot be nil'
322
+ end
323
+
324
+ @span_kind = span_kind
325
+ end
326
+
327
+ # Custom attribute writer method with validation
328
+ # @param [Object] service_name Value to be assigned
329
+ def service_name=(service_name)
330
+ if service_name.nil?
331
+ fail ArgumentError, 'service_name cannot be nil'
332
+ end
333
+
334
+ @service_name = service_name
335
+ end
336
+
337
+ # Custom attribute writer method with validation
338
+ # @param [Object] status_code Value to be assigned
339
+ def status_code=(status_code)
340
+ if status_code.nil?
341
+ fail ArgumentError, 'status_code cannot be nil'
342
+ end
343
+
344
+ @status_code = status_code
345
+ end
346
+
347
+ # Custom attribute writer method with validation
348
+ # @param [Object] duration_ns Value to be assigned
349
+ def duration_ns=(duration_ns)
350
+ if duration_ns.nil?
351
+ fail ArgumentError, 'duration_ns cannot be nil'
352
+ end
353
+
354
+ @duration_ns = duration_ns
355
+ end
356
+
357
+ # Custom attribute writer method with validation
358
+ # @param [Object] created_at Value to be assigned
359
+ def created_at=(created_at)
360
+ if created_at.nil?
361
+ fail ArgumentError, 'created_at cannot be nil'
362
+ end
363
+
364
+ @created_at = created_at
365
+ end
366
+
367
+ # Custom attribute writer method with validation
368
+ # @param [Object] retry_count Value to be assigned
369
+ def retry_count=(retry_count)
370
+ if retry_count.nil?
371
+ fail ArgumentError, 'retry_count cannot be nil'
372
+ end
373
+
374
+ @retry_count = retry_count
375
+ end
376
+
377
+ # Checks equality by comparing each attribute.
378
+ # @param [Object] Object to be compared
379
+ def ==(o)
380
+ return true if self.equal?(o)
381
+ self.class == o.class &&
382
+ trace_id == o.trace_id &&
383
+ span_id == o.span_id &&
384
+ span_name == o.span_name &&
385
+ span_kind == o.span_kind &&
386
+ service_name == o.service_name &&
387
+ status_code == o.status_code &&
388
+ duration_ns == o.duration_ns &&
389
+ created_at == o.created_at &&
390
+ retry_count == o.retry_count &&
391
+ parent_span_id == o.parent_span_id &&
392
+ status_message == o.status_message &&
393
+ resource_attributes == o.resource_attributes &&
394
+ span_attributes == o.span_attributes &&
395
+ scope_name == o.scope_name &&
396
+ scope_version == o.scope_version
397
+ end
398
+
399
+ # @see the `==` method
400
+ # @param [Object] Object to be compared
401
+ def eql?(o)
402
+ self == o
403
+ end
404
+
405
+ # Calculates hash code according to all attributes.
406
+ # @return [Integer] Hash code
407
+ def hash
408
+ [trace_id, span_id, span_name, span_kind, service_name, status_code, duration_ns, created_at, retry_count, parent_span_id, status_message, resource_attributes, span_attributes, scope_name, scope_version].hash
409
+ end
410
+
411
+ # Builds the object from hash
412
+ # @param [Hash] attributes Model attributes in the form of hash
413
+ # @return [Object] Returns the model itself
414
+ def self.build_from_hash(attributes)
415
+ return nil unless attributes.is_a?(Hash)
416
+ attributes = attributes.transform_keys(&:to_sym)
417
+ transformed_hash = {}
418
+ openapi_types.each_pair do |key, type|
419
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
420
+ transformed_hash["#{key}"] = nil
421
+ elsif type =~ /\AArray<(.*)>/i
422
+ # check to ensure the input is an array given that the attribute
423
+ # is documented as an array but the input is not
424
+ if attributes[attribute_map[key]].is_a?(Array)
425
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
426
+ end
427
+ elsif !attributes[attribute_map[key]].nil?
428
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
429
+ end
430
+ end
431
+ new(transformed_hash)
432
+ end
433
+
434
+ # Deserializes the data based on type
435
+ # @param string type Data type
436
+ # @param string value Value to be deserialized
437
+ # @return [Object] Deserialized data
438
+ def self._deserialize(type, value)
439
+ case type.to_sym
440
+ when :Time
441
+ Time.parse(value)
442
+ when :Date
443
+ Date.parse(value)
444
+ when :String
445
+ value.to_s
446
+ when :Integer
447
+ value.to_i
448
+ when :Float
449
+ value.to_f
450
+ when :Boolean
451
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
452
+ true
453
+ else
454
+ false
455
+ end
456
+ when :Object
457
+ # generic object (usually a Hash), return directly
458
+ value
459
+ when /\AArray<(?<inner_type>.+)>\z/
460
+ inner_type = Regexp.last_match[:inner_type]
461
+ value.map { |v| _deserialize(inner_type, v) }
462
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
463
+ k_type = Regexp.last_match[:k_type]
464
+ v_type = Regexp.last_match[:v_type]
465
+ {}.tap do |hash|
466
+ value.each do |k, v|
467
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
468
+ end
469
+ end
470
+ else # model
471
+ # models (e.g. Pet) or oneOf
472
+ klass = HatchetSdkRest.const_get(type)
473
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
474
+ end
475
+ end
476
+
477
+ # Returns the string representation of the object
478
+ # @return [String] String presentation of the object
479
+ def to_s
480
+ to_hash.to_s
481
+ end
482
+
483
+ # to_body is an alias to to_hash (backward compatibility)
484
+ # @return [Hash] Returns the object in the form of hash
485
+ def to_body
486
+ to_hash
487
+ end
488
+
489
+ # Returns the object in the form of hash
490
+ # @return [Hash] Returns the object in the form of hash
491
+ def to_hash
492
+ hash = {}
493
+ self.class.attribute_map.each_pair do |attr, param|
494
+ value = self.send(attr)
495
+ if value.nil?
496
+ is_nullable = self.class.openapi_nullable.include?(attr)
497
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
498
+ end
499
+
500
+ hash[param] = _to_hash(value)
501
+ end
502
+ hash
503
+ end
504
+
505
+ # Outputs non-array value in the form of hash
506
+ # For object, use to_hash. Otherwise, just return the value
507
+ # @param [Object] value Any valid value
508
+ # @return [Hash] Returns the value in the form of hash
509
+ def _to_hash(value)
510
+ if value.is_a?(Array)
511
+ value.compact.map { |v| _to_hash(v) }
512
+ elsif value.is_a?(Hash)
513
+ {}.tap do |hash|
514
+ value.each { |k, v| hash[k] = _to_hash(v) }
515
+ end
516
+ elsif value.respond_to? :to_hash
517
+ value.to_hash
518
+ else
519
+ value
520
+ end
521
+ end
522
+
523
+ end
524
+
525
+ end
@@ -0,0 +1,44 @@
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 OtelSpanKind
18
+ UNSPECIFIED = "UNSPECIFIED".freeze
19
+ INTERNAL = "INTERNAL".freeze
20
+ SERVER = "SERVER".freeze
21
+ CLIENT = "CLIENT".freeze
22
+ PRODUCER = "PRODUCER".freeze
23
+ CONSUMER = "CONSUMER".freeze
24
+
25
+ def self.all_vars
26
+ @all_vars ||= [UNSPECIFIED, INTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER].freeze
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def self.build_from_hash(value)
33
+ new.build_from_hash(value)
34
+ end
35
+
36
+ # Builds the enum from string
37
+ # @param [String] The enum value in the form of the string
38
+ # @return [String] The enum value
39
+ def build_from_hash(value)
40
+ return value if OtelSpanKind.all_vars.include?(value)
41
+ raise "Invalid ENUM value #{value} for class #OtelSpanKind"
42
+ end
43
+ end
44
+ end