mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
max: add currency parameter to /api/v3/wallet/:walletType/accounts api
This commit is contained in:
parent
24ca1b103b
commit
7aa673c673
|
@ -11,7 +11,7 @@ type GetWalletAccountsRequest struct {
|
|||
client requestgen.AuthenticatedAPIClient
|
||||
|
||||
walletType WalletType `param:"walletType,slug,required"`
|
||||
currency string `param:"currency"`
|
||||
currency *string `param:"currency,query"`
|
||||
}
|
||||
|
||||
func (s *Client) NewGetWalletAccountsRequest(walletType WalletType) *GetWalletAccountsRequest {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func (g *GetWalletAccountsRequest) Currency(currency string) *GetWalletAccountsRequest {
|
||||
g.currency = currency
|
||||
g.currency = ¤cy
|
||||
return g
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,14 @@ func (g *GetWalletAccountsRequest) WalletType(walletType max.WalletType) *GetWal
|
|||
// GetQueryParameters builds and checks the query parameters and returns url.Values
|
||||
func (g *GetWalletAccountsRequest) GetQueryParameters() (url.Values, error) {
|
||||
var params = map[string]interface{}{}
|
||||
// check currency field -> json key currency
|
||||
if g.currency != nil {
|
||||
currency := *g.currency
|
||||
|
||||
// assign parameter of currency
|
||||
params["currency"] = currency
|
||||
} else {
|
||||
}
|
||||
|
||||
query := url.Values{}
|
||||
for _k, _v := range params {
|
||||
|
@ -37,11 +45,6 @@ func (g *GetWalletAccountsRequest) GetQueryParameters() (url.Values, error) {
|
|||
// GetParameters builds and checks the parameters and return the result in a map object
|
||||
func (g *GetWalletAccountsRequest) GetParameters() (map[string]interface{}, error) {
|
||||
var params = map[string]interface{}{}
|
||||
// check currency field -> json key currency
|
||||
currency := g.currency
|
||||
|
||||
// assign parameter of currency
|
||||
params["currency"] = currency
|
||||
|
||||
return params, nil
|
||||
}
|
||||
|
@ -138,9 +141,9 @@ func (g *GetWalletAccountsRequest) GetSlugsMap() (map[string]string, error) {
|
|||
|
||||
func (g *GetWalletAccountsRequest) Do(ctx context.Context) ([]max.Account, error) {
|
||||
|
||||
// empty params for GET operation
|
||||
// no body params
|
||||
var params interface{}
|
||||
query, err := g.GetParametersQuery()
|
||||
query, err := g.GetQueryParameters()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user