gmail

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

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 New

func New(httpClient *http.Client, cfg Config, logger *slog.Logger) (*Reader, error)

New creates a new Gmail reader.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL