added status API endpoint

This commit is contained in:
2024-12-19 13:08:25 +01:00
parent 17fb608f45
commit f9e829dce6
8 changed files with 230 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
package domain
import (
"context"
"net/http"
)
type Status struct {
Downloading int `json:"downloading"`
Pending int `json:"pending"`
Completed int `json:"completed"`
DownloadSpeed int `json:"download_speed"`
}
type Repository interface {
Pending(ctx context.Context) int
Completed(ctx context.Context) int
Downloading(ctx context.Context) int
DownloadSpeed(ctx context.Context) int64
}
type Service interface {
Status(ctx context.Context) (*Status, error)
}
type RestHandler interface {
Status() http.HandlerFunc
}