Setup
public struct Setup<ModuleConfig> : Sendable where ModuleConfig : Sendable
Struct for a Setup. A Setup represents the setup of a module in the application.
- property workflow: The workflow of the application.
- property context: The shared context of the application.
- property logger: The logger used in the application.
- property httpClient: The HTTP client used in the application.
- property config: The configuration for the module.
-
Declaration
Swift
public let workflow: Workflow
-
Declaration
Swift
public let context: SharedContext
-
Declaration
Swift
public let logger: Logger
-
Declaration
Swift
public let httpClient: HttpClient
-
Declaration
Swift
public let config: ModuleConfig
-
Initializes a new Setup instance.
Declaration
Swift
public init(workflow: Workflow, config: ModuleConfig)
Parameters
workflow
The workflow of the application.
config
The configuration for the module.
-
Adds an initialization block to the workflow.
Declaration
Swift
public func initialize(block: @escaping @Sendable () async throws -> Void)
Parameters
block
The block to be added.
-
Adds a start block to the workflow.
Declaration
Swift
public func start(_ block: @escaping @Sendable (FlowContext, Request) async throws -> Request)
Parameters
block
The block to be added.
-
Adds a next block to the workflow.
Declaration
Swift
public func next(block: @escaping @Sendable (FlowContext, ContinueNode, Request) async throws -> Request)
Parameters
block
The block to be added.
-
Adds a response block to the workflow.
Declaration
Swift
public func response(block: @escaping @Sendable (FlowContext, Response) async throws -> Void)
Parameters
block
The block to be added.
-
Adds a node block to the workflow.
Declaration
Swift
public func node(block: @escaping @Sendable (FlowContext, Node) async throws -> Node)
Parameters
block
The block to be added.
-
Adds a success block to the workflow.
Declaration
Swift
public func success(block: @escaping @Sendable (FlowContext, SuccessNode) async throws -> SuccessNode)
Parameters
block
The block to be added.
-
Sets the transform block of the workflow.
Declaration
Swift
public func transform(block: @escaping @Sendable (FlowContext, Response) async throws -> Node)
Parameters
block
The block to be set.