client

package
v3.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package client provides methods to do http GET / POST request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CardanoGetResultFromJSONResponse added in v3.6.1

func CardanoGetResultFromJSONResponse(result interface{}, resp *http.Response) error

func CardanoPostRequest added in v3.6.1

func CardanoPostRequest(url string, req *Request, result interface{}) error

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

func GetDefaultTimeout(slow bool) int

GetDefaultTimeout get defaule timeout

func HTTPGet

func HTTPGet(url string, params, headers map[string]string, timeout int) (*http.Response, error)

HTTPGet http get

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 RPCGet

func RPCGet(result interface{}, url string) error

RPCGet rpc get

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

func RPCGetWithTimeout(result interface{}, url string, timeout int) error

RPCGetWithTimeout rpc get with timeout

func RPCPost

func RPCPost(result interface{}, url, method string, params ...interface{}) error

RPCPost rpc post

func RPCPostBody added in v3.6.1

func RPCPostBody(url string, params, headers map[string]string, body, result interface{}, timeout int, success_code map[int]bool) (errBody []byte, err error)

func RPCPostRequest

func RPCPostRequest(url string, req *Request, result interface{}) error

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 RPCRawGet

func RPCRawGet(url string) (string, error)

RPCRawGet rpc raw get

func RPCRawGetRequest

func RPCRawGetRequest(url string, params, headers map[string]string, timeout int) (string, error)

RPCRawGetRequest rpc raw get request

func RPCRawGetWithTimeout

func RPCRawGetWithTimeout(url string, timeout int) (string, error)

RPCRawGetWithTimeout rpc raw get with timeout

func RPCRawPost

func RPCRawPost(url, body string) (string, error)

RPCRawPost rpc raw post

func RPCRawPostWithTimeout

func RPCRawPostWithTimeout(url, reqBody string, timeout int) (string, error)

RPCRawPostWithTimeout rpc raw post 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

type Request struct {
	Method  string
	Params  interface{}
	Timeout int
	ID      int
}

Request json rpc request

func NewRequest

func NewRequest(method string, params ...interface{}) *Request

NewRequest new request

func NewRequestWithTimeoutAndID

func NewRequestWithTimeoutAndID(timeout, id int, method string, params ...interface{}) *Request

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL