From 6dba5cdd65e9ba4ed76765162855615d4f4d7bab Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 31 Jan 2025 10:26:16 -0600 Subject: [PATCH] add labels --- .../Controllers/AgentController.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs index 226783d3..4a05b121 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs @@ -160,4 +160,20 @@ public class AgentController : ControllerBase } return utilities.Where(x => !string.IsNullOrWhiteSpace(x.Name)).OrderBy(x => x.Name).ToList(); } + + [HttpGet("/agent/labels")] + public async Task> GetAgentLabels() + { + var agentService = _services.GetRequiredService(); + var agents = await agentService.GetAgents(new AgentFilter + { + Pager = new Pagination { Size = 1000 } + }); + + var labels = agents.Items?.SelectMany(x => x.Labels) + .Distinct() + .OrderBy(x => x) + .ToList() ?? []; + return labels; + } } \ No newline at end of file