Class: Zernio::WorkflowsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/workflows_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WorkflowsApi

Returns a new instance of WorkflowsApi.



19
20
21
# File 'lib/zernio-sdk/api/workflows_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/workflows_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#activate_workflow(workflow_id, opts = {}) ⇒ ActivateWorkflow200Response

Activate workflow Validate the graph is runnable and set the workflow live. Once active, matching inbound messages start executions. Idempotent.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/zernio-sdk/api/workflows_api.rb', line 27

def activate_workflow(workflow_id, opts = {})
  data, _status_code, _headers = activate_workflow_with_http_info(workflow_id, opts)
  data
end

#activate_workflow_with_http_info(workflow_id, opts = {}) ⇒ Array<(ActivateWorkflow200Response, Integer, Hash)>

Activate workflow Validate the graph is runnable and set the workflow live. Once active, matching inbound messages start executions. Idempotent.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ActivateWorkflow200Response, Integer, Hash)>)

    ActivateWorkflow200Response data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/zernio-sdk/api/workflows_api.rb', line 37

def activate_workflow_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.activate_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.activate_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/activate'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ActivateWorkflow200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.activate_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#activate_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_workflow(create_workflow_request, opts = {}) ⇒ CreateWorkflow200Response

Create workflow Create a branching conversation workflow (draft) from a node/edge graph. Created in draft status; activate it to start matching inbound messages. The graph is validated structurally; completeness (a trigger node + reachable entry) is required at activation.

Parameters:

  • create_workflow_request (CreateWorkflowRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



90
91
92
93
# File 'lib/zernio-sdk/api/workflows_api.rb', line 90

def create_workflow(create_workflow_request, opts = {})
  data, _status_code, _headers = create_workflow_with_http_info(create_workflow_request, opts)
  data
end

#create_workflow_with_http_info(create_workflow_request, opts = {}) ⇒ Array<(CreateWorkflow200Response, Integer, Hash)>

Create workflow Create a branching conversation workflow (draft) from a node/edge graph. Created in `draft` status; activate it to start matching inbound messages. The graph is validated structurally; completeness (a trigger node + reachable entry) is required at activation.

Parameters:

  • create_workflow_request (CreateWorkflowRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateWorkflow200Response, Integer, Hash)>)

    CreateWorkflow200Response data, response status code and response headers



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/zernio-sdk/api/workflows_api.rb', line 100

def create_workflow_with_http_info(create_workflow_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.create_workflow ...'
  end
  # verify the required parameter 'create_workflow_request' is set
  if @api_client.config.client_side_validation && create_workflow_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_workflow_request' when calling WorkflowsApi.create_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_workflow_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateWorkflow200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.create_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#create_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_workflow(workflow_id, opts = {}) ⇒ nil

Delete workflow Permanently delete a workflow and all of its executions.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


158
159
160
161
# File 'lib/zernio-sdk/api/workflows_api.rb', line 158

def delete_workflow(workflow_id, opts = {})
  delete_workflow_with_http_info(workflow_id, opts)
  nil
end

#delete_workflow_with_http_info(workflow_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete workflow Permanently delete a workflow and all of its executions.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/zernio-sdk/api/workflows_api.rb', line 168

def delete_workflow_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.delete_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.delete_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.delete_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#delete_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#duplicate_workflow(workflow_id, opts = {}) ⇒ DuplicateWorkflow201Response

Duplicate a workflow Create an independent copy of a workflow's graph, name, description, and account binding. The copy is created in draft status with fresh execution counters and a new id — execution history is NOT copied. Useful for branching off a known-good workflow before making experimental edits.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



221
222
223
224
# File 'lib/zernio-sdk/api/workflows_api.rb', line 221

def duplicate_workflow(workflow_id, opts = {})
  data, _status_code, _headers = duplicate_workflow_with_http_info(workflow_id, opts)
  data
end

#duplicate_workflow_with_http_info(workflow_id, opts = {}) ⇒ Array<(DuplicateWorkflow201Response, Integer, Hash)>

Duplicate a workflow Create an independent copy of a workflow's graph, name, description, and account binding. The copy is created in `draft` status with fresh execution counters and a new id — execution history is NOT copied. Useful for branching off a known-good workflow before making experimental edits.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/zernio-sdk/api/workflows_api.rb', line 231

def duplicate_workflow_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.duplicate_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.duplicate_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/duplicate'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DuplicateWorkflow201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.duplicate_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#duplicate_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workflow(workflow_id, opts = {}) ⇒ GetWorkflow200Response

Get workflow with graph Returns a workflow including its full node/edge graph and run stats.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



284
285
286
287
# File 'lib/zernio-sdk/api/workflows_api.rb', line 284

def get_workflow(workflow_id, opts = {})
  data, _status_code, _headers = get_workflow_with_http_info(workflow_id, opts)
  data
end

#get_workflow_version(workflow_id, version, opts = {}) ⇒ GetWorkflowVersion200Response

Get a specific workflow version Returns the full snapshot for a single historical version, including the graph.

Parameters:

  • workflow_id (String)
  • version (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



348
349
350
351
# File 'lib/zernio-sdk/api/workflows_api.rb', line 348

def get_workflow_version(workflow_id, version, opts = {})
  data, _status_code, _headers = get_workflow_version_with_http_info(workflow_id, version, opts)
  data
end

#get_workflow_version_with_http_info(workflow_id, version, opts = {}) ⇒ Array<(GetWorkflowVersion200Response, Integer, Hash)>

Get a specific workflow version Returns the full snapshot for a single historical version, including the graph.

Parameters:

  • workflow_id (String)
  • version (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/zernio-sdk/api/workflows_api.rb', line 359

def get_workflow_version_with_http_info(workflow_id, version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.get_workflow_version ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.get_workflow_version"
  end
  # verify the required parameter 'version' is set
  if @api_client.config.client_side_validation && version.nil?
    fail ArgumentError, "Missing the required parameter 'version' when calling WorkflowsApi.get_workflow_version"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/versions/{version}'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s)).sub('{' + 'version' + '}', CGI.escape(version.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetWorkflowVersion200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.get_workflow_version",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#get_workflow_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workflow_with_http_info(workflow_id, opts = {}) ⇒ Array<(GetWorkflow200Response, Integer, Hash)>

Get workflow with graph Returns a workflow including its full node/edge graph and run stats.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetWorkflow200Response, Integer, Hash)>)

    GetWorkflow200Response data, response status code and response headers



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/zernio-sdk/api/workflows_api.rb', line 294

def get_workflow_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.get_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.get_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetWorkflow200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.get_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#get_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_workflow_execution_events(workflow_id, execution_id, opts = {}) ⇒ ListWorkflowExecutionEvents200Response

Get an execution's timeline Returns the per-step run-log for a single workflow execution: trigger fired, each node visited, edge handles taken, errors, and durations. Backed by Tinybird (90-day retention). Used by the Runs UI drawer to render the timeline.

Parameters:

  • workflow_id (String)
  • execution_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



417
418
419
420
# File 'lib/zernio-sdk/api/workflows_api.rb', line 417

def list_workflow_execution_events(workflow_id, execution_id, opts = {})
  data, _status_code, _headers = list_workflow_execution_events_with_http_info(workflow_id, execution_id, opts)
  data
end

#list_workflow_execution_events_with_http_info(workflow_id, execution_id, opts = {}) ⇒ Array<(ListWorkflowExecutionEvents200Response, Integer, Hash)>

Get an execution's timeline Returns the per-step run-log for a single workflow execution: trigger fired, each node visited, edge handles taken, errors, and durations. Backed by Tinybird (90-day retention). Used by the Runs UI drawer to render the timeline.

Parameters:

  • workflow_id (String)
  • execution_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/zernio-sdk/api/workflows_api.rb', line 428

def list_workflow_execution_events_with_http_info(workflow_id, execution_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.list_workflow_execution_events ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.list_workflow_execution_events"
  end
  # verify the required parameter 'execution_id' is set
  if @api_client.config.client_side_validation && execution_id.nil?
    fail ArgumentError, "Missing the required parameter 'execution_id' when calling WorkflowsApi.list_workflow_execution_events"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/executions/{executionId}/events'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s)).sub('{' + 'executionId' + '}', CGI.escape(execution_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListWorkflowExecutionEvents200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.list_workflow_execution_events",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#list_workflow_execution_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_workflow_executions(workflow_id, opts = {}) ⇒ ListWorkflowExecutions200Response

List workflow runs Returns recent executions (runs) with their status, current node, and accumulated variables.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :limit (Integer) — default: default to 25
  • :skip (Integer) — default: default to 0

Returns:



488
489
490
491
# File 'lib/zernio-sdk/api/workflows_api.rb', line 488

def list_workflow_executions(workflow_id, opts = {})
  data, _status_code, _headers = list_workflow_executions_with_http_info(workflow_id, opts)
  data
end

#list_workflow_executions_with_http_info(workflow_id, opts = {}) ⇒ Array<(ListWorkflowExecutions200Response, Integer, Hash)>

List workflow runs Returns recent executions (runs) with their status, current node, and accumulated variables.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :limit (Integer) — default: default to 25
  • :skip (Integer) — default: default to 0

Returns:



501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/zernio-sdk/api/workflows_api.rb', line 501

def list_workflow_executions_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.list_workflow_executions ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.list_workflow_executions"
  end
  allowable_values = ["running", "waiting", "completed", "exited", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/executions'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListWorkflowExecutions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.list_workflow_executions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#list_workflow_executions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_workflow_versions(workflow_id, opts = {}) ⇒ ListWorkflowVersions200Response

List a workflow's version history Returns the snapshot history. A new version is recorded automatically before every PATCH to nodes / edges / entryNodeId, and explicitly when a previous version is restored. Lightweight list — call getWorkflowVersion for the full snapshot graph.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



561
562
563
564
# File 'lib/zernio-sdk/api/workflows_api.rb', line 561

def list_workflow_versions(workflow_id, opts = {})
  data, _status_code, _headers = list_workflow_versions_with_http_info(workflow_id, opts)
  data
end

#list_workflow_versions_with_http_info(workflow_id, opts = {}) ⇒ Array<(ListWorkflowVersions200Response, Integer, Hash)>

List a workflow's version history Returns the snapshot history. A new version is recorded automatically before every PATCH to `nodes` / `edges` / `entryNodeId`, and explicitly when a previous version is restored. Lightweight list — call `getWorkflowVersion` for the full snapshot graph.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/zernio-sdk/api/workflows_api.rb', line 571

def list_workflow_versions_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.list_workflow_versions ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.list_workflow_versions"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/versions'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListWorkflowVersions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.list_workflow_versions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#list_workflow_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_workflows(opts = {}) ⇒ ListWorkflows200Response

List workflows Returns workflows with run stats. Filter by status or profile.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile. Omit to list across all profiles

  • :status (String)
  • :limit (Integer) — default: default to 50
  • :skip (Integer) — default: default to 0

Returns:



627
628
629
630
# File 'lib/zernio-sdk/api/workflows_api.rb', line 627

def list_workflows(opts = {})
  data, _status_code, _headers = list_workflows_with_http_info(opts)
  data
end

#list_workflows_with_http_info(opts = {}) ⇒ Array<(ListWorkflows200Response, Integer, Hash)>

List workflows Returns workflows with run stats. Filter by status or profile.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile. Omit to list across all profiles

  • :status (String)
  • :limit (Integer) — default: default to 50
  • :skip (Integer) — default: default to 0

Returns:

  • (Array<(ListWorkflows200Response, Integer, Hash)>)

    ListWorkflows200Response data, response status code and response headers



640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
# File 'lib/zernio-sdk/api/workflows_api.rb', line 640

def list_workflows_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.list_workflows ...'
  end
  allowable_values = ["draft", "active", "paused"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/workflows'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListWorkflows200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.list_workflows",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#list_workflows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#pause_workflow(workflow_id, opts = {}) ⇒ PauseWorkflow200Response

Pause workflow Stop matching new inbound messages. In-flight executions continue to completion. Idempotent.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



697
698
699
700
# File 'lib/zernio-sdk/api/workflows_api.rb', line 697

def pause_workflow(workflow_id, opts = {})
  data, _status_code, _headers = pause_workflow_with_http_info(workflow_id, opts)
  data
end

#pause_workflow_with_http_info(workflow_id, opts = {}) ⇒ Array<(PauseWorkflow200Response, Integer, Hash)>

Pause workflow Stop matching new inbound messages. In-flight executions continue to completion. Idempotent.

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PauseWorkflow200Response, Integer, Hash)>)

    PauseWorkflow200Response data, response status code and response headers



707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
# File 'lib/zernio-sdk/api/workflows_api.rb', line 707

def pause_workflow_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.pause_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.pause_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/pause'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PauseWorkflow200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.pause_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#pause_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#restore_workflow_version(workflow_id, version, opts = {}) ⇒ RestoreWorkflowVersion200Response

Restore a workflow version Replace the current graph with the named version's snapshot. Before the swap, the current graph is itself snapshotted as a new version, so a restore is reversible. The workflow must be in draft or paused status (same gate as a normal graph edit). The returned workflow carries restoredFromVersion so the UI can surface which version was rolled back to.

Parameters:

  • workflow_id (String)
  • version (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



761
762
763
764
# File 'lib/zernio-sdk/api/workflows_api.rb', line 761

def restore_workflow_version(workflow_id, version, opts = {})
  data, _status_code, _headers = restore_workflow_version_with_http_info(workflow_id, version, opts)
  data
end

#restore_workflow_version_with_http_info(workflow_id, version, opts = {}) ⇒ Array<(RestoreWorkflowVersion200Response, Integer, Hash)>

Restore a workflow version Replace the current graph with the named version's snapshot. Before the swap, the current graph is itself snapshotted as a new version, so a restore is reversible. The workflow must be in `draft` or `paused` status (same gate as a normal graph edit). The returned workflow carries `restoredFromVersion` so the UI can surface which version was rolled back to.

Parameters:

  • workflow_id (String)
  • version (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/zernio-sdk/api/workflows_api.rb', line 772

def restore_workflow_version_with_http_info(workflow_id, version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.restore_workflow_version ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.restore_workflow_version"
  end
  # verify the required parameter 'version' is set
  if @api_client.config.client_side_validation && version.nil?
    fail ArgumentError, "Missing the required parameter 'version' when calling WorkflowsApi.restore_workflow_version"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/versions/{version}/restore'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s)).sub('{' + 'version' + '}', CGI.escape(version.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RestoreWorkflowVersion200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.restore_workflow_version",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#restore_workflow_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#trigger_workflow(workflow_id, trigger_workflow_request, opts = {}) ⇒ TriggerWorkflow200Response

Manually start a workflow run Kick off a run without waiting for an inbound message (useful for testing). Target an existing conversation by conversationId, or — WhatsApp only — a phone number via to (a conversation is found or created). text seeds the run's lastMessage variable. The graph must be runnable.

Parameters:

  • workflow_id (String)
  • trigger_workflow_request (TriggerWorkflowRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



830
831
832
833
# File 'lib/zernio-sdk/api/workflows_api.rb', line 830

def trigger_workflow(workflow_id, trigger_workflow_request, opts = {})
  data, _status_code, _headers = trigger_workflow_with_http_info(workflow_id, trigger_workflow_request, opts)
  data
end

#trigger_workflow_with_http_info(workflow_id, trigger_workflow_request, opts = {}) ⇒ Array<(TriggerWorkflow200Response, Integer, Hash)>

Manually start a workflow run Kick off a run without waiting for an inbound message (useful for testing). Target an existing conversation by `conversationId`, or — WhatsApp only — a phone number via `to` (a conversation is found or created). `text` seeds the run's `lastMessage` variable. The graph must be runnable.

Parameters:

  • workflow_id (String)
  • trigger_workflow_request (TriggerWorkflowRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(TriggerWorkflow200Response, Integer, Hash)>)

    TriggerWorkflow200Response data, response status code and response headers



841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
# File 'lib/zernio-sdk/api/workflows_api.rb', line 841

def trigger_workflow_with_http_info(workflow_id, trigger_workflow_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.trigger_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.trigger_workflow"
  end
  # verify the required parameter 'trigger_workflow_request' is set
  if @api_client.config.client_side_validation && trigger_workflow_request.nil?
    fail ArgumentError, "Missing the required parameter 'trigger_workflow_request' when calling WorkflowsApi.trigger_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}/executions'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(trigger_workflow_request)

  # return_type
  return_type = opts[:debug_return_type] || 'TriggerWorkflow200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.trigger_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#trigger_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_workflow(workflow_id, opts = {}) ⇒ UpdateWorkflow200Response

Update workflow Update name, description, the graph, or reassign to a different account. The graph can only be modified while the workflow is draft or paused. Account swaps re-validate the graph against the new platform (so e.g. moving from WhatsApp to Facebook surfaces a start_call node as an error instead of silently saving an unrunnable graph).

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



904
905
906
907
# File 'lib/zernio-sdk/api/workflows_api.rb', line 904

def update_workflow(workflow_id, opts = {})
  data, _status_code, _headers = update_workflow_with_http_info(workflow_id, opts)
  data
end

#update_workflow_with_http_info(workflow_id, opts = {}) ⇒ Array<(UpdateWorkflow200Response, Integer, Hash)>

Update workflow Update name, description, the graph, or reassign to a different account. The graph can only be modified while the workflow is draft or paused. Account swaps re-validate the graph against the new platform (so e.g. moving from WhatsApp to Facebook surfaces a `start_call` node as an error instead of silently saving an unrunnable graph).

Parameters:

  • workflow_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(UpdateWorkflow200Response, Integer, Hash)>)

    UpdateWorkflow200Response data, response status code and response headers



915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
# File 'lib/zernio-sdk/api/workflows_api.rb', line 915

def update_workflow_with_http_info(workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsApi.update_workflow ...'
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsApi.update_workflow"
  end
  # resource path
  local_var_path = '/v1/workflows/{workflowId}'.sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_workflow_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateWorkflow200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WorkflowsApi.update_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsApi#update_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end