starling

package
v0.0.0-...-c783838 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseUrlProd = "https://api.starlingbank.com/api/v2"
	// BaseUrlSb   = "https://api-sandbox.starlingbank.com/api/v2"
	AccountHolderEndpoint       = "account-holder"
	AccountsEndpoint            = "accounts"
	AddressesEndpoint           = "addresses"
	BalanceEndpoint             = "balance"
	ConfirmationOfFundsEndpoint = "confirmation-of-funds"
	IdentifiersEndpoint         = "identifiers"
	CardsEndpoint               = "cards"
	DirectDebitsEndpoint        = "direct-debit/mandates"
	RecurringPaymentsEndpoint   = "recurring-payment"
	SpacesEndpoint              = "spaces"
)
View Source
const (
	DateTimeFormat = "2006-01-02T15:04:05Z"
	DateOnlyFormat = "2006-01-02"
)
View Source
const RateLimit = 5

RateLimit because PAT has a rate limit of 5 requests per second

Variables

This section is empty.

Functions

func AccountEndpoint

func AccountEndpoint(a string, endpoint string) string

func BaseEndpoint

func BaseEndpoint(endpoint string) string

Types

type Account

type Account struct {
	AccountUID      string   `json:"accountUid"`
	AccountType     string   `json:"accountType"`
	DefaultCategory string   `json:"defaultCategory"`
	Currency        string   `json:"currency"`
	CreatedAt       DateTime `json:"createdAt"`
	Name            string   `json:"name"`
}

type AccountHolder

type AccountHolder struct {
	AccountHolderUid  string `json:"accountHolderUid"`
	AccountHolderType string `json:"accountHolderType"`
}

type AccountHolderName

type AccountHolderName struct {
	AccountHolderName string `json:"accountHolderName"`
}

type AccountIdentifier

type AccountIdentifier struct {
	IdentifierType    string `json:"identifierType"`
	BankIdentifier    string `json:"bankIdentifier"`
	AccountIdentifier string `json:"accountIdentifier"`
}

type AccountIdentifiers

type AccountIdentifiers struct {
	AccountIdentifier  string              `json:"accountIdentifier"`
	BankIdentifier     string              `json:"bankIdentifier"`
	IBAN               string              `json:"iban"`
	BIC                string              `json:"bic"`
	AccountIdentifiers []AccountIdentifier `json:"accountIdentifiers"`
}

type Accounts

type Accounts struct {
	Accounts []Account `json:"accounts"`
}

type Address

type Address struct {
	Line1       string `json:"line1"`
	Line2       string `json:"line2"`
	Line3       string `json:"line3"`
	PostTown    string `json:"postTown"`
	PostCode    string `json:"postCode"`
	CountryCode string `json:"countryCode"`
}

type Addresses

type Addresses struct {
	Current  Address   `json:"current"`
	Previous []Address `json:"previous"`
}

type Amount

type Amount struct {
	Amount float64
}

func (*Amount) String

func (c *Amount) String() string

func (*Amount) UnmarshalJSON

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

type AssociatedFeedRoundUp

type AssociatedFeedRoundUp struct {
	GoalCategoryUid string            `json:"goalCategoryUid"`
	Amount          CurrencyAndAmount `json:"amount"`
}

type Balance

type Balance struct {
	ClearedBalance        SignedCurrencyAndAmount `json:"clearedBalance"`
	EffectiveBalance      SignedCurrencyAndAmount `json:"effectiveBalance"`
	PendingTransactions   SignedCurrencyAndAmount `json:"pendingTransactions"`
	AcceptedOverdraft     SignedCurrencyAndAmount `json:"acceptedOverdraft"`
	Amount                SignedCurrencyAndAmount `json:"amount"`
	TotalClearedBalance   SignedCurrencyAndAmount `json:"totalClearedBalance"`
	TotalEffectiveBalance SignedCurrencyAndAmount `json:"totalEffectiveBalance"`
}

type BatchPaymentDetails

type BatchPaymentDetails struct {
	BatchPaymentUID  string `json:"batchPaymentUid"`
	BatchPaymentType string `json:"batchPaymentType"`
}

type Card

type Card struct {
	CardUid                   string         `json:"cardUid"`
	PublicToken               string         `json:"publicToken"`
	Enabled                   bool           `json:"enabled"`
	WalletNotificationEnabled bool           `json:"walletNotificationEnabled"`
	POSEnabled                bool           `json:"posEnabled"`
	ATMEnabled                bool           `json:"atmEnabled"`
	OnlineEnabled             bool           `json:"onlineEnabled"`
	MobileWalletEnabled       bool           `json:"mobileWalletEnabled"`
	GamblingEnabled           bool           `json:"gamblingEnabled"`
	MagStripeEnabled          bool           `json:"magStripeEnabled"`
	Cancelled                 bool           `json:"cancelled"`
	ActivationRequested       bool           `json:"activationRequested"`
	Activated                 bool           `json:"activated"`
	EndOfCardNumber           string         `json:"endOfCardNumber"`
	CurrencyFlags             []CurrencyFlag `json:"currencyFlag"`
	CardAssociationUid        string         `json:"cardAssociationUid"`
	GamblingToBeEnabledAt     string         `json:"gamblingToBeEnabledAt"`
}

type Cards

type Cards struct {
	Cards []Card `json:"cards"`
}

type Client

type Client struct {
	Token string
}

func New

func New(token string) *Client

func (*Client) GetAccountBalance

func (c *Client) GetAccountBalance(a *Account) (Balance, error)

func (*Client) GetAccountHolder

func (c *Client) GetAccountHolder() (AccountHolder, error)

func (*Client) GetAccountHolderName

func (c *Client) GetAccountHolderName() (AccountHolderName, error)

func (*Client) GetAccountIdentifiers

func (c *Client) GetAccountIdentifiers(a *Account) (AccountIdentifiers, error)

func (*Client) GetAccounts

func (c *Client) GetAccounts() ([]Account, error)

func (*Client) GetAddresses

func (c *Client) GetAddresses() (Addresses, error)

func (*Client) GetCards

func (c *Client) GetCards() ([]Card, error)

func (*Client) GetConfirmationOfFunds

func (c *Client) GetConfirmationOfFunds(a *Account, amountMinorUnits int64) (ConfirmationOfFunds, error)

func (*Client) GetDirectDebitMandates

func (c *Client) GetDirectDebitMandates() ([]DirectDebitMandate, error)

func (*Client) GetFeedItems

func (c *Client) GetFeedItems(a *Account, t0 time.Time) ([]FeedItem, error)

func (*Client) GetRecurringPayments

func (c *Client) GetRecurringPayments(a *Account) ([]RecurringCardPayment, error)

func (*Client) GetSpaces

func (c *Client) GetSpaces(a *Account) (Spaces, error)

func (*Client) Request

func (c *Client) Request(method string, url string, body string) (val []byte, err error)

func (*Client) UpdateUserNote

func (c *Client) UpdateUserNote(a *Account, categoryUid string, itemUid string, note string) error

type ConfirmationOfFunds

type ConfirmationOfFunds struct {
	RequestedAmountAvailableToSpend                 bool `json:"requestedAmountAvailableToSpend"`
	AccountWouldBeInOverdraftIfRequestedAmountSpent bool `json:"accountWouldBeInOverdraftIfRequestedAmountSpent"`
}

type Currency

type Currency struct {
	Currency currency.Unit
}

func (*Currency) String

func (c *Currency) String() string

func (*Currency) UnmarshalJSON

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

type CurrencyAndAmount

type CurrencyAndAmount struct {
	Currency Currency `json:"currency"`
	Amount   Amount   `json:"minorUnits"`
}

type CurrencyFlag

type CurrencyFlag struct {
	Enabled  bool   `json:"enabled"`
	Currency string `json:"currency"`
}

type DateOnly

type DateOnly struct {
	time.Time
}

func (*DateOnly) UnmarshalJSON

func (d *DateOnly) UnmarshalJSON(data []byte) error

type DateTime

type DateTime struct {
	time.Time
}

func ParseTime

func ParseTime(t time.Time) DateTime

func (DateTime) String

func (t DateTime) String() string

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(data []byte) error

type DirectDebitMandate

type DirectDebitMandate struct {
	UID            string      `json:"uid"`
	Reference      string      `json:"reference"`
	Status         string      `json:"status"`
	Source         string      `json:"source"`
	Created        DateTime    `json:"created"`
	Cancelled      DateTime    `json:"cancelled"`
	LastDate       DateOnly    `json:"lastDate"`
	OriginatorName string      `json:"originatorName"`
	OriginatorUID  string      `json:"originatorUid"`
	MerchantUID    string      `json:"merchantUid"`
	LastPayment    LastPayment `json:"lastPayment"`
	AccountUID     string      `json:"accountUid"`
	CategoryUID    string      `json:"categoryUid"`
}

type DirectDebitMandates

type DirectDebitMandates struct {
	Mandates []DirectDebitMandate `json:"mandates"`
}

type ErrorResponse

type ErrorResponse struct {
	Errors []struct {
		Message string `json:"message"`
	} `json:"errors"`
	Success bool `json:"success"`
}

type FeedItem

type FeedItem struct {
	FeedItemUID                        string                `json:"feedItemUid"`
	CategoryUID                        string                `json:"categoryUid"`
	Amount                             CurrencyAndAmount     `json:"amount"`
	SourceAmount                       CurrencyAndAmount     `json:"sourceAmount"`
	Direction                          string                `json:"direction"`
	UpdatedAt                          DateTime              `json:"updatedAt"`
	TransactionTime                    DateTime              `json:"transactionTime"`
	SettlementTime                     DateTime              `json:"settlementTime"`
	RetryAllocationUntilTime           DateTime              `json:"retryAllocationUntilTime"`
	Source                             string                `json:"source"`
	SourceSubType                      string                `json:"sourceSubType"`
	Status                             string                `json:"status"`
	TransactingApplicationUserUID      string                `json:"transactingApplicationUserUid"`
	CounterPartyType                   string                `json:"counterPartyType"`
	CounterPartyUID                    string                `json:"counterPartyUid"`
	CounterPartyName                   string                `json:"counterPartyName"`
	CounterPartySubEntityUID           string                `json:"counterPartySubEntityUid"`
	CounterPartySubEntityName          string                `json:"counterPartySubEntityName"`
	CounterPartySubEntityIdentifier    string                `json:"counterPartySubEntityIdentifier"`
	CounterPartySubEntitySubIdentifier string                `json:"counterPartySubEntitySubIdentifier"`
	ExchangeRate                       float64               `json:"exchangeRate"`
	TotalFees                          float64               `json:"totalFees"`
	TotalFeeAmount                     CurrencyAndAmount     `json:"totalFeeAmount"`
	Reference                          string                `json:"reference"`
	Country                            string                `json:"country"`
	SpendingCategory                   string                `json:"spendingCategory"`
	UserNote                           string                `json:"userNote"`
	RoundUp                            AssociatedFeedRoundUp `json:"roundUp"`
	HasAttachment                      bool                  `json:"hasAttachment"`
	HasReceipt                         bool                  `json:"hasReceipt"`
	BatchPaymentDetails                BatchPaymentDetails   `json:"batchPaymentDetails"`
}

type FeedItems

type FeedItems struct {
	FeedItems []FeedItem `json:"feedItems"`
}

type JointAccount

type JointAccount struct {
	AccountHolderUid string `json:"accountHolderUid"`
	PersonOne        struct {
		Title       string `json:"title"`
		FirstName   string `json:"firstName"`
		LastName    string `json:"lastName"`
		DateOfBirth string `json:"dateOfBirth"`
		Email       string `json:"email"`
		Phone       string `json:"phone"`
	} `json:"personOne"`
	PersonTwo struct {
		Title       string `json:"title"`
		FirstName   string `json:"firstName"`
		LastName    string `json:"lastName"`
		DateOfBirth string `json:"dateOfBirth"`
		Email       string `json:"email"`
		Phone       string `json:"phone"`
	} `json:"personTwo"`
}

type LastPayment

type LastPayment struct {
	LastDate   DateOnly          `json:"lastDate"`
	LastAmount CurrencyAndAmount `json:"lastAmount"`
}

type NextPayment

type NextPayment struct {
	Currency   string `json:"currency"`
	MinorUnits int    `json:"minorUnits"`
}

type RecurrenceRule

type RecurrenceRule struct {
	StartDate string   `json:"startDate"`
	Frequency string   `json:"frequency"`
	Interval  int      `json:"interval"`
	Count     int      `json:"count"`
	UntilDate string   `json:"untilDate"`
	WeekStart string   `json:"weekStart"`
	Days      []string `json:"days"`
	MonthDay  int      `json:"monthDay"`
	MonthWeek int      `json:"monthWeek"`
}

type RecurringCardPayment

type RecurringCardPayment struct {
	FeedItemUID         string            `json:"feedItemUid"`
	RecurringPaymentUID string            `json:"recurringPaymentUid"`
	AccountUID          string            `json:"accountUid"`
	CounterPartyUID     string            `json:"counterPartyUid"`
	CounterPartyName    string            `json:"counterPartyName"`
	Status              string            `json:"status"`
	LatestFeedItemUID   string            `json:"latestFeedItemUid"`
	LatestPaymentDate   string            `json:"latestPaymentDate"`
	LatestPaymentAmount CurrencyAndAmount `json:"latestPaymentAmount"`
}

type RecurringCardPayments

type RecurringCardPayments struct {
	RecurringPayments []RecurringCardPayment `json:"recurringPayments"`
}

type SavingGoalOrdered

type SavingGoalOrdered struct {
	SavingGoalUID   string            `json:"savingsGoalUid"`
	Name            string            `json:"name"`
	Target          CurrencyAndAmount `json:"target"`
	TotalSaved      CurrencyAndAmount `json:"totalSaved"`
	SavedPercentage int               `json:"savedPercentage"`
	SortOrder       int               `json:"sortOrder"`
	State           string            `json:"state"`
}

type ScheduleSavingPayment

type ScheduleSavingPayment struct {
	TransferUid       string            `json:"transferUid"`
	RecurrenceRule    RecurrenceRule    `json:"recurrenceRule"`
	CurrencyAndAmount CurrencyAndAmount `json:"currencyAndAmount"`
	NextPaymentDate   string            `json:"nextPaymentDate"`
}

type ScheduledPayment

type ScheduledPayment struct {
	AccountHolderUid  string         `json:"accountHolderUid"`
	PaymentOrderUid   string         `json:"paymentOrderUid"`
	CategoryUid       string         `json:"categoryUid"`
	NextPaymentAmount NextPayment    `json:"nextPaymentAmount"`
	Reference         string         `json:"reference"`
	PayeeUid          string         `json:"payeeUid"`
	PayeeAccountUid   string         `json:"payeeAccountUid"`
	RecipientName     string         `json:"recipientName"`
	RecurrenceRule    RecurrenceRule `json:"recurrenceRule"`
	StartDate         string         `json:"startDate"`
	NextDate          string         `json:"nextDate"`
	EndDate           string         `json:"endDate"`
	PaymentType       string         `json:"paymentType"`
	SpendingCategory  string         `json:"spendingCategory"`
}

type ScheduledPaymentResponse

type ScheduledPaymentResponse struct {
	ScheduledPayments []ScheduledPayment `json:"scheduledPayments"`
}

type SignedCurrencyAndAmount

type SignedCurrencyAndAmount struct {
	Currency   string `json:"currency"`
	MinorUnits int64  `json:"minorUnits"`
}

type Spaces

type Spaces struct {
	SavingGoals    []SavingGoalOrdered `json:"savingGoals"`
	SpendingSpaces []SpendingSpace     `json:"spendingSpaces"`
}

type SpendingSpace

type SpendingSpace struct {
	Name               string            `json:"name"`
	Balance            CurrencyAndAmount `json:"balance"`
	CardAssociationUid string            `json:"cardAssociationUid"`
	SortOrder          int               `json:"sortOrder"`
	SpendingSpaceType  string            `json:"spendingSpaceType"`
	State              string            `json:"state"`
	SpaceUid           string            `json:"spaceUid"`
}

type StandingOrder

type StandingOrder struct {
	Description             string                  `json:"description"`
	PaymentOrderUid         string                  `json:"paymentOrderUid"`
	Amount                  CurrencyAndAmount       `json:"amount"`
	Reference               string                  `json:"reference"`
	PayeeUid                string                  `json:"payeeUid"`
	PayeeAccountUid         string                  `json:"payeeAccountUid"`
	StandingOrderRecurrence StandingOrderRecurrence `json:"standingOrderRecurrence"`
	NextDate                string                  `json:"nextDate"`
	CancelledAt             string                  `json:"cancelledAt"`
	UpdatedAt               string                  `json:"updatedAt"`
	SpendingCategory        string                  `json:"spendingCategory"`
	CategoryUid             string                  `json:"categoryUid"`
}

type StandingOrderRecurrence

type StandingOrderRecurrence struct {
	Description string `json:"description"`
	StartDate   string `json:"startDate"`
	Frequency   string `json:"frequency"`
	Interval    int32  `json:"interval"`
	Count       int32  `json:"count"`
	UntilDate   string `json:"untilDate"`
}

Jump to

Keyboard shortcuts

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