wmill 1.440.3__py3-none-any.whl → 1.441.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
wmill/client.py CHANGED
@@ -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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wmill
3
- Version: 1.440.3
3
+ Version: 1.441.2
4
4
  Summary: A client library for accessing Windmill server wrapping the Windmill client API
5
5
  Home-page: https://windmill.dev
6
6
  License: Apache-2.0
@@ -1,8 +1,8 @@
1
1
  wmill/__init__.py,sha256=nGZnQPezTdrBnBW1D0JqUtm75Gdf_xi3tAcPGwHRZ5A,46
2
- wmill/client.py,sha256=8yXaAWEK_TSn1WkN1C4H34XmKLdzF1epCiydHwhbQf0,34925
2
+ wmill/client.py,sha256=qcFbU6Js8QiV6-zizuhGA33LYCtEV6jZlYvfNr5NOmc,36683
3
3
  wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
4
4
  wmill/s3_reader.py,sha256=izHlg2Xsg0Sr_LkDDEC35VuEijJcuPBDIm-xj21KsgU,1668
5
5
  wmill/s3_types.py,sha256=XVjPyc5sjWesTy6nnRReojhyPgPsaT0EY3X57mWUaJ4,1173
6
- wmill-1.440.3.dist-info/METADATA,sha256=TUEcIKwBkcfMxhkpJ8rmNy4WXKOyUTlmRyhnxWPN0Dc,2693
7
- wmill-1.440.3.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
- wmill-1.440.3.dist-info/RECORD,,
6
+ wmill-1.441.2.dist-info/METADATA,sha256=XBjirWz-zc_Br4EGWHOZFTVYlXt5yA7sNfL_i4rnUvw,2693
7
+ wmill-1.441.2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
+ wmill-1.441.2.dist-info/RECORD,,