dest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package dest defines where normalized activities are delivered (portfolio trackers, budgeting apps, files) and keeps the registry of destinations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(d Definition)

Types

type Account

type Account struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Currency string `json:"currency,omitempty"`
}

Account is a place in the destination activities can go to.

type Batch

type Batch struct {
	SourceName string
	Account    string // Account.ID chosen for this source
	Activities []model.Activity
	// Costs: what an incoming asset cost, by activity id, in the account's
	// currency (see model.Costs). Missing when no price is known.
	Costs map[string]decimal.Decimal
	// Transfers: for a deposit or withdrawal between two of your own
	// accounts, the name of the source on the other side, by activity id.
	Transfers map[string]string
}

Batch is the activities of one source going to one destination account.

type Config

type Config = source.Config

Config is the same shape as a source's.

type Definition

type Definition struct {
	Kind        string                                       `json:"kind"`
	Name        string                                       `json:"name"`
	Description string                                       `json:"description"`
	Fields      []source.Field                               `json:"fields"`
	Setup       string                                       `json:"setup,omitempty"`
	New         func(cfg source.Config) (Destination, error) `json:"-"`
}

Definition describes a kind of destination.

func Get

func Get(kind string) (Definition, error)

func List

func List() []Definition

type Destination

type Destination interface {
	// Accounts lists where activities can go, for the mapping screen.
	Accounts(ctx context.Context) ([]Account, error)
	// Push writes the activities and reports each one's fate. It must be
	// safe to call again with activities that were already delivered.
	Push(ctx context.Context, b Batch) ([]Result, error)
}

Destination is a configured target.

type Result

type Result struct {
	ActivityID string `json:"activityId"`
	Status     Status `json:"status"`
	ExternalID string `json:"externalId,omitempty"`
	Message    string `json:"message,omitempty"`
}

Result for one activity.

type Status

type Status string

Status of one delivered activity.

const (
	Delivered Status = "delivered" // written in the destination
	Duplicate Status = "duplicate" // the destination already had it
	Skipped   Status = "skipped"   // nothing to write (e.g. not representable); not retried
	Failed    Status = "failed"    // retried on the next run
)

Directories

Path Synopsis
Package ghostfolio delivers activities to a Ghostfolio server through its REST API (POST /api/v1/import), signed in with the user's security token (POST /api/v1/auth/anonymous gives a JWT, renewed when it is refused).
Package ghostfolio delivers activities to a Ghostfolio server through its REST API (POST /api/v1/import), signed in with the user's security token (POST /api/v1/auth/anonymous gives a JWT, renewed when it is refused).
Package wealthfolio delivers activities to a Wealthfolio server through its MCP endpoint (import pipeline: validate, then commit as one run).
Package wealthfolio delivers activities to a Wealthfolio server through its MCP endpoint (import pipeline: validate, then commit as one run).

Jump to

Keyboard shortcuts

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