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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wmill/client.py CHANGED
@@ -9,6 +9,7 @@ import os
9
9
  import random
10
10
  import time
11
11
  import warnings
12
+ import json
12
13
  from json import JSONDecodeError
13
14
  from typing import Dict, Any, Union, Literal
14
15
 
@@ -629,13 +630,46 @@ class Windmill:
629
630
  channel_id: str,
630
631
  message: str = None,
631
632
  approver: str = None,
633
+ default_args_json: dict = None,
634
+ dynamic_enums_json: dict = None,
632
635
  ) -> None:
633
636
  """
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
637
+ Sends an interactive approval request via Slack, allowing optional customization of the message, approver, and form fields.
638
+
639
+ **[Enterprise Edition Only]** To include form fields in the Slack approval request, use the "Advanced -> Suspend -> Form" functionality.
640
+ Learn more at: https://www.windmill.dev/docs/flows/flow_approval#form
641
+
642
+ :param slack_resource_path: The path to the Slack resource in Windmill.
643
+ :type slack_resource_path: str
644
+ :param channel_id: The Slack channel ID where the approval request will be sent.
645
+ :type channel_id: str
646
+ :param message: Optional custom message to include in the Slack approval request.
647
+ :type message: str, optional
648
+ :param approver: Optional user ID or name of the approver for the request.
649
+ :type approver: str, optional
650
+ :param default_args_json: Optional dictionary defining or overriding the default arguments for form fields.
651
+ :type default_args_json: dict, optional
652
+ :param dynamic_enums_json: Optional dictionary overriding the enum default values of enum form fields.
653
+ :type dynamic_enums_json: dict, optional
654
+
655
+ :raises Exception: If the function is not called within a flow or flow preview.
656
+ :raises Exception: If the required flow job or flow step environment variables are not set.
657
+
658
+ :return: None
659
+
660
+ **Usage Example:**
661
+ >>> client.request_interactive_slack_approval(
662
+ ... slack_resource_path="/u/alex/my_slack_resource",
663
+ ... channel_id="admins-slack-channel",
664
+ ... message="Please approve this request",
665
+ ... approver="approver123",
666
+ ... default_args_json={"key1": "value1", "key2": 42},
667
+ ... dynamic_enums_json={"foo": ["choice1", "choice2"], "bar": ["optionA", "optionB"]},
668
+ ... )
669
+
670
+ **Notes:**
671
+ - This function must be executed within a Windmill flow or flow preview.
672
+ - The function checks for required environment variables (`WM_FLOW_JOB_ID`, `WM_FLOW_STEP_ID`) to ensure it is run in the appropriate context.
639
673
  """
640
674
  workspace = self.workspace
641
675
  flow_job_id = os.environ.get("WM_FLOW_JOB_ID")
@@ -657,6 +691,10 @@ class Windmill:
657
691
  params["channel_id"] = channel_id
658
692
  if os.environ.get("WM_FLOW_STEP_ID"):
659
693
  params["flow_step_id"] = os.environ.get("WM_FLOW_STEP_ID")
694
+ if default_args_json:
695
+ params["default_args_json"] = json.dumps(default_args_json)
696
+ if dynamic_enums_json:
697
+ params["dynamic_enums_json"] = json.dumps(dynamic_enums_json)
660
698
 
661
699
  self.get(
662
700
  f"/w/{workspace}/jobs/slack_approval/{os.environ.get('WM_JOB_ID', 'NO_JOB_ID')}",
@@ -1018,12 +1056,16 @@ def request_interactive_slack_approval(
1018
1056
  channel_id: str,
1019
1057
  message: str = None,
1020
1058
  approver: str = None,
1059
+ default_args_json: dict = None,
1060
+ dynamic_enums_json: dict = None,
1021
1061
  ) -> None:
1022
1062
  return _client.request_interactive_slack_approval(
1023
1063
  slack_resource_path=slack_resource_path,
1024
1064
  channel_id=channel_id,
1025
1065
  message=message,
1026
1066
  approver=approver,
1067
+ default_args_json=default_args_json,
1068
+ dynamic_enums_json=dynamic_enums_json,
1027
1069
  )
1028
1070
 
1029
1071
  @init_global_client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wmill
3
- Version: 1.441.2
3
+ Version: 1.443.0
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=qcFbU6Js8QiV6-zizuhGA33LYCtEV6jZlYvfNr5NOmc,36683
2
+ wmill/client.py,sha256=8N1zUQ59FHLiQQ63x490dt7FbhJOOKPxmUlKjLO7rr8,39080
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.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,,
6
+ wmill-1.443.0.dist-info/METADATA,sha256=Qx-3d1tIr_gmU9TVsb5_1uKJWeK0zVjRXlB7bt1gHos,2693
7
+ wmill-1.443.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
+ wmill-1.443.0.dist-info/RECORD,,