Add checking and updating DeepL usage information

This commit is contained in:
Thelonius Kort
2023-01-10 20:06:54 +01:00
parent 33ed533a1a
commit e16710664d
4 changed files with 21 additions and 8 deletions

View File

@ -10,6 +10,12 @@ defmodule Outlook.Translators.Deepl do
send(pid, {:progress, %{progress: nil}})
end
def get_usage_counts(auth_key) do
response = HTTPoison.get!("https://api-free.deepl.com/v2/usage",
["Authorization": "DeepL-Auth-Key #{auth_key}"])
Jason.decode!(response.body, keys: :atoms)
end
# @options [ssl: [{:versions, [:'tlsv1.2']}], recv_timeout: 500]
@doc """