forked from fabioberger/coinbase-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
params.go
253 lines (227 loc) · 9.55 KB
/
params.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
package coinbase
// Params includes all the struct parameters that are required for specific API requests
// By defining a specific param struct, a developer can know which parameters are allowed
// for a given request. Also included here are the return object structs returned by
// specific API calls
// Parameter Struct for GET /api/v1/addresses Requests
type AddressesParams struct {
Page int64 `json:"page,omitempty"`
Limit int64 `json:"limit,omitempty"`
AccountId string `json:"account_id,omitempty"`
Query string `json:"query,omitempty"`
}
// Parameter Struct for POST /api/v1/account/generate_receive_address Requests
type AddressParams struct {
Label string `json:"label,omitempty"`
CallbackUrl string `json:"callback_url,omitempty"`
}
// Parameter Struct for POST /api/v1/transactions/(request_money,send_money) Requests
type TransactionParams struct {
To string `json:"to,omitempty"`
From string `json:"from,omitempty"`
Amount string `json:"amount,omitempty"`
AmountString string `json:"amount_string,omitempty"`
AmountCurrencyIso string `json:"amount_currency_iso,omitempty"`
Notes string `json:"notes,omitempty"`
UserFee string `json:"user_fee,omitempty"`
ReferrerId string `json:"refferer_id,omitempty"`
Idem string `json:"idem,omitempty"`
InstantBuy bool `json:"instant_buy,omitempty"`
OrderId string `json:"order_id,omitempty"`
}
// Parameter Struct for GET /api/v1/contacts Requests
type ContactsParams struct {
Page int64 `json:"page,omitempty"`
Limit int64 `json:"limit,omitempty"`
Query string `json:"query,omitempty"`
}
// The OAuth Tokens Struct returned from OAuth Authentication
type oauthTokens struct {
AccessToken string
RefreshToken string
ExpireTime int64
}
// The return response from SendMoney, RequestMoney, CompleteRequest
type transactionConfirmation struct {
Transaction transaction
Transfer transfer
}
// The return response from GetAllAddresses
type addresses struct {
paginationStats
Addresses []address
}
// The structure for one returned address from GetAllAddresses
type address struct {
Address string `json:"address,omitempty"`
CallbackUrl string `json:"callback_url,omitempty"`
Label string `json:"label,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
}
// The sub-structure of a response denominating a currency
type currency struct {
Name string `json:"name,omitempty"`
Iso string `json:"iso,omitempty"`
}
// The sub-structure of a response denominating a contact
type contact struct {
Contact struct {
Email string `json:"email,omitempty"`
} `json:"contact,omitempty"`
}
// The return response from CreateButton
type Button struct {
Name string `json:"name,omitempty"`
PriceString string `json:"price_string,omitempty"`
PriceCurrencyIso string `json:"price_currency_iso,omitempty"`
Type string `json:"type,omitempty"`
Subscription bool `json:"subscription,omitempty"`
Repeat string `json:"repeat,omitempty"`
Style string `json:"style,omitempty"`
Text string `json:"text,omitempty"`
Description string `json:"description,omitempty"`
Custom string `json:"custom,omitempty"`
CustomSecure bool `json:"custom_secure,omitempty"`
CallbackUrl string `json:"callback_url,omitempty"`
SuccessUrl string `json:"success_url,omitempty"`
CancelUrl string `json:"cancel_url,omitempty"`
InfoUrl string `json:"info_url,omitempty"`
AutoRedirect bool `json:"auto_redirect,omitempty"`
AutoRedirectSuccess bool `json:"auto_redirect_success,omitempty"`
AutoRedirectCancel bool `json:"auto_redirect_cancel,omitempty"`
VariablePrice bool `json:"variable_price,omitempty"`
ChoosePrice bool `json:"choose_price,omitempty"`
IncludeAddress bool `json:"include_address,omitempty"`
IncludeEmail bool `json:"include_email,omitempty"`
Price1 string `json:"price1,omitempty"`
Price2 string `json:"price2,omitempty"`
Price3 string `json:"price3,omitempty"`
Price4 string `json:"price4,omitempty"`
Price5 string `json:"price5,omitempty"`
Code string `json:"code,omitempty"`
Price fee `json:"price,omitempty"`
Id string `json:"id,omitempty"`
EmbedHtml string `json:"embed_html"` //Added embed_html for convenience
}
// The return response from GetUser and CreateUser
type user struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
ReceiveAddress string `json:"receive_address,omitempty"`
TimeZone string `json:"timezone,omitempty"`
NativeCurrency string `json:"native_currency,omitempty"`
Balance amount `json:"balance,omitempty"`
Merchant merchant `json:"merchant,omitempty"`
BuyLevel int64 `json:"buy_level,omitempty"`
SellLevel int64 `json:"sell_level,omitempty"`
BuyLimit amount `json:"buy_limit,omitempty"`
SellLimit amount `json:"sell_limit,omitempty"`
}
// The sub-structure of a response denominating a merchant
type merchant struct {
CompanyName string `json:"company_name,omitempty"`
Logo struct {
Small string `json:"small,omitempty"`
Medium string `json:"medium,omitempty"`
Url string `json:"url,omitempty"`
} `json:"logo,omitempty"`
}
// The sub-structure of a response denominating the oauth data
type oauth struct {
AccessToken string `json:"access_token,omitempty"`
TokenType string `json:"token_type,omitempty"`
ExpiresIn int64 `json:"expires_in,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
Scope string `json:"scope,omitempty"`
}
// The sub-structure of a response denominating pagination stats
type paginationStats struct {
TotalCount int64 `json:"total_count,omitempty"`
NumPages int64 `json:"num_pages,omitempty"`
CurrentPage int64 `json:"current_page,omitempty"`
}
// The return response from GetTransfers
type transfers struct {
paginationStats
Transfers []transfer
}
// The sub-structure of a response denominating a transfer
type transfer struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Code string `json:"code,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Fees fees `json:"fees,omitempty"`
Status string `json:"status,omitempty"`
PayoutDate string `json:"payout_date,omitempty"`
Btc amount `json:"btc,omitempty"`
Subtotal amount `json:"subtotal,omitempty"`
Total amount `json:"total,omitempty"`
Description string `json:"description,omitempty"`
TransactionId string `json:"transaction_id,omitempty"`
}
// The sub-structure of a response denominating an amount
type amount struct {
Amount string `json:"amount,omitempty"`
Currency string `json:"currency,omitempty"`
}
// The sub-structure of a response denominating a fee
type fee struct {
Cents float64 `json:"cents,omitempty"`
CurrencyIso string `json:"currency_iso,omitempty"`
}
// The sub-structure of a response denominating fees
type fees struct {
Coinbase fee `json:"coinbase,omitempty"`
Bank fee `json:"bank,omitempty"`
}
// The sub-structure of a response denominating a transaction actor
type transactionActor struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
}
// The return response from GetTransactions
type transactions struct {
paginationStats
Transactions []transaction
}
// The sub-structure of a response denominating a transaction
type transaction struct {
Id string `json:"id,omitempty"`
CreateAt string `json:"create_at,omitempty"`
Hsh string `json:"hsh,omitempty"`
Notes string `json:"notes,omitempty"`
Idem string `json:"idem,omitempty"`
Amount amount `json:"amount,omitempty"`
Request bool `json:"request,omitempty"`
Status string `json:"status,omitempty"`
Sender transactionActor `json:"sender,omitempty"`
Recipient transactionActor `json:"recipient,omitempty"`
RecipientAddress string `json:"recipient_address,omitempty"`
Type string `json:"type,omitempty"`
Signed bool `json:"signed,omitempty"`
SignaturesRequired int64 `json:"signature_required,omitempty"`
SignaturesPresent int64 `json:"signatures_present,omitempty"`
SignaturesNeeded int64 `json:"signatures_needed,omitempty"`
Hash string `json:"hash,omitempty"`
Confirmations int64 `json:"confirmations,omitempty"`
}
// The return response from GetOrders
type orders struct {
paginationStats
Orders []order
}
// The sub-structure of a response denominating an order
type order struct {
Id string `json:"id,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Status string `json:"status,omitempty"`
TotalBtc fee `json:"total_btc,omitempty"`
TotalNative fee `json:"total_native,omitempty"`
Custom string `json:"custom,omitempty"`
ReceiveAddress string `json:"receive_address,omitempty"`
Button Button `json:"button,omitempty"`
Transaction transaction `json:"transaction,omitempty"`
}