Skip to content

Commit c026bc5

Browse files
committed
list all recorders
1 parent df2525b commit c026bc5

File tree

6 files changed

+266
-34
lines changed

6 files changed

+266
-34
lines changed

server/cmd/api/api/api.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,20 @@ func (s *ApiService) DownloadRecording(ctx context.Context, req oapi.DownloadRec
164164
}, nil
165165
}
166166

167+
// ListRecorders returns a list of all registered recorders and whether each one is currently recording.
168+
func (s *ApiService) ListRecorders(ctx context.Context, _ oapi.ListRecordersRequestObject) (oapi.ListRecordersResponseObject, error) {
169+
var infos []oapi.RecorderInfo
170+
171+
recs := s.recordManager.ListActiveRecorders(ctx)
172+
for _, r := range recs {
173+
infos = append(infos, oapi.RecorderInfo{
174+
Id: r.ID(),
175+
IsRecording: r.IsRecording(ctx),
176+
})
177+
}
178+
return oapi.ListRecorders200JSONResponse(infos), nil
179+
}
180+
167181
func (s *ApiService) Shutdown(ctx context.Context) error {
168182
return s.recordManager.StopAll(ctx)
169183
}

server/cmd/api/api/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestApiService_StartRecording(t *testing.T) {
7070
require.NoError(t, err)
7171

7272
out = mgr.ListActiveRecorders(ctx)
73-
assert.Equal(t, 0, len(out))
73+
assert.Equal(t, 5, len(out))
7474
})
7575
}
7676

server/lib/oapi/oapi.go

Lines changed: 220 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)