import "go.bmvs.io/ynab/api/budget"
Package budget implements budget entities and services
type Budget struct { ID string `json:"id"` Name string `json:"name"` Accounts []*account.Account `json:"accounts"` Payees []*payee.Payee `json:"payees"` PayeeLocations []*payee.Location `json:"payee_locations"` Categories []*category.Category `json:"categories"` CategoryGroups []*category.Group `json:"category_groups"` Months []*month.Month `json:"months"` Transactions []*transaction.Summary `json:"transactions"` SubTransactions []*transaction.SubTransaction `json:"subtransactions"` ScheduledTransactions []*transaction.ScheduledSummary `json:"scheduled_transactions"` ScheduledSubTransactions []*transaction.ScheduledSubTransaction `json:"scheduled_sub_transactions"` // DateFormat the date format setting for the budget. In some cases // the format will not be available and will be specified as null. DateFormat *DateFormat `json:"date_format"` // CurrencyFormat the currency format setting for the budget. In // some cases the format will not be available and will be specified // as null. CurrencyFormat *CurrencyFormat `json:"currency_format"` // LastModifiedOn the last time any changes were made to the budget // from either a web or mobile client. LastModifiedOn *time.Time `json:"last_modified_on"` // FirstMonth undocumented field FirstMonth *api.Date `json:"first_month"` // LastMonth undocumented field LastMonth *api.Date `json:"last_month"` }
Budget represents a budget
type CurrencyFormat struct { ISOCode string `json:"iso_code"` ExampleFormat string `json:"example_format"` DecimalDigits uint64 `json:"decimal_digits"` DecimalSeparator string `json:"decimal_separator"` GroupSeparator string `json:"group_separator"` SymbolFirst bool `json:"symbol_first"` CurrencySymbol string `json:"currency_symbol"` DisplaySymbol bool `json:"display_symbol"` }
CurrencyFormat represents a currency format for a budget settings
DateFormat represents date format for a budget
type Service struct {
// contains filtered or unexported fields
}
Service wraps YNAB budget API endpoints
func NewService(c api.ClientReader) *Service
NewService facilitates the creation of a new budget service instance
GetBudget fetches a single budget with all related entities, effectively a full budget export with filtering capabilities https://api.youneedabudget.com/v1#/Budgets/getBudgetById
Code:
c := ynab.NewClient("<valid_ynab_access_token>") b, _ := c.Budget().GetBudget("<valid_budget_id>", nil) fmt.Println(reflect.TypeOf(b))
Output:
*budget.Snapshot
Code:
c := ynab.NewClient("<valid_ynab_access_token>") f := api.Filter{LastKnowledgeOfServer: 10} b, _ := c.Budget().GetBudget("<valid_budget_id>", &f) fmt.Println(reflect.TypeOf(b))
Output:
*budget.Snapshot
GetBudgetSettings fetches a budget settings https://api.youneedabudget.com/v1#/Budgets/getBudgetSettingsById
Code:
c := ynab.NewClient("<valid_ynab_access_token>") s, _ := c.Budget().GetBudgetSettings("<valid_budget_id>") fmt.Println(reflect.TypeOf(s))
Output:
*budget.Settings
GetBudgets fetches the list of budgets of the logger in user https://api.youneedabudget.com/v1#/Budgets/getBudgets
Code:
c := ynab.NewClient("<valid_ynab_access_token>") budgets, _ := c.Budget().GetBudgets() fmt.Println(reflect.TypeOf(budgets))
Output:
[]*budget.Summary
GetLastUsedBudget fetches the last used budget with all related entities, effectively a full budget export with filtering capabilities https://api.youneedabudget.com/v1#/Budgets/getBudgetById
Code:
c := ynab.NewClient("<valid_ynab_access_token>") b, _ := c.Budget().GetLastUsedBudget(nil) fmt.Println(reflect.TypeOf(b))
Output:
*budget.Snapshot
type Settings struct { // DateFormat the date format setting for the budget. In some cases // the format will not be available and will be specified as null. DateFormat *DateFormat `json:"date_format"` // CurrencyFormat the currency format setting for the budget. In // some cases the format will not be available and will be specified // as null. CurrencyFormat *CurrencyFormat `json:"currency_format"` }
Settings represents the settings for a budget
Snapshot represents a versioned snapshot for a budget
type Summary struct { ID string `json:"id"` Name string `json:"name"` // DateFormat the date format setting for the budget. In some cases // the format will not be available and will be specified as null. DateFormat *DateFormat `json:"date_format"` // CurrencyFormat the currency format setting for the budget. In // some cases the format will not be available and will be specified // as null. CurrencyFormat *CurrencyFormat `json:"currency_format"` // LastModifiedOn the last time any changes were made to the budget // from either a web or mobile client. LastModifiedOn *time.Time `json:"last_modified_on"` // FirstMonth undocumented field FirstMonth *api.Date `json:"first_month"` // LastMonth undocumented field LastMonth *api.Date `json:"last_month"` }
Summary represents the summary of a budget
Package budget imports 8 packages (graph) and is imported by 1 packages. Updated 2019-03-01. Refresh now. Tools for package owners.