Inttegro.Client (inttegro v0.2.0)

Copy Markdown View Source

Configures transport, authentication, telemetry, and error reporting for Inttegro operations.

The client is a plain immutable struct, not a process. Create it once in your application supervision tree or runtime configuration and safely share it between callers. Resource modules such as Inttegro.Orders receive the client as their first argument.

Creating a client

client = Inttegro.Client.new!(System.fetch_env!("INTTEGRO_API_KEY"))

new!/2 accepts:

  • :base_url — alternate API origin, primarily for tests. Defaults to https://api.inttegro.com.
  • :http — a configured Req.Request used as the transport.
  • :telemetry — a one-argument callback receiving privacy-safe lifecycle event maps.
  • :error_reporter — a one-argument callback receiving Inttegro.Telemetry.ErrorReport.t() values.
  • :error_reporting_policy:unexpected (the default) or :all.

The SDK does not configure an exporter or send reports to Inttegro on its own. See the Observability guide for the event contract and privacy guarantees.

Summary

Types

t()

A configured Inttegro API client.

Functions

Creates a client from a server-side secret key.

Types

t()

@type t() :: %Inttegro.Client{
  api_key: String.t(),
  base_url: String.t(),
  error_reporter: (Inttegro.Telemetry.ErrorReport.t() -> term()) | nil,
  error_reporting_policy: :unexpected | :all,
  http: Req.Request.t(),
  telemetry: (map() -> term()) | nil
}

A configured Inttegro API client.

Functions

new!(api_key, options \\ [])

@spec new!(String.t(), keyword()) :: t()

Creates a client from a server-side secret key.

Raises ArgumentError when api_key is empty. Keep the key in environment-backed secret configuration; never embed it in browser JavaScript or a mobile application.