New account balance
This commit is contained in:
parent
a422f62b2b
commit
c6eb542a2c
13
client.go
13
client.go
@ -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
|
||||
|
||||
}
|
||||
|
13
types.go
13
types.go
@ -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"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user