Documentation
¶
Index ¶
- Variables
- func ErrorStatus(err error) int
- func IsHttpError(err error) bool
- func IsNetError(err error) bool
- func IsRetriableHttpError(err error) bool
- func IsRetriableStatusCode(c int) bool
- func WrapError(e error, t ErrorWrapper) error
- func WrapNetError(err error) error
- type Client
- func (c *Client) Connect(base string) error
- func (c *Client) Do(req *http.Request, fn ResponseHandler) error
- func (c *Client) Get(ctx context.Context, urlpath string) ([]byte, error)
- func (c *Client) GetJson(ctx context.Context, urlpath string, result any) error
- func (c *Client) NewJsonResponseDecoder(v any) ResponseHandler
- func (c *Client) NewRawResponseDecoder(v *bytes.Buffer) ResponseHandler
- func (c *Client) NewRequest(ctx context.Context, method, urlStr, mediaType string, body any) (*http.Request, error)
- func (c *Client) PostJson(ctx context.Context, urlpath string, body, result any) error
- func (c *Client) SetLogLevel(lvl log.Level)
- func (c *Client) WithApiKey(k string) *Client
- func (c *Client) WithHttpClient(hc *http.Client) *Client
- func (c *Client) WithLogger(log log.Logger) *Client
- func (c *Client) WithRetry(num int, delay time.Duration) *Client
- func (c *Client) WithUserAgent(s string) *Client
- type ErrorWrapper
- type HTTPError
- type HTTPStatus
- type ResponseHandler
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsHttpError ¶
func IsNetError ¶
func IsRetriableHttpError ¶
func IsRetriableStatusCode ¶
func WrapError ¶
func WrapError(e error, t ErrorWrapper) error
func WrapNetError ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages communication with a Tezos RPC server.
func (*Client) Do ¶
func (c *Client) Do(req *http.Request, fn ResponseHandler) error
Do retrieves values from the API and marshals them into the provided interface.
func (*Client) NewJsonResponseDecoder ¶
func (c *Client) NewJsonResponseDecoder(v any) ResponseHandler
func (*Client) NewRawResponseDecoder ¶
func (c *Client) NewRawResponseDecoder(v *bytes.Buffer) ResponseHandler
func (*Client) NewRequest ¶
func (*Client) SetLogLevel ¶
func (*Client) WithApiKey ¶
func (*Client) WithUserAgent ¶
type ErrorWrapper ¶
type HTTPError ¶
type HTTPError interface { error HTTPStatus Body() []byte }
HTTPError retains HTTP status and error response body
type HTTPStatus ¶
type HTTPStatus interface { Request() string // e.g. GET /... Status() string // e.g. "200 OK" StatusCode() int // e.g. 200 }
HTTPStatus interface represents an unprocessed HTTP reply
Click to show internal directories.
Click to hide internal directories.