ynab: go.bmvs.io/ynab/api/account Index | Examples | Files

package account

import "go.bmvs.io/ynab/api/account"

Package account implements account entities and services



Package Files

entity.go enum.go service.go

type Account Uses

type Account struct {
    ID       string `json:"id"`
    Name     string `json:"name"`
    Type     Type   `json:"type"`
    OnBudget bool   `json:"on_budget"`
    // Balance The current balance of the account in milliunits format
    Balance int64 `json:"balance"`
    // ClearedBalance The current cleared balance of the account in milliunits format
    ClearedBalance int64 `json:"cleared_balance"`
    // ClearedBalance The current uncleared balance of the account in milliunits format
    UnclearedBalance int64 `json:"uncleared_balance"`
    Closed           bool  `json:"closed"`
    // Deleted Deleted accounts will only be included in delta requests
    Deleted bool `json:"deleted"`

    Note *string `json:"note"`

Account represents an account for a budget

type SearchResultSnapshot Uses

type SearchResultSnapshot struct {
    Accounts        []*Account
    ServerKnowledge uint64

SearchResultSnapshot represents a versioned snapshot for an account search

type Service Uses

type Service struct {
    // contains filtered or unexported fields

Service wraps YNAB account API endpoints

func NewService Uses

func NewService(c api.ClientReader) *Service

NewService facilitates the creation of a new account service instance

func (*Service) GetAccount Uses

func (s *Service) GetAccount(budgetID, accountID string) (*Account, error)

GetAccount fetches a specific account from a budget https://api.youneedabudget.com/v1#/Accounts/getAccountById


c := ynab.NewClient("<valid_ynab_access_token>")
account, _ := c.Account().GetAccount("<valid_budget_id>", "<valid_account_id>")



func (*Service) GetAccounts Uses

func (s *Service) GetAccounts(budgetID string, f *api.Filter) (*SearchResultSnapshot, error)

GetAccounts fetches the list of accounts from a budget https://api.youneedabudget.com/v1#/Accounts/getAccounts


c := ynab.NewClient("<valid_ynab_access_token>")
f := &api.Filter{LastKnowledgeOfServer: 10}
snapshot, _ := c.Account().GetAccounts("<valid_budget_id>", f)



type Type Uses

type Type string

Type identifies an account type

const (
    // TypeChecking identifies a checking account
    TypeChecking Type = "checking"
    // TypeSavings identifies a savings account
    TypeSavings Type = "savings"
    // TypeCash identifies a cash account
    TypeCash Type = "cash"
    // TypeCreditCard identifies a credit card account
    TypeCreditCard Type = "creditCard"
    // TypeLineOfCredit identifies a line of credit account
    TypeLineOfCredit Type = "lineOfCredit"
    // TypeOtherAsset identifies an other asset account
    TypeOtherAsset Type = "otherAsset"
    // TypeOtherLiability identifies an other liability account
    TypeOtherLiability Type = "otherLiability"
    // TypePayPal DEPRECATED identifies a PayPal account
    TypePayPal Type = "payPal"
    // TypeMerchant DEPRECATED identifies a merchant account
    TypeMerchant Type = "merchantAccount"
    // TypeInvestment DEPRECATED identifies an investment account
    TypeInvestment Type = "investmentAccount"
    // TypeMortgage DEPRECATED identifies a mortgage account
    TypeMortgage Type = "mortgage"

Package account imports 2 packages (graph) and is imported by 2 packages. Updated 2019-03-05. Refresh now. Tools for package owners.