Reusable configuration for Kagi requests.
A client stores the configured session token and request options. Building a client performs no network I/O.
The session token is redacted from inspect/1 output so crash reports and
logs do not leak it. Map.from_struct/1 and inspect(client, structs: false)
still expose the raw value.
Fields
:session_token- Kagi session token string.:req_options- keyword list merged into eachReqrequest. AcceptsReqoptions andCloakedReqadapter options such as:impersonate.
Requests follow no redirects and retry nothing by default; re-enable either
with redirect: true or retry: :safe_transient in :req_options.
Summary
Functions
Builds a %Kagi.Client{} from application config.
Builds a %Kagi.Client{} or raises Kagi.Error.
Types
Functions
@spec new() :: {:ok, t()} | {:error, Kagi.Error.t()}
Builds a %Kagi.Client{} from application config.
Reads :session_token and :req_options from :kagi_ex config. Returns
{:error, %Kagi.Error{}} when the token is missing or :req_options is not
a keyword list.
Examples
config :kagi_ex, session_token: "abc"
{:ok, client} = Kagi.Client.new()
{:error, %Kagi.Error{reason: :missing_session_token}} = Kagi.Client.new()
@spec new!() :: t()
Builds a %Kagi.Client{} or raises Kagi.Error.