mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +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
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
||||||
walletType WalletType `param:"walletType,slug,required"`
|
walletType WalletType `param:"walletType,slug,required"`
|
||||||
currency string `param:"currency"`
|
currency *string `param:"currency,query"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Client) NewGetWalletAccountsRequest(walletType WalletType) *GetWalletAccountsRequest {
|
func (s *Client) NewGetWalletAccountsRequest(walletType WalletType) *GetWalletAccountsRequest {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *GetWalletAccountsRequest) Currency(currency string) *GetWalletAccountsRequest {
|
func (g *GetWalletAccountsRequest) Currency(currency string) *GetWalletAccountsRequest {
|
||||||
g.currency = currency
|
g.currency = ¤cy
|
||||||
return g
|
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
|
// GetQueryParameters builds and checks the query parameters and returns url.Values
|
||||||
func (g *GetWalletAccountsRequest) GetQueryParameters() (url.Values, error) {
|
func (g *GetWalletAccountsRequest) GetQueryParameters() (url.Values, error) {
|
||||||
var params = map[string]interface{}{}
|
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{}
|
query := url.Values{}
|
||||||
for _k, _v := range params {
|
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
|
// GetParameters builds and checks the parameters and return the result in a map object
|
||||||
func (g *GetWalletAccountsRequest) GetParameters() (map[string]interface{}, error) {
|
func (g *GetWalletAccountsRequest) GetParameters() (map[string]interface{}, error) {
|
||||||
var params = map[string]interface{}{}
|
var params = map[string]interface{}{}
|
||||||
// check currency field -> json key currency
|
|
||||||
currency := g.currency
|
|
||||||
|
|
||||||
// assign parameter of currency
|
|
||||||
params["currency"] = currency
|
|
||||||
|
|
||||||
return params, nil
|
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) {
|
func (g *GetWalletAccountsRequest) Do(ctx context.Context) ([]max.Account, error) {
|
||||||
|
|
||||||
// empty params for GET operation
|
// no body params
|
||||||
var params interface{}
|
var params interface{}
|
||||||
query, err := g.GetParametersQuery()
|
query, err := g.GetQueryParameters()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user