com.mailgun.api.v3.MailgunMessagesApi Maven / Gradle / Ivy
Show all versions of mailgun-java Show documentation
package com.mailgun.api.v3;
import java.util.concurrent.CompletableFuture;
import com.mailgun.api.MailgunApi;
import com.mailgun.model.message.MailgunMimeMessage;
import com.mailgun.model.message.Message;
import com.mailgun.model.message.MessageResponse;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
import feign.Response;
/**
*
* This API allows you to send emails.
*
*
* When you submit messages for delivery Mailgun places them in a message queue.
*
*
* @see Send emails
*/
@Headers({"Content-Type: multipart/form-data", "Accept: application/json"})
public interface MailgunMessagesApi extends MailgunApi {
/**
*
* Send email(s).
*
*
* @param domain Name of the domain
* @param message {@link Message}
* @return {@link MessageResponse}
*/
@RequestLine("POST /{domain}/messages")
MessageResponse sendMessage(@Param("domain") String domain, Message message);
/**
*
* Send email(s).
*
*
* @param domain Name of the domain
* @param message {@link Message}
* @return {@link Response}
*/
@RequestLine("POST /{domain}/messages")
Response sendMessageFeignResponse(@Param("domain") String domain, Message message);
/**
*
* Asynchronously send email(s).
*
*
* Note: Use the asynchronous Mailgun client for this method.
*
* MailgunClient.config(PRIVATE_API_KEY)
* .createAsyncApi(MailgunMessagesApi.class);
*
*
* @param domain Name of the domain
* @param message {@link Message}
* @return {@link CompletableFuture} wrapped {@link MessageResponse}
*/
@RequestLine("POST /{domain}/messages")
CompletableFuture sendMessageAsync(@Param("domain") String domain, Message message);
/**
*
* Asynchronously send email(s).
*
*
* Note: Use the asynchronous Mailgun client for this method.
*
* MailgunClient.config(PRIVATE_API_KEY)
* .createAsyncApi(MailgunMessagesApi.class);
*
*
* @param domain Name of the domain
* @param message {@link Message}
* @return {@link CompletableFuture} wrapped {@link Response}
*/
@RequestLine("POST /{domain}/messages")
CompletableFuture sendMessageFeignResponseAsync(@Param("domain") String domain, Message message);
/**
*
* Send email(s) in MIME format.
*
*
* @param domain Name of the domain
* @param message {@link MailgunMimeMessage}
* @return {@link MessageResponse}
*/
@RequestLine("POST /{domain}/messages.mime")
MessageResponse sendMIMEMessage(@Param("domain") String domain, MailgunMimeMessage message);
/**
*
* Send email(s) in MIME format.
*
*
* @param domain Name of the domain
* @param message {@link MailgunMimeMessage}
* @return {@link Response}
*/
@RequestLine("POST /{domain}/messages.mime")
Response sendMIMEMessageFeignResponse(@Param("domain") String domain, MailgunMimeMessage message);
/**
*
* Asynchronously send email(s) in MIME format.
*
*
* Note: Use the asynchronous Mailgun client for this method.
*
* MailgunClient.config(PRIVATE_API_KEY)
* .createAsyncApi(MailgunMessagesApi.class);
*
*
* @param domain Name of the domain
* @param message {@link MailgunMimeMessage}
* @return {@link CompletableFuture} wrapped {@link MessageResponse}
*/
@RequestLine("POST /{domain}/messages.mime")
CompletableFuture sendMIMEMessageAsync(@Param("domain") String domain, MailgunMimeMessage message);
/**
*
* Asynchronously send email(s) in MIME format.
*
*
* Note: Use the asynchronous Mailgun client for this method.
*
* MailgunClient.config(PRIVATE_API_KEY)
* .createAsyncApi(MailgunMessagesApi.class);
*
*
* @param domain Name of the domain
* @param message {@link MailgunMimeMessage}
* @return {@link CompletableFuture} wrapped {@link Response}
*/
@RequestLine("POST /{domain}/messages.mime")
CompletableFuture sendMIMEMessageFeignResponseAsync(@Param("domain") String domain, MailgunMimeMessage message);
}