hatchet-sdk 0.6.0 → 0.7.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/lib/hatchet/clients/rest/.openapi-generator/FILES +9 -0
  4. data/lib/hatchet/clients/rest/README.md +16 -3
  5. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/filter_api.rb +4 -0
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb +405 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/webhook_api.rb +2 -0
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +14 -4
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_invite_request.rb +14 -4
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request.rb +105 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_pause.rb +343 -0
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_unpause.rb +262 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_invite.rb +11 -1
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +11 -1
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member_role.rb +2 -1
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb +14 -4
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_member_request.rb +14 -4
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb +346 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event.rb +14 -4
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb +372 -0
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb +231 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +14 -4
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb +252 -0
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run.rb +14 -4
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +43 -1
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_pause_scheduled_cron_run_queue_behavior.rb +40 -0
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_update_request.rb +7 -8
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +9 -0
  29. data/lib/hatchet/concurrency.rb +5 -1
  30. data/lib/hatchet/context.rb +5 -2
  31. data/lib/hatchet/contracts/v1/workflows_pb.rb +1 -1
  32. data/lib/hatchet/durable_context.rb +5 -12
  33. data/lib/hatchet/features/cel.rb +2 -2
  34. data/lib/hatchet/features/cron.rb +5 -5
  35. data/lib/hatchet/features/events.rb +7 -7
  36. data/lib/hatchet/features/filters.rb +7 -7
  37. data/lib/hatchet/features/logs.rb +2 -2
  38. data/lib/hatchet/features/metrics.rb +6 -6
  39. data/lib/hatchet/features/rate_limits.rb +2 -2
  40. data/lib/hatchet/features/runs.rb +4 -5
  41. data/lib/hatchet/features/scheduled.rb +7 -7
  42. data/lib/hatchet/features/tenant.rb +2 -2
  43. data/lib/hatchet/features/workers.rb +5 -5
  44. data/lib/hatchet/features/workflows.rb +6 -6
  45. data/lib/hatchet/version.rb +1 -1
  46. data/lib/hatchet/workflow.rb +58 -33
  47. data/lib/hatchet-sdk.rb +65 -32
  48. metadata +11 -2
@@ -0,0 +1,346 @@
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 V1CreateHTTPOperatorRequest
18
+ # The name of the operator.
19
+ attr_accessor :name
20
+
21
+ # The HTTPS endpoint (https, port 443) that assigned tasks are delivered to.
22
+ attr_accessor :trigger_endpoint
23
+
24
+ # The HTTPS endpoint polled periodically to discover the actions this operator handles.
25
+ attr_accessor :healthcheck_endpoint
26
+
27
+ # The secret used to HMAC-sign delivered requests (sent in the X-Hatchet-Signature header). Write-only: it is never returned in responses.
28
+ attr_accessor :signing_secret
29
+
30
+ # The per-request timeout backstop, in seconds.
31
+ attr_accessor :request_timeout_seconds
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'name' => :'name',
37
+ :'trigger_endpoint' => :'triggerEndpoint',
38
+ :'healthcheck_endpoint' => :'healthcheckEndpoint',
39
+ :'signing_secret' => :'signingSecret',
40
+ :'request_timeout_seconds' => :'requestTimeoutSeconds'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'name' => :'String',
58
+ :'trigger_endpoint' => :'String',
59
+ :'healthcheck_endpoint' => :'String',
60
+ :'signing_secret' => :'String',
61
+ :'request_timeout_seconds' => :'Integer'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1CreateHTTPOperatorRequest` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1CreateHTTPOperatorRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'name')
88
+ self.name = attributes[:'name']
89
+ else
90
+ self.name = nil
91
+ end
92
+
93
+ if attributes.key?(:'trigger_endpoint')
94
+ self.trigger_endpoint = attributes[:'trigger_endpoint']
95
+ else
96
+ self.trigger_endpoint = nil
97
+ end
98
+
99
+ if attributes.key?(:'healthcheck_endpoint')
100
+ self.healthcheck_endpoint = attributes[:'healthcheck_endpoint']
101
+ else
102
+ self.healthcheck_endpoint = nil
103
+ end
104
+
105
+ if attributes.key?(:'signing_secret')
106
+ self.signing_secret = attributes[:'signing_secret']
107
+ else
108
+ self.signing_secret = nil
109
+ end
110
+
111
+ if attributes.key?(:'request_timeout_seconds')
112
+ self.request_timeout_seconds = attributes[:'request_timeout_seconds']
113
+ else
114
+ self.request_timeout_seconds = nil
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ if @name.nil?
124
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
125
+ end
126
+
127
+ if @trigger_endpoint.nil?
128
+ invalid_properties.push('invalid value for "trigger_endpoint", trigger_endpoint cannot be nil.')
129
+ end
130
+
131
+ if @healthcheck_endpoint.nil?
132
+ invalid_properties.push('invalid value for "healthcheck_endpoint", healthcheck_endpoint cannot be nil.')
133
+ end
134
+
135
+ if @signing_secret.nil?
136
+ invalid_properties.push('invalid value for "signing_secret", signing_secret cannot be nil.')
137
+ end
138
+
139
+ if @request_timeout_seconds.nil?
140
+ invalid_properties.push('invalid value for "request_timeout_seconds", request_timeout_seconds cannot be nil.')
141
+ end
142
+
143
+ invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ warn '[DEPRECATED] the `valid?` method is obsolete'
150
+ return false if @name.nil?
151
+ return false if @trigger_endpoint.nil?
152
+ return false if @healthcheck_endpoint.nil?
153
+ return false if @signing_secret.nil?
154
+ return false if @request_timeout_seconds.nil?
155
+ true
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] name Value to be assigned
160
+ def name=(name)
161
+ if name.nil?
162
+ fail ArgumentError, 'name cannot be nil'
163
+ end
164
+
165
+ @name = name
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] trigger_endpoint Value to be assigned
170
+ def trigger_endpoint=(trigger_endpoint)
171
+ if trigger_endpoint.nil?
172
+ fail ArgumentError, 'trigger_endpoint cannot be nil'
173
+ end
174
+
175
+ @trigger_endpoint = trigger_endpoint
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] healthcheck_endpoint Value to be assigned
180
+ def healthcheck_endpoint=(healthcheck_endpoint)
181
+ if healthcheck_endpoint.nil?
182
+ fail ArgumentError, 'healthcheck_endpoint cannot be nil'
183
+ end
184
+
185
+ @healthcheck_endpoint = healthcheck_endpoint
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] signing_secret Value to be assigned
190
+ def signing_secret=(signing_secret)
191
+ if signing_secret.nil?
192
+ fail ArgumentError, 'signing_secret cannot be nil'
193
+ end
194
+
195
+ @signing_secret = signing_secret
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] request_timeout_seconds Value to be assigned
200
+ def request_timeout_seconds=(request_timeout_seconds)
201
+ if request_timeout_seconds.nil?
202
+ fail ArgumentError, 'request_timeout_seconds cannot be nil'
203
+ end
204
+
205
+ @request_timeout_seconds = request_timeout_seconds
206
+ end
207
+
208
+ # Checks equality by comparing each attribute.
209
+ # @param [Object] Object to be compared
210
+ def ==(o)
211
+ return true if self.equal?(o)
212
+ self.class == o.class &&
213
+ name == o.name &&
214
+ trigger_endpoint == o.trigger_endpoint &&
215
+ healthcheck_endpoint == o.healthcheck_endpoint &&
216
+ signing_secret == o.signing_secret &&
217
+ request_timeout_seconds == o.request_timeout_seconds
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [name, trigger_endpoint, healthcheck_endpoint, signing_secret, request_timeout_seconds].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ return nil unless attributes.is_a?(Hash)
237
+ attributes = attributes.transform_keys(&:to_sym)
238
+ transformed_hash = {}
239
+ openapi_types.each_pair do |key, type|
240
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
241
+ transformed_hash["#{key}"] = nil
242
+ elsif type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[attribute_map[key]].is_a?(Array)
246
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
247
+ end
248
+ elsif !attributes[attribute_map[key]].nil?
249
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
250
+ end
251
+ end
252
+ new(transformed_hash)
253
+ end
254
+
255
+ # Deserializes the data based on type
256
+ # @param string type Data type
257
+ # @param string value Value to be deserialized
258
+ # @return [Object] Deserialized data
259
+ def self._deserialize(type, value)
260
+ case type.to_sym
261
+ when :Time
262
+ Time.parse(value)
263
+ when :Date
264
+ Date.parse(value)
265
+ when :String
266
+ value.to_s
267
+ when :Integer
268
+ value.to_i
269
+ when :Float
270
+ value.to_f
271
+ when :Boolean
272
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
+ true
274
+ else
275
+ false
276
+ end
277
+ when :Object
278
+ # generic object (usually a Hash), return directly
279
+ value
280
+ when /\AArray<(?<inner_type>.+)>\z/
281
+ inner_type = Regexp.last_match[:inner_type]
282
+ value.map { |v| _deserialize(inner_type, v) }
283
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
+ k_type = Regexp.last_match[:k_type]
285
+ v_type = Regexp.last_match[:v_type]
286
+ {}.tap do |hash|
287
+ value.each do |k, v|
288
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
+ end
290
+ end
291
+ else # model
292
+ # models (e.g. Pet) or oneOf
293
+ klass = HatchetSdkRest.const_get(type)
294
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
295
+ end
296
+ end
297
+
298
+ # Returns the string representation of the object
299
+ # @return [String] String presentation of the object
300
+ def to_s
301
+ to_hash.to_s
302
+ end
303
+
304
+ # to_body is an alias to to_hash (backward compatibility)
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_body
307
+ to_hash
308
+ end
309
+
310
+ # Returns the object in the form of hash
311
+ # @return [Hash] Returns the object in the form of hash
312
+ def to_hash
313
+ hash = {}
314
+ self.class.attribute_map.each_pair do |attr, param|
315
+ value = self.send(attr)
316
+ if value.nil?
317
+ is_nullable = self.class.openapi_nullable.include?(attr)
318
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
319
+ end
320
+
321
+ hash[param] = _to_hash(value)
322
+ end
323
+ hash
324
+ end
325
+
326
+ # Outputs non-array value in the form of hash
327
+ # For object, use to_hash. Otherwise, just return the value
328
+ # @param [Object] value Any valid value
329
+ # @return [Hash] Returns the value in the form of hash
330
+ def _to_hash(value)
331
+ if value.is_a?(Array)
332
+ value.compact.map { |v| _to_hash(v) }
333
+ elsif value.is_a?(Hash)
334
+ {}.tap do |hash|
335
+ value.each { |k, v| hash[k] = _to_hash(v) }
336
+ end
337
+ elsif value.respond_to? :to_hash
338
+ value.to_hash
339
+ else
340
+ value
341
+ end
342
+ end
343
+
344
+ end
345
+
346
+ end
@@ -47,6 +47,9 @@ module HatchetSdkRest
47
47
  # The name of the webhook that triggered this event, if applicable.
48
48
  attr_accessor :triggering_webhook_name
49
49
 
50
+ # True when the event payload was omitted because the caller cannot view payloads. Additional metadata is still included.
51
+ attr_accessor :payloads_restricted
52
+
50
53
  # Attribute mapping from ruby-style variable name to JSON key.
51
54
  def self.attribute_map
52
55
  {
@@ -60,7 +63,8 @@ module HatchetSdkRest
60
63
  :'scope' => :'scope',
61
64
  :'seen_at' => :'seenAt',
62
65
  :'triggered_runs' => :'triggeredRuns',
63
- :'triggering_webhook_name' => :'triggeringWebhookName'
66
+ :'triggering_webhook_name' => :'triggeringWebhookName',
67
+ :'payloads_restricted' => :'payloadsRestricted'
64
68
  }
65
69
  end
66
70
 
@@ -87,7 +91,8 @@ module HatchetSdkRest
87
91
  :'scope' => :'String',
88
92
  :'seen_at' => :'Time',
89
93
  :'triggered_runs' => :'Array<V1EventTriggeredRun>',
90
- :'triggering_webhook_name' => :'String'
94
+ :'triggering_webhook_name' => :'String',
95
+ :'payloads_restricted' => :'Boolean'
91
96
  }
92
97
  end
93
98
 
@@ -166,6 +171,10 @@ module HatchetSdkRest
166
171
  if attributes.key?(:'triggering_webhook_name')
167
172
  self.triggering_webhook_name = attributes[:'triggering_webhook_name']
168
173
  end
174
+
175
+ if attributes.key?(:'payloads_restricted')
176
+ self.payloads_restricted = attributes[:'payloads_restricted']
177
+ end
169
178
  end
170
179
 
171
180
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -258,7 +267,8 @@ module HatchetSdkRest
258
267
  scope == o.scope &&
259
268
  seen_at == o.seen_at &&
260
269
  triggered_runs == o.triggered_runs &&
261
- triggering_webhook_name == o.triggering_webhook_name
270
+ triggering_webhook_name == o.triggering_webhook_name &&
271
+ payloads_restricted == o.payloads_restricted
262
272
  end
263
273
 
264
274
  # @see the `==` method
@@ -270,7 +280,7 @@ module HatchetSdkRest
270
280
  # Calculates hash code according to all attributes.
271
281
  # @return [Integer] Hash code
272
282
  def hash
273
- [metadata, key, tenant_id, workflow_run_summary, tenant, additional_metadata, payload, scope, seen_at, triggered_runs, triggering_webhook_name].hash
283
+ [metadata, key, tenant_id, workflow_run_summary, tenant, additional_metadata, payload, scope, seen_at, triggered_runs, triggering_webhook_name, payloads_restricted].hash
274
284
  end
275
285
 
276
286
  # Builds the object from hash