wmill 1.442.0__tar.gz → 1.443.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {wmill-1.442.0 → wmill-1.443.0}/PKG-INFO +1 -1
- {wmill-1.442.0 → wmill-1.443.0}/pyproject.toml +1 -1
- {wmill-1.442.0 → wmill-1.443.0}/wmill/client.py +41 -10
- {wmill-1.442.0 → wmill-1.443.0}/README.md +0 -0
- {wmill-1.442.0 → wmill-1.443.0}/wmill/__init__.py +0 -0
- {wmill-1.442.0 → wmill-1.443.0}/wmill/py.typed +0 -0
- {wmill-1.442.0 → wmill-1.443.0}/wmill/s3_reader.py +0 -0
- {wmill-1.442.0 → wmill-1.443.0}/wmill/s3_types.py +0 -0
@@ -631,14 +631,45 @@ class Windmill:
|
|
631
631
|
message: str = None,
|
632
632
|
approver: str = None,
|
633
633
|
default_args_json: dict = None,
|
634
|
-
|
634
|
+
dynamic_enums_json: dict = None,
|
635
635
|
) -> None:
|
636
636
|
"""
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
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.
|
642
673
|
"""
|
643
674
|
workspace = self.workspace
|
644
675
|
flow_job_id = os.environ.get("WM_FLOW_JOB_ID")
|
@@ -662,8 +693,8 @@ class Windmill:
|
|
662
693
|
params["flow_step_id"] = os.environ.get("WM_FLOW_STEP_ID")
|
663
694
|
if default_args_json:
|
664
695
|
params["default_args_json"] = json.dumps(default_args_json)
|
665
|
-
if
|
666
|
-
params["
|
696
|
+
if dynamic_enums_json:
|
697
|
+
params["dynamic_enums_json"] = json.dumps(dynamic_enums_json)
|
667
698
|
|
668
699
|
self.get(
|
669
700
|
f"/w/{workspace}/jobs/slack_approval/{os.environ.get('WM_JOB_ID', 'NO_JOB_ID')}",
|
@@ -1026,7 +1057,7 @@ def request_interactive_slack_approval(
|
|
1026
1057
|
message: str = None,
|
1027
1058
|
approver: str = None,
|
1028
1059
|
default_args_json: dict = None,
|
1029
|
-
|
1060
|
+
dynamic_enums_json: dict = None,
|
1030
1061
|
) -> None:
|
1031
1062
|
return _client.request_interactive_slack_approval(
|
1032
1063
|
slack_resource_path=slack_resource_path,
|
@@ -1034,7 +1065,7 @@ def request_interactive_slack_approval(
|
|
1034
1065
|
message=message,
|
1035
1066
|
approver=approver,
|
1036
1067
|
default_args_json=default_args_json,
|
1037
|
-
|
1068
|
+
dynamic_enums_json=dynamic_enums_json,
|
1038
1069
|
)
|
1039
1070
|
|
1040
1071
|
@init_global_client
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|