oaspec/httpc

BEAM HTTP adapter for oaspec generated clients.

oaspec/httpc bridges the pure oaspec/transport.Send contract to gleam_httpc. The simplest usage is the bare send function:

import oaspec/httpc
import api/client

let result = client.list_pets(httpc.send, ...)

For per-request configuration (timeouts, etc.) use the builder:

let send =
  httpc.config()
  |> httpc.with_timeout(5_000)
  |> httpc.build

Types

Adapter configuration. Build with config(), tune with the with_* helpers, then commit to a Send value via build().

pub opaque type Config

Values

pub fn build(
  cfg: Config,
) -> fn(transport.Request) -> Result(
  transport.Response,
  transport.TransportError,
)

Materialise a Send value from a Config. Use this when you’ve configured timeouts or other options. For the simplest case, prefer the bare send function, which has the same signature as Send.

pub fn config() -> Config
pub fn send(
  req: transport.Request,
) -> Result(transport.Response, transport.TransportError)

Convenience: equivalent to config() |> build. Provides the most common no-config path as a single function reference.

pub fn with_timeout(
  cfg cfg: Config,
  timeout_ms timeout_ms: Int,
) -> Config
Search Document