Skip to content

Commit

Permalink
maxapi: refactor rewards api
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Apr 20, 2022
1 parent 8b9383e commit 0410ef1
Show file tree
Hide file tree
Showing 8 changed files with 557 additions and 96 deletions.
6 changes: 3 additions & 3 deletions examples/max-rewards/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {

ctx := context.Background()

var req *maxapi.RewardsRequest
var req *maxapi.GetRewardsRequest

if len(os.Args) > 1 {
pathType := os.Args[1]
Expand All @@ -27,9 +27,9 @@ func main() {
log.Fatal(err)
}

req = api.RewardService.NewRewardsByTypeRequest(rewardType)
req = api.RewardService.NewGetRewardsOfTypeRequest(rewardType)
} else {
req = api.RewardService.NewRewardsRequest()
req = api.RewardService.NewGetRewardsRequest()
}

// req.From(1613931192)
Expand Down
2 changes: 1 addition & 1 deletion pkg/exchange/max/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ func (e *Exchange) QueryRewards(ctx context.Context, startTime time.Time) ([]typ
// an user might get most 14 commission records by currency per day
// limit 1000 / 14 = 71 days
to := from.Add(time.Hour * 24 * 30)
req := e.client.RewardService.NewRewardsRequest()
req := e.client.RewardService.NewGetRewardsRequest()
req.From(from.Unix())
req.To(to.Unix())
req.Limit(1000)
Expand Down
22 changes: 0 additions & 22 deletions pkg/exchange/max/maxapi/datatype.go

This file was deleted.

222 changes: 222 additions & 0 deletions pkg/exchange/max/maxapi/get_rewards_of_type_request_requestgen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0410ef1

Please sign in to comment.