Documentation ¶
Index ¶
- Constants
- func EncodeGetParams(req map[string]string) string
- func EncodeGetQuery(req map[string]string) string
- func GenerateAuthorizationHeader(signReq []byte, ApiKeyId string, key *ecdsa.PrivateKey) (string, error)
- func GenerateSignString(RequestMethod string, body []byte, XApiKey string, XApiNonce string, ...) string
- func GenerateUuid() string
- func GetCurrentGmtTime() string
- func Sign(signReq []byte, key *ecdsa.PrivateKey) ([]byte, error)
Constants ¶
const Accept = "application/json"
const RequestContentType = "application/json"
const ServiceName = "api"
Variables ¶
This section is empty.
Functions ¶
func EncodeGetParams ¶
EncodeGetParams encodes the post params, to the cactus format, like {param_name=[param_value], param_name2=[param_value2]} example:{b_id=[4a3e2fb40faa4b9d94480559ac01e8de], coin_names=[BTC,LTC], hide_no_coin_wallet=[false], total_market_order=[0]}
func EncodeGetQuery ¶
func GenerateAuthorizationHeader ¶
func GenerateAuthorizationHeader(signReq []byte, ApiKeyId string, key *ecdsa.PrivateKey) (string, error)
GenerateAuthorizationHeader generates the authorization header signReq: the string to be signed ApiKeyId: the api key id key: the private key
func GenerateSignString ¶
func GenerateSignString(RequestMethod string, body []byte, XApiKey string, XApiNonce string, uri string, FormattedParams string, currentTime string) string
GenerateSignString generates the string to be signed RequestMethod: GET, POST, PUT, DELETE, use the constants in http/method.go body: the body of the request, if it's post request, pass nil XApiKey: the api key XApiNonce: the nonce uri: the uri of the request FormattedParams: the formatted params, if there's no params, pass "" currentTime: the current time in RFC1123 format, using GMT TZ
func GenerateUuid ¶
func GenerateUuid() string
func GetCurrentGmtTime ¶
func GetCurrentGmtTime() string
Types ¶
This section is empty.