View Source Mixpanel.Config (Mixpanel API v1.2.4)

Module that helps handling configuration values provided by a user.

Summary

Functions

Helper that validates user provided configuration and substitutes default parameters when needed.

Types

@type base_url() :: String.t()
@type http_adapter() ::
  Mixpanel.HTTP.HTTPC | Mixpanel.HTTP.Hackney | Mixpanel.HTTP.NoOp
@type name() :: atom()
@type option() ::
  {:project_token, project_token()}
  | {:base_url, base_url()}
  | {:http_adapter, http_adapter()}
  | {:name, name()}
@type options() :: [option(), ...]
@type project_token() :: String.t()

Functions

@spec client(name(), options()) :: options() | nil

Helper that validates user provided configuration and substitutes default parameters when needed.

Examples

iex> Mixpanel.Config.client(MyApp.Mixpanel, [project_token: "token"])
[
  http_adapter: Mixpanel.HTTP.HTTPC,
  base_url: "https://api.mixpanel.com",
  name: MyApp.Mixpanel,
  project_token: "token"
]