diff --git a/src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs index bc5c4bf2e..e7798d6c1 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 f9b2efba5..05efe39d5 100644 --- a/src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs +++ b/src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs @@ -126,6 +126,12 @@ public PagedItems GetPagedPlugins(IServiceProvider services, PluginFi 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),