Documentation
¶
Overview ¶
Package gmail implements a Reader that extracts transactions from Gmail.
Package gmail provides the Gmail reader and its plugin integration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Rules defines the email matching rules for transaction extraction.
Rules []api.Rule
// Resolver maps merchant info to category and bucket.
Resolver api.CategoryResolver
// Interval between rule evaluations. Defaults to 60 seconds.
Interval time.Duration
// LookbackDays limits how far back in time to search for emails.
// Defaults to 180 days (6 months). Set to 0 to use the default.
LookbackDays int
// LastScanAt is the timestamp of the last successful scan. When set
// (and ForceFullScan is false) only emails received after this time
// are fetched, avoiding a full lookback scan every interval.
LastScanAt *time.Time
// ForceFullScan bypasses LastScanAt and fetches the full lookback window.
// Used for force-rescan and retroactive rule application.
ForceFullScan bool
// OnCheckpoint is called with time.Now() after each successful scan iteration.
// Use it to persist the checkpoint so the next run starts from here.
OnCheckpoint func(time.Time)
// State is the state manager for tracking processed messages.
State *state.Manager
// DiagnosticSink records best-effort extraction diagnostics.
DiagnosticSink api.DiagnosticSink
// ObservabilityScope records reader telemetry. Defaults to a Gmail reader scope.
ObservabilityScope *observability.Scope
}
Config holds configuration for the Gmail reader.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the ReaderPlugin interface for Gmail.
func (*Plugin) Metadata ¶
func (p *Plugin) Metadata() plugins.ReaderMetadata
Metadata returns catalog metadata for the Gmail reader plugin.
func (*Plugin) SetGuideData ¶
SetGuideData injects the setup guide content. Called by main.go after loading the centralized content/readers/gmail/guide.json via go:embed.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads transactions from Gmail messages.
func (*Reader) Read ¶
func (r *Reader) Read(ctx context.Context, out chan<- *api.TransactionDetails, ackChan <-chan string) error
Read continuously evaluates rules and sends extracted transactions to the output channel. It runs until the context is canceled. Messages are marked as processed only after receiving acknowledgment via ackChan.