View Source Kadena.Chainweb.Request (Kadena v0.19.1)
A module to work with Chainweb requests.
Requests are composed in a functional manner.
The request does not happen until it is configured and passed to perform/1
.
Link to this section Summary
Link to this section Types
@type api_type() :: :pact | :p2p
@type body() :: String.t() | nil
@type chain_id() :: 0..19 | String.t() | nil
@type encoded_query() :: String.t() | nil
@type endpoint() :: String.t() | nil
@type location() :: String.t() | nil
@type method() :: :get | :post | :put
@type network_id() :: :testnet04 | :mainnet01
@type opts() :: Keyword.t()
@type params() :: Keyword.t()
@type parsed_response() :: {:ok, struct()} | {:error, Kadena.Chainweb.Error.t()}
@type path() :: String.t() | nil
@type query() :: Keyword.t()
@type response() :: {:ok, map()} | {:error, Kadena.Chainweb.Error.t()}
@type segment() :: String.t() | nil
@type t() :: %Kadena.Chainweb.Request{ api_type: api_type(), body: body(), chain_id: chain_id(), encoded_query: encoded_query(), endpoint: endpoint(), headers: headers(), location: location(), method: method(), network_id: network_id(), path: path(), query: query(), segment: segment(), segment_path: path() }
Link to this section Functions
@spec results(response :: response(), opts :: opts()) :: parsed_response()
@spec set_network(t(), network :: network_id()) :: t()