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,262 @@
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 PauseWorkflowRequestUnpause
18
+ # Discriminator indicating this request unpauses the workflow.
19
+ attr_accessor :action
20
+
21
+ class EnumAttributeValidator
22
+ attr_reader :datatype
23
+ attr_reader :allowable_values
24
+
25
+ def initialize(datatype, allowable_values)
26
+ @allowable_values = allowable_values.map do |value|
27
+ case datatype.to_s
28
+ when /Integer/i
29
+ value.to_i
30
+ when /Float/i
31
+ value.to_f
32
+ else
33
+ value
34
+ end
35
+ end
36
+ end
37
+
38
+ def valid?(value)
39
+ !value || allowable_values.include?(value)
40
+ end
41
+ end
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'action' => :'action'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'action' => :'String'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::PauseWorkflowRequestUnpause` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ acceptable_attribute_map = self.class.acceptable_attribute_map
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!acceptable_attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::PauseWorkflowRequestUnpause`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'action')
90
+ self.action = attributes[:'action']
91
+ else
92
+ self.action = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @action.nil?
102
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
103
+ end
104
+
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ warn '[DEPRECATED] the `valid?` method is obsolete'
112
+ return false if @action.nil?
113
+ action_validator = EnumAttributeValidator.new('String', ["unpause"])
114
+ return false unless action_validator.valid?(@action)
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] action Object to be assigned
120
+ def action=(action)
121
+ validator = EnumAttributeValidator.new('String', ["unpause"])
122
+ unless validator.valid?(action)
123
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
124
+ end
125
+ @action = action
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ action == o.action
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [action].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ transformed_hash = {}
155
+ openapi_types.each_pair do |key, type|
156
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = nil
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[attribute_map[key]].is_a?(Array)
162
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
163
+ end
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
166
+ end
167
+ end
168
+ new(transformed_hash)
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def self._deserialize(type, value)
176
+ case type.to_sym
177
+ when :Time
178
+ Time.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ # models (e.g. Pet) or oneOf
209
+ klass = HatchetSdkRest.const_get(type)
210
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map { |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+
260
+ end
261
+
262
+ end
@@ -29,6 +29,9 @@ module HatchetSdkRest
29
29
  # The time that this invite expires.
30
30
  attr_accessor :expires
31
31
 
32
+ # Whether the invited user can view payloads. Defaults to true.
33
+ attr_accessor :can_view_payloads
34
+
32
35
  # The tenant name for the tenant.
33
36
  attr_accessor :tenant_name
34
37
 
@@ -62,6 +65,7 @@ module HatchetSdkRest
62
65
  :'role' => :'role',
63
66
  :'tenant_id' => :'tenantId',
64
67
  :'expires' => :'expires',
68
+ :'can_view_payloads' => :'canViewPayloads',
65
69
  :'tenant_name' => :'tenantName'
66
70
  }
67
71
  end
@@ -84,6 +88,7 @@ module HatchetSdkRest
84
88
  :'role' => :'TenantMemberRole',
85
89
  :'tenant_id' => :'String',
86
90
  :'expires' => :'Time',
91
+ :'can_view_payloads' => :'Boolean',
87
92
  :'tenant_name' => :'String'
88
93
  }
89
94
  end
@@ -140,6 +145,10 @@ module HatchetSdkRest
140
145
  self.expires = nil
141
146
  end
142
147
 
148
+ if attributes.key?(:'can_view_payloads')
149
+ self.can_view_payloads = attributes[:'can_view_payloads']
150
+ end
151
+
143
152
  if attributes.key?(:'tenant_name')
144
153
  self.tenant_name = attributes[:'tenant_name']
145
154
  end
@@ -245,6 +254,7 @@ module HatchetSdkRest
245
254
  role == o.role &&
246
255
  tenant_id == o.tenant_id &&
247
256
  expires == o.expires &&
257
+ can_view_payloads == o.can_view_payloads &&
248
258
  tenant_name == o.tenant_name
249
259
  end
250
260
 
@@ -257,7 +267,7 @@ module HatchetSdkRest
257
267
  # Calculates hash code according to all attributes.
258
268
  # @return [Integer] Hash code
259
269
  def hash
260
- [metadata, email, role, tenant_id, expires, tenant_name].hash
270
+ [metadata, email, role, tenant_id, expires, can_view_payloads, tenant_name].hash
261
271
  end
262
272
 
263
273
  # Builds the object from hash
@@ -23,6 +23,9 @@ module HatchetSdkRest
23
23
  # The role of the user in the tenant.
24
24
  attr_accessor :role
25
25
 
26
+ # Whether this member can view task, event, and log payloads in the dashboard and REST API. OWNER and ADMIN always can, regardless of this flag. Defaults to true.
27
+ attr_accessor :can_view_payloads
28
+
26
29
  # The tenant associated with this tenant member.
27
30
  attr_accessor :tenant
28
31
 
@@ -57,6 +60,7 @@ module HatchetSdkRest
57
60
  :'metadata' => :'metadata',
58
61
  :'user' => :'user',
59
62
  :'role' => :'role',
63
+ :'can_view_payloads' => :'canViewPayloads',
60
64
  :'tenant' => :'tenant',
61
65
  :'manually_added' => :'manually_added'
62
66
  }
@@ -78,6 +82,7 @@ module HatchetSdkRest
78
82
  :'metadata' => :'APIResourceMeta',
79
83
  :'user' => :'UserTenantPublic',
80
84
  :'role' => :'TenantMemberRole',
85
+ :'can_view_payloads' => :'Boolean',
81
86
  :'tenant' => :'Tenant',
82
87
  :'manually_added' => :'Boolean'
83
88
  }
@@ -123,6 +128,10 @@ module HatchetSdkRest
123
128
  self.role = nil
124
129
  end
125
130
 
131
+ if attributes.key?(:'can_view_payloads')
132
+ self.can_view_payloads = attributes[:'can_view_payloads']
133
+ end
134
+
126
135
  if attributes.key?(:'tenant')
127
136
  self.tenant = attributes[:'tenant']
128
137
  end
@@ -200,6 +209,7 @@ module HatchetSdkRest
200
209
  metadata == o.metadata &&
201
210
  user == o.user &&
202
211
  role == o.role &&
212
+ can_view_payloads == o.can_view_payloads &&
203
213
  tenant == o.tenant &&
204
214
  manually_added == o.manually_added
205
215
  end
@@ -213,7 +223,7 @@ module HatchetSdkRest
213
223
  # Calculates hash code according to all attributes.
214
224
  # @return [Integer] Hash code
215
225
  def hash
216
- [metadata, user, role, tenant, manually_added].hash
226
+ [metadata, user, role, can_view_payloads, tenant, manually_added].hash
217
227
  end
218
228
 
219
229
  # Builds the object from hash
@@ -18,9 +18,10 @@ module HatchetSdkRest
18
18
  OWNER = "OWNER".freeze
19
19
  ADMIN = "ADMIN".freeze
20
20
  MEMBER = "MEMBER".freeze
21
+ VIEWER = "VIEWER".freeze
21
22
 
22
23
  def self.all_vars
23
- @all_vars ||= [OWNER, ADMIN, MEMBER].freeze
24
+ @all_vars ||= [OWNER, ADMIN, MEMBER, VIEWER].freeze
24
25
  end
25
26
 
26
27
  # Builds the enum from string
@@ -18,6 +18,9 @@ module HatchetSdkRest
18
18
  # The role of the user in the tenant.
19
19
  attr_accessor :role
20
20
 
21
+ # Whether the invited user can view payloads.
22
+ attr_accessor :can_view_payloads
23
+
21
24
  class EnumAttributeValidator
22
25
  attr_reader :datatype
23
26
  attr_reader :allowable_values
@@ -43,7 +46,8 @@ module HatchetSdkRest
43
46
  # Attribute mapping from ruby-style variable name to JSON key.
44
47
  def self.attribute_map
45
48
  {
46
- :'role' => :'role'
49
+ :'role' => :'role',
50
+ :'can_view_payloads' => :'canViewPayloads'
47
51
  }
48
52
  end
49
53
 
@@ -60,7 +64,8 @@ module HatchetSdkRest
60
64
  # Attribute type mapping.
61
65
  def self.openapi_types
62
66
  {
63
- :'role' => :'TenantMemberRole'
67
+ :'role' => :'TenantMemberRole',
68
+ :'can_view_payloads' => :'Boolean'
64
69
  }
65
70
  end
66
71
 
@@ -91,6 +96,10 @@ module HatchetSdkRest
91
96
  else
92
97
  self.role = nil
93
98
  end
99
+
100
+ if attributes.key?(:'can_view_payloads')
101
+ self.can_view_payloads = attributes[:'can_view_payloads']
102
+ end
94
103
  end
95
104
 
96
105
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -128,7 +137,8 @@ module HatchetSdkRest
128
137
  def ==(o)
129
138
  return true if self.equal?(o)
130
139
  self.class == o.class &&
131
- role == o.role
140
+ role == o.role &&
141
+ can_view_payloads == o.can_view_payloads
132
142
  end
133
143
 
134
144
  # @see the `==` method
@@ -140,7 +150,7 @@ module HatchetSdkRest
140
150
  # Calculates hash code according to all attributes.
141
151
  # @return [Integer] Hash code
142
152
  def hash
143
- [role].hash
153
+ [role, can_view_payloads].hash
144
154
  end
145
155
 
146
156
  # Builds the object from hash
@@ -18,6 +18,9 @@ module HatchetSdkRest
18
18
  # The role of the user in the tenant.
19
19
  attr_accessor :role
20
20
 
21
+ # Whether this member can view payloads. Ignored for OWNER and ADMIN, who always can.
22
+ attr_accessor :can_view_payloads
23
+
21
24
  class EnumAttributeValidator
22
25
  attr_reader :datatype
23
26
  attr_reader :allowable_values
@@ -43,7 +46,8 @@ module HatchetSdkRest
43
46
  # Attribute mapping from ruby-style variable name to JSON key.
44
47
  def self.attribute_map
45
48
  {
46
- :'role' => :'role'
49
+ :'role' => :'role',
50
+ :'can_view_payloads' => :'canViewPayloads'
47
51
  }
48
52
  end
49
53
 
@@ -60,7 +64,8 @@ module HatchetSdkRest
60
64
  # Attribute type mapping.
61
65
  def self.openapi_types
62
66
  {
63
- :'role' => :'TenantMemberRole'
67
+ :'role' => :'TenantMemberRole',
68
+ :'can_view_payloads' => :'Boolean'
64
69
  }
65
70
  end
66
71
 
@@ -91,6 +96,10 @@ module HatchetSdkRest
91
96
  else
92
97
  self.role = nil
93
98
  end
99
+
100
+ if attributes.key?(:'can_view_payloads')
101
+ self.can_view_payloads = attributes[:'can_view_payloads']
102
+ end
94
103
  end
95
104
 
96
105
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -128,7 +137,8 @@ module HatchetSdkRest
128
137
  def ==(o)
129
138
  return true if self.equal?(o)
130
139
  self.class == o.class &&
131
- role == o.role
140
+ role == o.role &&
141
+ can_view_payloads == o.can_view_payloads
132
142
  end
133
143
 
134
144
  # @see the `==` method
@@ -140,7 +150,7 @@ module HatchetSdkRest
140
150
  # Calculates hash code according to all attributes.
141
151
  # @return [Integer] Hash code
142
152
  def hash
143
- [role].hash
153
+ [role, can_view_payloads].hash
144
154
  end
145
155
 
146
156
  # Builds the object from hash