From 110301a975e43739192577166d089e28c22ae266 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 29 Jul 2023 21:20:12 +0800 Subject: Add API server --- agent.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 agent.go (limited to 'agent.go') diff --git a/agent.go b/agent.go new file mode 100644 index 0000000..9f021f5 --- /dev/null +++ b/agent.go @@ -0,0 +1,23 @@ +package main + +import ( + "github.com/keuin/slbr/api/agent" + "github.com/keuin/slbr/recording" + "github.com/samber/lo" +) + +type agentImpl struct { + tasks *[]*recording.RunningTask +} + +func (a *agentImpl) GetTasks() []agent.TaskInfo { + return lo.Map(*a.tasks, func(t *recording.RunningTask, _ int) agent.TaskInfo { + return agent.TaskInfo{ + LiveRoom: agent.LiveRoomInfo{ + ID: t.RoomId, + Title: t.GetRoomTitle(), + }, + Status: t.GetStatus().String(), + } + }) +} -- cgit v1.2.3