Skip to content

Commit

Permalink
Merge pull request #8 from davidiola/api
Browse files Browse the repository at this point in the history
update api query params, minor model refactors
  • Loading branch information
bonedaddy authored Mar 29, 2021
2 parents 665e942 + b83a4f8 commit f63a814
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions models/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"`
Expand Down

0 comments on commit f63a814

Please sign in to comment.