client

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendJSONRequest

func SendJSONRequest(
	ctx context.Context,
	cli *http.Client,
	uri *url.URL,
	method string,
	params interface{},
	reply interface{},
	options ...Option,
) error

Types

type Client

type Client interface {
	// ProposeBlock submits data for a block
	ProposeBlock(ctx context.Context, data [timestampvm.DataLen]byte) (bool, error)

	// GetBlock fetches the contents of a block
	GetBlock(ctx context.Context, blockID *ids.ID) (uint64, [timestampvm.DataLen]byte, uint64, ids.ID, ids.ID, error)
}

Client defines timestampvm client operations.

func New

func New(uri string) Client

New creates a new client object.

type EndpointRequester

type EndpointRequester struct {
	// contains filtered or unexported fields
}

EndpointRequester is an extension of AvalancheGo's EndpointRequester with http.Client reuse.

func NewEndpointRequester

func NewEndpointRequester(uri, base string) *EndpointRequester

func (*EndpointRequester) SendRequest

func (e *EndpointRequester) SendRequest(
	ctx context.Context,
	method string,
	params interface{},
	reply interface{},
	options ...Option,
) error

type Option

type Option func(*Options)

func WithHeader

func WithHeader(key, val string) Option

func WithQueryParam

func WithQueryParam(key, val string) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions(ops []Option) *Options

func (*Options) Headers

func (o *Options) Headers() http.Header

func (*Options) QueryParams

func (o *Options) QueryParams() url.Values

Jump to

Keyboard shortcuts

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