View Source PorscheConnEx.Config (porsche_conn_ex v0.1.0)

Configures the region and behaviour of the API session.

Fields

  • language (default de) - a two-letter language code
  • country (default DE) - a two-letter country code
  • timezone (default Etc/UTC) - a timezone identifier
  • api_url (default https://api.porsche.com) - the base URL to access the Porsche Connect API
  • http_options (default []) - a list of options accepted by Req.new/1

Locales

The language and country fields, when put together, should form a valid locale name.

The chosen locale may affect various aspects of the API. The most obvious effect is to choose the units used (metric versus imperial).

The following locales are known to work:

  • de_DE (Germany) - metric units
  • en_US (United States) - imperial units

The following locales are known to NOT work:

  • en_CA (Canada)

When choosing an unsupported locale, the initial authentication will succeed, but most other requests will fail with {:error, :not_found}.

Note that this library was designed and tested using de_DE (and also defaults to this), on the assumption that German would be the most logical locale for a German car. Some effort has been made to test against en_US and imperial units as well, but there may still be bugs when working in non-German locales.

Summary

Functions

Creates a new configuration object.

Types

@type t() :: %PorscheConnEx.Config{
  api_url: binary(),
  country: binary(),
  http_options: Keyword.t(),
  language: binary(),
  timezone: binary()
}

Functions

@spec new(Keyword.t() | %{optional(atom()) => any()} | t()) :: t()

Creates a new configuration object.

opts can be a Keyword list, a Map, or any other enumerable containing key-value tuples.

It can also be an existing PorscheConnEx.Config structure, which will be returned verbatim.