Workflow

public class Workflow : @unchecked Sendable

Class representing a workflow.

  • The configuration for the workflow.

    Declaration

    Swift

    public let config: WorkflowConfig
  • Global SharedContext

    Declaration

    Swift

    public let sharedContext: SharedContext
  • Initializes the workflow.

    Declaration

    Swift

    public init(config: WorkflowConfig)

    Parameters

    config

    The configuration for the workflow.

  • initialize() Asynchronous

    Initializes the workflow.

    Declaration

    Swift

    public func initialize() async throws
  • start() Asynchronous

    Starts the workflow with a default request.

    Declaration

    Swift

    public func start() async -> Node

    Return Value

    The resulting Node after processing the workflow.

  • next(_:_:) Asynchronous

    Processes the next node in the workflow.

    Declaration

    Swift

    public func next(_ context: FlowContext, _ current: ContinueNode) async -> Node

    Parameters

    context

    The context of the flow.

    current

    The current ContinueNode.

    Return Value

    The resulting Node after processing the next step.

  • signOff() Asynchronous

    Signs off the workflow.

    Declaration

    Swift

    public func signOff() async -> Result<Void, Error>

    Return Value

    A Result indicating the success or failure of the sign off.

  • hasCookies() Asynchronous

    Checks if the workflow has cookies available in storage.

    Declaration

    Swift

    public func hasCookies() async -> Bool

    Return Value

    A Boolean value indicating whether cookies exist in the storage.

  • Creates a new Workflow instance with the provided configuration block.

    Declaration

    Swift

    public static func createWorkflow(_ block: (WorkflowConfig) -> Void = { _ in }) -> Workflow

    Parameters

    block

    The configuration block for the Workflow.

    Return Value

    A new Workflow instance.