Documentation ¶
Overview ¶
Package client provides methods to do http GET / POST request.
Index ¶
- func CardanoGetResultFromJSONResponse(result interface{}, resp *http.Response) error
- func CardanoPostRequest(url string, req *Request, result interface{}) error
- func CardanoPostRequestWithContext(ctx context.Context, url string, req *Request, result interface{}) error
- func GetDefaultTimeout(slow bool) int
- func HTTPGet(url string, params, headers map[string]string, timeout int) (*http.Response, error)
- func HTTPGetWithContext(ctx context.Context, url string, params, headers map[string]string, ...) (*http.Response, error)
- func HTTPPost(url string, body interface{}, params, headers map[string]string, timeout int) (*http.Response, error)
- func HTTPPostWithContext(ctx context.Context, url string, body interface{}, ...) (*http.Response, error)
- func HTTPRawPost(url, body string, params, headers map[string]string, timeout int) (*http.Response, error)
- func HTTPRawPostWithContext(ctx context.Context, url, body string, params, headers map[string]string, ...) (*http.Response, error)
- func RPCGet(result interface{}, url string) error
- func RPCGetRequest(result interface{}, url string, params, headers map[string]string, timeout int) error
- func RPCGetRequest2(result interface{}, url string, params, headers map[string]string, timeout int) (errBody []byte, err error)
- func RPCGetWithTimeout(result interface{}, url string, timeout int) error
- func RPCPost(result interface{}, url, method string, params ...interface{}) error
- func RPCPostBody(url string, params, headers map[string]string, body, result interface{}, ...) (errBody []byte, err error)
- func RPCPostRequest(url string, req *Request, result interface{}) error
- func RPCPostRequestWithContext(ctx context.Context, url string, req *Request, result interface{}) error
- func RPCPostWithContext(ctx context.Context, result interface{}, url, method string, ...) error
- func RPCPostWithTimeout(timeout int, result interface{}, url, method string, params ...interface{}) error
- func RPCPostWithTimeoutAndID(result interface{}, timeout, id int, url, method string, params ...interface{}) error
- func RPCRawGet(url string) (string, error)
- func RPCRawGetRequest(url string, params, headers map[string]string, timeout int) (string, error)
- func RPCRawGetWithTimeout(url string, timeout int) (string, error)
- func RPCRawPost(url, body string) (string, error)
- func RPCRawPostWithTimeout(url, reqBody string, timeout int) (string, error)
- type CardanoJsonrpcResponse
- type CardanoRequestBody
- type Request
- type RequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CardanoGetResultFromJSONResponse ¶ added in v3.6.1
func CardanoPostRequest ¶ added in v3.6.1
RPCPostRequest rpc post request
func CardanoPostRequestWithContext ¶ added in v3.6.1
func CardanoPostRequestWithContext(ctx context.Context, url string, req *Request, result interface{}) error
RPCPostRequestWithContext rpc post request with context
func GetDefaultTimeout ¶ added in v3.4.0
GetDefaultTimeout get defaule timeout
func HTTPGetWithContext ¶ added in v3.4.0
func HTTPGetWithContext(ctx context.Context, url string, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPGetWithContext http get with context
func HTTPPost ¶
func HTTPPost(url string, body interface{}, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPPost http post
func HTTPPostWithContext ¶ added in v3.4.0
func HTTPPostWithContext(ctx context.Context, url string, body interface{}, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPPostWithContext http post with context
func HTTPRawPost ¶
func HTTPRawPost(url, body string, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPRawPost http raw post
func HTTPRawPostWithContext ¶ added in v3.4.0
func HTTPRawPostWithContext(ctx context.Context, url, body string, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPRawPostWithContext http raw post with context
func RPCGetRequest ¶
func RPCGetRequest(result interface{}, url string, params, headers map[string]string, timeout int) error
RPCGetRequest rpc get request
func RPCGetRequest2 ¶ added in v3.6.1
func RPCGetRequest2(result interface{}, url string, params, headers map[string]string, timeout int) (errBody []byte, err error)
RPCGetRequest2 rpc get request
func RPCGetWithTimeout ¶
RPCGetWithTimeout rpc get with timeout
func RPCPostBody ¶ added in v3.6.1
func RPCPostRequest ¶
RPCPostRequest rpc post request
func RPCPostRequestWithContext ¶ added in v3.4.0
func RPCPostRequestWithContext(ctx context.Context, url string, req *Request, result interface{}) error
RPCPostRequestWithContext rpc post request with context
func RPCPostWithContext ¶ added in v3.4.0
func RPCPostWithContext(ctx context.Context, result interface{}, url, method string, params ...interface{}) error
RPCPostWithContext rpc post with context
func RPCPostWithTimeout ¶ added in v3.4.0
func RPCPostWithTimeout(timeout int, result interface{}, url, method string, params ...interface{}) error
RPCPostWithTimeout rpc post with timeout
func RPCPostWithTimeoutAndID ¶
func RPCPostWithTimeoutAndID(result interface{}, timeout, id int, url, method string, params ...interface{}) error
RPCPostWithTimeoutAndID rpc post with timeout and id
func RPCRawGetRequest ¶
RPCRawGetRequest rpc raw get request
func RPCRawGetWithTimeout ¶
RPCRawGetWithTimeout rpc raw get with timeout
Types ¶
type CardanoJsonrpcResponse ¶ added in v3.6.1
type CardanoJsonrpcResponse struct { Error json.RawMessage `json:"errors,omitempty"` Result json.RawMessage `json:"data,omitempty"` }
type CardanoRequestBody ¶ added in v3.6.1
type CardanoRequestBody struct { Version string `json:"jsonrpc"` Query interface{} `json:"query"` ID int `json:"id"` }
RequestBody request body
type Request ¶
Request json rpc request
func NewRequest ¶
NewRequest new request
func NewRequestWithTimeoutAndID ¶
NewRequestWithTimeoutAndID new request with timeout and id
type RequestBody ¶
type RequestBody struct { Version string `json:"jsonrpc"` Method string `json:"method"` Params interface{} `json:"params"` ID int `json:"id"` }
RequestBody request body