Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Call is used to send one request to REST API endpoint. The request input will be 'method' and 'requestBody'. // Note that 'requestBody' is mostly used for POST. The request response and error are returned. Call(ctx context.Context, method *RequestMethod, requestBody []byte) ([]byte, error) }
Client defines the interface for REST API. Different from Json RPC, parts of the parameters will be embeded into the URL. Therefore, different types of requests will query different URLs. The endpoint shared URL is stored in Config while each request method provides the parameter URL.
type ClientParams ¶
type ClientParams struct { fx.In fxparams.Params Master endpoints.EndpointProvider `name:"master"` Slave endpoints.EndpointProvider `name:"slave"` Validator endpoints.EndpointProvider `name:"validator"` Consensus endpoints.EndpointProvider `name:"consensus"` HTTPClient HTTPClient `optional:"true"` // Injected by unit test. }
type ClientResult ¶
type ClientResult struct { fx.Out Master Client `name:"master"` Slave Client `name:"slave"` Validator Client `name:"validator"` Consensus Client `name:"consensus"` }
func New ¶
func New(params ClientParams) (ClientResult, error)
type RequestMethod ¶
RequestMethod represents a REST method, including the parameter URL and timeout. The 'Name' is just used for annotation. For example, in Aptos, the 'ParamsPath' for block 1 will be: "/blocks/by_height/1?with_transactions=true".
Click to show internal directories.
Click to hide internal directories.