Skip to content

Commit

Permalink
Adding Filter property to ConversationSelectMenu & ConversationMultiS…
Browse files Browse the repository at this point in the history
…electMenu
  • Loading branch information
Simon Oxtoby committed Apr 19, 2020
1 parent fe9e622 commit ca6e0da
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
35 changes: 35 additions & 0 deletions SlackNet/Blocks/ConversationFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Collections.Generic;

namespace SlackNet.Blocks
{
/// <summary>
/// Provides a way to filter the list of options in a <see cref="ConversationSelectMenu"/> or <see cref="ConversationMultiSelectMenu"/>.
/// </summary>
public class ConversationFilter
{
/// <summary>
/// Indicates which type of conversations should be included in the list.
/// When this field is provided, any conversations that do not match will be excluded.
/// </summary>
[IgnoreIfEmpty]
public IList<ConversationTypeFilter> Include { get; set; } = new List<ConversationTypeFilter>();

/// <summary>
/// Indicates whether to exclude external shared channels from conversation lists.
/// </summary>
public bool ExcludeExternalSharedChannels { get; set; }

/// <summary>
/// Indicates whether to exclude bot users from conversation lists.
/// </summary>
public bool ExcludeBotUsers { get; set; }
}

public enum ConversationTypeFilter
{
Public,
Private,
Mpim,
Im
}
}
5 changes: 5 additions & 0 deletions SlackNet/Blocks/ConversationMultiSelectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public ConversationMultiSelectMenu() : base("multi_conversations_select") { }
/// Specifies the maximum number of items that can be selected in the menu. Minimum number is 1.
/// </summary>
public int? MaxSelectedItems { get; set; }

/// <summary>
/// A <see cref="ConversationFilter"/> object that reduces the list of available conversations using the specified criteria.
/// </summary>
public ConversationFilter Filter { get; set; }
}

[SlackType("multi_conversations_select")]
Expand Down
5 changes: 5 additions & 0 deletions SlackNet/Blocks/ConversationSelectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public ConversationSelectMenu() : base("conversations_select") { }
/// The ID of any valid conversation to be pre-selected when the menu loads.
/// </summary>
public string InitialConversation { get; set; }

/// <summary>
/// A <see cref="ConversationFilter"/> object that reduces the list of available conversations using the specified criteria.
/// </summary>
public ConversationFilter Filter { get; set; }
}

[SlackType("conversations_select")]
Expand Down

0 comments on commit ca6e0da

Please sign in to comment.