Current section
Files
Jump to
Current section
Files
lib/core_apis/api/session.ex
# NOTE: This file is auto generated by OpenAPI Generator 6.6.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule CoreAPIs.Api.Session do
@moduledoc """
API calls for all endpoints tagged `Session`.
"""
alias CoreAPIs.Connection
import CoreAPIs.RequestBuilder
@doc """
Create Login session
### Parameters
- `connection` (CoreAPIs.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:body` (CreateSessionRequest):
### Returns
- `{:ok, CoreAPIs.Model.Session.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_session(Tesla.Env.client, keyword()) :: {:ok, CoreAPIs.Model.Session.t} | {:error, Tesla.Env.t}
def create_session(connection, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/sessions")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %CoreAPIs.Model.Session{}}
])
end
end