ExFPL.HTTP (ExFPL v0.1.0)

Copy Markdown View Source

Thin wrapper around Req that handles base URL, retries, telemetry and optional session cookies for ExFPL API requests.

Library code should not call Req directly — go through get/2 so the test stub and telemetry events apply uniformly.

Summary

Types

Decoded JSON body returned by the API.

Errors returned by get/2.

Functions

Issue a GET request to the ExFPL API.

Types

body()

@type body() :: map() | list()

Decoded JSON body returned by the API.

error()

@type error() ::
  {:http_error, status :: pos_integer(), body :: term()}
  | Exception.t()
  | term()

Errors returned by get/2.

Functions

get(path, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, body()} | {:error, error()}

Issue a GET request to the ExFPL API.

Options:

  • :session — a ExFPL.Session{} whose cookie will be sent as the cookie request header.
  • :params — query string parameters (a keyword list).
  • any other key is forwarded to Req.request/1.

Returns {:ok, body} on a 2xx response and {:error, reason} otherwise.