The client struct — plain data, not a process.
new/1 resolves configuration once (see Picnic.Config) and stores a base
Req.Request template on the struct. Every request merges onto that
template, so there is no global state and nothing to start or supervise.
Resource functions take the client as their first argument and, where a call
changes it (login), return an updated client.
Options
:country- Country whose storefront to talk to. Defaults to:nl.:api_version(String.t/0) - Path version segment of the API, e.g."15".:base_url(String.t/0) - Full base URL including the version segment. Overrides:country/:api_version.:client_id(integer/0) - Client id sent with the login payload.:headers(map ofString.t/0keys andString.t/0values) - Extra or replacement default headers, merged over the built-in ones.:auth_token(String.t/0) - A previously obtained token; lets you skipPicnic.login/3entirely.:req_options(keyword/0) - Options merged into the underlyingReqrequest template (retry tuning, plug, …).
Reusing a token
The auth token is plain data on the struct. Persist client.auth_token
wherever you like and rebuild a logged-in client later with
Picnic.Client.new(auth_token: token).
Summary
Functions
Builds a new client. Raises NimbleOptions.ValidationError on invalid
options; see the module documentation for the accepted ones.
Returns a client that authenticates subsequent requests with token.
Types
@type t() :: %Picnic.Client{ auth_token: String.t() | nil, base_url: String.t(), config: Picnic.Config.t(), headers: %{required(String.t()) => String.t()}, req: Req.Request.t() }
Functions
Builds a new client. Raises NimbleOptions.ValidationError on invalid
options; see the module documentation for the accepted ones.
Returns a client that authenticates subsequent requests with token.