Skip to content

shipany.bot.actions.transition_action

shipany.bot.actions.transition_action package

Submodules

shipany.bot.actions.transition_action.v1 module

pydantic model shipany.bot.actions.transition_action.v1.TransitionAction

Bases: BaseModel

Action to transition to the next step.

If a condition is provided, it must be satisfied before transitioning to the step declared in ‘next-step’ attribute. The condition is evaluated using the JSONLogic library. The condition is satisfied if the result is true.

If the condition is not satisfied, the action is ignored. If the condition is not provided, the action transitions to the next step unconditionally.

Beware that the condition is evaluated in the context of the current step.

If transition to the next step executes successfully, the current other actions in the current step are ignored.

Payload samples

  • Transition to the next step:
    {
    "name": "TransitionAction@1",
    "next-step": "next_step"
    }
  • Transition to the next step with a condition:
    {
    "name": "TransitionAction@1",
    "next-step": "next_step",
    "condition": {
    "and": [
    {"==": [{"var": "user.name"}, "John Doe"]},
    {"==": [{"var": "user.age"}, 18]}
    ]
    }
    }

Pydantic model parameters

field name : t.Literal[‘TransitionAction@1’] [Required]

Action name.

field next_step : str [Required] (alias ‘next-step’)

Name of the next step to transition to.

field condition : JsonLogic | None = None

Condition to evaluate before transitioning to the next step.

Module contents