kucoin: split request files

This commit is contained in:
c9s 2023-05-17 16:27:43 +08:00
parent 71be12bfc3
commit feb20571e9
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
3 changed files with 31 additions and 19 deletions

View File

@ -17,14 +17,6 @@ func (s *AccountService) NewListSubAccountsRequest() *ListSubAccountsRequest {
return &ListSubAccountsRequest{client: s.client}
}
func (s *AccountService) NewListAccountsRequest() *ListAccountsRequest {
return &ListAccountsRequest{client: s.client}
}
func (s *AccountService) NewGetAccountRequest(accountID string) *GetAccountRequest {
return &GetAccountRequest{client: s.client, accountID: accountID}
}
type SubAccount struct {
UserID string `json:"userId"`
Name string `json:"subName"`
@ -45,14 +37,3 @@ type Account struct {
Available fixedpoint.Value `json:"available"`
Holds fixedpoint.Value `json:"holds"`
}
//go:generate GetRequest -url "/api/v1/accounts" -type ListAccountsRequest -responseDataType []Account
type ListAccountsRequest struct {
client requestgen.AuthenticatedAPIClient
}
//go:generate GetRequest -url "/api/v1/accounts/:accountID" -type GetAccountRequest -responseDataType .Account
type GetAccountRequest struct {
client requestgen.AuthenticatedAPIClient
accountID string `param:"accountID,slug"`
}

View File

@ -0,0 +1,16 @@
package kucoinapi
//go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Data
//go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Data
import "github.com/c9s/requestgen"
//go:generate GetRequest -url "/api/v1/accounts/:accountID" -type GetAccountRequest -responseDataType .Account
type GetAccountRequest struct {
client requestgen.AuthenticatedAPIClient
accountID string `param:"accountID,slug"`
}
func (s *AccountService) NewGetAccountRequest(accountID string) *GetAccountRequest {
return &GetAccountRequest{client: s.client, accountID: accountID}
}

View File

@ -0,0 +1,15 @@
package kucoinapi
//go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Data
//go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Data
import "github.com/c9s/requestgen"
//go:generate GetRequest -url "/api/v1/accounts" -type ListAccountsRequest -responseDataType []Account
type ListAccountsRequest struct {
client requestgen.AuthenticatedAPIClient
}
func (s *AccountService) NewListAccountsRequest() *ListAccountsRequest {
return &ListAccountsRequest{client: s.client}
}