From 3929cb6e583fed128eb084c30ace58ad77a24b44 Mon Sep 17 00:00:00 2001 From: Filip Stojanac Date: Thu, 22 Oct 2020 09:17:32 +0200 Subject: [PATCH 1/4] [ENH] Add DispatchAction property to InputBlock --- SlackNet/Blocks/InputBlock.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SlackNet/Blocks/InputBlock.cs b/SlackNet/Blocks/InputBlock.cs index 82f429d..674f3a1 100644 --- a/SlackNet/Blocks/InputBlock.cs +++ b/SlackNet/Blocks/InputBlock.cs @@ -27,5 +27,10 @@ public InputBlock() : base("input") { } /// A boolean that indicates whether the input element may be empty when a user submits the modal. /// public bool Optional { get; set; } + + /// + /// A boolean that indicates whether or not the use of elements in this block should dispatch a block_actions payload. Defaults to false. + /// + public bool DispatchAction { get; set; } } } \ No newline at end of file From 19577d83c877e61400de871fb28c31bbbdcec56e Mon Sep 17 00:00:00 2001 From: Filip Stojanac Date: Thu, 22 Oct 2020 09:39:10 +0200 Subject: [PATCH 2/4] [ENH] Update docs for DispatchAction --- SlackNet/Blocks/InputBlock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SlackNet/Blocks/InputBlock.cs b/SlackNet/Blocks/InputBlock.cs index 674f3a1..f4b9270 100644 --- a/SlackNet/Blocks/InputBlock.cs +++ b/SlackNet/Blocks/InputBlock.cs @@ -29,7 +29,7 @@ public InputBlock() : base("input") { } public bool Optional { get; set; } /// - /// A boolean that indicates whether or not the use of elements in this block should dispatch a block_actions payload. Defaults to false. + /// A boolean that indicates whether or not the use of elements in this block should dispatch a payload. Defaults to false. /// public bool DispatchAction { get; set; } } From 979a874cad418ee07e48287b82f703828f33be11 Mon Sep 17 00:00:00 2001 From: Filip Stojanac Date: Thu, 22 Oct 2020 09:39:27 +0200 Subject: [PATCH 3/4] [ENH] Add DispatchActionConfig for PlainTextInput --- SlackNet/Blocks/DispatchActionConfig.cs | 22 ++++++++++++++++++++++ SlackNet/Blocks/PlainTextInput.cs | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 SlackNet/Blocks/DispatchActionConfig.cs diff --git a/SlackNet/Blocks/DispatchActionConfig.cs b/SlackNet/Blocks/DispatchActionConfig.cs new file mode 100644 index 0000000..3807ae3 --- /dev/null +++ b/SlackNet/Blocks/DispatchActionConfig.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace SlackNet.Blocks +{ + /// + /// Determines when a element will return a interaction payload. + /// + public class DispatchActionConfig + { + /// + /// An array of that you would like to receive a payload for. + /// + [IgnoreIfEmpty] + public IList TriggerActionsOn { get; set; } = new List(); + } + + public enum InteractionType + { + OnEnterPressed, + OnCharacterEntered + } +} \ No newline at end of file diff --git a/SlackNet/Blocks/PlainTextInput.cs b/SlackNet/Blocks/PlainTextInput.cs index 492d1a8..914afab 100644 --- a/SlackNet/Blocks/PlainTextInput.cs +++ b/SlackNet/Blocks/PlainTextInput.cs @@ -37,6 +37,11 @@ public PlainTextInput() : base("plain_text_input") { } /// The maximum length of input that the user can provide. If the user provides more, they will receive an error. /// public int? MaxLength { get; set; } + + /// + /// A that determines when during text input the element returns a payload. + /// + public DispatchActionConfig DispatchActionConfig { get; set; } } [SlackType("plain_text_input")] From 0fb11ae06a0d314775c62a3c5f7095e383a8863e Mon Sep 17 00:00:00 2001 From: Filip Stojanac Date: Thu, 22 Oct 2020 09:59:02 +0200 Subject: [PATCH 4/4] [ENH] Add PlainTextInputAction --- SlackNet/Blocks/PlainTextInput.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SlackNet/Blocks/PlainTextInput.cs b/SlackNet/Blocks/PlainTextInput.cs index 914afab..c01c03a 100644 --- a/SlackNet/Blocks/PlainTextInput.cs +++ b/SlackNet/Blocks/PlainTextInput.cs @@ -44,6 +44,12 @@ public PlainTextInput() : base("plain_text_input") { } public DispatchActionConfig DispatchActionConfig { get; set; } } + [SlackType("plain_text_input")] + public class PlainTextInputAction : BlockAction + { + public string Value { get; set; } + } + [SlackType("plain_text_input")] public class PlainTextInputValue : ElementValue {