-
Notifications
You must be signed in to change notification settings - Fork 34
/
holders.go
112 lines (97 loc) · 3.35 KB
/
holders.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
package coinbase
// Holders includes all the structs used for marshaling JSON responses from the coinbase API
// The holder used to marshal the JSON request returned in GetTokens
type tokensHolder 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"`
}
// addressesHolder used to marshal the JSON request returned in GetAllAddresses
type addressesHolder struct {
paginationStats
Addresses []struct {
Address address `json:"address,omitempty"`
} `json:"addresses,omitempty"`
}
// orderHolder used to marshal the JSON request returned in CreateOrderFromButtonCode and GetOrder
type orderHolder struct {
response
Order order `json:"order,omitempty"`
}
// orderHolders used to marshal the JSON request returned in GetOrders
type ordersHolder struct {
paginationStats
Orders []struct {
Order order `json:"order,omitempty"`
} `json:"orders,omitempty"`
}
// buttonHolder used to marshal the JSON request returned in CreateButton
type buttonHolder struct {
response
Button Button `json:"button,omitempty"`
}
// transfersHolder used to marshal the JSON request returned in GetTransfers
type transfersHolder struct {
paginationStats
Transfers []struct {
Transfer transfer `json:"transfer,omitempty"`
} `json:"transfers,omitempty"`
}
// transferHolder used to marshal the JSON request returned in Buy & Sell
type transferHolder struct {
response
Transfer transfer `json:"transfer,omitempty"`
}
// pricesHolder used to marshal the JSON request returned in GetBuyPrice & GetSellPrice
type pricesHolder struct {
Subtotal amount `json:"subtotal,omitempty"`
Fees []struct {
Coinbase amount `json:"coinbase,omitempty"`
Bank amount `json:"bank,omitempty"`
} `json:"fees,omitempty"`
Total amount `json:"total,omitempty"`
}
// usersHolder used to marshal the JSON request returned in GetUser
type usersHolder struct {
response
Users []struct {
User user `json:"user,omitempty"`
} `json:"users,omitempty"`
}
// userHolder used to marshal the JSON request returned in CreateUser
type userHolder struct {
response
User user `json:"user,omitempty"`
Oauth oauth `json:"oauth,omitempty"`
}
// The sub-structure of a response denominating its success and/or errors
type response struct {
Success bool `json:"success"`
Errors []string `json:"errors"`
Error string `json:"error"`
}
// contactsHolder used to marshal the JSON request returned in GetContacts
type contactsHolder struct {
paginationStats
Contacts []contact `json:"contacts,omitempty"`
Emails []string `json:"emails,omitempty"` // Add for convenience
}
// transactionHolder used to marshal the JSON request returned in SendMoney, RequestMoney,
// GetTransaction
type transactionHolder struct {
response
Transaction transaction `json:"transaction"`
Transfer transfer `json:"transfer"`
}
// transactionsHolder used to marshal the JSON request returned in GetTransactions
type transactionsHolder struct {
paginationStats
CurrentUser user `json:"current_user,omitempty"`
Balance amount `json:"balance,omitempty"`
NativeBalance amount `json:"native_balance,omitempty"`
Transactions []struct {
Transaction transaction `json:"transaction,omitempty"`
} `json:"transactions,omitempty"`
}