-
Notifications
You must be signed in to change notification settings - Fork 1
/
account.go
156 lines (132 loc) · 4.18 KB
/
account.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package betfair
import "time"
type DeveloperAppVersion struct {
Owner string
VersionID int
Version string
ApplicationKey string
DelayData bool
SubscriptionRequired bool
OwnerManaged bool
Active bool
}
type DeveloperAppKey struct {
AppName string
AppID int64
AppVersions []DeveloperAppVersion
}
// CreateAppKeys for create new developer app keys in account
func (b *Betting) CreateAppKeys() (developAppKeys []DeveloperAppKey, err error) {
err = b.Request(&developAppKeys, AccountURL, "createDeveloperAppKeys", nil)
if err != nil {
return
}
return
}
type AccountDetails struct {
CurrencyCode string
FirstName string
LastName string
LocaleCode string
Region string
Timezone string
DiscountRate float64
PointsBalance int
CountryCode string
}
// GetAccountDetails like get account details :)
func (b *Betting) GetAccountDetails() (accountDetails AccountDetails, err error) {
err = b.Request(&accountDetails, AccountURL, "getAccountDetails", nil)
if err != nil {
return
}
return
}
type AccountFunds struct {
AvailableToBetBalance float64
Exposure float64
RetainedCommission float64
ExposureLimit float64
DiscountRate float64 `json:"omitempty"`
PointsBalance int `json:"omitempty"`
}
// GetAccountFunds for getting balances of account
func (b *Betting) GetAccountFunds(filter Filter) (accountFunds AccountFunds, err error) {
err = b.Request(&accountFunds, AccountURL, "getAccountFunds", &filter)
if err != nil {
return
}
return
}
// GetAppKeys for getting all developer keys from account
func (b *Betting) GetAppKeys() (developAppKeys []DeveloperAppKey, err error) {
err = b.Request(&developAppKeys, AccountURL, "getDeveloperAppKeys", nil)
if err != nil {
return
}
return
}
type StatementLegacyData struct {
AvgPrice float64 `json:"omitempty"`
BetSize float64 `json:"omitempty"`
BetType string `json:"omitempty"`
BetCategoryType string `json:"omitempty"`
CommissionRate string `json:"omitempty"`
EventID int64 `json:"omitempty"`
EventTypeID int64 `json:"omitempty"`
FullMarketName string `json:"omitempty"`
GrossBetAmount float64 `json:"omitempty"`
MarketName string `json:"omitempty"`
MarketType EMarketType `json:"omitempty"`
PlacedDate time.Time `json:"omitempty"`
SelectionID int64 `json:"omitempty"`
SelectionName string `json:"omitempty"`
StartDate time.Time `json:"omitempty"`
TransactionType string `json:"omitempty"`
TransactionID int64 `json:"omitempty"`
WinLose string `json:"omitempty"`
}
type StatementItem struct {
RefID string `json:"omitempty"`
ItemDate time.Time
Amount float64 `json:"omitempty"`
Balance float64 `json:"omitempty"`
ItemClass EItemClass `json:"omitempty"`
ItemClassData map[string]string `json:"omitempty"`
LegacyData StatementLegacyData `json:"omitempty"`
}
type AccountStatementReport struct {
AccountStatement []StatementItem
MoreAvailable bool
}
// GetAccountStatement about get account statements for 90 days
func (b *Betting) GetAccountStatement(filter Filter) (accountStatementReport AccountStatementReport, err error) {
err = b.Request(&accountStatementReport, AccountURL, "getAccountStatement", &filter)
if err != nil {
return
}
return
}
type CurrencyRate struct {
CurrencyCode string `json:"omitempty"`
Rate float64 `json:"omitempty"`
}
// GetListCurrencyRates for get currency rates for hour
func (b *Betting) GetListCurrencyRates(filter Filter) (currencyRate []CurrencyRate, err error) {
err = b.Request(¤cyRate, AccountURL, "listCurrencyRates", &filter)
if err != nil {
return
}
return
}
type TransferResponse struct {
TransactionID string
}
// GetTransferFunds for transfer funds between UK and AUS wallets
func (b *Betting) GetTransferFunds(filter Filter) (transferResponse TransferResponse, err error) {
err = b.Request(&transferResponse, AccountURL, "transferFunds", &filter)
if err != nil {
return
}
return
}