client

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOption

func NewOption(fs ...SetOption) (*option, error)

NewOption 创建可选参数

func NewTestQstarsServer

func NewTestQstarsServer() *testQmoonServer

Types

type Client

type Client struct {
	Transfer *transferService
	// contains filtered or unexported fields
}

Client 客户端结构

func NewClient

func NewClient(opt *option) *Client

NewClient 创建tendermint Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.

The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type SetOption

type SetOption func(options *option) error

func SetOptionHost

func SetOptionHost(host string) SetOption

SetOptionHost 设置可选参数host

func SetOptionSecretKey

func SetOptionSecretKey(secretKey string) SetOption

SetOptionSecretKey 设置可选参数secretKey

type TransferOption

type TransferOption struct {
	Offset int64 `url:"offset,omitempty"`
	Limit  int64 `url:"limit,omitempty"`
}

Jump to

Keyboard shortcuts

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