MollieAPI.Connection (mollie_api v0.1.0-20260303)
View SourceHandle Tesla connections for MollieAPI.
Additional middleware can be set in the compile-time or runtime configuration:
config :tesla, MollieAPI.Connection,
base_url: "https://api.mollie.com/v2",
adapter: Tesla.Adapter.HackneyThe default base URL can also be set as:
config :mollie_api,
:base_url, "https://api.mollie.com/v2"
Summary
Types
The list of options that can be passed to new/1.
An arity-1 function or module/function tuple specification which, given a list of scopes, obtains an OAuth2 token.
Functions
Returns the default adapter for this API.
Returns an authentication middleware tuple for a Tesla client that sets
the authorization header to the value of the provided bearer token. If
the token is provided as a function of arity one, it will be called with
a list of requested scopes that will obtain an OAuth2 token.
Returns fully configured middleware for passing to Tesla.client/2.
Configure a MollieAPI client.
Forward requests to Tesla.
Types
@type options() :: [ base_url: String.t(), user_agent: String.t(), token: String.t() | token_fetcher(), token_scopes: [String.t()], bearer_token: String.t() | nil ]
The list of options that can be passed to new/1.
base_url: Overrides the base URL on a per-client basis.user_agent: Overrides the User-Agent header.token: An OAuth2 token or a token fetcher function.token_scopes: A list of OAuth2 scope strings for use with a token fetcher function.bearer_token: A bearer token for bearer authentication.
An arity-1 function or module/function tuple specification which, given a list of scopes, obtains an OAuth2 token.
Functions
Returns the default adapter for this API.
@spec authorization(String.t() | token_fetcher(), [String.t()]) :: Tesla.Client.middleware()
Returns an authentication middleware tuple for a Tesla client that sets
the authorization header to the value of the provided bearer token. If
the token is provided as a function of arity one, it will be called with
a list of requested scopes that will obtain an OAuth2 token.
Parameters
token: a String or a function of arity one. This value, or the result of the function call, will be set as a bearer token in theauthorizationheader.scopes: an optional list of scopes for use with the token fetcher function. Ignored whentokenis provided as a String. Defaults to[].
Returns
{Tesla.Middleware.Headers, [{"authorization", TOKEN}]}
@spec middleware(options()) :: [Tesla.Client.middleware()]
Returns fully configured middleware for passing to Tesla.client/2.
@spec new(options()) :: Tesla.Env.client()
Configure a MollieAPI client.
Parameters
options: an optional keyword list of MollieAPI.Connection.options.
Returns
Tesla.Env.client
@spec request(Tesla.Client.t(), [Tesla.option()]) :: Tesla.Env.result()
Forward requests to Tesla.