package ynab import ( "fmt" "net/url" ) // Reference: https://api.ynab.com/v1#/Accounts/ type Accounts struct { Data struct { Account struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` OnBudget bool `json:"on_budget"` Closed bool `json:"closed"` Note interface{} `json:"note"` Balance int `json:"balance"` ClearedBalance int `json:"cleared_balance"` UnclearedBalance int `json:"uncleared_balance"` TransferPayeeID string `json:"transfer_payee_id"` DirectImportLinked bool `json:"direct_import_linked"` DirectImportInError bool `json:"direct_import_in_error"` Deleted bool `json:"deleted"` } `json:"account"` ServerKnowledge int `json:"server_knowledge"` } `json:"data"` } func (c *Client) GetAccount(accountID string) (*Accounts, error) { response := Accounts{} err := c.get(fmt.Sprintf("/accounts/%s", accountID), &response, url.Values{}) if err != nil { return nil, fmt.Errorf("failed to get accounts: %v", err) } return &response, nil }