fetch_ml/cmd/tui/internal/services/export.go
Jeremie Fraeys 23e5f3d1dc
refactor(api): internal refactoring for TUI and worker modules
- Refactor internal/worker and internal/queue packages
- Update cmd/tui for monitoring interface
- Update test configurations
2026-02-20 15:51:23 -05:00

46 lines
1.2 KiB
Go

// Package services provides TUI service clients
package services
import (
"fmt"
"time"
"github.com/jfraeys/fetch_ml/internal/logging"
)
// ExportService handles job export functionality for TUI
type ExportService struct {
serverURL string
apiKey string
logger *logging.Logger
}
// NewExportService creates a new export service
func NewExportService(serverURL, apiKey string, logger *logging.Logger) *ExportService {
return &ExportService{
serverURL: serverURL,
apiKey: apiKey,
logger: logger,
}
}
// ExportJob exports a job with optional anonymization
// Returns the path to the exported file
func (s *ExportService) ExportJob(jobName string, anonymize bool) (string, error) {
s.logger.Info("exporting job", "job", jobName, "anonymize", anonymize)
// Placeholder - actual implementation would call API
// POST /api/jobs/{id}/export?anonymize=true
exportPath := fmt.Sprintf("/tmp/%s_export_%d.tar.gz", jobName, time.Now().Unix())
s.logger.Info("export complete", "job", jobName, "path", exportPath)
return exportPath, nil
}
// ExportOptions contains options for export
type ExportOptions struct {
Anonymize bool
IncludeLogs bool
IncludeData bool
}