# 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.CommonActionsController do @moduledoc """ API calls for all endpoints tagged `CommonActionsController`. """ alias MailSlurpAPI.Connection import MailSlurpAPI.RequestBuilder @doc """ Create new random inbox Returns an Inbox with an `id` and an `emailAddress` ## Parameters - connection (MailSlurpAPI.Connection): Connection to server - opts (KeywordList): [optional] Optional parameters - :allow_team_access (boolean()): - :use_domain_pool (boolean()): - :expires_at (DateTime.t): - :expires_in (integer()): - :email_address (String.t): - :inbox_type (String.t): - :description (String.t): - :name (String.t): - :tags ([String.t]): - :favourite (boolean()): - :virtual_inbox (boolean()): ## Returns {:ok, %MailSlurpAPI.Model.InboxDto{}} on success {:error, info} on failure """ @spec create_new_email_address(Tesla.Env.client, keyword()) :: {:ok, MailSlurpAPI.Model.InboxDto.t} | {:error, Tesla.Env.t} def create_new_email_address(connection, opts \\ []) do optional_params = %{ :"allowTeamAccess" => :query, :"useDomainPool" => :query, :"expiresAt" => :query, :"expiresIn" => :query, :"emailAddress" => :query, :"inboxType" => :query, :"description" => :query, :"name" => :query, :"tags" => :query, :"favourite" => :query, :"virtualInbox" => :query } %{} |> method(:post) |> url("/newEmailAddress") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ { 201, %MailSlurpAPI.Model.InboxDto{}} ]) end @doc """ Create new random inbox Returns an Inbox with an `id` and an `emailAddress` ## Parameters - connection (MailSlurpAPI.Connection): Connection to server - opts (KeywordList): [optional] Optional parameters - :allow_team_access (boolean()): - :use_domain_pool (boolean()): - :expires_at (DateTime.t): - :expires_in (integer()): - :email_address (String.t): - :inbox_type (String.t): - :description (String.t): - :name (String.t): - :tags ([String.t]): - :favourite (boolean()): - :virtual_inbox (boolean()): ## Returns {:ok, %MailSlurpAPI.Model.InboxDto{}} on success {:error, info} on failure """ @spec create_random_inbox(Tesla.Env.client, keyword()) :: {:ok, MailSlurpAPI.Model.InboxDto.t} | {:error, Tesla.Env.t} def create_random_inbox(connection, opts \\ []) do optional_params = %{ :"allowTeamAccess" => :query, :"useDomainPool" => :query, :"expiresAt" => :query, :"expiresIn" => :query, :"emailAddress" => :query, :"inboxType" => :query, :"description" => :query, :"name" => :query, :"tags" => :query, :"favourite" => :query, :"virtualInbox" => :query } %{} |> method(:post) |> url("/createInbox") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ { 201, %MailSlurpAPI.Model.InboxDto{}} ]) end @doc """ Delete inbox email address by inbox id Deletes inbox email address ## Parameters - connection (MailSlurpAPI.Connection): Connection to server - inbox_id (String.t): - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %{}} on success {:error, info} on failure """ @spec delete_email_address(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def delete_email_address(connection, inbox_id, _opts \\ []) do %{} |> method(:delete) |> url("/deleteEmailAddress") |> add_param(:query, :"inboxId", inbox_id) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ { 204, false} ]) end @doc """ Delete all emails in an inbox Deletes all emails ## Parameters - connection (MailSlurpAPI.Connection): Connection to server - inbox_id (String.t): - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %{}} on success {:error, info} on failure """ @spec empty_inbox(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def empty_inbox(connection, inbox_id, _opts \\ []) do %{} |> method(:delete) |> url("/emptyInbox") |> add_param(:query, :"inboxId", inbox_id) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ { 204, false} ]) end @doc """ Send an email If no senderId or inboxId provided a random email address will be used to send from. ## Parameters - connection (MailSlurpAPI.Connection): Connection to server - simple_send_email_options (SimpleSendEmailOptions): - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %{}} on success {:error, info} on failure """ @spec send_email_simple(Tesla.Env.client, MailSlurpAPI.Model.SimpleSendEmailOptions.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def send_email_simple(connection, simple_send_email_options, _opts \\ []) do %{} |> method(:post) |> url("/sendEmail") |> add_param(:body, :body, simple_send_email_options) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ { 201, false} ]) end end