Skip to content
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
73 changes: 73 additions & 0 deletions slack_sdk/web/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,67 @@ async def apps_uninstall(
kwargs.update({"client_id": client_id, "client_secret": client_secret})
return await self.api_call("apps.uninstall", params=kwargs)

async def apps_manifest_create(
self,
*,
manifest: str,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seratch I want to verify I've crafted these signatures correctly. For testing purposes (and as I mentioned in the corresponding PR), I used the following:

client.apps_manifest_create(token=CONFIGURATION_ACCESS_TOKEN, manifest=VALID_APP_MANIFEST)

Again, since these tokens are so specific to this set of methods, I assume the explicit passing of the tooling token will be often utilized. Does anything need to change about the arguments to encourage this, or is what is here fine?

Copy link
Contributor

Choose a reason for hiding this comment

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

First of all, for all methods except api.test, token argument is available as part of kwargs. The current code works as-is.

For apps.connections.open API method, we added app_token this way for consistency with Node SDK. We may want to have something similar for tooling tokens but I think that it's not really necessary so far.

Speaking of realistic use cases, I don't think developers often want to use bot token along with tooling token in a single WebClient instance. When using apps.manifest.* endpoints, it's rare to reuse a WebClient associated with a specific workspace installation (except the case where you would like to send manifest via an existing Slack app; I don't think this is a common use case). For this reason, I think the current code should be fine.

If many people think explicit name of the argument should exist here and we receive such feedback a lot, we may revisit, though.

**kwargs,
) -> AsyncSlackResponse:
"""Creates a new app from a manifest.
https://api.slack.com/methods/apps.manifest.create
"""
kwargs.update({"manifest": manifest})
return await self.api_call("apps.manifest.create", params=kwargs)

async def apps_manifest_delete(
self,
*,
app_id: str,
**kwargs,
) -> AsyncSlackResponse:
"""Deletes an app.
https://api.slack.com/methods/apps.manifest.delete
"""
kwargs.update({"app_id": app_id})
return await self.api_call("apps.manifest.delete", params=kwargs)

async def apps_manifest_export(
self,
*,
app_id: str,
**kwargs,
) -> AsyncSlackResponse:
"""Retrieves the manifest of an app.
https://api.slack.com/methods/apps.manifest.export
"""
kwargs.update({"app_id": app_id})
return await self.api_call("apps.manifest.export", params=kwargs)

async def apps_manifest_update(
self,
*,
app_id: str,
manifest: str,
**kwargs,
) -> AsyncSlackResponse:
"""Updates an app using a manifest.
https://api.slack.com/methods/apps.manifest.update
"""
kwargs.update({"app_id": app_id, "manifest": manifest})
return await self.api_call("apps.manifest.update", params=kwargs)

async def apps_manifest_validate(
self,
*,
manifest: str,
**kwargs,
) -> AsyncSlackResponse:
"""Validates an app manifest.
https://api.slack.com/methods/apps.manifest.validate
"""
kwargs.update({"manifest": manifest})
return await self.api_call("apps.manifest.validate", params=kwargs)

async def auth_revoke(
self,
*,
Expand Down Expand Up @@ -3853,6 +3914,18 @@ async def team_profile_get(
kwargs.update({"visibility": visibility})
return await self.api_call("team.profile.get", http_verb="GET", params=kwargs)

async def tooling_tokens_rotate(
self,
*,
refresh_token: str,
**kwargs,
) -> AsyncSlackResponse:
"""Refresh a tooling token.
https://api.slack.com/methods/tooling.tokens.rotate
"""
kwargs.update({"refresh_token": refresh_token})
return await self.api_call("tooling.tokens.rotate", params=kwargs)

async def usergroups_create(
self,
*,
Expand Down
73 changes: 73 additions & 0 deletions slack_sdk/web/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,67 @@ def apps_uninstall(
kwargs.update({"client_id": client_id, "client_secret": client_secret})
return self.api_call("apps.uninstall", params=kwargs)

def apps_manifest_create(
self,
*,
manifest: str,
**kwargs,
) -> SlackResponse:
"""Creates a new app from a manifest.
https://api.slack.com/methods/apps.manifest.create
"""
kwargs.update({"manifest": manifest})
return self.api_call("apps.manifest.create", params=kwargs)

def apps_manifest_delete(
self,
*,
app_id: str,
**kwargs,
) -> SlackResponse:
"""Deletes an app.
https://api.slack.com/methods/apps.manifest.delete
"""
kwargs.update({"app_id": app_id})
return self.api_call("apps.manifest.delete", params=kwargs)

def apps_manifest_export(
self,
*,
app_id: str,
**kwargs,
) -> SlackResponse:
"""Retrieves the manifest of an app.
https://api.slack.com/methods/apps.manifest.export
"""
kwargs.update({"app_id": app_id})
return self.api_call("apps.manifest.export", params=kwargs)

def apps_manifest_update(
self,
*,
app_id: str,
manifest: str,
**kwargs,
) -> SlackResponse:
"""Updates an app using a manifest.
https://api.slack.com/methods/apps.manifest.update
"""
kwargs.update({"app_id": app_id, "manifest": manifest})
return self.api_call("apps.manifest.update", params=kwargs)

def apps_manifest_validate(
self,
*,
manifest: str,
**kwargs,
) -> SlackResponse:
"""Validates an app manifest.
https://api.slack.com/methods/apps.manifest.validate
"""
kwargs.update({"manifest": manifest})
return self.api_call("apps.manifest.validate", params=kwargs)

def auth_revoke(
self,
*,
Expand Down Expand Up @@ -3792,6 +3853,18 @@ def team_profile_get(
kwargs.update({"visibility": visibility})
return self.api_call("team.profile.get", http_verb="GET", params=kwargs)

def tooling_tokens_rotate(
self,
*,
refresh_token: str,
**kwargs,
) -> SlackResponse:
"""Refresh a tooling token.
https://api.slack.com/methods/tooling.tokens.rotate
"""
kwargs.update({"refresh_token": refresh_token})
return self.api_call("tooling.tokens.rotate", params=kwargs)

def usergroups_create(
self,
*,
Expand Down
73 changes: 73 additions & 0 deletions slack_sdk/web/legacy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,67 @@ def apps_uninstall(
kwargs.update({"client_id": client_id, "client_secret": client_secret})
return self.api_call("apps.uninstall", params=kwargs)

def apps_manifest_create(
self,
*,
manifest: str,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Creates a new app from a manifest.
https://api.slack.com/methods/apps.manifest.create
"""
kwargs.update({"manifest": manifest})
return self.api_call("apps.manifest.create", params=kwargs)

def apps_manifest_delete(
self,
*,
app_id: str,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Deletes an app.
https://api.slack.com/methods/apps.manifest.delete
"""
kwargs.update({"app_id": app_id})
return self.api_call("apps.manifest.delete", params=kwargs)

def apps_manifest_export(
self,
*,
app_id: str,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Retrieves the manifest of an app.
https://api.slack.com/methods/apps.manifest.export
"""
kwargs.update({"app_id": app_id})
return self.api_call("apps.manifest.export", params=kwargs)

def apps_manifest_update(
self,
*,
app_id: str,
manifest: str,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Updates an app using a manifest.
https://api.slack.com/methods/apps.manifest.update
"""
kwargs.update({"app_id": app_id, "manifest": manifest})
return self.api_call("apps.manifest.update", params=kwargs)

def apps_manifest_validate(
self,
*,
manifest: str,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Validates an app manifest.
https://api.slack.com/methods/apps.manifest.validate
"""
kwargs.update({"manifest": manifest})
return self.api_call("apps.manifest.validate", params=kwargs)

def auth_revoke(
self,
*,
Expand Down Expand Up @@ -3803,6 +3864,18 @@ def team_profile_get(
kwargs.update({"visibility": visibility})
return self.api_call("team.profile.get", http_verb="GET", params=kwargs)

def tooling_tokens_rotate(
self,
*,
refresh_token: str,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Refresh a tooling token.
https://api.slack.com/methods/tooling.tokens.rotate
"""
kwargs.update({"refresh_token": refresh_token})
return self.api_call("tooling.tokens.rotate", params=kwargs)

def usergroups_create(
self,
*,
Expand Down
Loading