Skip to content

Commit 4f1b52a

Browse files
committed
Adding BlockActions for FeedbackButtons and IconButton
Resolves #250
1 parent 60ce29c commit 4f1b52a

File tree

4 files changed

+47
-31
lines changed

4 files changed

+47
-31
lines changed

SlackNet/Blocks/BlockElement.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ public interface IBlockElement
55
string Type { get; }
66
}
77

8-
public abstract class BlockElement : IBlockElement
8+
public abstract class BlockElement(string type) : IBlockElement
99
{
10-
protected BlockElement(string type) => Type = type;
11-
12-
public string Type { get; }
10+
public string Type { get; } = type;
1311
}

SlackNet/Blocks/ContextActionsBlock.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,5 @@ public class ContextActionsBlock() : Block("context_actions")
1111
public abstract class ContextActionsElement(string type)
1212
{
1313
public string Type { get; set; } = type;
14-
}
15-
16-
[SlackType("feedback_buttons")]
17-
public class FeedbackButtons() : ContextActionsElement("feedback_buttons")
18-
{
19-
public FeedbackButton PositiveButton { get; set; } = new();
20-
public FeedbackButton NegativeButton { get; set; } = new();
21-
public string ActionId { get; set; }
22-
}
23-
24-
public class FeedbackButton
25-
{
26-
public PlainText Text { get; set; }
27-
public string Value { get; set; }
28-
public string AccessibilityLabel { get; set; }
29-
}
30-
31-
[SlackType("icon_button")]
32-
public class IconButton() : ContextActionsElement("icon_button")
33-
{
34-
public string Icon { get; set; }
35-
public PlainText Text { get; set; }
3614
public string ActionId { get; set; }
37-
public string Value { get; set; }
38-
public ConfirmationDialog Confirm { get; set; }
39-
public string AccessibilityLabel { get; set; }
40-
[IgnoreIfEmpty]
41-
public IList<string> VisibleToUserIds { get; set; } = [];
4215
}

SlackNet/Blocks/FeedbackButtons.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace SlackNet.Blocks;
2+
3+
[SlackType("feedback_buttons")]
4+
public class FeedbackButtons() : ContextActionsElement("feedback_buttons")
5+
{
6+
public FeedbackButton PositiveButton { get; set; } = new();
7+
public FeedbackButton NegativeButton { get; set; } = new();
8+
}
9+
10+
public class FeedbackButton
11+
{
12+
public PlainText Text { get; set; }
13+
public string Value { get; set; }
14+
public string AccessibilityLabel { get; set; }
15+
}
16+
17+
[SlackType("feedback_buttons")]
18+
public class FeedbackButtonsAction : BlockAction
19+
{
20+
public PlainText Text { get; set; }
21+
public string Value { get; set; }
22+
}

SlackNet/Blocks/IconButton.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Collections.Generic;
2+
3+
namespace SlackNet.Blocks;
4+
5+
[SlackType("icon_button")]
6+
public class IconButton() : ContextActionsElement("icon_button")
7+
{
8+
public string Icon { get; set; }
9+
public PlainText Text { get; set; }
10+
public string Value { get; set; }
11+
public ConfirmationDialog Confirm { get; set; }
12+
public string AccessibilityLabel { get; set; }
13+
[IgnoreIfEmpty]
14+
public IList<string> VisibleToUserIds { get; set; } = [];
15+
}
16+
17+
[SlackType("icon_button")]
18+
public class IconButtonAction : BlockAction
19+
{
20+
public string Icon { get; set; }
21+
public PlainText Text { get; set; }
22+
public string Value { get; set; }
23+
}

0 commit comments

Comments
 (0)