Deepl (deepl v0.1.2)
View SourceAn Elixir package providing a convenient interface to the DeepL API.
Summary
Functions
Get the base URL for the DeepL API based on the current plan.
Get the API key from the application environment.
Gets the current plan of the DeepL API based on the API key.
Sets the API key for the DeepL service.
Functions
@spec base_url!() :: String.t()
Get the base URL for the DeepL API based on the current plan.
Returns the base URL for the DeepL API, which varies depending on whether the user has a free or pro plan.
Examples
iex> Deepl.base_url!()
"https://api-free.deepl.com"
@spec get_api_key() :: String.t() | nil
Get the API key from the application environment.
Retrieves the API key set in the application configuration.
Examples
iex> Deepl.get_api_key()
"wwwwwwww-xxxx-yyyy-zzzz-123456789012:fx"
@spec plan!() :: :free | :pro | Exception.t()
Gets the current plan of the DeepL API based on the API key.
Returns :free
for free accounts and :pro
for pro accounts.
Examples
iex> Deepl.plan!()
:free
@spec set_api_key(String.t()) :: :ok
Sets the API key for the DeepL service.
Stores the API key string in the application environment.
Examples
iex> Deepl.set_api_key("wwwwwwww-xxxx-yyyy-zzzz-123456789012:fx")
:ok