JSONRPC2 v2.0.0 JSONRPC2.Clients.HTTP View Source

A client for JSON-RPC 2.0 using an HTTP transport with JSON in the body.

Link to this section Summary

Link to this section Types

Specs

batch_result() :: {:ok, JSONRPC2.Response.id_and_response()} | {:error, any()}

Link to this section Functions

Link to this function

batch(url, requests, headers \\ [{"content-type", "application/json"}], http_method \\ :post, hackney_opts \\ [])

View Source

Specs

batch(String.t(), [JSONRPC2.Request.request()], any(), atom(), list()) ::
  [batch_result()] | :ok | {:error, any()}

Make a batch request via url for JSON-RPC 2.0 requests.

You can also pass headers, http_method, and hackney_opts to customize the options for hackney.

See hackney for more information on the available options.

Link to this function

call(url, method, params, headers \\ [{"content-type", "application/json"}], http_method \\ :post, hackney_opts \\ [], request_id \\ "0")

View Source

Specs

call(
  String.t(),
  JSONRPC2.method(),
  JSONRPC2.params(),
  any(),
  atom(),
  list(),
  JSONRPC2.id()
) :: {:ok, any()} | {:error, any()}

Make a call to url for JSON-RPC 2.0 method with params.

You can also pass headers, http_method, hackney_opts to customize the options for hackney, and request_id for a custom JSON-RPC 2.0 request ID.

See hackney for more information on the available options.

Link to this function

notify(url, method, params, headers \\ [{"content-type", "application/json"}], http_method \\ :post, hackney_opts \\ [])

View Source

Specs

notify(String.t(), JSONRPC2.method(), JSONRPC2.params(), any(), atom(), list()) ::
  :ok | {:error, any()}

Notify via url for JSON-RPC 2.0 method with params.

You can also pass headers, http_method, and hackney_opts to customize the options for hackney.

See hackney for more information on the available options.