Skip to content

Commit 4b88c31

Browse files
committed
Add support for apps.manfiest.* endpoints
1 parent 8e9df44 commit 4b88c31

File tree

4 files changed

+201
-1
lines changed

4 files changed

+201
-1
lines changed

slack_sdk/web/async_client.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,67 @@ async def apps_uninstall(
15141514
kwargs.update({"client_id": client_id, "client_secret": client_secret})
15151515
return await self.api_call("apps.uninstall", params=kwargs)
15161516

1517+
async def apps_manifest_create(
1518+
self,
1519+
*,
1520+
manifest: str,
1521+
**kwargs,
1522+
) -> AsyncSlackResponse:
1523+
"""Creates a new app from a manifest.
1524+
https://api.slack.com/methods/apps.manifest.create
1525+
"""
1526+
kwargs.update({"manifest": manifest})
1527+
return await self.api_call("apps.manifest.create", params=kwargs)
1528+
1529+
async def apps_manifest_delete(
1530+
self,
1531+
*,
1532+
app_id: str,
1533+
**kwargs,
1534+
) -> AsyncSlackResponse:
1535+
"""Deletes an app manifest.
1536+
https://api.slack.com/methods/apps.manifest.delete
1537+
"""
1538+
kwargs.update({"app_id": app_id})
1539+
return await self.api_call("apps.manifest.delete", params=kwargs)
1540+
1541+
async def apps_manifest_export(
1542+
self,
1543+
*,
1544+
app_id: str,
1545+
**kwargs,
1546+
) -> AsyncSlackResponse:
1547+
"""Exports the manifest of an existing app.
1548+
https://api.slack.com/methods/apps.manifest.export
1549+
"""
1550+
kwargs.update({"app_id": app_id})
1551+
return await self.api_call("apps.manifest.export", params=kwargs)
1552+
1553+
async def apps_manifest_update(
1554+
self,
1555+
*,
1556+
app_id: str,
1557+
manifest: str,
1558+
**kwargs,
1559+
) -> AsyncSlackResponse:
1560+
"""Updates an app manifest with a new manifest.
1561+
https://api.slack.com/methods/apps.manifest.update
1562+
"""
1563+
kwargs.update({"app_id": app_id, "manifest": manifest})
1564+
return await self.api_call("apps.manifest.update", params=kwargs)
1565+
1566+
async def apps_manifest_validate(
1567+
self,
1568+
*,
1569+
manifest: str,
1570+
**kwargs,
1571+
) -> AsyncSlackResponse:
1572+
"""Validates an app manifest.
1573+
https://api.slack.com/methods/apps.manifest.validate
1574+
"""
1575+
kwargs.update({"manifest": manifest})
1576+
return await self.api_call("apps.manifest.validate", params=kwargs)
1577+
15171578
async def auth_revoke(
15181579
self,
15191580
*,

slack_sdk/web/client.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,67 @@ def apps_uninstall(
14671467
kwargs.update({"client_id": client_id, "client_secret": client_secret})
14681468
return self.api_call("apps.uninstall", params=kwargs)
14691469

1470+
def apps_manifest_create(
1471+
self,
1472+
*,
1473+
manifest: str,
1474+
**kwargs,
1475+
) -> SlackResponse:
1476+
"""Creates a new app from a manifest.
1477+
https://api.slack.com/methods/apps.manifest.create
1478+
"""
1479+
kwargs.update({"manifest": manifest})
1480+
return self.api_call("apps.manifest.create", params=kwargs)
1481+
1482+
def apps_manifest_delete(
1483+
self,
1484+
*,
1485+
app_id: str,
1486+
**kwargs,
1487+
) -> SlackResponse:
1488+
"""Deletes an app manifest.
1489+
https://api.slack.com/methods/apps.manifest.delete
1490+
"""
1491+
kwargs.update({"app_id": app_id})
1492+
return self.api_call("apps.manifest.delete", params=kwargs)
1493+
1494+
def apps_manifest_export(
1495+
self,
1496+
*,
1497+
app_id: str,
1498+
**kwargs,
1499+
) -> SlackResponse:
1500+
"""Exports the manifest of an existing app.
1501+
https://api.slack.com/methods/apps.manifest.export
1502+
"""
1503+
kwargs.update({"app_id": app_id})
1504+
return self.api_call("apps.manifest.export", params=kwargs)
1505+
1506+
def apps_manifest_update(
1507+
self,
1508+
*,
1509+
app_id: str,
1510+
manifest: str,
1511+
**kwargs,
1512+
) -> SlackResponse:
1513+
"""Updates an app manifest with a new manifest.
1514+
https://api.slack.com/methods/apps.manifest.update
1515+
"""
1516+
kwargs.update({"app_id": app_id, "manifest": manifest})
1517+
return self.api_call("apps.manifest.update", params=kwargs)
1518+
1519+
def apps_manifest_validate(
1520+
self,
1521+
*,
1522+
manifest: str,
1523+
**kwargs,
1524+
) -> SlackResponse:
1525+
"""Validates an app manifest.
1526+
https://api.slack.com/methods/apps.manifest.validate
1527+
"""
1528+
kwargs.update({"manifest": manifest})
1529+
return self.api_call("apps.manifest.validate", params=kwargs)
1530+
14701531
def auth_revoke(
14711532
self,
14721533
*,

slack_sdk/web/legacy_client.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,67 @@ def apps_uninstall(
14781478
kwargs.update({"client_id": client_id, "client_secret": client_secret})
14791479
return self.api_call("apps.uninstall", params=kwargs)
14801480

1481+
def apps_manifest_create(
1482+
self,
1483+
*,
1484+
manifest: str,
1485+
**kwargs,
1486+
) -> Union[Future, SlackResponse]:
1487+
"""Creates a new app from a manifest.
1488+
https://api.slack.com/methods/apps.manifest.create
1489+
"""
1490+
kwargs.update({"manifest": manifest})
1491+
return self.api_call("apps.manifest.create", params=kwargs)
1492+
1493+
def apps_manifest_delete(
1494+
self,
1495+
*,
1496+
app_id: str,
1497+
**kwargs,
1498+
) -> Union[Future, SlackResponse]:
1499+
"""Deletes an app manifest.
1500+
https://api.slack.com/methods/apps.manifest.delete
1501+
"""
1502+
kwargs.update({"app_id": app_id})
1503+
return self.api_call("apps.manifest.delete", params=kwargs)
1504+
1505+
def apps_manifest_export(
1506+
self,
1507+
*,
1508+
app_id: str,
1509+
**kwargs,
1510+
) -> Union[Future, SlackResponse]:
1511+
"""Exports the manifest of an existing app.
1512+
https://api.slack.com/methods/apps.manifest.export
1513+
"""
1514+
kwargs.update({"app_id": app_id})
1515+
return self.api_call("apps.manifest.export", params=kwargs)
1516+
1517+
def apps_manifest_update(
1518+
self,
1519+
*,
1520+
app_id: str,
1521+
manifest: str,
1522+
**kwargs,
1523+
) -> Union[Future, SlackResponse]:
1524+
"""Updates an app manifest with a new manifest.
1525+
https://api.slack.com/methods/apps.manifest.update
1526+
"""
1527+
kwargs.update({"app_id": app_id, "manifest": manifest})
1528+
return self.api_call("apps.manifest.update", params=kwargs)
1529+
1530+
def apps_manifest_validate(
1531+
self,
1532+
*,
1533+
manifest: str,
1534+
**kwargs,
1535+
) -> Union[Future, SlackResponse]:
1536+
"""Validates an app manifest.
1537+
https://api.slack.com/methods/apps.manifest.validate
1538+
"""
1539+
kwargs.update({"manifest": manifest})
1540+
return self.api_call("apps.manifest.validate", params=kwargs)
1541+
14811542
def auth_revoke(
14821543
self,
14831544
*,

tests/slack_sdk_async/web/test_web_client_coverage.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
class TestWebClientCoverage(unittest.TestCase):
18-
# 240 endpoints as of Sept 4, 2021
18+
# 240 endpoints as of Sept 4, 2021 // TODO :: update before merge
1919
# Can be fetched by running `var methodNames = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')).map(e => e.href.replace("https://api.slack.com/methods/", ""));console.log(methodNames.toString());console.log(methodNames.length);` on https://api.slack.com/methods
2020
all_api_methods = "admin.analytics.getFile,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.requests.list,admin.apps.restricted.list,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.convertToPrivate,admin.conversations.create,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.setSettings,api.test,apps.connections.open,apps.event.authorizations.list,apps.uninstall,auth.revoke,auth.test,auth.teams.list,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.comments.delete,files.delete,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,migration.exchange,oauth.access,oauth.token,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.profile.get,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,apps.permissions.info,apps.permissions.request,apps.permissions.resources.list,apps.permissions.scopes.list,apps.permissions.users.list,apps.permissions.users.request,channels.archive,channels.create,channels.history,channels.info,channels.invite,channels.join,channels.leave,channels.list,channels.mark,channels.replies,channels.setPurpose,channels.setTopic,channels.unarchive,groups.archive,groups.create,groups.history,groups.info,groups.invite,groups.leave,groups.list,groups.mark,groups.open,groups.replies,groups.setPurpose,groups.setTopic,groups.unarchive,im.history,im.list,im.mark,im.open,im.replies,mpim.history,mpim.list,mpim.mark,mpim.open,mpim.replies".split(
2121
","
@@ -366,6 +366,23 @@ async def run_method(self, method_name, method, async_method):
366366
method(client_id="111.222", client_secret="xxx")["method"]
367367
)
368368
await async_method(client_id="111.222", client_secret="xxx")
369+
elif method_name == "apps_manifest_create":
370+
self.api_methods_to_call.remove(method(manifest="{}")["method"])
371+
await async_method(manifest="{}")
372+
elif method_name == "apps_manifest_delete":
373+
self.api_methods_to_call.remove(method(app_id="AID123")["method"])
374+
await async_method(app_id="AID123")
375+
elif method_name == "apps_manifest_export":
376+
self.api_methods_to_call.remove(method(app_id="AID123")["method"])
377+
await async_method(app_id="AID123")
378+
elif method_name == "apps_manifest_update":
379+
self.api_methods_to_call.remove(
380+
method(app_id="AID123", manifest="{}")["method"]
381+
)
382+
await async_method(app_id="AID123", manifest="{}")
383+
elif method_name == "apps_manifest_validate":
384+
self.api_methods_to_call.remove(method(manifest="{}")["method"])
385+
await async_method(manifest="{}")
369386
elif method_name == "calls_add":
370387
self.api_methods_to_call.remove(
371388
method(

0 commit comments

Comments
 (0)