-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
v5_user_service.go
67 lines (59 loc) · 1.73 KB
/
v5_user_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package bybit
import (
"net/url"
"time"
)
// V5UserServiceI :
type V5UserServiceI interface {
GetAPIKey() (*V5APIKeyResponse, error)
}
// V5UserService :
type V5UserService struct {
client *Client
}
// V5APIKeyResponse :
type V5APIKeyResponse struct {
CommonV5Response `json:",inline"`
Result V5ApiKeyResult `json:"result"`
}
// V5ApiKeyResult :
type V5ApiKeyResult struct {
ID string `json:"id"`
Note string `json:"note"`
APIKey string `json:"apiKey"`
ReadOnly int `json:"readOnly"`
Secret string `json:"secret"`
Permissions struct {
ContractTrade []string `json:"ContractTrade"`
Spot []string `json:"Spot"`
Wallet []string `json:"Wallet"`
Options []string `json:"Options"`
Derivatives []string `json:"Derivatives"`
CopyTrading []string `json:"CopyTrading"`
BlockTrade []string `json:"BlockTrade"`
Exchange []string `json:"Exchange"`
Nft []string `json:"NFT"`
} `json:"permissions"`
Ips []string `json:"ips"`
Type int `json:"type"`
DeadlineDay int `json:"deadlineDay"`
ExpiredAt time.Time `json:"expiredAt"`
CreatedAt time.Time `json:"createdAt"`
Unified int `json:"unified"`
Uta int `json:"uta"`
UserID int `json:"userID"`
InviterID int `json:"inviterID"`
VipLevel string `json:"vipLevel"`
MktMakerLevel string `json:"mktMakerLevel"`
AffiliateID int `json:"affiliateID"`
}
// GetAPIKey :
func (s *V5UserService) GetAPIKey() (*V5APIKeyResponse, error) {
var (
res V5APIKeyResponse
)
if err := s.client.getV5Privately("/v5/user/query-api", url.Values{}, &res); err != nil {
return nil, err
}
return &res, nil
}