Documentation
¶
Overview ¶
Package deletion provides safe, staged email deletion from Gmail.
Index ¶
- type ExecuteOptions
- type Execution
- type Executor
- type Filters
- type Manager
- func (m *Manager) CancelManifest(id string) error
- func (m *Manager) CompletedDir() string
- func (m *Manager) CreateManifest(description string, gmailIDs []string, filters Filters) (*Manifest, error)
- func (m *Manager) FailedDir() string
- func (m *Manager) GetManifest(id string) (*Manifest, string, error)
- func (m *Manager) InProgressDir() string
- func (m *Manager) ListCompleted() ([]*Manifest, error)
- func (m *Manager) ListFailed() ([]*Manifest, error)
- func (m *Manager) ListInProgress() ([]*Manifest, error)
- func (m *Manager) ListPending() ([]*Manifest, error)
- func (m *Manager) MoveManifest(id string, fromStatus, toStatus Status) error
- func (m *Manager) PendingDir() string
- func (m *Manager) SaveManifest(manifest *Manifest) error
- type Manifest
- type Method
- type NullProgress
- type Progress
- type SenderCount
- type Status
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecuteOptions ¶
type ExecuteOptions struct {
Method Method // Trash or permanent delete
BatchSize int // Messages per batch for batch delete API
Resume bool // Resume from last checkpoint
}
ExecuteOptions configures deletion execution.
func DefaultExecuteOptions ¶
func DefaultExecuteOptions() *ExecuteOptions
DefaultExecuteOptions returns sensible defaults.
type Execution ¶
type Execution struct {
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Method Method `json:"method"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
FailedIDs []string `json:"failed_ids,omitempty"`
LastProcessedIndex int `json:"last_processed_index"` // For resumability
}
Execution tracks progress of a deletion operation.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor performs deletion operations.
func NewExecutor ¶
NewExecutor creates a deletion executor.
func (*Executor) ExecuteBatch ¶
ExecuteBatch performs batch deletion (more efficient but permanent).
func (*Executor) WithLogger ¶
WithLogger sets the logger.
func (*Executor) WithProgress ¶
WithProgress sets the progress reporter.
type Filters ¶
type Filters struct {
Senders []string `json:"senders,omitempty"`
SenderDomains []string `json:"sender_domains,omitempty"`
Recipients []string `json:"recipients,omitempty"`
Labels []string `json:"labels,omitempty"`
After string `json:"after,omitempty"` // ISO date
Before string `json:"before,omitempty"` // ISO date
Account string `json:"account,omitempty"`
}
Filters specifies criteria for selecting messages.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles deletion manifest files.
func NewManager ¶
NewManager creates a deletion manager.
func (*Manager) CancelManifest ¶
CancelManifest removes a pending or in-progress manifest.
func (*Manager) CompletedDir ¶
CompletedDir returns the path to the completed directory.
func (*Manager) CreateManifest ¶
func (m *Manager) CreateManifest(description string, gmailIDs []string, filters Filters) (*Manifest, error)
CreateManifest creates and saves a new manifest.
func (*Manager) GetManifest ¶
GetManifest loads a manifest by ID from any status directory.
func (*Manager) InProgressDir ¶
InProgressDir returns the path to the in_progress directory.
func (*Manager) ListCompleted ¶
ListCompleted returns all completed deletion manifests.
func (*Manager) ListFailed ¶
ListFailed returns all failed deletion manifests.
func (*Manager) ListInProgress ¶
ListInProgress returns all in-progress deletion manifests.
func (*Manager) ListPending ¶
ListPending returns all pending deletion manifests.
func (*Manager) MoveManifest ¶
MoveManifest moves a manifest from one status directory to another.
func (*Manager) PendingDir ¶
PendingDir returns the path to the pending directory.
func (*Manager) SaveManifest ¶
SaveManifest saves a manifest to the appropriate directory based on status.
type Manifest ¶
type Manifest struct {
Version int `json:"version"`
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by"` // "tui", "cli", "api"
Description string `json:"description"`
Filters Filters `json:"filters"`
Summary *Summary `json:"summary,omitempty"`
GmailIDs []string `json:"gmail_ids"`
Status Status `json:"status"`
Execution *Execution `json:"execution,omitempty"`
}
Manifest represents a deletion batch.
func LoadManifest ¶
LoadManifest reads a manifest from a JSON file.
func NewManifest ¶
NewManifest creates a new deletion manifest.
func (*Manifest) FormatSummary ¶
FormatSummary returns a human-readable summary of the deletion.
type NullProgress ¶
type NullProgress struct{}
NullProgress is a no-op progress reporter.
func (NullProgress) OnComplete ¶
func (NullProgress) OnComplete(succeeded, failed int)
func (NullProgress) OnProgress ¶
func (NullProgress) OnProgress(processed, succeeded, failed int)
func (NullProgress) OnStart ¶
func (NullProgress) OnStart(total, alreadyProcessed int)
type Progress ¶
type Progress interface {
OnStart(total, alreadyProcessed int)
OnProgress(processed, succeeded, failed int)
OnComplete(succeeded, failed int)
}
Progress reports deletion progress.
type SenderCount ¶
SenderCount represents a sender and their message count.
type Summary ¶
type Summary struct {
MessageCount int `json:"message_count"`
TotalSizeBytes int64 `json:"total_size_bytes"`
DateRange [2]string `json:"date_range"` // [earliest, latest]
Accounts []string `json:"accounts"`
TopSenders []SenderCount `json:"top_senders"`
}
Summary contains statistics about messages to be deleted.