forked from jeffwalsh/go-coinpayments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.go
32 lines (26 loc) · 864 Bytes
/
convert.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
package coinpayments
import "net/url"
// ConvertLimitRequest is used to hold our request parameters for getting conversion limits
type ConvertLimitRequest struct {
From string `json:"from"`
To string `json:"to"`
}
// ConvertLimitResponse hold's a response to the Get Conversion Limits API call
type ConvertLimitResponse struct {
Error string `json:"error"`
Result struct {
Min string `json:"min"`
Max string `json:"max"`
} `json:"result"`
}
// CallGetConversionLimits calls the get conversion limits comand on the API
func (c *Client) CallGetConversionLimits(req *ConvertLimitRequest) (*ConvertLimitResponse, error) {
data := url.Values{}
data.Add("from", req.From)
data.Add("to", req.To)
var response ConvertLimitResponse
if err := c.Call(CmdGetConversionLimits, data, &response); err != nil {
return nil, err
}
return &response, nil
}