Current section

Files

Jump to
open_xchange_client lib open_xchange_client api token.ex
Raw

lib/open_xchange_client/api/token.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.Token do
@moduledoc """
API calls for all endpoints tagged `Token`.
"""
alias OpenXchangeClient.Connection
import OpenXchangeClient.RequestBuilder
@doc """
Gets a login token.
With a valid session it is possible to acquire a secret. Using this secret another system is able to generate a valid session (see [login?action=redeemToken](#operation--login-action-redeemToken-post)).
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.AcquireTokenResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec acquire_token(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, OpenXchangeClient.Model.AcquireTokenResponse.t()} | {:error, Tesla.Env.t()}
def acquire_token(connection, session, _opts \\ []) do
%{}
|> method(:get)
|> url("/token?action=acquireToken")
|> add_param(:query, :session, session)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.AcquireTokenResponse{}}
])
end
end