starling

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionIN             Direction = "IN"
	DirectionOUT            Direction = "OUT"
	StatusUpcoming          Status    = "UPCOMING"
	StatusUpcomingCancelled Status    = "UPCOMING_CANCELLED"
	StatusPending           Status    = "PENDING"
	StatusReversed          Status    = "REVERSED"
	StatusSettled           Status    = "SETTLED"
	StatusDeclined          Status    = "DECLINED"
	StatusRefunded          Status    = "REFUNDED"
	StatusRetrying          Status    = "RETRYING"
	StatusAccountCheck      Status    = "ACCOUNT_CHECK"
)

Variables

This section is empty.

Functions

func New

func New(httpClient *http.Client, opts ...Option) *client

func UnmarshalError

func UnmarshalError(status int, body []byte) error

Types

type Account

type Account struct {
	ID                AccountID  `json:"accountUid"`
	Type              string     `json:"accountType"`
	DefaultCategoryID CategoryID `json:"defaultCategory"`
	Currency          string     `json:"currency"`
	CreatedAt         time.Time  `json:"createdAt"`
	Name              string     `json:"name"`
}

type AccountID

type AccountID uuid.UUID

func (AccountID) String

func (a AccountID) String() string

func (*AccountID) UnmarshalJSON

func (a *AccountID) UnmarshalJSON(data []byte) error

type CategoryID

type CategoryID uuid.UUID

func (CategoryID) String

func (c CategoryID) String() string

func (*CategoryID) UnmarshalJSON

func (c *CategoryID) UnmarshalJSON(data []byte) error

type Client

type Client interface {
	FetchTransactionsSince(ctx context.Context, opts FetchTransactionOptions) ([]*FeedItem, error)
	FetchFeedItem(ctx context.Context, accountID AccountID, categoryID CategoryID, feedItemID FeedItemID) (*FeedItem, error)
	FetchAccounts(ctx context.Context) ([]*Account, error)
	FetchSavingsGoals(ctx context.Context, accountID AccountID) ([]*SavingsGoal, error)
}

type CounterPartyID

type CounterPartyID uuid.UUID

func (CounterPartyID) String

func (c CounterPartyID) String() string

func (*CounterPartyID) UnmarshalJSON

func (c *CounterPartyID) UnmarshalJSON(data []byte) error

type Direction

type Direction string

type Error

type Error struct {
	HTTPStatus    int
	Code          string         `json:"error"`
	Message       string         `json:"error_description"`
	Success       bool           `json:"success"`
	ErrorMessages []ErrorMessage `json:"errors"`
}

func (Error) Error

func (err Error) Error() string

type ErrorMessage

type ErrorMessage struct {
	Message string `json:"message"`
}

type FeedItem

type FeedItem struct {
	ID                      FeedItemID     `json:"feedItemUid"`
	Amount                  domain.Money   `json:"amount"` // Amount in the account's currency
	TransactedAt            time.Time      `json:"transactionTime"`
	SettledAt               *time.Time     `json:"settlementTime"`
	CategoryID              CategoryID     `json:"categoryUid"`
	CategoryName            string         `json:"spendingCategory"`
	Description             string         `json:"reference"`
	Status                  Status         `json:"status"`
	UserNote                string         `json:"userNote"`
	Direction               Direction      `json:"direction"`        // Direction of payment, e.g. IN or OUT
	Source                  string         `json:"source"`           // e.g. MASTED_CARD
	SourceSubType           string         `json:"sourceSubType"`    // e.g. Online, ATM, Deposit
	CounterPartyType        string         `json:"counterPartyType"` // e.g. STARLING, MERCHANT
	CounterPartyID          CounterPartyID `json:"counterPartyUid"`
	CounterPartySubEntityID string         `json:"counterPartySubEntityUid"`
	CounterPartyName        string         `json:"counterPartyName"`
	RoundUp                 *RoundUp       `json:"roundUp"`
}

type FeedItemID

type FeedItemID uuid.UUID

func (FeedItemID) String

func (f FeedItemID) String() string

func (*FeedItemID) UnmarshalJSON

func (f *FeedItemID) UnmarshalJSON(data []byte) error

type FetchTransactionOptions

type FetchTransactionOptions struct {
	AccountID  AccountID
	CategoryID CategoryID
	Start      time.Time
	End        time.Time
}

func (*FetchTransactionOptions) Validate

func (fto *FetchTransactionOptions) Validate(ctx context.Context) error

type Option

type Option func(*client)

func WithAuthToken

func WithAuthToken(authToken string) Option

func WithBaseURL

func WithBaseURL(baseURL string) Option

type RoundUp

type RoundUp struct {
	GoalCategoryID CategoryID   `json:"goalCategoryUid"`
	Amount         domain.Money `json:"amount"`
}

type SavingsGoal

type SavingsGoal struct {
	ID         SavingsGoalID `json:"savingsGoalUid"`
	Name       string        `json:"name"`
	State      string        `json:"state"`
	Target     domain.Money  `json:"target"`
	TotalSaved domain.Money  `json:"totalSaved"`
}

type SavingsGoalID

type SavingsGoalID uuid.UUID

func (SavingsGoalID) String

func (s SavingsGoalID) String() string

func (*SavingsGoalID) UnmarshalJSON

func (s *SavingsGoalID) UnmarshalJSON(data []byte) error

type Status

type Status string

Jump to

Keyboard shortcuts

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