Current section
Files
Jump to
Current section
Files
lib/open_xchange_client/api/autoconfig.ex
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule OpenXchangeClient.Api.Autoconfig do
@moduledoc """
API calls for all endpoints tagged `Autoconfig`.
"""
alias OpenXchangeClient.Connection
import OpenXchangeClient.RequestBuilder
@doc """
Gets the auto configuration for a mail account.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- email (String.t): The email address for which a mail configuration will be discovered.
- password (String.t): The corresponding password for the mail account.
- opts (KeywordList): [optional] Optional parameters
- :force_secure (boolean()): Enforces a secure connection for configured mail account, default is `true`.
- :oauth (integer()): The optional identifier of the OAuth account to use for authentication.
## Returns
{:ok, OpenXchangeClient.Model.AutoConfigResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_auto_config(Tesla.Env.client(), String.t(), String.t(), String.t(), keyword()) ::
{:ok, OpenXchangeClient.Model.AutoConfigResponse.t()} | {:error, Tesla.Env.t()}
def get_auto_config(connection, session, email, password, opts \\ []) do
optional_params = %{
:force_secure => :form,
:oauth => :form
}
%{}
|> method(:post)
|> url("/autoconfig?action=get")
|> add_param(:query, :session, session)
|> add_param(:form, :email, email)
|> add_param(:form, :password, password)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AutoConfigResponse{}}
])
end
end