Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interactivity_pointer as trigger_id alias to views.* APIs #1556

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions slack_sdk/web/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5232,15 +5232,16 @@ async def users_profile_set(
async def views_open(
self,
*,
trigger_id: str,
trigger_id: Optional[str] = None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way to accept both in Python is to make both optional..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add some logic that raises a TypeError if both fields are None but this may not be needed if the API error mentions a missing trigger_id or interactivity_pointer field

interactivity_pointer: Optional[str] = None,
view: Union[dict, View],
**kwargs,
) -> AsyncSlackResponse:
"""Open a view for a user.
https://api.slack.com/methods/views.open
See https://api.slack.com/surfaces/modals for details.
"""
kwargs.update({"trigger_id": trigger_id})
kwargs.update({"trigger_id": trigger_id, "interactivity_pointer": interactivity_pointer})
if isinstance(view, View):
kwargs.update({"view": view.to_dict()})
else:
Expand All @@ -5252,7 +5253,8 @@ async def views_open(
async def views_push(
self,
*,
trigger_id: str,
trigger_id: Optional[str] = None,
interactivity_pointer: Optional[str] = None,
view: Union[dict, View],
**kwargs,
) -> AsyncSlackResponse:
Expand All @@ -5264,7 +5266,7 @@ async def views_push(
to learn more about the lifecycle and intricacies of views.
https://api.slack.com/methods/views.push
"""
kwargs.update({"trigger_id": trigger_id})
kwargs.update({"trigger_id": trigger_id, "interactivity_pointer": interactivity_pointer})
if isinstance(view, View):
kwargs.update({"view": view.to_dict()})
else:
Expand Down
10 changes: 6 additions & 4 deletions slack_sdk/web/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5223,15 +5223,16 @@ def users_profile_set(
def views_open(
self,
*,
trigger_id: str,
trigger_id: Optional[str] = None,
interactivity_pointer: Optional[str] = None,
view: Union[dict, View],
**kwargs,
) -> SlackResponse:
"""Open a view for a user.
https://api.slack.com/methods/views.open
See https://api.slack.com/surfaces/modals for details.
"""
kwargs.update({"trigger_id": trigger_id})
kwargs.update({"trigger_id": trigger_id, "interactivity_pointer": interactivity_pointer})
if isinstance(view, View):
kwargs.update({"view": view.to_dict()})
else:
Expand All @@ -5243,7 +5244,8 @@ def views_open(
def views_push(
self,
*,
trigger_id: str,
trigger_id: Optional[str] = None,
interactivity_pointer: Optional[str] = None,
view: Union[dict, View],
**kwargs,
) -> SlackResponse:
Expand All @@ -5255,7 +5257,7 @@ def views_push(
to learn more about the lifecycle and intricacies of views.
https://api.slack.com/methods/views.push
"""
kwargs.update({"trigger_id": trigger_id})
kwargs.update({"trigger_id": trigger_id, "interactivity_pointer": interactivity_pointer})
if isinstance(view, View):
kwargs.update({"view": view.to_dict()})
else:
Expand Down
10 changes: 6 additions & 4 deletions slack_sdk/web/legacy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5234,15 +5234,16 @@ def users_profile_set(
def views_open(
self,
*,
trigger_id: str,
trigger_id: Optional[str] = None,
interactivity_pointer: Optional[str] = None,
view: Union[dict, View],
**kwargs,
) -> Union[Future, SlackResponse]:
"""Open a view for a user.
https://api.slack.com/methods/views.open
See https://api.slack.com/surfaces/modals for details.
"""
kwargs.update({"trigger_id": trigger_id})
kwargs.update({"trigger_id": trigger_id, "interactivity_pointer": interactivity_pointer})
if isinstance(view, View):
kwargs.update({"view": view.to_dict()})
else:
Expand All @@ -5254,7 +5255,8 @@ def views_open(
def views_push(
self,
*,
trigger_id: str,
trigger_id: Optional[str] = None,
interactivity_pointer: Optional[str] = None,
view: Union[dict, View],
**kwargs,
) -> Union[Future, SlackResponse]:
Expand All @@ -5266,7 +5268,7 @@ def views_push(
to learn more about the lifecycle and intricacies of views.
https://api.slack.com/methods/views.push
"""
kwargs.update({"trigger_id": trigger_id})
kwargs.update({"trigger_id": trigger_id, "interactivity_pointer": interactivity_pointer})
if isinstance(view, View):
kwargs.update({"view": view.to_dict()})
else:
Expand Down
Loading