telega/flow/compose
Composition API for combining flows.
Values
pub fn compose_conditional(
name: String,
condition: fn(types.FlowInstance) -> String,
flows: dict.Dict(
String,
types.Flow(dynamic.Dynamic, session, error),
),
storage: types.FlowStorage(error),
) -> types.Flow(types.ComposedStep, session, error)
Compose flows with conditional selection
pub fn compose_parallel(
name: String,
flows: List(types.Flow(dynamic.Dynamic, session, error)),
merge_results: fn(List(dict.Dict(String, String))) -> dict.Dict(
String,
String,
),
storage: types.FlowStorage(error),
) -> types.Flow(types.ComposedStep, session, error)
Compose flows for parallel execution
pub fn compose_sequential(
name: String,
flows: List(types.Flow(dynamic.Dynamic, session, error)),
storage: types.FlowStorage(error),
) -> types.Flow(types.ComposedStep, session, error)
Compose flows sequentially
pub fn validation_middleware(
validator: fn(types.FlowInstance) -> Result(Nil, String),
) -> fn(
bot.Context(session, error),
types.FlowInstance,
fn() -> Result(
#(
bot.Context(session, error),
types.FlowAction(step_type),
types.FlowInstance,
),
error,
),
) -> Result(
#(
bot.Context(session, error),
types.FlowAction(step_type),
types.FlowInstance,
),
error,
)
Validation middleware