Tink.HTTPAdapter (Tink v0.1.1)

Copy Markdown View Source

Production HTTP client implementation using Finch.

This module implements the Tink.HTTPBehaviour interface and provides a high-performance HTTP client built on top of Finch and Mint.

Features

  • ⚡ Connection pooling via Finch
  • 🔄 Automatic retries with exponential backoff
  • ⏱️ Configurable timeouts
  • 📊 Telemetry integration
  • 🔍 Request/response logging
  • 🌐 HTTP/1.1 and HTTP/2 support

Configuration

The adapter respects Tink configuration:

config :tink,
  timeout: 30_000,
  max_retries: 3,
  pool_size: 32

Telemetry

Emits the following telemetry events:

  • [:tink, :request, :start] - Request initiated
  • [:tink, :request, :stop] - Request completed
  • [:tink, :request, :exception] - Request failed

Examples

# Direct usage
{:ok, response} = Tink.HTTPAdapter.request(
  :get,
  "https://api.tink.com/api/v1/providers",
  nil,
  [{"authorization", "Bearer token"}],
  timeout: 5_000
)

# Used automatically by Tink.Client
client = Tink.client()
{:ok, accounts} = Tink.Accounts.list(client)

Summary

Functions

build_request(method, url, headers, body)