wmill 1.440.3__tar.gz → 1.441.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {wmill-1.440.3 → wmill-1.441.1}/PKG-INFO +1 -1
- {wmill-1.440.3 → wmill-1.441.1}/pyproject.toml +1 -1
- {wmill-1.440.3 → wmill-1.441.1}/wmill/client.py +53 -0
- {wmill-1.440.3 → wmill-1.441.1}/README.md +0 -0
- {wmill-1.440.3 → wmill-1.441.1}/wmill/__init__.py +0 -0
- {wmill-1.440.3 → wmill-1.441.1}/wmill/py.typed +0 -0
- {wmill-1.440.3 → wmill-1.441.1}/wmill/s3_reader.py +0 -0
- {wmill-1.440.3 → wmill-1.441.1}/wmill/s3_types.py +0 -0
@@ -623,6 +623,46 @@ class Windmill:
|
|
623
623
|
params={"approver": approver},
|
624
624
|
).json()
|
625
625
|
|
626
|
+
def request_interactive_slack_approval(
|
627
|
+
self,
|
628
|
+
slack_resource_path: str,
|
629
|
+
channel_id: str,
|
630
|
+
message: str = None,
|
631
|
+
approver: str = None,
|
632
|
+
) -> None:
|
633
|
+
"""
|
634
|
+
Request interactive Slack approval
|
635
|
+
:param slack_resource_path: Slack resource path
|
636
|
+
:param channel_id: Slack channel
|
637
|
+
:param message: Message to send to Slack
|
638
|
+
:param approver: Approver name
|
639
|
+
"""
|
640
|
+
workspace = self.workspace
|
641
|
+
flow_job_id = os.environ.get("WM_FLOW_JOB_ID")
|
642
|
+
|
643
|
+
if not flow_job_id:
|
644
|
+
raise Exception(
|
645
|
+
"You can't use 'request_interactive_slack_approval' function in a standalone script or flow step preview. Please use it in a flow or a flow preview."
|
646
|
+
)
|
647
|
+
|
648
|
+
# Only include non-empty parameters
|
649
|
+
params = {}
|
650
|
+
if message:
|
651
|
+
params["message"] = message
|
652
|
+
if approver:
|
653
|
+
params["approver"] = approver
|
654
|
+
if slack_resource_path:
|
655
|
+
params["slack_resource_path"] = slack_resource_path
|
656
|
+
if channel_id:
|
657
|
+
params["channel_id"] = channel_id
|
658
|
+
if os.environ.get("WM_FLOW_STEP_ID"):
|
659
|
+
params["flow_step_id"] = os.environ.get("WM_FLOW_STEP_ID")
|
660
|
+
|
661
|
+
self.get(
|
662
|
+
f"/w/{workspace}/jobs/slack_approval/{os.environ.get('WM_JOB_ID', 'NO_JOB_ID')}",
|
663
|
+
params=params,
|
664
|
+
)
|
665
|
+
|
626
666
|
def username_to_email(self, username: str) -> str:
|
627
667
|
"""
|
628
668
|
Get email from workspace username
|
@@ -972,6 +1012,19 @@ def get_state_path() -> str:
|
|
972
1012
|
def get_resume_urls(approver: str = None) -> dict:
|
973
1013
|
return _client.get_resume_urls(approver)
|
974
1014
|
|
1015
|
+
@init_global_client
|
1016
|
+
def request_interactive_slack_approval(
|
1017
|
+
slack_resource_path: str,
|
1018
|
+
channel_id: str,
|
1019
|
+
message: str = None,
|
1020
|
+
approver: str = None,
|
1021
|
+
) -> None:
|
1022
|
+
return _client.request_interactive_slack_approval(
|
1023
|
+
slack_resource_path=slack_resource_path,
|
1024
|
+
channel_id=channel_id,
|
1025
|
+
message=message,
|
1026
|
+
approver=approver,
|
1027
|
+
)
|
975
1028
|
|
976
1029
|
@init_global_client
|
977
1030
|
def cancel_running() -> dict:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|