Documentation ¶
Index ¶
- Constants
- Variables
- func GZipCompress(input string) ([]byte, error)
- func GZipDecompress(input []byte) (string, error)
- type DefaultAuthParam
- type HTTPRequest
- type HTTPResponse
- type HTXClient
- func (htx *HTXClient) CheckAuth() error
- func (htx *HTXClient) GenAuthParams() DefaultAuthParam
- func (htx *HTXClient) GetBaseURL() string
- func (htx *HTXClient) GetDebug() bool
- func (htx *HTXClient) GetHeaders() (map[string]string, error)
- func (htx *HTXClient) GetKey() string
- func (htx *HTXClient) GetSecret() string
- func (htx *HTXClient) GetSignVersion() string
- func (htx *HTXClient) NormalizeRequestContent(req HTTPRequest, tempQuery any) (string, error)
- func (htx *HTXClient) SendHTTPRequest(ctx context.Context, req HTTPRequest) (*HTTPResponse, error)
- func (htx *HTXClient) Sign(plain []byte) string
- type HTXClientCfg
- type V1Response
- type V2Response
Constants ¶
View Source
const ApiKeyVersionV2 = "2"
ApiKeyVersionV2 is v2 api key version
Variables ¶
View Source
var ( SpotBaseURL = "https://api.huobi.pro" SpotAWSBaseURL = "https://api-aws.huobi.pro" UsdmBaseURL = "https://api.hbdm.com" UsdmAWSBaseURL = "https://api.hbdm.vn" )
View Source
var ErrAuth = errors.New("auth error, you should reinitialize client using key and secret")
View Source
var NIL = "<nil>"
Functions ¶
func GZipCompress ¶
func GZipDecompress ¶
Types ¶
type DefaultAuthParam ¶
type DefaultAuthParam struct { AccessKeyId string `url:"AccessKeyId,omitempty" validate:"omitempty"` SignatureMethod string `url:"SignatureMethod,omitempty" validate:"omitempty"` SignatureVersion string `url:"SignatureVersion,omitempty" validate:"omitempty"` Timestamp string `url:"Timestamp,omitempty" validate:"omitempty"` Signature string `url:"Signature,omitempty" validate:"omitempty"` }
type HTTPRequest ¶
type HTTPRequest struct { BaseURL string Path string Method string Headers map[string]string Query any Body any }
func (*HTTPRequest) RequestBody ¶
func (h *HTTPRequest) RequestBody() (string, error)
func (*HTTPRequest) RequestURI ¶
func (h *HTTPRequest) RequestURI() (string, error)
RequestURI returns the request uri.
type HTTPResponse ¶
type HTTPResponse struct { Req *HTTPRequest Resp *http.Response Body []byte }
A HTTPResponse represents a HTTP response.
func NewResponse ¶
func NewResponse( request *HTTPRequest, response *http.Response, body []byte, ) *HTTPResponse
NewResponse Creates a new Response
func (*HTTPResponse) Error ¶
func (r *HTTPResponse) Error() string
func (*HTTPResponse) ReadBody ¶
func (r *HTTPResponse) ReadBody() ([]byte, error)
ReadBody read the response data, then return it.
func (*HTTPResponse) ReadJsonBody ¶
func (r *HTTPResponse) ReadJsonBody(v interface{}) error
ReadJsonBody read the response data as JSON into v.
type HTXClient ¶
type HTXClient struct {
// contains filtered or unexported fields
}
func NewHTXRestClient ¶
func NewHTXRestClient(cfg *HTXClientCfg) (*HTXClient, error)
func (*HTXClient) GenAuthParams ¶
func (htx *HTXClient) GenAuthParams() DefaultAuthParam
func (*HTXClient) GetBaseURL ¶
func (*HTXClient) GetSignVersion ¶
func (*HTXClient) NormalizeRequestContent ¶
func (htx *HTXClient) NormalizeRequestContent(req HTTPRequest, tempQuery any) (string, error)
func (*HTXClient) SendHTTPRequest ¶
func (htx *HTXClient) SendHTTPRequest(ctx context.Context, req HTTPRequest) (*HTTPResponse, error)
type HTXClientCfg ¶
type V1Response ¶
type V2Response ¶
Click to show internal directories.
Click to hide internal directories.