feat(api): add live collection contract endpoints
This commit is contained in:
@@ -28,12 +28,16 @@ type Server struct {
|
||||
mu sync.RWMutex
|
||||
result *models.AnalysisResult
|
||||
detectedVendor string
|
||||
|
||||
collectMu sync.RWMutex
|
||||
collectJobs map[string]*CollectJobStatusResponse
|
||||
}
|
||||
|
||||
func New(cfg Config) *Server {
|
||||
s := &Server{
|
||||
config: cfg,
|
||||
mux: http.NewServeMux(),
|
||||
config: cfg,
|
||||
mux: http.NewServeMux(),
|
||||
collectJobs: make(map[string]*CollectJobStatusResponse),
|
||||
}
|
||||
s.setupRoutes()
|
||||
return s
|
||||
@@ -64,6 +68,9 @@ func (s *Server) setupRoutes() {
|
||||
s.mux.HandleFunc("GET /api/export/txt", s.handleExportTXT)
|
||||
s.mux.HandleFunc("DELETE /api/clear", s.handleClear)
|
||||
s.mux.HandleFunc("POST /api/shutdown", s.handleShutdown)
|
||||
s.mux.HandleFunc("POST /api/collect", s.handleCollectStart)
|
||||
s.mux.HandleFunc("GET /api/collect/{id}", s.handleCollectStatus)
|
||||
s.mux.HandleFunc("POST /api/collect/{id}/cancel", s.handleCollectCancel)
|
||||
}
|
||||
|
||||
func (s *Server) Run() error {
|
||||
|
||||
Reference in New Issue
Block a user