Zep.HTTP (Zep v1.0.0)

Copy Markdown View Source

Low-level request execution shared by every resource module.

Handles JSON encoding/decoding, retry-with-backoff on retriable errors, and emits :telemetry events around every call:

  • [:zep, :request, :start] - %{system_time: t} / %{method:, url:, resource:, action:}
  • [:zep, :request, :stop] - %{duration: t} / %{method:, url:, resource:, action:, status:}
  • [:zep, :request, :exception] - %{duration: t} / %{method:, url:, resource:, action:, kind:, reason:}

This is not part of the public API surface used directly by callers - see Zep.Thread, Zep.Graph, etc. for the documented, typed functions.

Summary

Functions

Drops nil values from a keyword list/map of query params before encoding.

Issues an HTTP request against the Zep API and decodes the JSON response.

URL-encodes a single path segment (thread IDs, user IDs, UUIDs, etc).

Types

method()

@type method() :: :get | :post | :put | :patch | :delete

Functions

compact(params)

@spec compact(map() | keyword()) :: map()

Drops nil values from a keyword list/map of query params before encoding.

request(client, method, path, opts \\ [])

@spec request(Zep.Client.t(), method(), String.t(), keyword()) ::
  {:ok, term()} | {:error, Zep.Error.t() | Zep.TransportError.t()}

Issues an HTTP request against the Zep API and decodes the JSON response.

telemetry_meta should include at least :resource and :action atoms (e.g. resource: :thread, action: :list) so telemetry handlers/loggers can attribute calls meaningfully.

segment(value)

@spec segment(String.t() | non_neg_integer()) :: String.t()

URL-encodes a single path segment (thread IDs, user IDs, UUIDs, etc).