Skip to content

Commit

Permalink
[flows] add typing for `FlowRequestCallbackWrapper.on(..., data_filte…
Browse files Browse the repository at this point in the history
…r=<async/sync filter>)`
  • Loading branch information
david-lev committed Aug 21, 2024
1 parent ecb135e commit 7b9324d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pywa/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,8 @@ def on(
*,
action: FlowRequestActionType,
screen: Screen | str | None = None,
data_filter: Callable[[WhatsApp, dict | None], bool] | None = None,
data_filter: Callable[[WhatsApp, dict | None], bool | Awaitable[bool]]
| None = None,
) -> Callable[[_FlowRequestHandlerT], _FlowRequestHandlerT]:
"""
Decorator to help you add more handlers to the same endpoint and split the logic into multiple functions.
Expand All @@ -1172,7 +1173,7 @@ def on(
Args:
action: The action type to listen to.
screen: The screen ID to listen to.
screen: The screen ID to listen to (if screen is not provided, the handler will be called for all screens for this action!).
data_filter: A filter function to apply to the incoming data.
Returns:
Expand Down Expand Up @@ -1219,7 +1220,8 @@ def add_handler(
callback: _FlowRequestHandlerT,
action: FlowRequestActionType,
screen: Screen | str | None = None,
data_filter: Callable[[WhatsApp, dict | None], bool] | None = None,
data_filter: Callable[[WhatsApp, dict | None], bool | Awaitable[bool]]
| None = None,
) -> FlowRequestCallbackWrapper:
"""
Add a handler to the current endpoint.
Expand All @@ -1242,7 +1244,7 @@ def add_handler(
Args:
callback: The callback function to handle this particular request.
action: The action type to listen to.
screen: The screen ID to listen to.
screen: The screen ID to listen to (if screen is not provided, the handler will be called for all screens for this action!).
data_filter: A filter function to apply to the incoming data.
Returns:
Expand Down

0 comments on commit 7b9324d

Please sign in to comment.