-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequests.go
78 lines (67 loc) · 2.07 KB
/
requests.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
package coincap
import "fmt"
func (c *Client) GetAssets(params GetAssetsParams) (AssetsData, error) {
var data AssetsData
err := c.Do(fmt.Sprintf("%s/assets", url), params, &data)
return data, err
}
func (c *Client) GetAsset(id string) (AssetData, error) {
var data AssetData
if len(id) == 0 {
return data, MissingParameterError
}
err := c.Do(fmt.Sprintf("%s/assets/%s", url, id), nil, &data)
return data, err
}
func (c *Client) GetAssetHistory(params GetAssetHistoryParams) (AssetHistoriesData, error) {
var data AssetHistoriesData
if len(params.Id) == 0 {
return data, MissingParameterError
}
err := c.Do(fmt.Sprintf("%s/assets/%s/history", url, params.Id), params, &data)
return data, err
}
func (c *Client) GetAssetMarkets(params GetAssetMarketsParams) (AssetMarketsData, error) {
var data AssetMarketsData
if len(params.Id) == 0 {
return data, MissingParameterError
}
err := c.Do(fmt.Sprintf("%s/assets/%s/markets", url, params.Id), params, &data)
return data, err
}
func (c *Client) GetRates() (RatesData, error) {
var data RatesData
err := c.Do(fmt.Sprintf("%s/rates", url), nil, &data)
return data, err
}
func (c *Client) GetRate(id string) (RateData, error) {
var data RateData
if len(id) == 0 {
return data, MissingParameterError
}
err := c.Do(fmt.Sprintf("%s/rates/%s", url, id), nil, &data)
return data, err
}
func (c *Client) GetExchanges() (ExchangesData, error) {
var data ExchangesData
err := c.Do(fmt.Sprintf("%s/exchanges", url), nil, &data)
return data, err
}
func (c *Client) GetExchange(id string) (ExchangeData, error) {
var data ExchangeData
if len(id) == 0 {
return data, MissingParameterError
}
err := c.Do(fmt.Sprintf("%s/exchanges/%s", url, id), nil, &data)
return data, err
}
func (c *Client) GetMarkets(params GetMarketsParams) (MarketsData, error) {
var data MarketsData
err := c.Do(fmt.Sprintf("%s/markets", url), params, &data)
return data, err
}
func (c *Client) GetCandles(params GetCandlesParams) (CandlesData, error) {
var data CandlesData
err := c.Do(fmt.Sprintf("%s/candles", url), params, &data)
return data, err
}