firefly

package
v0.0.0-...-506d6dd Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Id         string            `json:"id"`
	Attributes AccountAttributes `json:"attributes"`
}

type AccountAttributes

type AccountAttributes struct {
	Name          string `json:"name"`
	Type          string `json:"type"`
	CurrencyCode  string `json:"currency_code"`
	Iban          string `json:"iban"`
	Bic           string `json:"bic"`
	AccountNumber string `json:"account_number"`
	Active        bool   `json:"active"`
}

type Firefly

type Firefly struct {
	// contains filtered or unexported fields
}

func NewFirefly

func NewFirefly(
	apiKey string,
	fireflyURL string,
	cl *req.Client,
) *Firefly

func (*Firefly) CreateTransactions

func (f *Firefly) CreateTransactions(ctx context.Context, tx *Transaction) (*Transaction, error)

func (*Firefly) ListAccounts

func (f *Firefly) ListAccounts(ctx context.Context) ([]*Account, error)

func (*Firefly) MapTransactions

func (f *Firefly) MapTransactions(
	ctx context.Context,
	transactions []*database.Transaction,
) ([]*MappedTransaction, error)

type GenericApiResponse

type GenericApiResponse[T any] struct {
	Data T `json:"data"`
}

type MappedTransaction

type MappedTransaction struct {
	Original            *database.Transaction
	Transaction         *Transaction
	FireflyMappingError error
	IsCommitted         bool
}

type Transaction

type Transaction struct {
	Type                string `json:"type"`
	Date                string `json:"date"`
	Amount              string `json:"amount"`
	Description         string `json:"description"`
	CurrencyCode        string `json:"currency_code"`
	SourceID            string `json:"source_id"`
	SourceName          string `json:"-"`
	DestinationID       string `json:"destination_id,omitempty"`
	DestinationName     string `json:"-"`
	Notes               string `json:"notes"`
	ForeignAmount       string `json:"foreign_amount,omitempty"`
	ForeignCurrencyCode string `json:"foreign_currency_code,omitempty"`
}

Jump to

Keyboard shortcuts

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