diff --git a/src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs index bc5c4bf2..e7798d6c 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs @@ -3,5 +3,6 @@ namespace BotSharp.Abstraction.Plugins.Models public class PluginFilter { public Pagination Pager { get; set; } = new Pagination(); + public IEnumerable? Names { get; set; } } } diff --git a/src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs b/src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs index f9b2efba..05efe39d 100644 --- a/src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs +++ b/src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs @@ -126,6 +126,12 @@ public class PluginLoader var plugins = GetPlugins(services); var pager = filter?.Pager ?? new Pagination(); + // Apply filter + if (!filter.Names.IsNullOrEmpty()) + { + plugins = plugins.Where(x => filter.Names.Any(n => x.Name.IsEqualTo(n))).ToList(); + } + return new PagedItems { Items = plugins.Skip(pager.Offset).Take(pager.Size),