From b83a4f8cc4f794dd6fd26a50cb39a435c4fb4c54 Mon Sep 17 00:00:00 2001 From: David Iola Date: Sun, 28 Mar 2021 15:45:12 -0700 Subject: [PATCH] update api query params, minor model refactors --- client/client.go | 2 +- models/account.go | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/client/client.go b/client/client.go index 739a9b1..ab96cbf 100644 --- a/client/client.go +++ b/client/client.go @@ -67,7 +67,7 @@ func (c *Client) GetAccounts(pageSize, pageNum string) (*models.AccountResponse, if pageNum == "" { pageNum = "0" } - apiURL := fmt.Sprintf("%s/account?page_size=%s&page_num=%s", c.url, pageSize, pageNum) + apiURL := fmt.Sprintf("%s/account?page_size=%s&page_number=%s", c.url, pageSize, pageNum) bodyBytes, err := c.sendRequest(apiURL) if err != nil { return nil, err diff --git a/models/account.go b/models/account.go index 3e9edf1..20bc6d4 100644 --- a/models/account.go +++ b/models/account.go @@ -14,14 +14,12 @@ type AccountResponse struct { } type Account struct { - Address string `json:"address"` - BlockUpdated interface{} `json:"block_updated"` - Health struct { - Value string `json:"value"` - } `json:"health"` - Tokens []Token `json:"tokens"` - TotalBorrowValueInEth Value `json:"total_borrow_value_in_eth"` - TotalCollateralValueInEth Value `json:"total_collateral_value_in_eth"` + Address string `json:"address"` + BlockUpdated interface{} `json:"block_updated"` + Health Value `json:"health"` + Tokens []Token `json:"tokens"` + TotalBorrowValueInEth Value `json:"total_borrow_value_in_eth"` + TotalCollateralValueInEth Value `json:"total_collateral_value_in_eth"` } type PaginationSummary struct { @@ -47,10 +45,8 @@ type Value struct { // Token is an individual token type Token struct { - Address string `json:"address"` - BorrowBalanceUnderlying struct { - Value string `json:"value"` - } `json:"borrow_balance_underlying"` + Address string `json:"address"` + BorrowBalanceUnderlying Value `json:"borrow_balance_underlying"` LifetimeBorrowInterestAccrued Value `json:"lifetime_borrow_interest_accrued"` LifetimeSupplyInterestAccrued Value `json:"lifetime_supply_interest_accrued"` SupplyBalanceUnderlying Value `json:"supply_balance_underlying"`