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
@@ -72,12 +72,18 @@ module HatchetSdkRest
72
72
  # The duration of the task run, in milliseconds.
73
73
  attr_accessor :duration
74
74
 
75
+ # Whether this task was created as a durable task.
76
+ attr_accessor :is_durable
77
+
75
78
  # The error message of the task run (for the latest run)
76
79
  attr_accessor :error_message
77
80
 
78
81
  # The timestamp the task run finished.
79
82
  attr_accessor :finished_at
80
83
 
84
+ # Whether the task has been evicted from a worker (still counts as RUNNING).
85
+ attr_accessor :is_evicted
86
+
81
87
  # The timestamp the task run started.
82
88
  attr_accessor :started_at
83
89
 
@@ -94,6 +100,9 @@ module HatchetSdkRest
94
100
  # The external ID of the parent task.
95
101
  attr_accessor :parent_task_external_id
96
102
 
103
+ # The idempotency key that was claimed by the task run
104
+ attr_accessor :idempotency_key
105
+
97
106
  class EnumAttributeValidator
98
107
  attr_reader :datatype
99
108
  attr_reader :allowable_values
@@ -139,14 +148,17 @@ module HatchetSdkRest
139
148
  :'additional_metadata' => :'additionalMetadata',
140
149
  :'children' => :'children',
141
150
  :'duration' => :'duration',
151
+ :'is_durable' => :'isDurable',
142
152
  :'error_message' => :'errorMessage',
143
153
  :'finished_at' => :'finishedAt',
154
+ :'is_evicted' => :'isEvicted',
144
155
  :'started_at' => :'startedAt',
145
156
  :'step_id' => :'stepId',
146
157
  :'workflow_name' => :'workflowName',
147
158
  :'workflow_version_id' => :'workflowVersionId',
148
159
  :'workflow_config' => :'workflowConfig',
149
- :'parent_task_external_id' => :'parentTaskExternalId'
160
+ :'parent_task_external_id' => :'parentTaskExternalId',
161
+ :'idempotency_key' => :'idempotencyKey'
150
162
  }
151
163
  end
152
164
 
@@ -183,14 +195,17 @@ module HatchetSdkRest
183
195
  :'additional_metadata' => :'Object',
184
196
  :'children' => :'Array<V1TaskSummary>',
185
197
  :'duration' => :'Integer',
198
+ :'is_durable' => :'Boolean',
186
199
  :'error_message' => :'String',
187
200
  :'finished_at' => :'Time',
201
+ :'is_evicted' => :'Boolean',
188
202
  :'started_at' => :'Time',
189
203
  :'step_id' => :'String',
190
204
  :'workflow_name' => :'String',
191
205
  :'workflow_version_id' => :'String',
192
206
  :'workflow_config' => :'Object',
193
- :'parent_task_external_id' => :'String'
207
+ :'parent_task_external_id' => :'String',
208
+ :'idempotency_key' => :'String'
194
209
  }
195
210
  end
196
211
 
@@ -326,6 +341,10 @@ module HatchetSdkRest
326
341
  self.duration = attributes[:'duration']
327
342
  end
328
343
 
344
+ if attributes.key?(:'is_durable')
345
+ self.is_durable = attributes[:'is_durable']
346
+ end
347
+
329
348
  if attributes.key?(:'error_message')
330
349
  self.error_message = attributes[:'error_message']
331
350
  end
@@ -334,6 +353,10 @@ module HatchetSdkRest
334
353
  self.finished_at = attributes[:'finished_at']
335
354
  end
336
355
 
356
+ if attributes.key?(:'is_evicted')
357
+ self.is_evicted = attributes[:'is_evicted']
358
+ end
359
+
337
360
  if attributes.key?(:'started_at')
338
361
  self.started_at = attributes[:'started_at']
339
362
  end
@@ -357,6 +380,10 @@ module HatchetSdkRest
357
380
  if attributes.key?(:'parent_task_external_id')
358
381
  self.parent_task_external_id = attributes[:'parent_task_external_id']
359
382
  end
383
+
384
+ if attributes.key?(:'idempotency_key')
385
+ self.idempotency_key = attributes[:'idempotency_key']
386
+ end
360
387
  end
361
388
 
362
389
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -673,14 +700,17 @@ module HatchetSdkRest
673
700
  additional_metadata == o.additional_metadata &&
674
701
  children == o.children &&
675
702
  duration == o.duration &&
703
+ is_durable == o.is_durable &&
676
704
  error_message == o.error_message &&
677
705
  finished_at == o.finished_at &&
706
+ is_evicted == o.is_evicted &&
678
707
  started_at == o.started_at &&
679
708
  step_id == o.step_id &&
680
709
  workflow_name == o.workflow_name &&
681
710
  workflow_version_id == o.workflow_version_id &&
682
711
  workflow_config == o.workflow_config &&
683
- parent_task_external_id == o.parent_task_external_id
712
+ parent_task_external_id == o.parent_task_external_id &&
713
+ idempotency_key == o.idempotency_key
684
714
  end
685
715
 
686
716
  # @see the `==` method
@@ -692,7 +722,7 @@ module HatchetSdkRest
692
722
  # Calculates hash code according to all attributes.
693
723
  # @return [Integer] Hash code
694
724
  def hash
695
- [metadata, created_at, display_name, input, num_spawned_children, output, status, task_external_id, task_id, task_inserted_at, tenant_id, type, workflow_id, workflow_run_external_id, action_id, retry_count, attempt, additional_metadata, children, duration, error_message, finished_at, started_at, step_id, workflow_name, workflow_version_id, workflow_config, parent_task_external_id].hash
725
+ [metadata, created_at, display_name, input, num_spawned_children, output, status, task_external_id, task_id, task_inserted_at, tenant_id, type, workflow_id, workflow_run_external_id, action_id, retry_count, attempt, additional_metadata, children, duration, is_durable, error_message, finished_at, is_evicted, started_at, step_id, workflow_name, workflow_version_id, workflow_config, parent_task_external_id, idempotency_key].hash
696
726
  end
697
727
 
698
728
  # Builds the object from hash
@@ -37,6 +37,9 @@ module HatchetSdkRest
37
37
  # The ID of the tenant.
38
38
  attr_accessor :tenant_id
39
39
 
40
+ # Whether the task has been evicted from a worker (still counts as RUNNING).
41
+ attr_accessor :is_evicted
42
+
40
43
  # The external ID of the parent task.
41
44
  attr_accessor :parent_task_external_id
42
45
 
@@ -91,6 +94,7 @@ module HatchetSdkRest
91
94
  :'task_id' => :'taskId',
92
95
  :'task_inserted_at' => :'taskInsertedAt',
93
96
  :'tenant_id' => :'tenantId',
97
+ :'is_evicted' => :'isEvicted',
94
98
  :'parent_task_external_id' => :'parentTaskExternalId',
95
99
  :'queued_at' => :'queuedAt',
96
100
  :'started_at' => :'startedAt',
@@ -122,6 +126,7 @@ module HatchetSdkRest
122
126
  :'task_id' => :'Integer',
123
127
  :'task_inserted_at' => :'Time',
124
128
  :'tenant_id' => :'String',
129
+ :'is_evicted' => :'Boolean',
125
130
  :'parent_task_external_id' => :'String',
126
131
  :'queued_at' => :'Time',
127
132
  :'started_at' => :'Time',
@@ -202,6 +207,10 @@ module HatchetSdkRest
202
207
  self.tenant_id = nil
203
208
  end
204
209
 
210
+ if attributes.key?(:'is_evicted')
211
+ self.is_evicted = attributes[:'is_evicted']
212
+ end
213
+
205
214
  if attributes.key?(:'parent_task_external_id')
206
215
  self.parent_task_external_id = attributes[:'parent_task_external_id']
207
216
  end
@@ -443,6 +452,7 @@ module HatchetSdkRest
443
452
  task_id == o.task_id &&
444
453
  task_inserted_at == o.task_inserted_at &&
445
454
  tenant_id == o.tenant_id &&
455
+ is_evicted == o.is_evicted &&
446
456
  parent_task_external_id == o.parent_task_external_id &&
447
457
  queued_at == o.queued_at &&
448
458
  started_at == o.started_at &&
@@ -461,7 +471,7 @@ module HatchetSdkRest
461
471
  # Calculates hash code according to all attributes.
462
472
  # @return [Integer] Hash code
463
473
  def hash
464
- [metadata, depth, status, task_display_name, task_external_id, task_id, task_inserted_at, tenant_id, parent_task_external_id, queued_at, started_at, finished_at, workflow_run_id, retry_count, attempt].hash
474
+ [metadata, depth, status, task_display_name, task_external_id, task_id, task_inserted_at, tenant_id, is_evicted, parent_task_external_id, queued_at, started_at, finished_at, workflow_run_id, retry_count, attempt].hash
465
475
  end
466
476
 
467
477
  # Builds the object from hash
@@ -25,13 +25,17 @@ module HatchetSdkRest
25
25
  # The priority of the workflow run.
26
26
  attr_accessor :priority
27
27
 
28
+ # A boolean flag indicating whether to only return the id of the created run.
29
+ attr_accessor :return_only_id
30
+
28
31
  # Attribute mapping from ruby-style variable name to JSON key.
29
32
  def self.attribute_map
30
33
  {
31
34
  :'workflow_name' => :'workflowName',
32
35
  :'input' => :'input',
33
36
  :'additional_metadata' => :'additionalMetadata',
34
- :'priority' => :'priority'
37
+ :'priority' => :'priority',
38
+ :'return_only_id' => :'return_only_id'
35
39
  }
36
40
  end
37
41
 
@@ -51,7 +55,8 @@ module HatchetSdkRest
51
55
  :'workflow_name' => :'String',
52
56
  :'input' => :'Object',
53
57
  :'additional_metadata' => :'Object',
54
- :'priority' => :'Integer'
58
+ :'priority' => :'Integer',
59
+ :'return_only_id' => :'Boolean'
55
60
  }
56
61
  end
57
62
 
@@ -96,6 +101,10 @@ module HatchetSdkRest
96
101
  if attributes.key?(:'priority')
97
102
  self.priority = attributes[:'priority']
98
103
  end
104
+
105
+ if attributes.key?(:'return_only_id')
106
+ self.return_only_id = attributes[:'return_only_id']
107
+ end
99
108
  end
100
109
 
101
110
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -151,7 +160,8 @@ module HatchetSdkRest
151
160
  workflow_name == o.workflow_name &&
152
161
  input == o.input &&
153
162
  additional_metadata == o.additional_metadata &&
154
- priority == o.priority
163
+ priority == o.priority &&
164
+ return_only_id == o.return_only_id
155
165
  end
156
166
 
157
167
  # @see the `==` method
@@ -163,7 +173,7 @@ module HatchetSdkRest
163
173
  # Calculates hash code according to all attributes.
164
174
  # @return [Integer] Hash code
165
175
  def hash
166
- [workflow_name, input, additional_metadata, priority].hash
176
+ [workflow_name, input, additional_metadata, priority, return_only_id].hash
167
177
  end
168
178
 
169
179
  # Builds the object from hash
@@ -24,12 +24,16 @@ module HatchetSdkRest
24
24
  # The static payload to use for the webhook. This is used to send a static payload with the webhook.
25
25
  attr_accessor :static_payload
26
26
 
27
+ # Whether to return the triggered event as the response payload when this webhook is triggered
28
+ attr_accessor :return_event_as_response_payload
29
+
27
30
  # Attribute mapping from ruby-style variable name to JSON key.
28
31
  def self.attribute_map
29
32
  {
30
33
  :'event_key_expression' => :'eventKeyExpression',
31
34
  :'scope_expression' => :'scopeExpression',
32
- :'static_payload' => :'staticPayload'
35
+ :'static_payload' => :'staticPayload',
36
+ :'return_event_as_response_payload' => :'returnEventAsResponsePayload'
33
37
  }
34
38
  end
35
39
 
@@ -48,7 +52,8 @@ module HatchetSdkRest
48
52
  {
49
53
  :'event_key_expression' => :'String',
50
54
  :'scope_expression' => :'String',
51
- :'static_payload' => :'Object'
55
+ :'static_payload' => :'Object',
56
+ :'return_event_as_response_payload' => :'Boolean'
52
57
  }
53
58
  end
54
59
 
@@ -85,6 +90,10 @@ module HatchetSdkRest
85
90
  if attributes.key?(:'static_payload')
86
91
  self.static_payload = attributes[:'static_payload']
87
92
  end
93
+
94
+ if attributes.key?(:'return_event_as_response_payload')
95
+ self.return_event_as_response_payload = attributes[:'return_event_as_response_payload']
96
+ end
88
97
  end
89
98
 
90
99
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -109,7 +118,8 @@ module HatchetSdkRest
109
118
  self.class == o.class &&
110
119
  event_key_expression == o.event_key_expression &&
111
120
  scope_expression == o.scope_expression &&
112
- static_payload == o.static_payload
121
+ static_payload == o.static_payload &&
122
+ return_event_as_response_payload == o.return_event_as_response_payload
113
123
  end
114
124
 
115
125
  # @see the `==` method
@@ -121,7 +131,7 @@ module HatchetSdkRest
121
131
  # Calculates hash code according to all attributes.
122
132
  # @return [Integer] Hash code
123
133
  def hash
124
- [event_key_expression, scope_expression, static_payload].hash
134
+ [event_key_expression, scope_expression, static_payload, return_event_as_response_payload].hash
125
135
  end
126
136
 
127
137
  # Builds the object from hash
@@ -0,0 +1,280 @@
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 V1WaitItem
18
+ attr_accessor :kind
19
+
20
+ attr_accessor :sleep_duration_ms
21
+
22
+ attr_accessor :event_key
23
+
24
+ attr_accessor :workflow_name
25
+
26
+ attr_accessor :_or
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'kind' => :'kind',
54
+ :'sleep_duration_ms' => :'sleepDurationMs',
55
+ :'event_key' => :'eventKey',
56
+ :'workflow_name' => :'workflowName',
57
+ :'_or' => :'or'
58
+ }
59
+ end
60
+
61
+ # Returns attribute mapping this model knows about
62
+ def self.acceptable_attribute_map
63
+ attribute_map
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ acceptable_attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'kind' => :'V1DurableWaitConditionKind',
75
+ :'sleep_duration_ms' => :'Integer',
76
+ :'event_key' => :'String',
77
+ :'workflow_name' => :'String',
78
+ :'_or' => :'Array<V1DurableWaitCondition>'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1WaitItem` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1WaitItem`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'kind')
105
+ self.kind = attributes[:'kind']
106
+ end
107
+
108
+ if attributes.key?(:'sleep_duration_ms')
109
+ self.sleep_duration_ms = attributes[:'sleep_duration_ms']
110
+ end
111
+
112
+ if attributes.key?(:'event_key')
113
+ self.event_key = attributes[:'event_key']
114
+ end
115
+
116
+ if attributes.key?(:'workflow_name')
117
+ self.workflow_name = attributes[:'workflow_name']
118
+ end
119
+
120
+ if attributes.key?(:'_or')
121
+ if (value = attributes[:'_or']).is_a?(Array)
122
+ self._or = value
123
+ end
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
131
+ invalid_properties = Array.new
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ kind == o.kind &&
148
+ sleep_duration_ms == o.sleep_duration_ms &&
149
+ event_key == o.event_key &&
150
+ workflow_name == o.workflow_name &&
151
+ _or == o._or
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [kind, sleep_duration_ms, event_key, workflow_name, _or].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ attributes = attributes.transform_keys(&:to_sym)
172
+ transformed_hash = {}
173
+ openapi_types.each_pair do |key, type|
174
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = nil
176
+ elsif type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[attribute_map[key]].is_a?(Array)
180
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
181
+ end
182
+ elsif !attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
184
+ end
185
+ end
186
+ new(transformed_hash)
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def self._deserialize(type, value)
194
+ case type.to_sym
195
+ when :Time
196
+ Time.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ # models (e.g. Pet) or oneOf
227
+ klass = HatchetSdkRest.const_get(type)
228
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
229
+ end
230
+ end
231
+
232
+ # Returns the string representation of the object
233
+ # @return [String] String presentation of the object
234
+ def to_s
235
+ to_hash.to_s
236
+ end
237
+
238
+ # to_body is an alias to to_hash (backward compatibility)
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_body
241
+ to_hash
242
+ end
243
+
244
+ # Returns the object in the form of hash
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_hash
247
+ hash = {}
248
+ self.class.attribute_map.each_pair do |attr, param|
249
+ value = self.send(attr)
250
+ if value.nil?
251
+ is_nullable = self.class.openapi_nullable.include?(attr)
252
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
253
+ end
254
+
255
+ hash[param] = _to_hash(value)
256
+ end
257
+ hash
258
+ end
259
+
260
+ # Outputs non-array value in the form of hash
261
+ # For object, use to_hash. Otherwise, just return the value
262
+ # @param [Object] value Any valid value
263
+ # @return [Hash] Returns the value in the form of hash
264
+ def _to_hash(value)
265
+ if value.is_a?(Array)
266
+ value.compact.map { |v| _to_hash(v) }
267
+ elsif value.is_a?(Hash)
268
+ {}.tap do |hash|
269
+ value.each { |k, v| hash[k] = _to_hash(v) }
270
+ end
271
+ elsif value.respond_to? :to_hash
272
+ value.to_hash
273
+ else
274
+ value
275
+ end
276
+ end
277
+
278
+ end
279
+
280
+ end
@@ -38,6 +38,9 @@ module HatchetSdkRest
38
38
  # The static payload to use for the webhook. This is used to send a static payload with the webhook.
39
39
  attr_accessor :static_payload
40
40
 
41
+ # Whether to return the triggered event as the response payload when this webhook is triggered
42
+ attr_accessor :return_event_as_response_payload
43
+
41
44
  class EnumAttributeValidator
42
45
  attr_reader :datatype
43
46
  attr_reader :allowable_values
@@ -70,7 +73,8 @@ module HatchetSdkRest
70
73
  :'event_key_expression' => :'eventKeyExpression',
71
74
  :'auth_type' => :'authType',
72
75
  :'scope_expression' => :'scopeExpression',
73
- :'static_payload' => :'staticPayload'
76
+ :'static_payload' => :'staticPayload',
77
+ :'return_event_as_response_payload' => :'returnEventAsResponsePayload'
74
78
  }
75
79
  end
76
80
 
@@ -94,7 +98,8 @@ module HatchetSdkRest
94
98
  :'event_key_expression' => :'String',
95
99
  :'auth_type' => :'V1WebhookAuthType',
96
100
  :'scope_expression' => :'String',
97
- :'static_payload' => :'Object'
101
+ :'static_payload' => :'Object',
102
+ :'return_event_as_response_payload' => :'Boolean'
98
103
  }
99
104
  end
100
105
 
@@ -163,6 +168,10 @@ module HatchetSdkRest
163
168
  if attributes.key?(:'static_payload')
164
169
  self.static_payload = attributes[:'static_payload']
165
170
  end
171
+
172
+ if attributes.key?(:'return_event_as_response_payload')
173
+ self.return_event_as_response_payload = attributes[:'return_event_as_response_payload']
174
+ end
166
175
  end
167
176
 
168
177
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -282,7 +291,8 @@ module HatchetSdkRest
282
291
  event_key_expression == o.event_key_expression &&
283
292
  auth_type == o.auth_type &&
284
293
  scope_expression == o.scope_expression &&
285
- static_payload == o.static_payload
294
+ static_payload == o.static_payload &&
295
+ return_event_as_response_payload == o.return_event_as_response_payload
286
296
  end
287
297
 
288
298
  # @see the `==` method
@@ -294,7 +304,7 @@ module HatchetSdkRest
294
304
  # Calculates hash code according to all attributes.
295
305
  # @return [Integer] Hash code
296
306
  def hash
297
- [metadata, tenant_id, name, source_name, event_key_expression, auth_type, scope_expression, static_payload].hash
307
+ [metadata, tenant_id, name, source_name, event_key_expression, auth_type, scope_expression, static_payload, return_event_as_response_payload].hash
298
308
  end
299
309
 
300
310
  # Builds the object from hash
@@ -126,7 +126,7 @@ module HatchetSdkRest
126
126
  :'registered_workflows' => :'Array<RegisteredWorkflow>',
127
127
  :'slots' => :'Array<SemaphoreSlots>',
128
128
  :'recent_step_runs' => :'Array<RecentStepRuns>',
129
- :'status' => :'String',
129
+ :'status' => :'WorkerStatus',
130
130
  :'slot_config' => :'Hash<String, WorkerSlotConfig>',
131
131
  :'dispatcher_id' => :'String',
132
132
  :'labels' => :'Array<WorkerLabel>',
@@ -276,8 +276,6 @@ module HatchetSdkRest
276
276
  return false if @metadata.nil?
277
277
  return false if @name.nil?
278
278
  return false if @type.nil?
279
- status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "INACTIVE", "PAUSED"])
280
- return false unless status_validator.valid?(@status)
281
279
  return false if !@dispatcher_id.nil? && @dispatcher_id.to_s.length > 36
282
280
  return false if !@dispatcher_id.nil? && @dispatcher_id.to_s.length < 36
283
281
  true
@@ -313,16 +311,6 @@ module HatchetSdkRest
313
311
  @type = type
314
312
  end
315
313
 
316
- # Custom attribute writer method checking allowed values (enum).
317
- # @param [Object] status Object to be assigned
318
- def status=(status)
319
- validator = EnumAttributeValidator.new('String', ["ACTIVE", "INACTIVE", "PAUSED"])
320
- unless validator.valid?(status)
321
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
322
- end
323
- @status = status
324
- end
325
-
326
314
  # Custom attribute writer method with validation
327
315
  # @param [Object] dispatcher_id Value to be assigned
328
316
  def dispatcher_id=(dispatcher_id)