conductor_ruby 0.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +142 -0
- data/LICENSE +190 -0
- data/README.md +517 -0
- data/examples/agentic_workflows/llm_chat.rb +106 -0
- data/examples/dynamic_workflow.rb +177 -0
- data/examples/event_handler.rb +94 -0
- data/examples/event_listener_examples.rb +430 -0
- data/examples/helloworld/greetings_worker.rb +24 -0
- data/examples/helloworld/helloworld.rb +99 -0
- data/examples/kitchensink.rb +213 -0
- data/examples/metadata_journey.rb +189 -0
- data/examples/metrics_example.rb +284 -0
- data/examples/new_dsl_demo.rb +141 -0
- data/examples/orkes/http_poll.rb +83 -0
- data/examples/orkes/secrets_example.rb +69 -0
- data/examples/orkes/wait_for_webhook.rb +90 -0
- data/examples/prompt_journey.rb +245 -0
- data/examples/rag_workflow.rb +167 -0
- data/examples/schedule_journey.rb +244 -0
- data/examples/simple_worker.rb +125 -0
- data/examples/simple_workflow.rb +89 -0
- data/examples/task_context_example.rb +257 -0
- data/examples/task_listener_example.rb +192 -0
- data/examples/worker_configuration_example.rb +282 -0
- data/examples/workflow_dsl.rb +316 -0
- data/examples/workflow_ops.rb +305 -0
- data/lib/conductor/client/authorization_client.rb +238 -0
- data/lib/conductor/client/integration_client.rb +108 -0
- data/lib/conductor/client/metadata_client.rb +139 -0
- data/lib/conductor/client/prompt_client.rb +58 -0
- data/lib/conductor/client/scheduler_client.rb +132 -0
- data/lib/conductor/client/schema_client.rb +32 -0
- data/lib/conductor/client/secret_client.rb +48 -0
- data/lib/conductor/client/task_client.rb +168 -0
- data/lib/conductor/client/workflow_client.rb +242 -0
- data/lib/conductor/configuration/authentication_settings.rb +17 -0
- data/lib/conductor/configuration.rb +103 -0
- data/lib/conductor/exceptions.rb +86 -0
- data/lib/conductor/http/api/application_resource_api.rb +107 -0
- data/lib/conductor/http/api/authorization_resource_api.rb +56 -0
- data/lib/conductor/http/api/event_resource_api.rb +133 -0
- data/lib/conductor/http/api/gateway_auth_resource_api.rb +48 -0
- data/lib/conductor/http/api/group_resource_api.rb +76 -0
- data/lib/conductor/http/api/integration_resource_api.rb +145 -0
- data/lib/conductor/http/api/metadata_resource_api.rb +231 -0
- data/lib/conductor/http/api/prompt_resource_api.rb +81 -0
- data/lib/conductor/http/api/role_resource_api.rb +60 -0
- data/lib/conductor/http/api/scheduler_resource_api.rb +211 -0
- data/lib/conductor/http/api/schema_resource_api.rb +82 -0
- data/lib/conductor/http/api/secret_resource_api.rb +134 -0
- data/lib/conductor/http/api/task_resource_api.rb +321 -0
- data/lib/conductor/http/api/token_resource_api.rb +42 -0
- data/lib/conductor/http/api/user_resource_api.rb +59 -0
- data/lib/conductor/http/api/workflow_bulk_resource_api.rb +91 -0
- data/lib/conductor/http/api/workflow_resource_api.rb +451 -0
- data/lib/conductor/http/api_client.rb +437 -0
- data/lib/conductor/http/models/authentication_config.rb +67 -0
- data/lib/conductor/http/models/authorization_request.rb +39 -0
- data/lib/conductor/http/models/base_model.rb +162 -0
- data/lib/conductor/http/models/bulk_response.rb +39 -0
- data/lib/conductor/http/models/conductor_application.rb +39 -0
- data/lib/conductor/http/models/conductor_user.rb +53 -0
- data/lib/conductor/http/models/create_or_update_application_request.rb +24 -0
- data/lib/conductor/http/models/create_or_update_role_request.rb +27 -0
- data/lib/conductor/http/models/event_handler.rb +130 -0
- data/lib/conductor/http/models/generate_token_request.rb +27 -0
- data/lib/conductor/http/models/group.rb +36 -0
- data/lib/conductor/http/models/integration.rb +70 -0
- data/lib/conductor/http/models/integration_api.rb +53 -0
- data/lib/conductor/http/models/integration_api_update.rb +43 -0
- data/lib/conductor/http/models/integration_update.rb +36 -0
- data/lib/conductor/http/models/permission.rb +24 -0
- data/lib/conductor/http/models/poll_data.rb +33 -0
- data/lib/conductor/http/models/prompt_template.rb +59 -0
- data/lib/conductor/http/models/prompt_template_test_request.rb +43 -0
- data/lib/conductor/http/models/rerun_workflow_request.rb +37 -0
- data/lib/conductor/http/models/role.rb +27 -0
- data/lib/conductor/http/models/schema_def.rb +59 -0
- data/lib/conductor/http/models/search_result.rb +187 -0
- data/lib/conductor/http/models/skip_task_request.rb +27 -0
- data/lib/conductor/http/models/start_workflow_request.rb +68 -0
- data/lib/conductor/http/models/subject_ref.rb +35 -0
- data/lib/conductor/http/models/tag_object.rb +36 -0
- data/lib/conductor/http/models/target_ref.rb +39 -0
- data/lib/conductor/http/models/task.rb +156 -0
- data/lib/conductor/http/models/task_def.rb +95 -0
- data/lib/conductor/http/models/task_exec_log.rb +30 -0
- data/lib/conductor/http/models/task_result.rb +115 -0
- data/lib/conductor/http/models/task_result_status.rb +24 -0
- data/lib/conductor/http/models/token.rb +33 -0
- data/lib/conductor/http/models/upsert_group_request.rb +30 -0
- data/lib/conductor/http/models/upsert_user_request.rb +39 -0
- data/lib/conductor/http/models/workflow.rb +202 -0
- data/lib/conductor/http/models/workflow_def.rb +73 -0
- data/lib/conductor/http/models/workflow_schedule.rb +100 -0
- data/lib/conductor/http/models/workflow_state_update.rb +30 -0
- data/lib/conductor/http/models/workflow_status_constants.rb +57 -0
- data/lib/conductor/http/models/workflow_task.rb +169 -0
- data/lib/conductor/http/models/workflow_test_request.rb +67 -0
- data/lib/conductor/http/rest_client.rb +211 -0
- data/lib/conductor/orkes/models/access_key.rb +56 -0
- data/lib/conductor/orkes/models/granted_permission.rb +27 -0
- data/lib/conductor/orkes/models/metadata_tag.rb +15 -0
- data/lib/conductor/orkes/models/rate_limit_tag.rb +15 -0
- data/lib/conductor/orkes/orkes_clients.rb +69 -0
- data/lib/conductor/version.rb +5 -0
- data/lib/conductor/worker/events/conductor_event.rb +40 -0
- data/lib/conductor/worker/events/global_dispatcher.rb +37 -0
- data/lib/conductor/worker/events/http_events.rb +25 -0
- data/lib/conductor/worker/events/listener_registry.rb +40 -0
- data/lib/conductor/worker/events/listeners.rb +34 -0
- data/lib/conductor/worker/events/sync_event_dispatcher.rb +78 -0
- data/lib/conductor/worker/events/task_runner_events.rb +271 -0
- data/lib/conductor/worker/events/workflow_events.rb +49 -0
- data/lib/conductor/worker/fiber_executor.rb +532 -0
- data/lib/conductor/worker/ractor_task_runner.rb +501 -0
- data/lib/conductor/worker/task_context.rb +114 -0
- data/lib/conductor/worker/task_definition_registrar.rb +322 -0
- data/lib/conductor/worker/task_handler.rb +360 -0
- data/lib/conductor/worker/task_in_progress.rb +60 -0
- data/lib/conductor/worker/task_runner.rb +538 -0
- data/lib/conductor/worker/telemetry/metrics_collector.rb +196 -0
- data/lib/conductor/worker/telemetry/prometheus_backend.rb +224 -0
- data/lib/conductor/worker/worker.rb +355 -0
- data/lib/conductor/worker/worker_config.rb +154 -0
- data/lib/conductor/worker/worker_registry.rb +71 -0
- data/lib/conductor/workflow/dsl/input_ref.rb +37 -0
- data/lib/conductor/workflow/dsl/output_ref.rb +44 -0
- data/lib/conductor/workflow/dsl/parallel_builder.rb +49 -0
- data/lib/conductor/workflow/dsl/switch_builder.rb +74 -0
- data/lib/conductor/workflow/dsl/task_ref.rb +178 -0
- data/lib/conductor/workflow/dsl/workflow_builder.rb +1016 -0
- data/lib/conductor/workflow/dsl/workflow_definition.rb +150 -0
- data/lib/conductor/workflow/llm/chat_message.rb +47 -0
- data/lib/conductor/workflow/llm/embedding_model.rb +19 -0
- data/lib/conductor/workflow/llm/tool_call.rb +43 -0
- data/lib/conductor/workflow/llm/tool_spec.rb +46 -0
- data/lib/conductor/workflow/task_type.rb +68 -0
- data/lib/conductor/workflow/timeout_policy.rb +31 -0
- data/lib/conductor/workflow/workflow_executor.rb +373 -0
- data/lib/conductor.rb +192 -0
- metadata +359 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# WorkflowResourceApi - API for workflow operations
|
|
9
|
+
class WorkflowResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
# Initialize WorkflowResourceApi
|
|
13
|
+
# @param [ApiClient] api_client Optional API client
|
|
14
|
+
def initialize(api_client = nil)
|
|
15
|
+
@api_client = api_client || ApiClient.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Start a workflow execution
|
|
19
|
+
# @param [StartWorkflowRequest] body Start workflow request
|
|
20
|
+
# @return [String] Workflow ID
|
|
21
|
+
def start_workflow(body)
|
|
22
|
+
@api_client.call_api(
|
|
23
|
+
'/workflow',
|
|
24
|
+
'POST',
|
|
25
|
+
body: body,
|
|
26
|
+
return_type: 'String',
|
|
27
|
+
return_http_data_only: true
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Get workflow execution status
|
|
32
|
+
# @param [String] workflow_id Workflow ID
|
|
33
|
+
# @param [Boolean] include_tasks Include task details (default: true)
|
|
34
|
+
# @return [Workflow] Workflow object
|
|
35
|
+
def get_execution_status(workflow_id, include_tasks: true)
|
|
36
|
+
@api_client.call_api(
|
|
37
|
+
'/workflow/{workflowId}',
|
|
38
|
+
'GET',
|
|
39
|
+
path_params: { workflowId: workflow_id },
|
|
40
|
+
query_params: { includeTasks: include_tasks },
|
|
41
|
+
return_type: 'Workflow',
|
|
42
|
+
return_http_data_only: true
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Delete a workflow
|
|
47
|
+
# @param [String] workflow_id Workflow ID
|
|
48
|
+
# @param [Boolean] archive_workflow Archive workflow before deleting (default: true)
|
|
49
|
+
# @return [void]
|
|
50
|
+
def delete(workflow_id, archive_workflow: true)
|
|
51
|
+
@api_client.call_api(
|
|
52
|
+
'/workflow/{workflowId}/remove',
|
|
53
|
+
'DELETE',
|
|
54
|
+
path_params: { workflowId: workflow_id },
|
|
55
|
+
query_params: { archiveWorkflow: archive_workflow },
|
|
56
|
+
return_http_data_only: true
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Pause a workflow
|
|
61
|
+
# @param [String] workflow_id Workflow ID
|
|
62
|
+
# @return [void]
|
|
63
|
+
def pause_workflow(workflow_id)
|
|
64
|
+
@api_client.call_api(
|
|
65
|
+
'/workflow/{workflowId}/pause',
|
|
66
|
+
'PUT',
|
|
67
|
+
path_params: { workflowId: workflow_id },
|
|
68
|
+
return_http_data_only: true
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Resume a paused workflow
|
|
73
|
+
# @param [String] workflow_id Workflow ID
|
|
74
|
+
# @return [void]
|
|
75
|
+
def resume_workflow(workflow_id)
|
|
76
|
+
@api_client.call_api(
|
|
77
|
+
'/workflow/{workflowId}/resume',
|
|
78
|
+
'PUT',
|
|
79
|
+
path_params: { workflowId: workflow_id },
|
|
80
|
+
return_http_data_only: true
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Restart a completed workflow
|
|
85
|
+
# @param [String] workflow_id Workflow ID
|
|
86
|
+
# @param [Boolean] use_latest_def Use latest workflow definition (default: false)
|
|
87
|
+
# @return [void]
|
|
88
|
+
def restart(workflow_id, use_latest_def: false)
|
|
89
|
+
@api_client.call_api(
|
|
90
|
+
'/workflow/{workflowId}/restart',
|
|
91
|
+
'POST',
|
|
92
|
+
path_params: { workflowId: workflow_id },
|
|
93
|
+
query_params: { useLatestDefinitions: use_latest_def },
|
|
94
|
+
return_http_data_only: true
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Rerun a workflow from a specific task
|
|
99
|
+
# @param [String] workflow_id Workflow ID
|
|
100
|
+
# @param [RerunWorkflowRequest] body Rerun request
|
|
101
|
+
# @return [String] New workflow ID
|
|
102
|
+
def rerun(workflow_id, body)
|
|
103
|
+
@api_client.call_api(
|
|
104
|
+
'/workflow/{workflowId}/rerun',
|
|
105
|
+
'POST',
|
|
106
|
+
path_params: { workflowId: workflow_id },
|
|
107
|
+
body: body,
|
|
108
|
+
return_type: 'String',
|
|
109
|
+
return_http_data_only: true
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Terminate a running workflow
|
|
114
|
+
# @param [String] workflow_id Workflow ID
|
|
115
|
+
# @param [String] reason Termination reason
|
|
116
|
+
# @return [void]
|
|
117
|
+
def terminate(workflow_id, reason: nil)
|
|
118
|
+
@api_client.call_api(
|
|
119
|
+
'/workflow/{workflowId}',
|
|
120
|
+
'DELETE',
|
|
121
|
+
path_params: { workflowId: workflow_id },
|
|
122
|
+
query_params: reason ? { reason: reason } : {},
|
|
123
|
+
return_http_data_only: true
|
|
124
|
+
)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Retry a failed workflow
|
|
128
|
+
# @param [String] workflow_id Workflow ID
|
|
129
|
+
# @param [Boolean] resume_subworkflow_tasks Resume subworkflow tasks (default: false)
|
|
130
|
+
# @return [void]
|
|
131
|
+
def retry(workflow_id, resume_subworkflow_tasks: false)
|
|
132
|
+
@api_client.call_api(
|
|
133
|
+
'/workflow/{workflowId}/retry',
|
|
134
|
+
'POST',
|
|
135
|
+
path_params: { workflowId: workflow_id },
|
|
136
|
+
query_params: { resumeSubworkflowTasks: resume_subworkflow_tasks },
|
|
137
|
+
return_http_data_only: true
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Get workflows by correlation ID
|
|
142
|
+
# @param [String] name Workflow name
|
|
143
|
+
# @param [String] correlation_id Correlation ID
|
|
144
|
+
# @param [Boolean] include_closed Include closed workflows (default: false)
|
|
145
|
+
# @param [Boolean] include_tasks Include task details (default: false)
|
|
146
|
+
# @return [Array<Workflow>] List of workflows
|
|
147
|
+
def get_workflows(name, correlation_id, include_closed: false, include_tasks: false)
|
|
148
|
+
@api_client.call_api(
|
|
149
|
+
'/workflow/{name}/correlated/{correlationId}',
|
|
150
|
+
'GET',
|
|
151
|
+
path_params: { name: name, correlationId: correlation_id },
|
|
152
|
+
query_params: { includeClosed: include_closed, includeTasks: include_tasks },
|
|
153
|
+
return_type: 'Array<Workflow>',
|
|
154
|
+
return_http_data_only: true
|
|
155
|
+
)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Get running workflows by name
|
|
159
|
+
# @param [String] name Workflow name
|
|
160
|
+
# @param [Integer] version Workflow version (optional)
|
|
161
|
+
# @param [Integer] start_time Start time (epoch millis, optional)
|
|
162
|
+
# @param [Integer] end_time End time (epoch millis, optional)
|
|
163
|
+
# @return [Array<String>] List of workflow IDs
|
|
164
|
+
def get_running_workflow(name, version: nil, start_time: nil, end_time: nil)
|
|
165
|
+
query_params = {}
|
|
166
|
+
query_params[:version] = version if version
|
|
167
|
+
query_params[:startTime] = start_time if start_time
|
|
168
|
+
query_params[:endTime] = end_time if end_time
|
|
169
|
+
|
|
170
|
+
@api_client.call_api(
|
|
171
|
+
'/workflow/running/{name}',
|
|
172
|
+
'GET',
|
|
173
|
+
path_params: { name: name },
|
|
174
|
+
query_params: query_params,
|
|
175
|
+
return_type: 'Array<String>',
|
|
176
|
+
return_http_data_only: true
|
|
177
|
+
)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Register a workflow definition
|
|
181
|
+
# @param [WorkflowDef] body Workflow definition
|
|
182
|
+
# @param [Boolean] overwrite Overwrite existing definition (default: false)
|
|
183
|
+
# @return [void]
|
|
184
|
+
def register_workflow(body, overwrite: false)
|
|
185
|
+
@api_client.call_api(
|
|
186
|
+
'/metadata/workflow',
|
|
187
|
+
'POST',
|
|
188
|
+
query_params: { overwrite: overwrite },
|
|
189
|
+
body: body,
|
|
190
|
+
return_http_data_only: true
|
|
191
|
+
)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Get a workflow definition
|
|
195
|
+
# @param [String] name Workflow name
|
|
196
|
+
# @param [Integer] version Workflow version (optional)
|
|
197
|
+
# @return [WorkflowDef] Workflow definition
|
|
198
|
+
def get_workflow_def(name, version: nil)
|
|
199
|
+
query_params = {}
|
|
200
|
+
query_params[:version] = version if version
|
|
201
|
+
|
|
202
|
+
@api_client.call_api(
|
|
203
|
+
'/metadata/workflow/{name}',
|
|
204
|
+
'GET',
|
|
205
|
+
path_params: { name: name },
|
|
206
|
+
query_params: query_params,
|
|
207
|
+
return_type: 'WorkflowDef',
|
|
208
|
+
return_http_data_only: true
|
|
209
|
+
)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Delete a workflow definition
|
|
213
|
+
# @param [String] name Workflow name
|
|
214
|
+
# @param [Integer] version Workflow version
|
|
215
|
+
# @return [void]
|
|
216
|
+
def unregister_workflow(name, version:)
|
|
217
|
+
@api_client.call_api(
|
|
218
|
+
'/metadata/workflow/{name}/{version}',
|
|
219
|
+
'DELETE',
|
|
220
|
+
path_params: { name: name, version: version },
|
|
221
|
+
return_http_data_only: true
|
|
222
|
+
)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Execute a workflow synchronously and wait for completion
|
|
226
|
+
# @param [StartWorkflowRequest] body Start workflow request
|
|
227
|
+
# @param [String] name Workflow name
|
|
228
|
+
# @param [Integer] version Workflow version
|
|
229
|
+
# @param [String] request_id Unique request ID for idempotency
|
|
230
|
+
# @param [String] wait_until_task_ref Wait until this task completes (optional)
|
|
231
|
+
# @param [Integer] wait_for_seconds Maximum time to wait (default: 10)
|
|
232
|
+
# @return [WorkflowRun] Workflow run result
|
|
233
|
+
def execute_workflow(body, name:, version:, request_id:, wait_until_task_ref: nil, wait_for_seconds: 10)
|
|
234
|
+
query_params = {
|
|
235
|
+
requestId: request_id,
|
|
236
|
+
waitForSeconds: wait_for_seconds
|
|
237
|
+
}
|
|
238
|
+
query_params[:waitUntilTaskRef] = wait_until_task_ref if wait_until_task_ref
|
|
239
|
+
|
|
240
|
+
@api_client.call_api(
|
|
241
|
+
'/workflow/execute/{name}/{version}',
|
|
242
|
+
'POST',
|
|
243
|
+
path_params: { name: name, version: version },
|
|
244
|
+
query_params: query_params,
|
|
245
|
+
body: body,
|
|
246
|
+
return_type: 'WorkflowRun',
|
|
247
|
+
return_http_data_only: true
|
|
248
|
+
)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Get workflow status (lightweight, without full task details)
|
|
252
|
+
# @param [String] workflow_id Workflow ID
|
|
253
|
+
# @param [Boolean] include_output Include workflow output (default: false)
|
|
254
|
+
# @param [Boolean] include_variables Include workflow variables (default: false)
|
|
255
|
+
# @return [Hash] Workflow status
|
|
256
|
+
def get_workflow_status(workflow_id, include_output: false, include_variables: false)
|
|
257
|
+
@api_client.call_api(
|
|
258
|
+
'/workflow/{workflowId}/status',
|
|
259
|
+
'GET',
|
|
260
|
+
path_params: { workflowId: workflow_id },
|
|
261
|
+
query_params: { includeOutput: include_output, includeVariables: include_variables },
|
|
262
|
+
return_type: 'Hash',
|
|
263
|
+
return_http_data_only: true
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Skip a task in a running workflow
|
|
268
|
+
# @param [String] workflow_id Workflow ID
|
|
269
|
+
# @param [String] task_reference_name Task reference name to skip
|
|
270
|
+
# @param [Hash] request Skip task request body (optional)
|
|
271
|
+
# @return [void]
|
|
272
|
+
def skip_task_from_workflow(workflow_id, task_reference_name, request: nil)
|
|
273
|
+
@api_client.call_api(
|
|
274
|
+
'/workflow/{workflowId}/skiptask/{taskReferenceName}',
|
|
275
|
+
'PUT',
|
|
276
|
+
path_params: { workflowId: workflow_id, taskReferenceName: task_reference_name },
|
|
277
|
+
body: request,
|
|
278
|
+
return_http_data_only: true
|
|
279
|
+
)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Decide on workflow (evaluate next steps)
|
|
283
|
+
# @param [String] workflow_id Workflow ID
|
|
284
|
+
# @return [void]
|
|
285
|
+
def decide(workflow_id)
|
|
286
|
+
@api_client.call_api(
|
|
287
|
+
'/workflow/decide/{workflowId}',
|
|
288
|
+
'PUT',
|
|
289
|
+
path_params: { workflowId: workflow_id },
|
|
290
|
+
return_http_data_only: true
|
|
291
|
+
)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Reset workflow callbacks
|
|
295
|
+
# @param [String] workflow_id Workflow ID
|
|
296
|
+
# @return [void]
|
|
297
|
+
def reset_workflow(workflow_id)
|
|
298
|
+
@api_client.call_api(
|
|
299
|
+
'/workflow/{workflowId}/resetcallbacks',
|
|
300
|
+
'POST',
|
|
301
|
+
path_params: { workflowId: workflow_id },
|
|
302
|
+
return_http_data_only: true
|
|
303
|
+
)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Search for workflows
|
|
307
|
+
# @param [Integer] start Start index (default: 0)
|
|
308
|
+
# @param [Integer] size Page size (default: 100)
|
|
309
|
+
# @param [String] free_text Free text search (default: '*')
|
|
310
|
+
# @param [String] query Query string (optional)
|
|
311
|
+
# @param [Boolean] skip_cache Skip cache (default: false)
|
|
312
|
+
# @return [SearchResult] Search results with workflow summaries
|
|
313
|
+
def search(start: 0, size: 100, free_text: '*', query: nil, skip_cache: false)
|
|
314
|
+
query_params = { start: start, size: size, freeText: free_text, skipCache: skip_cache }
|
|
315
|
+
query_params[:query] = query if query
|
|
316
|
+
|
|
317
|
+
@api_client.call_api(
|
|
318
|
+
'/workflow/search',
|
|
319
|
+
'GET',
|
|
320
|
+
query_params: query_params,
|
|
321
|
+
return_type: 'SearchResult',
|
|
322
|
+
return_http_data_only: true
|
|
323
|
+
)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Update workflow variables
|
|
327
|
+
# @param [String] workflow_id Workflow ID
|
|
328
|
+
# @param [Hash] variables Variables to update
|
|
329
|
+
# @return [Workflow]
|
|
330
|
+
def update_workflow_state(workflow_id, variables)
|
|
331
|
+
@api_client.call_api(
|
|
332
|
+
'/workflow/{workflowId}/variables',
|
|
333
|
+
'POST',
|
|
334
|
+
path_params: { workflowId: workflow_id },
|
|
335
|
+
body: variables,
|
|
336
|
+
return_type: 'Workflow',
|
|
337
|
+
return_http_data_only: true
|
|
338
|
+
)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# Update workflow and task state
|
|
342
|
+
# @param [String] workflow_id Workflow ID
|
|
343
|
+
# @param [WorkflowStateUpdate] body State update request
|
|
344
|
+
# @param [String] request_id Request ID (optional)
|
|
345
|
+
# @param [String] wait_until_task_ref Wait until task ref (optional)
|
|
346
|
+
# @param [Integer] wait_for_seconds Wait time in seconds (default: 10)
|
|
347
|
+
# @return [WorkflowRun]
|
|
348
|
+
def update_workflow_and_task_state(workflow_id, body, request_id: nil, wait_until_task_ref: nil,
|
|
349
|
+
wait_for_seconds: 10)
|
|
350
|
+
query_params = { waitForSeconds: wait_for_seconds }
|
|
351
|
+
query_params[:requestId] = request_id if request_id
|
|
352
|
+
query_params[:waitUntilTaskRef] = wait_until_task_ref if wait_until_task_ref
|
|
353
|
+
|
|
354
|
+
@api_client.call_api(
|
|
355
|
+
'/workflow/{workflowId}/state',
|
|
356
|
+
'POST',
|
|
357
|
+
path_params: { workflowId: workflow_id },
|
|
358
|
+
query_params: query_params,
|
|
359
|
+
body: body,
|
|
360
|
+
return_type: 'WorkflowRun',
|
|
361
|
+
return_http_data_only: true
|
|
362
|
+
)
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# Test a workflow with mocked task outputs
|
|
366
|
+
# @param [WorkflowTestRequest] body Test request
|
|
367
|
+
# @return [Workflow]
|
|
368
|
+
def test_workflow(body)
|
|
369
|
+
@api_client.call_api(
|
|
370
|
+
'/workflow/test',
|
|
371
|
+
'POST',
|
|
372
|
+
body: body,
|
|
373
|
+
return_type: 'Workflow',
|
|
374
|
+
return_http_data_only: true
|
|
375
|
+
)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
# Get workflows by multiple correlation IDs (batch)
|
|
379
|
+
# @param [String] name Workflow name
|
|
380
|
+
# @param [Array<String>] correlation_ids List of correlation IDs
|
|
381
|
+
# @param [Boolean] include_closed Include closed workflows (default: false)
|
|
382
|
+
# @param [Boolean] include_tasks Include task details (default: false)
|
|
383
|
+
# @return [Hash<String, Array<Workflow>>]
|
|
384
|
+
def get_workflows_batch(name, correlation_ids, include_closed: false, include_tasks: false)
|
|
385
|
+
@api_client.call_api(
|
|
386
|
+
'/workflow/{name}/correlated',
|
|
387
|
+
'POST',
|
|
388
|
+
path_params: { name: name },
|
|
389
|
+
query_params: { includeClosed: include_closed, includeTasks: include_tasks },
|
|
390
|
+
body: correlation_ids,
|
|
391
|
+
return_type: 'Hash<String, Object>',
|
|
392
|
+
return_http_data_only: true
|
|
393
|
+
)
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
# Start a workflow by name (alternative endpoint)
|
|
397
|
+
# @param [String] name Workflow name
|
|
398
|
+
# @param [Hash] body Workflow input
|
|
399
|
+
# @param [Integer] version Workflow version (optional)
|
|
400
|
+
# @param [String] correlation_id Correlation ID (optional)
|
|
401
|
+
# @param [Integer] priority Priority (optional)
|
|
402
|
+
# @return [String] Workflow ID
|
|
403
|
+
def start_workflow_by_name(name, body, version: nil, correlation_id: nil, priority: nil)
|
|
404
|
+
query_params = {}
|
|
405
|
+
query_params[:version] = version if version
|
|
406
|
+
query_params[:correlationId] = correlation_id if correlation_id
|
|
407
|
+
query_params[:priority] = priority if priority
|
|
408
|
+
|
|
409
|
+
@api_client.call_api(
|
|
410
|
+
'/workflow/{name}',
|
|
411
|
+
'POST',
|
|
412
|
+
path_params: { name: name },
|
|
413
|
+
query_params: query_params,
|
|
414
|
+
body: body,
|
|
415
|
+
return_type: 'String',
|
|
416
|
+
return_http_data_only: true
|
|
417
|
+
)
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# Jump to a specific task in a workflow
|
|
421
|
+
# @param [String] workflow_id Workflow ID
|
|
422
|
+
# @param [String] task_reference_name Task reference name
|
|
423
|
+
# @param [Hash] input Task input (optional)
|
|
424
|
+
# @return [void]
|
|
425
|
+
def jump_to_task(workflow_id, task_reference_name, input: nil)
|
|
426
|
+
@api_client.call_api(
|
|
427
|
+
'/workflow/{workflowId}/jump/{taskReferenceName}',
|
|
428
|
+
'POST',
|
|
429
|
+
path_params: { workflowId: workflow_id, taskReferenceName: task_reference_name },
|
|
430
|
+
body: input,
|
|
431
|
+
return_http_data_only: true
|
|
432
|
+
)
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
# Upgrade a running workflow to a new version
|
|
436
|
+
# @param [String] workflow_id Workflow ID
|
|
437
|
+
# @param [Hash] body Upgrade request
|
|
438
|
+
# @return [void]
|
|
439
|
+
def upgrade_running_workflow(workflow_id, body)
|
|
440
|
+
@api_client.call_api(
|
|
441
|
+
'/workflow/{workflowId}/upgrade',
|
|
442
|
+
'POST',
|
|
443
|
+
path_params: { workflowId: workflow_id },
|
|
444
|
+
body: body,
|
|
445
|
+
return_http_data_only: true
|
|
446
|
+
)
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
end
|