Documentation

Overview

    Package account implements account entities and services

    Index

    Examples

    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"`
    	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 Service

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

        Service wraps YNAB account API endpoints

        func NewService

        func NewService(c api.ClientReader) *Service

          NewService facilitates the creation of a new account service instance

          func (*Service) GetAccount

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

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

            Example
            Output:
            
            *account.Account
            

            func (*Service) GetAccounts

            func (s *Service) GetAccounts(budgetID string) ([]*Account, error)

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

              Example
              Output:
              
              []*account.Account
              

              type Type

              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"
                )