Class: Retab::WorkflowSteps

Inherits:
Object
  • Object
show all
Defined in:
lib/retab/workflow_steps.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ WorkflowSteps

Returns a new instance of WorkflowSteps.



9
10
11
# File 'lib/retab/workflow_steps.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#get(step_id:, run_id: nil, request_options: {}) ⇒ Retab::WorkflowRunStep

Get Workflow Step

Parameters:

  • step_id (String)
  • run_id (String, nil) (defaults to: nil)

    Optional workflow run ID disambiguator.

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

    (see Retab::Types::RequestOptions)

Returns:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/retab/workflow_steps.rb', line 86

def get(
  step_id:,
  run_id: nil,
  request_options: {}
)
  params = {
    "run_id" => run_id
  }.compact
  response = @client.request(
    method: :get,
    path: "/v1/workflows/steps/#{Retab::Util.encode_path(step_id)}",
    auth: true,
    params: params,
    request_options: request_options
  )
  result = Retab::WorkflowRunStep.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(
    http_status: response.code.to_i,
    http_headers: response.each_header.to_h,
    request_id: response["x-request-id"]
  )
  result
end

#list(run_id: nil, block_id: nil, step_id: nil, block_type: nil, status: nil, before: nil, after: nil, limit: 5, request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowRunStep>

List Workflow Run Steps

Parameters:

  • run_id (String, nil) (defaults to: nil)

    Optional workflow run ID filter.

  • block_id (String, nil) (defaults to: nil)

    Optional logical block ID filter.

  • step_id (String, nil) (defaults to: nil)

    Optional step ID filter.

  • block_type (Array<String>, nil) (defaults to: nil)

    Optional block type filter. Repeat the query parameter for multiple values.

  • status (Array<String>, nil) (defaults to: nil)

    Optional step lifecycle status filter. Repeat the query parameter for multiple values.

  • before (String, nil) (defaults to: nil)

    Step id cursor: return the page before this id (mutually exclusive with ‘after`).

  • after (String, nil) (defaults to: nil)

    Step id cursor: return the page after this id (mutually exclusive with ‘before`).

  • limit (Integer, nil) (defaults to: 5)

    Maximum number of steps to return per page (1-1000). Defaults to 5 because each step hydrates its handle payloads from the artifact store; raise it deliberately when you need a larger page, and use cursor pagination for the rest.

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

    (see Retab::Types::RequestOptions)

Returns:



24
25
26
27
28
29
30
31
32
33
34
35
36
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
# File 'lib/retab/workflow_steps.rb', line 24

def list(
  run_id: nil,
  block_id: nil,
  step_id: nil,
  block_type: nil,
  status: nil,
  before: nil,
  after: nil,
  limit: 5,
  request_options: {}
)
  params = {
    "run_id" => run_id,
    "block_id" => block_id,
    "step_id" => step_id,
    "block_type" => block_type,
    "status" => status,
    "before" => before,
    "after" => after,
    "limit" => limit
  }.compact
  response = @client.request(
    method: :get,
    path: "/v1/workflows/steps",
    auth: true,
    params: params,
    request_options: request_options
  )
  fetch_next = -> (cursor) {
    list(
      run_id: run_id,
      block_id: block_id,
      step_id: step_id,
      block_type: block_type,
      status: status,
      before: before,
      after: cursor,
      limit: limit,
      request_options: request_options
    )
  }
  Retab::PaginatedList.from_response(
    response,
    model: Retab::WorkflowRunStep,
    filters: {
      run_id: run_id,
      block_id: block_id,
      step_id: step_id,
      block_type: block_type,
      status: status,
      before: before,
      limit: limit
    },
    fetch_next: fetch_next
  )
end