Documentation
¶
Overview ¶
Package api defines the core interfaces and data structures for expensor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Labels ¶
Labels maps merchant names to their category and bucket classification.
func (Labels) LabelLookup ¶
LabelLookup returns the category and bucket for a merchant. Returns empty strings if the merchant is not found.
type Reader ¶
type Reader interface {
Read(ctx context.Context, out chan<- *TransactionDetails, ackChan <-chan string) error
}
Reader reads transactions from a source and sends them to the provided channel. Implementations should close the channel when done or on error. The ackChan is used to receive acknowledgments of successfully written transactions.
type Rule ¶
type Rule struct {
Name string
Query string
Amount *regexp.Regexp
MerchantInfo *regexp.Regexp
Enabled bool
Source string
}
Rule defines an email matching rule for transaction extraction.
type TransactionDetails ¶
type TransactionDetails struct {
Amount float64 `json:"amount"`
Timestamp string `json:"timestamp"`
MerchantInfo string `json:"merchant_info"`
Category string `json:"category"`
// Bucket classifies the expense as Need/Want/Investment.
Bucket string `json:"bucket"`
Source string `json:"source"`
// MessageID is the email message ID (used for marking as read after successful write).
MessageID string `json:"-"`
}
TransactionDetails holds extracted transaction information.
Click to show internal directories.
Click to hide internal directories.