New account balance

This commit is contained in:
Jacob Windle 2019-11-26 15:35:50 -05:00
parent a422f62b2b
commit c6eb542a2c
2 changed files with 26 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/joho/godotenv"
"github.com/mrjones/oauth"
"io/ioutil"
"log"
"net/http"
"os"
)
@ -68,3 +69,15 @@ func (c *AllyApi) Accounts() []AccountSummary {
return resp.Accounts.Accountsummary
}
func (c *AllyApi) AccountBalances() (balances []AccountBalance) {
b, err := c.get("accounts/balances")
if err != nil {
log.Fatal("Could not get account balances")
return
}
defer b.Body.Close()
var resp AccountBalanceResponse
}

View File

@ -105,3 +105,16 @@ type AccountResponse struct {
Accountsummary []AccountSummary `xml:"accountsummary"`
} `xml:"accounts"`
}
type AccountBalance struct {
XMLName xml.Name `xml:"accountbalance"`
Account int `xml:"account"`
AccountName string `xml:"accountname"`
AccountValue float64 `xml:"accountvalue"`
}
type AccountBalanceResponse struct {
XMLName xml.Name `xml:"response"`
AccountBalances []AccountBalance `xml:"accountbalance"`
TotalBalance float64 `xml:"totalbalance>accountvalue"`
}