def save( self, *args, matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None, middleware: Optional[Union[Callable, Middleware]] = None, lazy: Optional[List[Callable[..., None]]] = None, ): """Register a new save listener with details. You can use this method as decorator as well. @my_step.save def save_my_step(ack, step, update): pass It's also possible to add additional listener matchers and/or middleware @my_step.save(matchers=[is_valid], middleware=[update_context]) def save_my_step(ack, step, update): pass """ if _is_used_without_argument(args): func = args[0] self._save = self._to_listener("save", func, matchers, middleware) return func def _inner(func): functions = [func] + (lazy if lazy is not None else []) self._save = self._to_listener("save", functions, matchers, middleware) @wraps(func) def _wrapper(*args, **kwargs): return func(*args, **kwargs) return _wrapper return _inner
def edit( self, *args, matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None, middleware: Optional[Union[Callable, Middleware]] = None, lazy: Optional[List[Callable[..., None]]] = None, ): """Registers a new edit listener with details. You can use this method as decorator as well. @my_step.edit def edit_my_step(ack, configure): pass It's also possible to add additional listener matchers and/or middleware @my_step.edit(matchers=[is_valid], middleware=[update_context]) def edit_my_step(ack, configure): pass For further information about WorkflowStep specific function arguments such as `configure`, `update`, `complete`, and `fail`, refer to `slack_bolt.workflows.step.utilities` API documents. Args: *args: This method can behave as either decorator or a method matchers: Listener matchers middleware: Listener middleware lazy: Lazy listeners """ if _is_used_without_argument(args): func = args[0] self._edit = self._to_listener("edit", func, matchers, middleware) return func def _inner(func): functions = [func] + (lazy if lazy is not None else []) self._edit = self._to_listener("edit", functions, matchers, middleware) @wraps(func) def _wrapper(*args, **kwargs): return func(*args, **kwargs) return _wrapper return _inner