lib/mail_slurp_api/api/api_user_controller.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 MailSlurpAPI.Api.ApiUserController do
  @moduledoc """
  API calls for all endpoints tagged `ApiUserController`.
  """

  alias MailSlurpAPI.Connection
  import MailSlurpAPI.RequestBuilder


  @doc """
  Utility function to extract properties from JSON objects in language where this is cumbersome.

  ## Parameters

  - connection (MailSlurpAPI.Connection): Connection to server
  - property (String.t): JSON property name or dot separated path selector such as `a.b.c`
  - body (Map): 
  - opts (KeywordList): [optional] Optional parameters
  ## Returns

  {:ok, %MailSlurpAPI.Model.String.t{}} on success
  {:error, info} on failure
  """
  @spec get_json_property_as_string(Tesla.Env.client, String.t, Map, keyword()) :: {:ok, String.t} | {:error, Tesla.Env.t}
  def get_json_property_as_string(connection, property, body, _opts \\ []) do
    %{}
    |> method(:post)
    |> url("/user/json/pluck")
    |> add_param(:query, :"property", property)
    |> add_param(:body, :body, body)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> evaluate_response([
      { 200, false}
    ])
  end

  @doc """

  ## Parameters

  - connection (MailSlurpAPI.Connection): Connection to server
  - opts (KeywordList): [optional] Optional parameters
  ## Returns

  {:ok, %MailSlurpAPI.Model.UserInfoDto{}} on success
  {:error, info} on failure
  """
  @spec get_user_info(Tesla.Env.client, keyword()) :: {:ok, MailSlurpAPI.Model.UserInfoDto.t} | {:error, Tesla.Env.t}
  def get_user_info(connection, _opts \\ []) do
    %{}
    |> method(:get)
    |> url("/user/info")
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> evaluate_response([
      { 200, %MailSlurpAPI.Model.UserInfoDto{}}
    ])
  end
end