Deepl (deepl v0.3.0)

View Source

Provide base functions for the DeepL API.

Summary

Functions

Get base URL based on API key input.

Get the currently active API key.

Get current plan based on the API key.

Set the API key in the application environment.

Functions

base_url!()

(since 0.1.0)
@spec base_url!() :: String.t()

Get base URL based on API key input.

Returns base URL for pro or free accounts, determined by the API key, free account keys end with :fx.

Examples

iex> Deepl.base_url!()
"https://api-free.deepl.com"

get_api_key()

(since 0.1.0)
@spec get_api_key() :: String.t() | nil

Get the currently active API key.

Examples

iex> Deepl.get_api_key()
"wwwwwwww-xxxx-yyyy-zzzz-123456789012:fx"

plan!()

(since 0.1.0)
@spec plan!() :: :free | :pro | Exception.t()

Get current plan based on the API key.

Returns atom :free for free accounts and :pro for pro accounts.

Examples

iex> Deepl.plan!()
:free

set_api_key(key)

(since 0.1.0)
@spec set_api_key(String.t()) :: :ok

Set the API key in the application environment.

Examples

iex> Deepl.set_api_key("wwwwwwww-xxxx-yyyy-zzzz-123456789012:fx")
:ok