com.mailgun.api.v3.suppression.MailgunSuppressionUnsubscribeApi Maven / Gradle / Ivy
Show all versions of mailgun-java Show documentation
package com.mailgun.api.v3.suppression;
import com.mailgun.api.MailgunApi;
import com.mailgun.model.ResponseWithMessage;
import com.mailgun.model.suppression.SuppressionResponse;
import com.mailgun.model.suppression.unsubscribe.UnsubscribeItem;
import com.mailgun.model.suppression.unsubscribe.UnsubscribeItemResponse;
import com.mailgun.model.suppression.unsubscribe.UnsubscribeSingleItemRequest;
import com.mailgun.model.suppression.unsubscribe.UnsubscribesListImportRequest;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
import feign.Response;
import java.util.List;
/**
*
* Mailgun Suppression Unsubscribe Api
*
*
*
* Mailgun keeps three lists of addresses it blocks the delivery to: bounces, unsubscribes and complaints.
* These lists are populated automatically as Mailgun detects undeliverable addresses you try to send to
* and as recipients unsubscribe from your mailings or mark your emails as a spam (for ESPs that provide FBL).
* You can also add/remove addresses from any of these lists using the API.
*
*
* It’s important to note that these suppression lists are unique to a sending domain and are not an account level (global) suppression list.
* If you want to add/remove the same address(es) from multiple domains, you’ll need to do so for each domain.
*
*
*
* Unsubscribe list stores email addresses of recipients who unsubscribed from your mailings by clicking a Mailgun generated unsubscribe link.
*
*
*
* Mailgun allows you to quickly add “Unsubscribe me” feature to your outgoing emails without any programming on your end.
* You can enable this in your Control Panel under your domain settings
*
*
*
* Mailgun can notify your application every time a user unsubscribes via an
* unsubscribed webhook
*
.
*
* @see Suppressions/Unsubscribe
*/
@Headers("Accept: application/json")
public interface MailgunSuppressionUnsubscribeApi extends MailgunApi {
/**
*
* Returns a list of unsubscribes for a domain (limit to 100 entries).
*
*
* Note: Via this API method unsubscribes are returned in the alphabetical order.
* If you wish to poll for the recently occurred unsubscribes, please consider using the {@link com.mailgun.api.v3.MailgunEventsApi}.
*
*
* @param domain Name of the domain
* @return {@link UnsubscribeItemResponse}
*/
@RequestLine("GET /{domain}/unsubscribes")
UnsubscribeItemResponse getAllUnsubscribe(@Param("domain") String domain);
/**
*
* Returns a list of unsubscribes for a domain (limit to 100 entries).
*
*
* Note: Via this API method unsubscribes are returned in the alphabetical order.
* If you wish to poll for the recently occurred unsubscribes, please consider using the {@link com.mailgun.api.v3.MailgunEventsApi}.
*
*
* @param domain Name of the domain
* @return {@link Response}
*/
@RequestLine("GET /{domain}/unsubscribes")
Response getAllUnsubscribeFeignResponse(@Param("domain") String domain);
/**
*
* Returns a list of unsubscribes for a domain.
*
*
* Note: Via this API method unsubscribes are returned in the alphabetical order.
* If you wish to poll for the recently occurred unsubscribes, please consider using the {@link com.mailgun.api.v3.MailgunEventsApi}.
*
*
* @param domain Name of the domain
* @param limit Number of entries to return, max: 10000.
* @return {@link UnsubscribeItemResponse}
*/
@RequestLine("GET /{domain}/unsubscribes?limit={limit}")
UnsubscribeItemResponse getAllUnsubscribe(@Param("domain") String domain, @Param("limit") Integer limit);
/**
*
* Returns a list of unsubscribes for a domain.
*
*
* Note: Via this API method unsubscribes are returned in the alphabetical order.
* If you wish to poll for the recently occurred unsubscribes, please consider using the {@link com.mailgun.api.v3.MailgunEventsApi}.
*
*
* @param domain Name of the domain
* @param limit Number of entries to return, max: 10000.
* @return {@link Response}
*/
@RequestLine("GET /{domain}/unsubscribes?limit={limit}")
Response getAllUnsubscribeFeignResponse(@Param("domain") String domain, @Param("limit") Integer limit);
/**
*
* Fetch a single unsubscribe record. Can be used to check if a given address is present in the list of unsubscribed users.
*
*
* @param domain Name of the domain
* @param address An email address
* @return {@link UnsubscribeItem}
*/
@RequestLine("GET /{domain}/unsubscribes/{address}")
UnsubscribeItem getSingleUnsubscribe(@Param("domain") String domain, @Param("address") String address);
/**
*
* Fetch a single unsubscribe record. Can be used to check if a given address is present in the list of unsubscribed users.
*
*
* @param domain Name of the domain
* @param address An email address
* @return {@link Response }
*/
@RequestLine("GET /{domain}/unsubscribes/{address}")
Response getSingleUnsubscribeFeignResponse(@Param("domain") String domain, @Param("address") String address);
/**
*
* Add an address to the unsubscribe table.
*
*
* @param domain Name of the domain
* @param request {@link UnsubscribeSingleItemRequest}
* @return {@link SuppressionResponse}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/unsubscribes")
SuppressionResponse addAddressToUnsubscribeTable(@Param("domain") String domain, UnsubscribeSingleItemRequest request);
/**
*
* Add an address to the unsubscribe table.
*
*
* @param domain Name of the domain
* @param request {@link UnsubscribeSingleItemRequest}
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/unsubscribes")
Response addAddressToUnsubscribeTableFeignResponse(@Param("domain") String domain, UnsubscribeSingleItemRequest request);
/**
*
* Add multiple unsubscribe records to the unsubscribe list in a single API call(up to 1000 unsubscribe records).
*
*
* @param domain Name of the domain
* @param request list of {@link UnsubscribeItem}
* @return {@link ResponseWithMessage}
*/
@Headers("Content-Type: application/json")
@RequestLine("POST /{domain}/unsubscribes")
ResponseWithMessage addAddressesToUnsubscribeTable(@Param("domain") String domain, List request);
/**
*
* Add multiple unsubscribe records to the unsubscribe list in a single API call(up to 1000 unsubscribe records).
*
*
* @param domain Name of the domain
* @param request list of {@link UnsubscribeItem}
* @return {@link Response}
*/
@Headers("Content-Type: application/json")
@RequestLine("POST /{domain}/unsubscribes")
Response addAddressesToUnsubscribeTableFeignResponse(@Param("domain") String domain, List request);
/**
*
* Import a CSV file containing a list of addresses to add to the unsubscribe list.
*
*
* CSV file must be 25MB or under and must contain the following column headers:
*
*
* address
Valid email address
* tags
Tag to unsubscribe from, use * to unsubscribe an address from all domain’s correspondence (optional, default: *)
* created_at
Timestamp of a bounce event in RFC2822 format (optional, default: current time)
*
*
* @param domain Name of the domain
* @param request list of {@link UnsubscribesListImportRequest}
* @return {@link ResponseWithMessage}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/unsubscribes/import")
ResponseWithMessage importAddressesToUnsubscribeTable(@Param("domain") String domain, UnsubscribesListImportRequest request);
/**
*
* Import a CSV file containing a list of addresses to add to the unsubscribe list.
*
*
* CSV file must be 25MB or under and must contain the following column headers:
*
*
* address
Valid email address
* tags
Tag to unsubscribe from, use * to unsubscribe an address from all domain’s correspondence (optional, default: *)
* created_at
Timestamp of a bounce event in RFC2822 format (optional, default: current time)
*
*
* @param domain Name of the domain
* @param request list of {@link UnsubscribesListImportRequest}
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/unsubscribes/import")
Response importAddressesToUnsubscribeTableFeignResponse(@Param("domain") String domain, UnsubscribesListImportRequest request);
/**
*
* Remove an address from the unsubscribes list.
*
*
* @param domain Name of the domain
* @param address An email address
* @param tag Specific tag to remove (optional)
* @return {@link SuppressionResponse}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("DELETE /{domain}/unsubscribes/{address}")
SuppressionResponse removeAddressFromUnsubscribeTag(@Param("domain") String domain, @Param("address") String address, @Param("tag") String tag);
/**
*
* Remove an address from the unsubscribes list.
*
*
* @param domain Name of the domain
* @param address An email address
* @param tag Specific tag to remove
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("DELETE /{domain}/unsubscribes/{address}")
Response removeAddressFromUnsubscribeTagFeignResponse(@Param("domain") String domain, @Param("address") String address, @Param("tag") String tag);
/**
*
* Completely remove an address from the unsubscribes list.
*
*
* @param domain Name of the domain
* @param address An email address
* @return {@link SuppressionResponse}
*/
@RequestLine("DELETE /{domain}/unsubscribes/{address}")
SuppressionResponse removeAddressFromUnsubscribeList(@Param("domain") String domain, @Param("address") String address);
/**
*
* Completely remove an address from the unsubscribes list.
*
*
* @param domain Name of the domain
* @param address An email address
* @return {@link Response}
*/
@RequestLine("DELETE /{domain}/unsubscribes/{address}")
Response removeAddressFromUnsubscribeListFeignResponse(@Param("domain") String domain, @Param("address") String address);
}