Documentation
¶
Overview ¶
Package gmail implements a Reader that extracts transactions from Gmail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTransactionDetails ¶
func ExtractTransactionDetails(emailBody string, amountRegex, merchantRegex *regexp.Regexp, receivedTime time.Time) *api.TransactionDetails
ExtractTransactionDetails extracts transaction details from an email body using regex patterns.
Types ¶
type Config ¶
type Config struct {
// Rules defines the email matching rules for transaction extraction.
Rules []api.Rule
// Labels maps merchants to categories.
Labels api.Labels
// Interval between rule evaluations. Defaults to 10 seconds.
Interval time.Duration
}
Config holds configuration for the Gmail reader.
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. Emails are only marked as read after receiving acknowledgment via ackChan.
Click to show internal directories.
Click to hide internal directories.