max: fix GetDepositHistoryRequest

This commit is contained in:
c9s 2024-08-16 13:40:26 +08:00
parent 7488a1069f
commit b88aff6d73
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
3 changed files with 34 additions and 32 deletions

View File

@ -846,6 +846,7 @@ func (e *Exchange) QueryWithdrawHistory(
withdraws, err := req.
Timestamp(startTime).
Order("asc").
Limit(limit).
Do(ctx)
@ -927,8 +928,8 @@ func (e *Exchange) QueryDepositHistory(
}
deposits, err := req.
From(startTime).
To(endTime).
Timestamp(startTime).
Order("asc").
Limit(limit).
Do(ctx)

View File

@ -133,15 +133,17 @@ type Deposit struct {
UpdatedAt types.MillisecondTimestamp `json:"updated_at"`
}
//go:generate GetRequest -url "v2/deposits" -type GetDepositHistoryRequest -responseType []Deposit
//go:generate GetRequest -url "v3/deposits" -type GetDepositHistoryRequest -responseType []Deposit
type GetDepositHistoryRequest struct {
client requestgen.AuthenticatedAPIClient
currency *string `param:"currency"`
from *time.Time `param:"from,seconds"` // seconds
to *time.Time `param:"to,seconds"` // seconds
state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect
limit *int `param:"limit"`
currency *string `param:"currency"`
timestamp *time.Time `param:"timestamp,milliseconds"` // seconds
state *string `param:"state"` // submitting, submitted, rejected, accepted, checking, refunded, canceled, suspect
order *string `param:"order"`
limit *int `param:"limit"`
}
func (c *RestClient) NewGetDepositHistoryRequest() *GetDepositHistoryRequest {

View File

@ -1,4 +1,4 @@
// Code generated by "requestgen -method GET -url v2/deposits -type GetDepositHistoryRequest -responseType []Deposit"; DO NOT EDIT.
// Code generated by "requestgen -method GET -url v3/deposits -type GetDepositHistoryRequest -responseType []Deposit"; DO NOT EDIT.
package max
@ -18,13 +18,8 @@ func (g *GetDepositHistoryRequest) Currency(currency string) *GetDepositHistoryR
return g
}
func (g *GetDepositHistoryRequest) From(from time.Time) *GetDepositHistoryRequest {
g.from = &from
return g
}
func (g *GetDepositHistoryRequest) To(to time.Time) *GetDepositHistoryRequest {
g.to = &to
func (g *GetDepositHistoryRequest) Timestamp(timestamp time.Time) *GetDepositHistoryRequest {
g.timestamp = &timestamp
return g
}
@ -33,6 +28,11 @@ func (g *GetDepositHistoryRequest) State(state string) *GetDepositHistoryRequest
return g
}
func (g *GetDepositHistoryRequest) Order(order string) *GetDepositHistoryRequest {
g.order = &order
return g
}
func (g *GetDepositHistoryRequest) Limit(limit int) *GetDepositHistoryRequest {
g.limit = &limit
return g
@ -61,22 +61,13 @@ func (g *GetDepositHistoryRequest) GetParameters() (map[string]interface{}, erro
params["currency"] = currency
} else {
}
// check from field -> json key from
if g.from != nil {
from := *g.from
// check timestamp field -> json key timestamp
if g.timestamp != nil {
timestamp := *g.timestamp
// assign parameter of from
// convert time.Time to seconds time stamp
params["from"] = strconv.FormatInt(from.Unix(), 10)
} else {
}
// check to field -> json key to
if g.to != nil {
to := *g.to
// assign parameter of to
// convert time.Time to seconds time stamp
params["to"] = strconv.FormatInt(to.Unix(), 10)
// assign parameter of timestamp
// convert time.Time to milliseconds time stamp
params["timestamp"] = strconv.FormatInt(timestamp.UnixNano()/int64(time.Millisecond), 10)
} else {
}
// check state field -> json key state
@ -87,6 +78,14 @@ func (g *GetDepositHistoryRequest) GetParameters() (map[string]interface{}, erro
params["state"] = state
} else {
}
// check order field -> json key order
if g.order != nil {
order := *g.order
// assign parameter of order
params["order"] = order
} else {
}
// check limit field -> json key limit
if g.limit != nil {
limit := *g.limit
@ -180,7 +179,7 @@ func (g *GetDepositHistoryRequest) GetSlugsMap() (map[string]string, error) {
// GetPath returns the request path of the API
func (g *GetDepositHistoryRequest) GetPath() string {
return "v2/deposits"
return "v3/deposits"
}
// Do generates the request object and send the request object to the API endpoint