Add checking and updating DeepL usage information
This commit is contained in:
@ -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 """
|
||||
|
||||
@ -18,6 +18,6 @@ defmodule Outlook.Translators.DeeplAccount do
|
||||
def changeset(deepl_account, attrs) do
|
||||
deepl_account
|
||||
|> cast(attrs, [:name, :description, :auth_key, :character_limit, :character_count, :our_character_count, :user_id])
|
||||
|> validate_required([:name, :description, :auth_key, :character_limit, :user_id])
|
||||
|> validate_required([:name, :description, :auth_key, :user_id])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user