-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add listener --------- Co-authored-by: Kazuhiro Sera <[email protected]>
- Loading branch information
1 parent
4b086cf
commit 370cddf
Showing
39 changed files
with
1,358 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Don't add async module imports here | ||
from .complete import Complete | ||
|
||
__all__ = [ | ||
"Complete", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import Any, Dict, Optional | ||
|
||
from slack_sdk.web.async_client import AsyncWebClient | ||
from slack_sdk.web.async_slack_response import AsyncSlackResponse | ||
|
||
|
||
class AsyncComplete: | ||
client: AsyncWebClient | ||
function_execution_id: Optional[str] | ||
|
||
def __init__( | ||
self, | ||
client: AsyncWebClient, | ||
function_execution_id: Optional[str], | ||
): | ||
self.client = client | ||
self.function_execution_id = function_execution_id | ||
|
||
async def __call__(self, outputs: Dict[str, Any] = {}) -> AsyncSlackResponse: | ||
"""Signal the successful completion of the custom function. | ||
Kwargs: | ||
outputs: Json serializable object containing the output values | ||
Returns: | ||
SlackResponse: The response object returned from slack | ||
Raises: | ||
ValueError: If this function cannot be used. | ||
""" | ||
if self.function_execution_id is None: | ||
raise ValueError("complete is unsupported here as there is no function_execution_id") | ||
|
||
return await self.client.functions_completeSuccess(function_execution_id=self.function_execution_id, outputs=outputs) |
Oops, something went wrong.