Skip to content

Commit 804b76e

Browse files
committed
python setup.py validate
1 parent 9fd4752 commit 804b76e

3 files changed

Lines changed: 63 additions & 15 deletions

File tree

slack/web/async_client.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,3 +2320,60 @@ async def views_publish(
23202320
else:
23212321
kwargs.update({"view": view})
23222322
return await self.api_call("views.publish", json=kwargs)
2323+
2324+
async def workflows_stepCompleted(
2325+
self, *, workflow_step_execute_id: str, outputs: dict = None, **kwargs
2326+
) -> AsyncSlackResponse:
2327+
"""Indicate a successful outcome of a workflow step's execution.
2328+
Args:
2329+
workflow_step_execute_id (str): A unique identifier of the workflow step to be updated.
2330+
e.g. 'add_task'
2331+
outputs (dict): A key-value object of outputs from your step.
2332+
e.g. { 'task_name': 'Task Name' }
2333+
"""
2334+
kwargs.update({"workflow_step_execute_id": workflow_step_execute_id})
2335+
if outputs:
2336+
kwargs.update({"outputs": outputs})
2337+
2338+
return await self.api_call("workflows.stepCompleted", json=kwargs)
2339+
2340+
async def workflows_stepFailed(
2341+
self, *, workflow_step_execute_id: str, error: dict, **kwargs
2342+
) -> AsyncSlackResponse:
2343+
"""Indicate an unsuccessful outcome of a workflow step's execution.
2344+
Args:
2345+
workflow_step_execute_id (str): A unique identifier of the workflow step to be updated.
2346+
e.g. 'add_task'
2347+
error (dict): A dict with a message property that contains a human readable error message
2348+
e.g. { message: 'Step failed to execute.' }
2349+
"""
2350+
kwargs.update(
2351+
{"workflow_step_execute_id": workflow_step_execute_id, "error": error}
2352+
)
2353+
return await self.api_call("workflows.stepFailed", json=kwargs)
2354+
2355+
async def workflows_updateStep(
2356+
self,
2357+
*,
2358+
workflow_step_edit_id: str,
2359+
inputs: dict = None,
2360+
outputs: list = None,
2361+
**kwargs
2362+
) -> AsyncSlackResponse:
2363+
"""Update the configuration for a workflow extension step.
2364+
Args:
2365+
workflow_step_edit_id (str): A unique identifier of the workflow step to be updated.
2366+
e.g. 'add_task'
2367+
inputs (dict): A key-value object of inputs required from a user during step configuration.
2368+
e.g. { 'title': { 'value': 'The Title' }, 'submitter': { 'value': 'The Submitter' } }
2369+
outputs (list): A list of output objects used during step execution.
2370+
e.g. [{ 'type': 'text', 'name': 'title', 'label': 'Title' }]
2371+
"""
2372+
kwargs.update({"workflow_step_edit_id": workflow_step_edit_id})
2373+
2374+
if inputs:
2375+
kwargs.update({"inputs": inputs})
2376+
if outputs:
2377+
kwargs.update({"outputs": outputs})
2378+
2379+
return await self.api_call("workflows.updateStep", json=kwargs)

slack/web/client.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,11 +2316,7 @@ def views_publish(
23162316
return self.api_call("views.publish", json=kwargs)
23172317

23182318
def workflows_stepCompleted(
2319-
self,
2320-
*,
2321-
workflow_step_execute_id: str,
2322-
outputs: dict = None,
2323-
**kwargs
2319+
self, *, workflow_step_execute_id: str, outputs: dict = None, **kwargs
23242320
) -> Union[Future, SlackResponse]:
23252321
"""Indicate a successful outcome of a workflow step's execution.
23262322
Args:
@@ -2336,11 +2332,7 @@ def workflows_stepCompleted(
23362332
return self.api_call("workflows.stepCompleted", json=kwargs)
23372333

23382334
def workflows_stepFailed(
2339-
self,
2340-
*,
2341-
workflow_step_execute_id: str,
2342-
error: dict,
2343-
**kwargs
2335+
self, *, workflow_step_execute_id: str, error: dict, **kwargs
23442336
) -> Union[Future, SlackResponse]:
23452337
"""Indicate an unsuccessful outcome of a workflow step's execution.
23462338
Args:
@@ -2349,7 +2341,9 @@ def workflows_stepFailed(
23492341
error (dict): A dict with a message property that contains a human readable error message
23502342
e.g. { message: 'Step failed to execute.' }
23512343
"""
2352-
kwargs.update({"workflow_step_execute_id": workflow_step_execute_id, "error": error})
2344+
kwargs.update(
2345+
{"workflow_step_execute_id": workflow_step_execute_id, "error": error}
2346+
)
23532347
return self.api_call("workflows.stepFailed", json=kwargs)
23542348

23552349
def workflows_updateStep(

tests/web/test_web_client_coverage.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class TestWebClientCoverage(unittest.TestCase):
12-
#220 endpoints as of Sep 2, 2020
12+
#221 endpoints as of Sep 2, 2020
1313
# Can be fetched by running `var methodNames = [].slice.call(document.getElementsByClassName('bold')).map(e => e.text);console.log(methodNames.toString());console.log(methodNames.length);` on https://api.slack.com/methods
1414
all_api_methods = "admin.apps.approve,admin.apps.restrict,admin.apps.approved.list,admin.apps.requests.list,admin.apps.restricted.list,admin.conversations.archive,admin.conversations.convertToPrivate,admin.conversations.create,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,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.reset,api.test,apps.permissions.info,apps.permissions.request,apps.permissions.resources.list,apps.permissions.scopes.list,apps.permissions.users.list,apps.permissions.users.request,apps.uninstall,auth.revoke,auth.test,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.archive,conversations.close,conversations.create,conversations.history,conversations.info,conversations.invite,conversations.join,conversations.kick,conversations.leave,conversations.list,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,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,admin.conversations.whitelist.add,admin.conversations.whitelist.listGroupsLinkedToChannel,admin.conversations.whitelist.remove,channels.archive,channels.create,channels.history,channels.info,channels.invite,channels.join,channels.kick,channels.leave,channels.list,channels.mark,channels.rename,channels.replies,channels.setPurpose,channels.setTopic,channels.unarchive,groups.archive,groups.create,groups.createChild,groups.history,groups.info,groups.invite,groups.kick,groups.leave,groups.list,groups.mark,groups.open,groups.rename,groups.replies,groups.setPurpose,groups.setTopic,groups.unarchive,im.close,im.history,im.list,im.mark,im.open,im.replies,mpim.close,mpim.history,mpim.list,mpim.mark,mpim.open,mpim.replies".split(
1515
","
@@ -31,9 +31,6 @@ def setUp(self):
3131
"admin.conversations.whitelist.add", # deprecated
3232
"admin.conversations.whitelist.listGroupsLinkedToChannel", # deprecated
3333
"admin.conversations.whitelist.remove", # deprecated
34-
"workflows.stepCompleted", # still in beta
35-
"workflows.stepFailed", # still in beta
36-
"workflows.updateStep", # still in beta
3734
]:
3835
continue
3936
self.api_methods_to_call.append(api_method)

0 commit comments

Comments
 (0)