├── .github └── dependabot.yml ├── .gitignore ├── .travis.yml ├── LICENCE ├── README.md ├── lombok.config ├── pom.xml └── src ├── main └── java │ └── com │ └── mailjet │ └── client │ ├── Base64.java │ ├── ClientOptions.java │ ├── MailjetClient.java │ ├── MailjetRequest.java │ ├── MailjetRequestUtil.java │ ├── MailjetResponse.java │ ├── MailjetResponseUtil.java │ ├── Resource.java │ ├── easy │ ├── MJEasyClient.java │ ├── MJEasyEmail.java │ ├── MJEasySms.java │ └── package-info.java │ ├── enums │ ├── ApiAuthenticationType.java │ └── ApiVersion.java │ ├── errors │ ├── MailjetClientCommunicationException.java │ ├── MailjetClientRequestException.java │ ├── MailjetException.java │ ├── MailjetRateLimitException.java │ ├── MailjetServerException.java │ └── MailjetUnauthorizedException.java │ ├── package-info.java │ ├── resource │ ├── Aggregategraphstatistics.java │ ├── Apikey.java │ ├── Apikeyaccess.java │ ├── Apikeytotals.java │ ├── Apitoken.java │ ├── Axtesting.java │ ├── Batchjob.java │ ├── Bouncestatistics.java │ ├── Campaign.java │ ├── Campaignaggregate.java │ ├── Campaigndraft.java │ ├── CampaigndraftDetailcontent.java │ ├── CampaigndraftSchedule.java │ ├── CampaigndraftSend.java │ ├── CampaigndraftStatus.java │ ├── CampaigndraftTest.java │ ├── Campaigngraphstatistics.java │ ├── Campaignoverview.java │ ├── Campaignstatistics.java │ ├── Clickstatistics.java │ ├── Contact.java │ ├── ContactGetcontactslists.java │ ├── ContactManagecontactslists.java │ ├── ContactManagemanycontacts.java │ ├── Contactdata.java │ ├── Contactfilter.java │ ├── Contacthistorydata.java │ ├── Contactmetadata.java │ ├── Contacts.java │ ├── Contactslist.java │ ├── ContactslistImportList.java │ ├── ContactslistManageContact.java │ ├── ContactslistManageManyContacts.java │ ├── Contactslistsignup.java │ ├── Contactstatistics.java │ ├── Csvimport.java │ ├── Dns.java │ ├── DnsCheck.java │ ├── Domainstatistics.java │ ├── Email.java │ ├── Emailv31.java │ ├── Eventcallbackurl.java │ ├── Geostatistics.java │ ├── Graphstatistics.java │ ├── Listrecipient.java │ ├── Listrecipientstatistics.java │ ├── Message.java │ ├── Messagehistory.java │ ├── Messageinformation.java │ ├── Messagestate.java │ ├── Messagestatistics.java │ ├── Metadata.java │ ├── Metasender.java │ ├── Myprofile.java │ ├── Newsletter.java │ ├── NewsletterDetailcontent.java │ ├── NewsletterSchedule.java │ ├── NewsletterSend.java │ ├── NewsletterStatus.java │ ├── NewsletterTest.java │ ├── Newslettertemplate.java │ ├── Newslettertemplatecategory.java │ ├── Openinformation.java │ ├── Openstatistics.java │ ├── Parseroute.java │ ├── Preferences.java │ ├── Preset.java │ ├── Sender.java │ ├── SenderValidate.java │ ├── Senderstatistics.java │ ├── Statcounters.java │ ├── StatisticsLinkclick.java │ ├── StatisticsRecepientesp.java │ ├── Template.java │ ├── TemplateDetailcontent.java │ ├── TemplateDetailpreviews.java │ ├── TemplateDetailthumbnail.java │ ├── TemplateDisplaypreview.java │ ├── TemplateDisplaythumbnail.java │ ├── Toplinkclicked.java │ ├── Trigger.java │ ├── User.java │ ├── UserActivate.java │ ├── Useragentstatistics.java │ ├── Widget.java │ ├── Widgetcustomvalue.java │ └── sms │ │ ├── Sms.java │ │ ├── SmsCount.java │ │ ├── SmsExport.java │ │ └── SmsSend.java │ └── transactional │ ├── Attachment.java │ ├── SendContact.java │ ├── SendEmailsRequest.java │ ├── TrackClicks.java │ ├── TrackOpens.java │ ├── TransactionalEmail.java │ └── response │ ├── EmailResult.java │ ├── MessageResult.java │ ├── SendEmailError.java │ ├── SendEmailsResponse.java │ └── SentMessageStatus.java └── test ├── java └── com │ └── mailjet │ └── client │ ├── Base64Test.java │ ├── ContactFlowIT.java │ ├── MailjetClientExceptionTest.java │ ├── MailjetClientTest.java │ ├── MailjetExceptionIT.java │ ├── MailjetRequestTest.java │ ├── MailjetRequestUtilTest.java │ ├── MailjetResponseTest.java │ ├── MailjetResponseUtilTest.java │ ├── MessageEndpointFilteringIT.java │ ├── SendIT.java │ ├── SendSmsIT.java │ ├── StatisticsIT.java │ ├── TemplateIT.java │ ├── TestHelper.java │ ├── TransactionalEmailBuilderIT.java │ ├── TransactionalEmailBuilderTest.java │ ├── easy │ ├── MJEasyClientTest.java │ ├── MJEasyEmailTest.java │ └── MJEasySmsTest.java │ └── transactional │ ├── AttachmentTest.java │ └── SendEmailsRequestTest.java └── resources └── Test-attachment.txt /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | open-pull-requests-limit: 16 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/* 2 | /.idea 3 | /.classpath 4 | /.project 5 | /.settings/org.eclipse.core.resources.prefs 6 | /.settings/org.eclipse.jdt.core.prefs 7 | /.settings/org.eclipse.m2e.core.prefs 8 | mailjet-client.iml 9 | release.properties 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | script: mvn verify 3 | notifications: 4 | slack: 5 | secure: IMaSW3IgweT0HwDPo67iGwS/e7WD78y52Gz5m+VMbsiaryVRnetzttD+swerZ6DvvJe8vlpW+718a+/d9epG9oA63mbZ/kXPlAsPToqHN0/HH5QIlUfaupJeP4srXkqsnK+VnSw8cGxh9Ks5IE/cUvTLRGxKOP/qk7Gc3Sb55Kg= 6 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2013-2015 Mashape (https://www.mashape.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /lombok.config: -------------------------------------------------------------------------------- 1 | # this is root dir and don't search for parent 2 | config.stopBubbling = true 3 | # add @Generated and Jacoco will detect Lombok generated code and ignore them in reports 4 | lombok.addLombokGeneratedAnnotation = true 5 | 6 | # Copy the Qualifier annotation from the instance variables to the constructor 7 | # see https://github.com/rzwitserloot/lombok/issues/745 8 | lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Qualifier 9 | lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Value 10 | 11 | lombok.equalsAndHashCode.callSuper=call 12 | lombok.toString.callSuper=call 13 | 14 | # Use JDK's NonNull annotation instead of Lombok's 15 | lombok.nonNull.exceptionType = JDK 16 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/Base64.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | 4 | import static java.nio.charset.StandardCharsets.UTF_8; 5 | 6 | public class Base64 { 7 | 8 | /** 9 | * Translates the specified byte array into Base64 string. 10 | * 11 | * @param buf the byte array (not null) 12 | * @return the translated Base64 string (not null) 13 | */ 14 | public static String encode(byte[] buf){ 15 | return new String(java.util.Base64.getEncoder().encode(buf), UTF_8); 16 | } 17 | 18 | /** 19 | * Translates the specified Base64 string into a byte array. 20 | * 21 | * @param s the Base64 string (not null) 22 | * @return the byte array (not null) 23 | */ 24 | public static byte[] decode(String s){ 25 | return java.util.Base64.getDecoder().decode(s); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/ClientOptions.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | import okhttp3.OkHttpClient; 6 | 7 | /** 8 | * Class used to configure MailJet client 9 | * 10 | */ 11 | @Builder 12 | @Data 13 | public class ClientOptions { 14 | 15 | private static final String defaultBaseURL = "https://api.mailjet.com"; 16 | 17 | /** 18 | * base Url for all API calls 19 | */ 20 | @Builder.Default 21 | private String baseUrl = defaultBaseURL; 22 | 23 | /** 24 | * Bearer token used for SMS Api calls 25 | */ 26 | private String bearerAccessToken; 27 | 28 | /** 29 | * API key to authenticate Email Api calls 30 | */ 31 | private String apiKey; 32 | 33 | /** 34 | * API secret key to authenticate Email Api calls 35 | */ 36 | private String apiSecretKey; 37 | 38 | /** 39 | * If set to the customly created OkHttp client, mailJet client will use provided client 40 | * Instead of creating the new one internally 41 | * use this to add custom calls interceptors/logging/etc 42 | */ 43 | private OkHttpClient okHttpClient; 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/MailjetRequestUtil.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import java.math.BigDecimal; 4 | 5 | /** 6 | * 7 | * @author s.stoyanov 8 | * 9 | */ 10 | public final class MailjetRequestUtil { 11 | 12 | private MailjetRequestUtil() { 13 | } 14 | 15 | public static String encodeDecimal(BigDecimal value) { 16 | return value != null ? "\f" + (value.scale() != 0 ? value : value.setScale(1)).toString() + "\f" : null; 17 | } 18 | 19 | public static String decodeDecimals(String payload) { 20 | return payload != null ? payload.replaceAll("\"\\\\f([^\"]+)\\\\f\"", "$1") : null; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/MailjetResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.mailjet.client; 7 | 8 | import com.mailjet.client.errors.MailjetException; 9 | import org.json.JSONArray; 10 | import org.json.JSONObject; 11 | 12 | import lombok.Getter; 13 | 14 | /** 15 | * 16 | * @author Guillaume Badi 17 | */ 18 | public class MailjetResponse { 19 | 20 | private final JSONObject responseObject; 21 | private final String rawResponse; 22 | /** 23 | * -- GETTER -- 24 | * 25 | * @return HTTP status code returned by Mailjet server 26 | */ 27 | @Getter 28 | private final int status; 29 | 30 | public MailjetResponse(int status, String rawResponse) { 31 | responseObject = new JSONObject(rawResponse); 32 | this.rawResponse = rawResponse; 33 | this.status = status; 34 | } 35 | 36 | /** 37 | * @return Raw response string sent by Mailjet server 38 | */ 39 | public String getRawResponseContent() { return rawResponse; } 40 | 41 | public JSONArray getData() { 42 | if (responseObject.has("Data")) { 43 | return responseObject.getJSONArray("Data"); 44 | } else if (responseObject.has("Sent")) { 45 | return responseObject.getJSONArray("Sent"); 46 | } else if (responseObject.has("Messages")) { 47 | return responseObject.getJSONArray("Messages"); 48 | } else { 49 | return (new JSONArray()).put(responseObject); 50 | } 51 | } 52 | 53 | public int getTotal() { 54 | if (responseObject.has("Total")) { 55 | return responseObject.getInt("Total"); 56 | } else { 57 | return 0; 58 | } 59 | } 60 | 61 | public String getString(String key) throws MailjetException { 62 | try { 63 | return responseObject.getString(key); 64 | } catch (NullPointerException e) { 65 | throw new MailjetException("No entry found for key: " + key); 66 | } 67 | } 68 | 69 | public int getInt(String key) throws MailjetException { 70 | try { 71 | return responseObject.getInt(key); 72 | } catch (NullPointerException e) { 73 | throw new MailjetException("No entry found for key: " + key); 74 | } 75 | } 76 | 77 | public JSONArray getJSONArray(String key) throws MailjetException { 78 | try { 79 | return responseObject.getJSONArray(key); 80 | } catch (NullPointerException e) { 81 | throw new MailjetException("No entry found for key: " + key); 82 | } 83 | } 84 | 85 | public int getCount() { 86 | if (responseObject.has("Count")) { 87 | return responseObject.getInt("Count"); 88 | } else { 89 | return 0; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/MailjetResponseUtil.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.enums.ApiVersion; 4 | import com.mailjet.client.errors.*; 5 | 6 | import com.mailjet.client.resource.Emailv31; 7 | 8 | /** 9 | * 10 | * @author y.vanov 11 | * 12 | */ 13 | public final class MailjetResponseUtil { 14 | 15 | private static final int TOO_MANY_REQUEST_STATUS = 429; 16 | private static final int INTERNAL_SERVER_ERROR_STATUS = 500; 17 | private static final int BAD_REQUEST_ERROR_STATUS = 400; 18 | private static final int UNAUTHORIZED_STATUS = 401; 19 | public static final int CREATED_STATUS = 201; 20 | 21 | private static final String UNAUTHORIZED_MESSAGE = "Unauthorized. Please,verify your access key and access secret key or token for the given account"; 22 | private static final String TOO_MANY_REQUESTS_EXCEPTION = "Too Many Requests"; 23 | private static final String INTERNAL_SERVER_ERROR_GENERAL_EXCEPTION = "Internal Server Error: "; 24 | 25 | private MailjetResponseUtil() { 26 | } 27 | 28 | public static void validateMailjetResponse(MailjetRequest request, int responseCode, String responseBody) throws MailjetException { 29 | if (responseCode == TOO_MANY_REQUEST_STATUS) { 30 | throw new MailjetRateLimitException(TOO_MANY_REQUESTS_EXCEPTION); 31 | } else if (responseCode == UNAUTHORIZED_STATUS) { 32 | throw new MailjetUnauthorizedException(UNAUTHORIZED_MESSAGE); 33 | } else if (responseCode >= INTERNAL_SERVER_ERROR_STATUS) { 34 | throw new MailjetServerException(responseBody == null ? INTERNAL_SERVER_ERROR_GENERAL_EXCEPTION : responseBody); 35 | } else if (responseCode >= BAD_REQUEST_ERROR_STATUS) { // Errors between 400 and 500, exclude 429 and 401 36 | if (!isResponseIndicatesPartialSuccess(request, responseCode, responseBody)) { // do not throw exception if the response still can be parsed and verified 37 | throw new MailjetClientRequestException(responseBody, responseCode); 38 | } 39 | } 40 | } 41 | 42 | public static boolean isValidJSON(String json) { 43 | return json != null && json.trim().startsWith("{") && json.trim().endsWith("}"); 44 | } 45 | 46 | /** 47 | * Specific API methods support partial success 48 | * like, if we send multiple emails in bulk 49 | * and the one is failed and other one sent successfully 50 | * server returns 400 51 | * */ 52 | private static boolean isResponseIndicatesPartialSuccess(MailjetRequest request, int responseCode, String responseBody) { 53 | return responseCode == BAD_REQUEST_ERROR_STATUS && 54 | isValidJSON(responseBody) && 55 | ApiVersion.V3_1.equals(request.getApiVersion()) && 56 | Emailv31.resource.getResource().equals(request.getResource()); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/Resource.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.enums.ApiAuthenticationType; 4 | import com.mailjet.client.enums.ApiVersion; 5 | import lombok.Getter; 6 | 7 | /** 8 | * 9 | * @author guillaume 10 | */ 11 | public class Resource { 12 | 13 | @Getter 14 | private final String resource; 15 | 16 | @Getter 17 | private final String action; 18 | 19 | @Getter 20 | private final Boolean withoutNamespace; 21 | 22 | @Getter 23 | private final ApiVersion apiVersion; 24 | 25 | @Getter 26 | private final ApiAuthenticationType authenticationType; 27 | 28 | public Resource(String resource, String action, ApiVersion apiVersion, ApiAuthenticationType authenticationType, Boolean withoutNamespace) { 29 | this.resource = resource; 30 | this.action = action; 31 | this.withoutNamespace = withoutNamespace; 32 | this.apiVersion = apiVersion; 33 | this.authenticationType = authenticationType; 34 | } 35 | 36 | public Resource(String resource, String action, ApiVersion apiVersion, ApiAuthenticationType authenticationType) { 37 | 38 | this(resource, action, apiVersion, authenticationType, false); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/easy/MJEasyClient.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.easy; 2 | 3 | import com.mailjet.client.ClientOptions; 4 | import com.mailjet.client.MailjetClient; 5 | import com.mailjet.client.MailjetRequest; 6 | import com.mailjet.client.resource.Email; 7 | import com.mailjet.client.resource.sms.SmsSend; 8 | 9 | import lombok.Getter; 10 | 11 | /** 12 | * Mailjet easy client 13 | */ 14 | @Getter 15 | public class MJEasyClient { 16 | /** 17 | * -- GETTER -- 18 | * Get the internal Mailjet client 19 | * 20 | * @return MailjetClient instance 21 | */ 22 | private final MailjetClient client; 23 | 24 | /** 25 | * Constructor with api keys 26 | * @param apiKeyPublic Public API Key 27 | * @param apiKeyPrivate Private API Key 28 | */ 29 | public MJEasyClient(String apiKeyPublic, String apiKeyPrivate) { 30 | ClientOptions clientOptions = ClientOptions 31 | .builder() 32 | .apiKey(apiKeyPublic) 33 | .apiSecretKey(apiKeyPrivate) 34 | .build(); 35 | 36 | client = new MailjetClient(clientOptions); 37 | } 38 | 39 | /** 40 | * Constructor with token 41 | * @param token V4 api token 42 | */ 43 | public MJEasyClient(String token) { 44 | ClientOptions clientOptions = ClientOptions 45 | .builder() 46 | .bearerAccessToken(token) 47 | .build(); 48 | 49 | client = new MailjetClient(clientOptions); 50 | } 51 | 52 | /** 53 | * Constructor using the MJ_APIKEY_PUBLIC and MJ_APIKEY_PRIVATE environment variables. 54 | */ 55 | public MJEasyClient() { 56 | ClientOptions clientOptions = ClientOptions 57 | .builder() 58 | .apiKey(System.getenv("MJ_APIKEY_PUBLIC")) 59 | .apiSecretKey(System.getenv("MJ_APIKEY_PRIVATE")) 60 | .build(); 61 | 62 | client = new MailjetClient(clientOptions); 63 | } 64 | 65 | /** 66 | * Constructor using a pre-configured MailjetClient instance. 67 | * @param client Pre-configured MailjetClient instance 68 | */ 69 | protected MJEasyClient(MailjetClient client) { 70 | this.client = client; 71 | } 72 | 73 | /** 74 | * Create an MJEasyEmail instance to prepare an email to send. 75 | * @return MJEasyEMail instance 76 | */ 77 | public MJEasyEmail email() { 78 | return new MJEasyEmail(this, new MailjetRequest(Email.resource)); 79 | } 80 | 81 | /** 82 | * Create an {@link MJEasySms} instance to prepare an email to send. 83 | * @return {@link MJEasyClient} instance 84 | */ 85 | public MJEasySms sms() { 86 | return new MJEasySms(this, new MailjetRequest(SmsSend.resource)); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/easy/MJEasyEmail.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.easy; 2 | 3 | import com.mailjet.client.MailjetRequest; 4 | import com.mailjet.client.MailjetResponse; 5 | import com.mailjet.client.errors.MailjetException; 6 | import com.mailjet.client.resource.Contact; 7 | import com.mailjet.client.resource.Email; 8 | import org.json.JSONArray; 9 | import org.json.JSONObject; 10 | 11 | /** 12 | * Mailjet easy email sending object. 13 | * 14 | * It's a MailjetRequest object wrapper 15 | */ 16 | public class MJEasyEmail { 17 | private final MJEasyClient client; 18 | private final MailjetRequest request; 19 | private final JSONArray recipients = new JSONArray(); 20 | 21 | protected MJEasyEmail(MJEasyClient client, MailjetRequest request) { 22 | this.client = client; 23 | this.request = request; 24 | } 25 | 26 | /** 27 | * Set the sender 28 | * @param email Email address of the sender 29 | * @param name Name of the sender 30 | * @return Current instance 31 | */ 32 | public MJEasyEmail from(String email, String name) { 33 | request.property(Email.FROMEMAIL, email); 34 | if (name != null) { 35 | request.property(Email.FROMNAME, name); 36 | } 37 | return this; 38 | } 39 | 40 | /** 41 | * Set the sender 42 | * @param email Email address of the sender 43 | * @return Current instance 44 | */ 45 | public MJEasyEmail from(String email) { 46 | return from(email, null); 47 | } 48 | 49 | /** 50 | * Add a recipient 51 | * @param email Email of the recipient 52 | * @return Current instance 53 | */ 54 | public MJEasyEmail to(String email) { 55 | recipients.put(new JSONObject().put(Contact.EMAIL, email)); 56 | request.property(Email.RECIPIENTS, recipients); 57 | return this; 58 | } 59 | 60 | /** 61 | * Set the subject 62 | * @param subject Subject of the email 63 | * @return Current instance 64 | */ 65 | public MJEasyEmail subject(String subject) { 66 | request.property(Email.SUBJECT, subject); 67 | return this; 68 | } 69 | 70 | /** 71 | * Set the text content of the message 72 | * @param text Text content 73 | * @return Current instance 74 | */ 75 | public MJEasyEmail text(String text) { 76 | request.property(Email.TEXTPART, text); 77 | return this; 78 | } 79 | 80 | /** 81 | * Set the HTML content of the message 82 | * @param html HTML content 83 | * @return Current instance 84 | */ 85 | public MJEasyEmail html(String html) { 86 | request.property(Email.HTMLPART, html); 87 | return this; 88 | } 89 | 90 | /** 91 | * Set the customID 92 | * @param customId CustomID 93 | * @return Current instance 94 | */ 95 | public MJEasyEmail customId(String customId) { 96 | request.property(Email.MJCUSTOMID, customId); 97 | return this; 98 | } 99 | 100 | /** 101 | * Send the email 102 | * @return a MailjetResponse instance 103 | * @throws MailjetException 104 | */ 105 | public MailjetResponse send() throws MailjetException { 106 | return client.getClient().post(request); 107 | } 108 | 109 | /** 110 | * Get the internal MailjetRequest wrapped by the MJEasyEmail object 111 | * @return MailjetRequest instance 112 | */ 113 | public MailjetRequest getRequest() { 114 | return request; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/easy/MJEasySms.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.easy; 2 | 3 | import com.mailjet.client.MailjetRequest; 4 | import com.mailjet.client.MailjetResponse; 5 | import com.mailjet.client.errors.MailjetException; 6 | import com.mailjet.client.resource.sms.SmsSend; 7 | 8 | /** 9 | * Mailjet easy sms sending object. 10 | * 11 | * It's a MailjetRequest object wrapper 12 | */ 13 | public class MJEasySms { 14 | private final MJEasyClient client; 15 | private final MailjetRequest request; 16 | 17 | protected MJEasySms(MJEasyClient client, MailjetRequest request) { 18 | this.client = client; 19 | this.request = request; 20 | } 21 | 22 | /** 23 | * Set the sender 24 | * @param number sender name 25 | * @return Current instance 26 | */ 27 | public MJEasySms from(String number) { 28 | request.property(SmsSend.FROM, number); 29 | return this; 30 | } 31 | 32 | /** 33 | * Set the recipient 34 | * @param number Number of the recipient 35 | * @return Current instance 36 | */ 37 | public MJEasySms to(String number) { 38 | request.property(SmsSend.TO, number); 39 | return this; 40 | } 41 | 42 | /** 43 | * Set the text content of the message 44 | * @param text Text content 45 | * @return Current instance 46 | */ 47 | public MJEasySms text(String text) { 48 | request.property(SmsSend.TEXT, text); 49 | return this; 50 | } 51 | 52 | /** 53 | * Send the sms 54 | * @return a MailjetResponse instance 55 | * @throws MailjetException 56 | */ 57 | public MailjetResponse send() throws MailjetException { 58 | return client.getClient().post(request); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/easy/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * A proposal of a higher-level wrapper of the java API. 3 | * 4 | * It should: 5 | * 10 | */ 11 | package com.mailjet.client.easy; 12 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/enums/ApiAuthenticationType.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.enums; 2 | 3 | public enum ApiAuthenticationType { 4 | Basic, 5 | Bearer 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/enums/ApiVersion.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * Declares constants with supported MailJet API versions 7 | */ 8 | public enum ApiVersion { 9 | 10 | V3_1("v3.1"), 11 | V3("v3"), 12 | V4("v4"); 13 | 14 | @Getter 15 | private final String urlSegment; 16 | 17 | ApiVersion(String urlSegment){ 18 | this.urlSegment = urlSegment; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/errors/MailjetClientCommunicationException.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.errors; 2 | 3 | /** 4 | * Indicates that the error happened during communication with the server 5 | * And the error nature is bound to the underlying HTTP provider / java.net stack 6 | * Please, verify your network configuration 7 | * */ 8 | public class MailjetClientCommunicationException extends MailjetException { 9 | public MailjetClientCommunicationException(String message) { 10 | super(message); 11 | } 12 | 13 | public MailjetClientCommunicationException(String message, Exception cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/errors/MailjetClientRequestException.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.errors; 2 | 3 | /** 4 | * MailjetClientRequestException indicates that the given request is invalid 5 | * And MailJet API server returned error like 6 | * 400 Bad Request 7 | * 403 Forbidden 8 | * 404 Not Found 9 | * 405 Method Not Allowed 10 | * 11 | * Please, verify your request 12 | */ 13 | public class MailjetClientRequestException extends MailjetException { 14 | public MailjetClientRequestException(String message, int statusCode) { 15 | super(message); 16 | 17 | this.statusCode = statusCode; 18 | } 19 | 20 | private int statusCode; 21 | 22 | public int getStatusCode(){ return statusCode; } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/errors/MailjetException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.mailjet.client.errors; 7 | 8 | /** 9 | * Base exception class for the all exceptions thrown by MailJet client 10 | * @author guillaume 11 | */ 12 | public class MailjetException extends Exception { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | public MailjetException(String message) { 17 | super(message); 18 | } 19 | public MailjetException(String message, Exception cause) { 20 | super(message, cause); 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/errors/MailjetRateLimitException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.mailjet.client.errors; 7 | 8 | /** 9 | * MailjetRateLimitException handles http status code 429 (Too Many Requests) 10 | * 11 | * Oops! You have reached the maximum number of calls allowed per minute by our API. 12 | * Please review your integration to reduce the number of calls issued by your system 13 | * 14 | * @author y.vanov 15 | * 16 | */ 17 | public class MailjetRateLimitException extends MailjetException { 18 | 19 | private static final long serialVersionUID = 7854200196479735430L; 20 | 21 | public MailjetRateLimitException(String error) { 22 | super(error); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/errors/MailjetServerException.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.errors; 2 | 3 | /** 4 | * MailjetServerException indicates that something went wrong on our side 5 | * 6 | * When such error occurs, it will contain an error identifier in its description 7 | * (e.g. "ErrorIdentifier" : "D4DF574C-0C5F-45C7-BA52-7AA8E533C3DE"), which is crucial for us to track the problem and identify the root cause. 8 | * Please contact our support team, providing the error identifier and we will do our best to help. 9 | * 10 | * @author y.vanov 11 | * 12 | */ 13 | public class MailjetServerException extends MailjetException { 14 | 15 | /** 16 | * 17 | */ 18 | private static final long serialVersionUID = -6534953525088397824L; 19 | 20 | public MailjetServerException(String error) { 21 | super(error); 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/errors/MailjetUnauthorizedException.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.errors; 2 | 3 | /** 4 | * You have specified an incorrect API Key / API Secret Key pair or Bearer token in case of invoking SMS API 5 | * You may be unauthorized to access the API or your API key may be inactive. 6 | * Please, visit API keys Management section to check your keys. 7 | */ 8 | public class MailjetUnauthorizedException extends MailjetClientRequestException { 9 | public MailjetUnauthorizedException(String message) { 10 | super(message, 401); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/package-info.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Aggregategraphstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Aggregategraphstatistics { 17 | 18 | public static Resource resource = new Resource("aggregategraphstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BLOCKEDSTDDEV = "BlockedStdDev"; 22 | public static String BOUNCEDCOUNT = "BouncedCount"; 23 | public static String BOUNCEDSTDDEV = "BouncedStdDev"; 24 | public static String CAMPAIGNAGGREGATEID = "CampaignAggregateID"; 25 | public static String CLICKEDCOUNT = "ClickedCount"; 26 | public static String CLICKEDSTDDEV = "ClickedStdDev"; 27 | public static String OPENEDCOUNT = "OpenedCount"; 28 | public static String OPENEDSTDDEV = "OpenedStdDev"; 29 | public static String REFTIMESTAMP = "RefTimestamp"; 30 | public static String SENTCOUNT = "SentCount"; 31 | public static String SENTSTDDEV = "SentStdDev"; 32 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 33 | public static String SPAMCOMPLAINTSTDDEV = "SpamcomplaintStdDev"; 34 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 35 | public static String UNSUBSCRIBEDSTDDEV = "UnsubscribedStdDev"; 36 | public static String RANGE = "Range"; 37 | public static String LIMIT = "Limit"; 38 | public static String OFFSET = "Offset"; 39 | public static String COUNTONLY = "CountOnly"; 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Apikey.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Apikey { 17 | 18 | public static Resource resource = new Resource("apikey", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ACL = "ACL"; 21 | public static String APIKEY = "APIKey"; 22 | public static String CREATEDAT = "CreatedAt"; 23 | public static String ID = "ID"; 24 | public static String ISACTIVE = "IsActive"; 25 | public static String ISMASTER = "IsMaster"; 26 | public static String NAME = "Name"; 27 | public static String QUARANTINEVALUE = "QuarantineValue"; 28 | public static String RUNLEVEL = "Runlevel"; 29 | public static String SECRETKEY = "SecretKey"; 30 | public static String TRACKHOST = "TrackHost"; 31 | public static String USERID = "UserID"; 32 | public static String CONFIRMKEY = "ConfirmKey"; 33 | public static String CUSTOMSTATUS = "CustomStatus"; 34 | public static String KEYTYPE = "KeyType"; 35 | public static String USER = "User"; 36 | public static String LIMIT = "Limit"; 37 | public static String OFFSET = "Offset"; 38 | public static String COUNTONLY = "CountOnly"; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Apikeyaccess.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Apikeyaccess { 17 | 18 | public static Resource resource = new Resource("apikeyaccess", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ALLOWEDACCESS = "AllowedAccess"; 21 | public static String APIKEY = "APIKey"; 22 | public static String CREATEDAT = "CreatedAt"; 23 | public static String CUSTOMNAME = "CustomName"; 24 | public static String ID = "ID"; 25 | public static String ISACTIVE = "IsActive"; 26 | public static String LASTACTIVITYAT = "LastActivityAt"; 27 | public static String REALUSER = "RealUser"; 28 | public static String SUBACCOUNT = "Subaccount"; 29 | public static String USER = "User"; 30 | public static String TOKEN = "Token"; 31 | public static String LIMIT = "Limit"; 32 | public static String OFFSET = "Offset"; 33 | public static String COUNTONLY = "CountOnly"; 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Apikeytotals.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Apikeytotals { 17 | 18 | public static Resource resource = new Resource("apikeytotals", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BOUNCEDCOUNT = "BouncedCount"; 22 | public static String CLICKEDCOUNT = "ClickedCount"; 23 | public static String DELIVEREDCOUNT = "DeliveredCount"; 24 | public static String LASTACTIVITY = "LastActivity"; 25 | public static String OPENEDCOUNT = "OpenedCount"; 26 | public static String PROCESSEDCOUNT = "ProcessedCount"; 27 | public static String QUEUEDCOUNT = "QueuedCount"; 28 | public static String SPAMCOMPLAINTCOUNT = "SpamcomplaintCount"; 29 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 30 | public static String LIMIT = "Limit"; 31 | public static String OFFSET = "Offset"; 32 | public static String COUNTONLY = "CountOnly"; 33 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 34 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 35 | public static final String DEFERREDCOUNT = "DeferredCount"; 36 | public static final String WORKFLOWEXITEDCOUNT = "WorkflowExitedCount"; 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Apitoken.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Apitoken { 17 | 18 | public static Resource resource = new Resource("apitoken", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ACL = "ACL"; 21 | public static String ALLOWEDACCESS = "AllowedAccess"; 22 | public static String APIKEY = "APIKey"; 23 | public static String CATCHEDIP = "CatchedIp"; 24 | public static String CREATEDAT = "CreatedAt"; 25 | public static String FIRSTUSEDAT = "FirstUsedAt"; 26 | public static String ID = "ID"; 27 | public static String ISACTIVE = "IsActive"; 28 | public static String LANG = "Lang"; 29 | public static String LASTUSEDAT = "LastUsedAt"; 30 | public static String SENTDATA = "SentData"; 31 | public static String TIMEZONE = "Timezone"; 32 | public static String TOKEN = "Token"; 33 | public static String TOKENTYPE = "TokenType"; 34 | public static String VALIDFOR = "ValidFor"; 35 | public static String ISAPIKEYACTIVE = "IsAPIKeyActive"; 36 | public static String LIMIT = "Limit"; 37 | public static String OFFSET = "Offset"; 38 | public static String COUNTONLY = "CountOnly"; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Axtesting.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Axtesting { 17 | 18 | public static Resource resource = new Resource("axtesting", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONTACTLIST = "ContactList"; 21 | public static String CREATEDAT = "CreatedAt"; 22 | public static String DELETED = "Deleted"; 23 | public static String ID = "ID"; 24 | public static String MODE = "Mode"; 25 | public static String NAME = "Name"; 26 | public static String PERCENTAGE = "Percentage"; 27 | public static String REMAINDERAT = "RemainderAt"; 28 | public static String SEGMENTATION = "Segmentation"; 29 | public static String STARRED = "Starred"; 30 | public static String STARTAT = "StartAt"; 31 | public static String STATUS = "Status"; 32 | public static String STATUSCODE = "StatusCode"; 33 | public static String STATUSSTRING = "StatusString"; 34 | public static String WINNERCLICKRATE = "WinnerClickRate"; 35 | public static String WINNERID = "WinnerID"; 36 | public static String WINNERMETHOD = "WinnerMethod"; 37 | public static String WINNEROPENRATE = "WinnerOpenRate"; 38 | public static String WINNERSPAMRATE = "WinnerSpamRate"; 39 | public static String WINNERUNSUBRATE = "WinnerUnsubRate"; 40 | public static String CONTACTSLIST = "ContactsList"; 41 | public static String ISDELETED = "IsDeleted"; 42 | public static String ISSTARRED = "IsStarred"; 43 | public static String LIMIT = "Limit"; 44 | public static String OFFSET = "Offset"; 45 | public static String COUNTONLY = "CountOnly"; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Batchjob.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Batchjob { 17 | 18 | public static Resource resource = new Resource("batchjob", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ALIVEAT = "AliveAt"; 21 | public static String APIKEY = "APIKey"; 22 | public static String BLOCKSIZE = "Blocksize"; 23 | public static String COUNT = "Count"; 24 | public static String CURRENT = "Current"; 25 | public static String DATA = "Data"; 26 | public static String ERRCOUNT = "Errcount"; 27 | public static String ERRTRESHOLD = "ErrTreshold"; 28 | public static String ID = "ID"; 29 | public static String JOBEND = "JobEnd"; 30 | public static String JOBSTART = "JobStart"; 31 | public static String JOBTYPE = "JobType"; 32 | public static String METHOD = "Method"; 33 | public static String REFID = "RefId"; 34 | public static String REQUESTAT = "RequestAt"; 35 | public static String STATUS = "Status"; 36 | public static String THROTTLE = "Throttle"; 37 | public static String MAXJOBEND = "MaxJobEnd"; 38 | public static String MAXJOBSTART = "MaxJobStart"; 39 | public static String MAXREQUESTAT = "MaxRequestAt"; 40 | public static String MINJOBEND = "MinJobEnd"; 41 | public static String MINJOBSTART = "MinJobStart"; 42 | public static String MINREQUESTAT = "MinRequestAt"; 43 | public static String LIMIT = "Limit"; 44 | public static String OFFSET = "Offset"; 45 | public static String COUNTONLY = "CountOnly"; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Bouncestatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Bouncestatistics { 17 | 18 | public static Resource resource = new Resource("bouncestatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BOUNCEDAT = "BouncedAt"; 21 | public static String CAMPAIGN = "Campaign"; 22 | public static String CONTACT = "Contact"; 23 | public static String ID = "ID"; 24 | public static String ISBLOCKED = "IsBlocked"; 25 | public static String ISSTATEPERMANENT = "IsStatePermanent"; 26 | public static String STATE = "State"; 27 | public static String CAMPAIGNID = "CampaignID"; 28 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 29 | public static String CONTACTSLIST = "ContactsList"; 30 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 31 | public static String FROM = "From"; 32 | public static String FROMDOMAIN = "FromDomain"; 33 | public static String FROMID = "FromID"; 34 | public static String FROMTS = "FromTS"; 35 | public static String FROMTYPE = "FromType"; 36 | public static String ISDELETED = "IsDeleted"; 37 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 38 | public static String ISSTARRED = "IsStarred"; 39 | public static String MESSAGESTATUS = "MessageStatus"; 40 | public static String PERIOD = "Period"; 41 | public static String TOTS = "ToTS"; 42 | public static String LIMIT = "Limit"; 43 | public static String OFFSET = "Offset"; 44 | public static String COUNTONLY = "CountOnly"; 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Campaign.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Campaign { 17 | 18 | public static Resource resource = new Resource("campaign", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CAMPAIGNTYPE = "CampaignType"; 21 | public static String CLICKTRACKED = "ClickTracked"; 22 | public static String CREATEDAT = "CreatedAt"; 23 | public static String CUSTOMVALUE = "CustomValue"; 24 | public static String FIRSTMESSAGEID = "FirstMessageID"; 25 | public static String FROM = "From"; 26 | public static String FROMEMAIL = "FromEmail"; 27 | public static String FROMNAME = "FromName"; 28 | public static String HASHTMLCOUNT = "HasHtmlCount"; 29 | public static String HASTXTCOUNT = "HasTxtCount"; 30 | public static String ID = "ID"; 31 | public static String ISDELETED = "IsDeleted"; 32 | public static String ISSTARRED = "IsStarred"; 33 | public static String LIST = "List"; 34 | public static String NEWSLETTERID = "NewsLetterID"; 35 | public static String OPENTRACKED = "OpenTracked"; 36 | public static String SEGMENTATION = "Segmentation"; 37 | public static String SENDENDAT = "SendEndAt"; 38 | public static String SENDSTARTAT = "SendStartAt"; 39 | public static String SPAMASSSCORE = "SpamassScore"; 40 | public static String STATUS = "Status"; 41 | public static String SUBJECT = "Subject"; 42 | public static String UNSUBSCRIBETRACKEDCOUNT = "UnsubscribeTrackedCount"; 43 | public static String CAMPAIGNID = "CampaignID"; 44 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 45 | public static String CONTACTSLIST = "ContactsList"; 46 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 47 | public static String FROMDOMAIN = "FromDomain"; 48 | public static String FROMID = "FromID"; 49 | public static String FROMTS = "FromTS"; 50 | public static String FROMTYPE = "FromType"; 51 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 52 | public static String PERIOD = "Period"; 53 | public static String TOTS = "ToTS"; 54 | public static String LIMIT = "Limit"; 55 | public static String OFFSET = "Offset"; 56 | public static String COUNTONLY = "CountOnly"; 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Campaignaggregate.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Campaignaggregate { 17 | 18 | public static Resource resource = new Resource("campaignaggregate", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CAMPAIGNIDS = "CampaignIDS"; 21 | public static String CONTACTFILTER = "ContactFilter"; 22 | public static String CONTACTSLIST = "ContactsList"; 23 | public static String FINAL = "Final"; 24 | public static String FROMDATE = "FromDate"; 25 | public static String ID = "ID"; 26 | public static String KEYWORD = "Keyword"; 27 | public static String NAME = "Name"; 28 | public static String SENDER = "Sender"; 29 | public static String TODATE = "ToDate"; 30 | public static String LIMIT = "Limit"; 31 | public static String OFFSET = "Offset"; 32 | public static String COUNTONLY = "CountOnly"; 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Campaigndraft.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Campaigndraft { 17 | 18 | public static Resource resource = new Resource("campaigndraft", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String AXFRACTIONNAME = "AXFractionName"; 21 | public static String AXTESTING = "AXTesting"; 22 | public static String CAMPAIGN = "Campaign"; 23 | public static String CONTACTSLIST = "ContactsList"; 24 | public static String CREATEDAT = "CreatedAt"; 25 | public static String CURRENT = "Current"; 26 | public static String DELIVEREDAT = "DeliveredAt"; 27 | public static String EDITMODE = "EditMode"; 28 | public static String ID = "ID"; 29 | public static String ISSTARRED = "IsStarred"; 30 | public static String ISTEXTPARTINCLUDED = "IsTextPartIncluded"; 31 | public static String LOCALE = "Locale"; 32 | public static String MODIFIEDAT = "ModifiedAt"; 33 | public static String PRESET = "Preset"; 34 | public static String REPLYEMAIL = "ReplyEmail"; 35 | public static String SEGMENTATION = "Segmentation"; 36 | public static String SENDER = "Sender"; 37 | public static String SENDEREMAIL = "SenderEmail"; 38 | public static String SENDERNAME = "SenderName"; 39 | public static String STATUS = "Status"; 40 | public static String SUBJECT = "Subject"; 41 | public static String TEMPLATE = "Template"; 42 | public static String TITLE = "Title"; 43 | public static String URL = "Url"; 44 | public static String USED = "Used"; 45 | public static String ISARCHIVED = "IsArchived"; 46 | public static String ISCAMPAIGN = "IsCampaign"; 47 | public static String ISDELETED = "IsDeleted"; 48 | public static String ISHANDLED = "IsHandled"; 49 | public static String MODIFIED = "Modified"; 50 | public static String NEWSLETTERTEMPLATE = "NewsLetterTemplate"; 51 | public static String LIMIT = "Limit"; 52 | public static String OFFSET = "Offset"; 53 | public static String COUNTONLY = "CountOnly"; 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/CampaigndraftDetailcontent.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class CampaigndraftDetailcontent { 17 | 18 | public static Resource resource = new Resource("campaigndraft", "detailcontent", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String TEXTPART = "Text-part"; 21 | public static String HTMLPART = "Html-part"; 22 | public static String MJMLCONTENT = "MJMLContent"; 23 | public static String HEADERS = "Headers"; 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/CampaigndraftSchedule.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class CampaigndraftSchedule { 17 | 18 | public static Resource resource = new Resource("campaigndraft", "schedule", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DATE = "Date"; 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/CampaigndraftSend.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class CampaigndraftSend { 17 | 18 | public static Resource resource = new Resource("campaigndraft", "send", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/CampaigndraftStatus.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class CampaigndraftStatus { 17 | 18 | public static Resource resource = new Resource("campaigndraft", "status", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/CampaigndraftTest.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class CampaigndraftTest { 17 | 18 | public static Resource resource = new Resource("campaigndraft", "test", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String RECIPIENTS = "Recipients"; 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Campaigngraphstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Campaigngraphstatistics { 17 | 18 | public static Resource resource = new Resource("campaigngraphstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CLICKCOUNT = "Clickcount"; 21 | public static String ID = "ID"; 22 | public static String OPENCOUNT = "Opencount"; 23 | public static String SPAMCOUNT = "Spamcount"; 24 | public static String TICK = "Tick"; 25 | public static String UNSUBCOUNT = "Unsubcount"; 26 | public static String CLICK = "Click"; 27 | public static String IDS = "IDS"; 28 | public static String OPEN = "Open"; 29 | public static String RANGE = "Range"; 30 | public static String SPAM = "Spam"; 31 | public static String UNSUB = "Unsub"; 32 | public static String LIMIT = "Limit"; 33 | public static String OFFSET = "Offset"; 34 | public static String COUNTONLY = "CountOnly"; 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Campaignoverview.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Campaignoverview { 17 | 18 | public static Resource resource = new Resource("campaignoverview", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CLICKEDCOUNT = "ClickedCount"; 21 | public static String DELIVEREDCOUNT = "DeliveredCount"; 22 | public static String EDITMODE = "EditMode"; 23 | public static String EDITTYPE = "EditType"; 24 | public static String ID = "ID"; 25 | public static String IDTYPE = "IDType"; 26 | public static String OPENEDCOUNT = "OpenedCount"; 27 | public static String PROCESSEDCOUNT = "ProcessedCount"; 28 | public static String SENDTIMESTART = "SendTimeStart"; 29 | public static String STARRED = "Starred"; 30 | public static String STATUS = "Status"; 31 | public static String SUBJECT = "Subject"; 32 | public static String TITLE = "Title"; 33 | public static String ALL = "All"; 34 | public static String ARCHIVED = "Archived"; 35 | public static String DRAFTS = "Drafts"; 36 | public static String PROGRAMMED = "Programmed"; 37 | public static String SENT = "Sent"; 38 | public static String LIMIT = "Limit"; 39 | public static String OFFSET = "Offset"; 40 | public static String COUNTONLY = "CountOnly"; 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Campaignstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Campaignstatistics { 17 | 18 | public static Resource resource = new Resource("campaignstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String AXTESTING = "AXTesting"; 21 | public static String BLOCKEDCOUNT = "BlockedCount"; 22 | public static String BOUNCEDCOUNT = "BouncedCount"; 23 | public static String CAMPAIGN = "Campaign"; 24 | public static String CAMPAIGNISSTARRED = "CampaignIsStarred"; 25 | public static String CAMPAIGNSENDSTARTAT = "CampaignSendStartAt"; 26 | public static String CAMPAIGNSUBJECT = "CampaignSubject"; 27 | public static String CLICKEDCOUNT = "ClickedCount"; 28 | public static String CONTACTLISTNAME = "ContactListName"; 29 | public static String DELIVEREDCOUNT = "DeliveredCount"; 30 | public static String LASTACTIVITYAT = "LastActivityAt"; 31 | public static String NEWSLETTER = "NewsLetter"; 32 | public static String OPENEDCOUNT = "OpenedCount"; 33 | public static String PROCESSEDCOUNT = "ProcessedCount"; 34 | public static String QUEUEDCOUNT = "QueuedCount"; 35 | public static String SEGMENTNAME = "SegmentName"; 36 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 37 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 38 | public static String BLOCKED = "Blocked"; 39 | public static String BOUNCED = "Bounced"; 40 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 41 | public static String CLICK = "Click"; 42 | public static String CONTACTSLIST = "ContactsList"; 43 | public static String FROMTS = "FromTS"; 44 | public static String FROMTYPE = "FromType"; 45 | public static String GROUPAX = "GroupAX"; 46 | public static String ISDELETED = "IsDeleted"; 47 | public static String ISSTARRED = "IsStarred"; 48 | public static String MAXLASTACTIVITYAT = "MaxLastActivityAt"; 49 | public static String MINLASTACTIVITYAT = "MinLastActivityAt"; 50 | public static String OPEN = "Open"; 51 | public static String QUEUED = "Queued"; 52 | public static String SEGMENTATION = "Segmentation"; 53 | public static String SENDER = "Sender"; 54 | public static String SENT = "Sent"; 55 | public static String SHOWEXTRADATA = "ShowExtraData"; 56 | public static String SPAM = "Spam"; 57 | public static String SUBJECT = "Subject"; 58 | public static String TOTS = "ToTS"; 59 | public static String UNSUBSCRIBED = "Unsubscribed"; 60 | public static String LIMIT = "Limit"; 61 | public static String OFFSET = "Offset"; 62 | public static String COUNTONLY = "CountOnly"; 63 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 64 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 65 | public static final String DEFERREDCOUNT = "DeferredCount"; 66 | public static final String WORKFLOWEXITEDCOUNT = "WorkflowExitedCount"; 67 | 68 | } 69 | 70 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Clickstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Clickstatistics { 17 | 18 | public static Resource resource = new Resource("clickstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CLICKEDAT = "ClickedAt"; 21 | public static String CLICKEDDELAY = "ClickedDelay"; 22 | public static String CONTACT = "Contact"; 23 | public static String ID = "ID"; 24 | public static String MESSAGE = "Message"; 25 | public static String URL = "Url"; 26 | public static String USERAGENT = "UserAgent"; 27 | public static String CAMPAIGNID = "CampaignID"; 28 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 29 | public static String CONTACTSLIST = "ContactsList"; 30 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 31 | public static String FROM = "From"; 32 | public static String FROMDOMAIN = "FromDomain"; 33 | public static String FROMID = "FromID"; 34 | public static String FROMTS = "FromTS"; 35 | public static String FROMTYPE = "FromType"; 36 | public static String ISDELETED = "IsDeleted"; 37 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 38 | public static String ISSTARRED = "IsStarred"; 39 | public static String MESSAGEID = "MessageID"; 40 | public static String MESSAGESTATUS = "MessageStatus"; 41 | public static String PERIOD = "Period"; 42 | public static String TOTS = "ToTS"; 43 | public static String LIMIT = "Limit"; 44 | public static String OFFSET = "Offset"; 45 | public static String COUNTONLY = "CountOnly"; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contact.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contact { 17 | 18 | public static Resource resource = new Resource("contact", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CREATEDAT = "CreatedAt"; 21 | public static String ISEXCLUDEDFROMCAMPAIGNS = "IsExcludedFromCampaigns"; 22 | public static String EXCLUSIONFROMCAMPAIGNSUPDATEDAT = "ExclusionFromCampaignsUpdatedAt"; 23 | public static String DELIVEREDCOUNT = "DeliveredCount"; 24 | public static String EMAIL = "Email"; 25 | public static String ID = "ID"; 26 | public static String ISOPTINPENDING = "IsOptInPending"; 27 | public static String ISSPAMCOMPLAINING = "IsSpamComplaining"; 28 | public static String LASTACTIVITYAT = "LastActivityAt"; 29 | public static String LASTUPDATEAT = "LastUpdateAt"; 30 | public static String NAME = "Name"; 31 | public static String UNSUBSCRIBEDAT = "UnsubscribedAt"; 32 | public static String UNSUBSCRIBEDBY = "UnsubscribedBy"; 33 | public static String CAMPAIGN = "Campaign"; 34 | public static String CONTACTSLIST = "ContactsList"; 35 | public static String ISUNSUBSCRIBED = "IsUnsubscribed"; 36 | public static String STATUS = "Status"; 37 | public static String LIMIT = "Limit"; 38 | public static String OFFSET = "Offset"; 39 | public static String COUNTONLY = "CountOnly"; 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/ContactGetcontactslists.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class ContactGetcontactslists { 17 | 18 | public static Resource resource = new Resource("contact", "getcontactslists", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/ContactManagecontactslists.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class ContactManagecontactslists { 17 | 18 | public static Resource resource = new Resource("contact", "managecontactslists", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONTACTSLISTS = "ContactsLists"; 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/ContactManagemanycontacts.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class ContactManagemanycontacts { 17 | 18 | public static Resource resource = new Resource("contact", "managemanycontacts", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONTACTSLISTS = "ContactsLists"; 21 | public static String CONTACTS = "Contacts"; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contactdata.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contactdata { 17 | 18 | public static Resource resource = new Resource("contactdata", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONTACTID = "ContactID"; 21 | public static String DATA = "Data"; 22 | public static String ID = "ID"; 23 | public static String CAMPAIGN = "Campaign"; 24 | public static String CONTACTEMAIL = "ContactEmail"; 25 | public static String CONTACTSLIST = "ContactsList"; 26 | public static String FIELDS = "Fields"; 27 | public static String ISUNSUBSCRIBED = "IsUnsubscribed"; 28 | public static String LASTACTIVITYAT = "LastActivityAt"; 29 | public static String STATUS = "Status"; 30 | public static String LIMIT = "Limit"; 31 | public static String OFFSET = "Offset"; 32 | public static String COUNTONLY = "CountOnly"; 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contactfilter.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contactfilter { 17 | 18 | public static Resource resource = new Resource("contactfilter", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DESCRIPTION = "Description"; 21 | public static String EXPRESSION = "Expression"; 22 | public static String ID = "ID"; 23 | public static String NAME = "Name"; 24 | public static String STATUS = "Status"; 25 | public static String SHOWDELETED = "ShowDeleted"; 26 | public static String LIMIT = "Limit"; 27 | public static String OFFSET = "Offset"; 28 | public static String COUNTONLY = "CountOnly"; 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contacthistorydata.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contacthistorydata { 17 | 18 | public static Resource resource = new Resource("contacthistorydata", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONTACT = "Contact"; 21 | public static String CREATEDAT = "CreatedAt"; 22 | public static String DATA = "Data"; 23 | public static String ID = "ID"; 24 | public static String NAME = "Name"; 25 | public static String LAST = "Last"; 26 | public static String MAXCREATEDAT = "MaxCreatedAt"; 27 | public static String MINCREATEDAT = "MinCreatedAt"; 28 | public static String LIMIT = "Limit"; 29 | public static String OFFSET = "Offset"; 30 | public static String COUNTONLY = "CountOnly"; 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contactmetadata.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contactmetadata { 17 | 18 | public static Resource resource = new Resource("contactmetadata", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DATATYPE = "Datatype"; 21 | public static String ID = "ID"; 22 | public static String NAME = "Name"; 23 | public static String NAMESPACE = "NameSpace"; 24 | public static String LIMIT = "Limit"; 25 | public static String OFFSET = "Offset"; 26 | public static String COUNTONLY = "CountOnly"; 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contacts.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | /** 8 | * contacts resource 9 | * Please, care - this is used only for GDPR delete contact call in the API version v4 10 | * https://dev.mailjet.com/email/guides/contact-management/#gdpr-delete-contacts 11 | * For any other contact actions use {@link com.mailjet.client.resource.Contact} in API v3 12 | */ 13 | public class Contacts { 14 | 15 | public static Resource resource = new Resource("contacts", "", ApiVersion.V4, ApiAuthenticationType.Basic, true); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contactslist.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contactslist { 17 | 18 | public static Resource resource = new Resource("contactslist", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | public static Resource csvDataResource = new Resource("contactslist", "csvdata", ApiVersion.V3, ApiAuthenticationType.Basic); 20 | 21 | public static String ADDRESS = "Address"; 22 | public static String CREATEDAT = "CreatedAt"; 23 | public static String ID = "ID"; 24 | public static String ISDELETED = "IsDeleted"; 25 | public static String NAME = "Name"; 26 | public static String SUBSCRIBERCOUNT = "SubscriberCount"; 27 | public static String EXCLUDEID = "ExcludeID"; 28 | public static String LIMIT = "Limit"; 29 | public static String OFFSET = "Offset"; 30 | public static String COUNTONLY = "CountOnly"; 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/ContactslistImportList.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class ContactslistImportList { 17 | 18 | public static Resource resource = new Resource("contactslist", "ImportList", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ACTION = "Action"; 21 | public static String LISTID = "ListID"; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/ContactslistManageContact.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class ContactslistManageContact { 17 | 18 | public static Resource resource = new Resource("contactslist", "ManageContact", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String EMAIL = "Email"; 21 | public static String NAME = "Name"; 22 | public static String ACTION = "Action"; 23 | public static String PROPERTIES = "Properties"; 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/ContactslistManageManyContacts.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class ContactslistManageManyContacts { 17 | 18 | public static Resource resource = new Resource("contactslist", "ManageManyContacts", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ACTION = "Action"; 21 | public static String CONTACTS = "Contacts"; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contactslistsignup.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contactslistsignup { 17 | 18 | public static Resource resource = new Resource("contactslistsignup", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONFIRMAT = "ConfirmAt"; 21 | public static String CONFIRMIP = "ConfirmIp"; 22 | public static String CONTACT = "Contact"; 23 | public static String EMAIL = "Email"; 24 | public static String ID = "ID"; 25 | public static String LIST = "List"; 26 | public static String SIGNUPAT = "SignupAt"; 27 | public static String SIGNUPIP = "SignupIp"; 28 | public static String SIGNUPKEY = "SignupKey"; 29 | public static String SOURCE = "Source"; 30 | public static String SOURCEID = "SourceId"; 31 | public static String APIKEY = "APIKey"; 32 | public static String CONTACTSLIST = "ContactsList"; 33 | public static String DOMAIN = "Domain"; 34 | public static String LOCALPART = "LocalPart"; 35 | public static String MAXCONFIRMAT = "MaxConfirmAt"; 36 | public static String MAXSIGNUPAT = "MaxSignupAt"; 37 | public static String MINCONFIRMAT = "MinConfirmAt"; 38 | public static String MINSIGNUPAT = "MinSignupAt"; 39 | public static String LIMIT = "Limit"; 40 | public static String OFFSET = "Offset"; 41 | public static String COUNTONLY = "CountOnly"; 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Contactstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Contactstatistics { 17 | 18 | public static Resource resource = new Resource("contactstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BOUNCEDCOUNT = "BouncedCount"; 22 | public static String CLICKEDCOUNT = "ClickedCount"; 23 | public static String CONTACT = "Contact"; 24 | public static String DELIVEREDCOUNT = "DeliveredCount"; 25 | public static String LASTACTIVITYAT = "LastActivityAt"; 26 | public static String MARKETINGCONTACTS = "MarketingContacts"; 27 | public static String OPENEDCOUNT = "OpenedCount"; 28 | public static String PROCESSEDCOUNT = "ProcessedCount"; 29 | public static String QUEUEDCOUNT = "QueuedCount"; 30 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 31 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 32 | public static String USERMARKETINGCONTACTS = "UserMarketingContacts"; 33 | public static String BLOCKED = "Blocked"; 34 | public static String BOUNCED = "Bounced"; 35 | public static String CLICK = "Click"; 36 | public static String MAXLASTACTIVITYAT = "MaxLastActivityAt"; 37 | public static String MINLASTACTIVITYAT = "MinLastActivityAt"; 38 | public static String OPEN = "Open"; 39 | public static String QUEUED = "Queued"; 40 | @Deprecated 41 | public static String RECALCULATE = "Recalculate"; 42 | public static String SENT = "Sent"; 43 | public static String SPAM = "Spam"; 44 | public static String UNSUBSCRIBED = "Unsubscribed"; 45 | public static String LIMIT = "Limit"; 46 | public static String OFFSET = "Offset"; 47 | public static String COUNTONLY = "CountOnly"; 48 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 49 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 50 | public static final String DEFERREDCOUNT = "DeferredCount"; 51 | public static final String WORKFLOWEXITEDCOUNT = "WorkflowExitedCount"; 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Csvimport.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Csvimport { 17 | 18 | public static Resource resource = new Resource("csvimport", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ALIVEAT = "AliveAt"; 21 | public static String CONTACTSLIST = "ContactsList"; 22 | public static String CONTACTSLISTID = "ContactsListID"; 23 | public static String COUNT = "Count"; 24 | public static String CURRENT = "Current"; 25 | public static String DATAID = "DataID"; 26 | public static String ERRCOUNT = "Errcount"; 27 | public static String ERRTRESHOLD = "ErrTreshold"; 28 | public static String ID = "ID"; 29 | public static String IMPORTOPTIONS = "ImportOptions"; 30 | public static String JOBEND = "JobEnd"; 31 | public static String JOBSTART = "JobStart"; 32 | public static String METHOD = "Method"; 33 | public static String REQUESTAT = "RequestAt"; 34 | public static String STATUS = "Status"; 35 | public static String LIMIT = "Limit"; 36 | public static String OFFSET = "Offset"; 37 | public static String COUNTONLY = "CountOnly"; 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Dns.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Dns { 17 | 18 | public static Resource resource = new Resource("dns", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DKIMRECORDNAME = "DKIMRecordName"; 21 | public static String DKIMRECORDVALUE = "DKIMRecordValue"; 22 | public static String DKIMSTATUS = "DKIMStatus"; 23 | public static String DOMAIN = "Domain"; 24 | public static String ID = "ID"; 25 | public static String ISCHECKINPROGRESS = "IsCheckInProgress"; 26 | public static String LASTCHECKAT = "LastCheckAt"; 27 | public static String OWNERSHIPTOKEN = "OwnerShipToken"; 28 | public static String SPFRECORDVALUE = "SPFRecordValue"; 29 | public static String SPFSTATUS = "SPFStatus"; 30 | public static String ISSENDERIDENTIFIED = "IsSenderIdentified"; 31 | public static String ISYAHOOFBL = "IsYahooFBL"; 32 | public static String MAXLASTCHECKAT = "MaxLastCheckAt"; 33 | public static String MINLASTCHECKAT = "MinLastCheckAt"; 34 | public static String LIMIT = "Limit"; 35 | public static String OFFSET = "Offset"; 36 | public static String COUNTONLY = "CountOnly"; 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/DnsCheck.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class DnsCheck { 17 | 18 | public static Resource resource = new Resource("dns", "check", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DKIMSTATUS = "DKIMStatus"; 21 | public static String DKIMERRORS = "DKIMErrors"; 22 | public static String DKIMRECORDCURRENTVALUE = "DKIMRecordCurrentValue"; 23 | public static String SPFSTATUS = "SPFStatus"; 24 | public static String SPFERRORS = "SPFErrors"; 25 | public static String SPFRECORDSCURRENTVALUES = "SPFRecordsCurrentValues"; 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Domainstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Domainstatistics { 17 | 18 | public static Resource resource = new Resource("domainstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BOUNCEDCOUNT = "BouncedCount"; 22 | public static String CLICKEDCOUNT = "ClickedCount"; 23 | public static String DELIVEREDCOUNT = "DeliveredCount"; 24 | public static String DOMAIN = "Domain"; 25 | public static String ID = "ID"; 26 | public static String OPENEDCOUNT = "OpenedCount"; 27 | public static String PROCESSEDCOUNT = "ProcessedCount"; 28 | public static String QUEUEDCOUNT = "QueuedCount"; 29 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 30 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 31 | public static String CAMPAIGNID = "CampaignID"; 32 | @Deprecated 33 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 34 | public static String CONTACTSLIST = "ContactsList"; 35 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 36 | public static String FROM = "From"; 37 | public static String FROMDOMAIN = "FromDomain"; 38 | public static String FROMID = "FromID"; 39 | public static String FROMTS = "FromTS"; 40 | public static String FROMTYPE = "FromType"; 41 | public static String ISDELETED = "IsDeleted"; 42 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 43 | public static String ISSTARRED = "IsStarred"; 44 | public static String MESSAGESTATUS = "MessageStatus"; 45 | public static String PERIOD = "Period"; 46 | public static String TOTS = "ToTS"; 47 | public static String LIMIT = "Limit"; 48 | public static String OFFSET = "Offset"; 49 | public static String COUNTONLY = "CountOnly"; 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Email.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author guillaume 15 | */ 16 | public class Email { 17 | 18 | public static Resource resource = new Resource("send", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String EMAIL = "Email"; 21 | public static String FROMEMAIL = "FromEmail"; 22 | public static String FROMNAME = "FromName"; 23 | public static String SENDER = "Sender"; 24 | public static String SUBJECT = "Subject"; 25 | public static String TEXTPART = "Text-Part"; 26 | public static String HTMLPART = "Html-Part"; 27 | public static String RECIPIENTS = "Recipients"; 28 | public static String VARS = "Vars"; 29 | public static String TO = "To"; 30 | public static String CC = "cc"; 31 | public static String BCC = "bcc"; 32 | public static String MJTEMPLATEID = "Mj-TemplateID"; 33 | public static String MJTEMPLATELANGUAGE = "Mj-TemplateLanguage"; 34 | public static String MJTEMPLATEERRORREPORTING = "MJ-TemplateErrorReporting"; 35 | public static String MJTEMPLATEERRORDELIVERY = "MJ-TemplateErrorDeliver"; 36 | public static String ATTACHMENTS = "Attachments"; 37 | public static String INLINE_ATTACHMENTS = "Inline_Attachments"; 38 | public static String INLINEATTACHMENTS = "Inline_Attachments"; 39 | public static String MJPRIO = "Mj-prio"; 40 | public static String MJCUSTOMID = "Mj-CustomID"; 41 | public static String MJCAMPAIGN = "Mj-campaign"; 42 | public static String MJDEDUPLICATECAMPAIGN = "Mj-deduplicatecampaign"; 43 | public static String MJEVENTPAYLOAD = "Mj-EventPayload"; 44 | public static String MJTRACK_OPENS = "Mj-trackopen"; 45 | public static String MJTRACK_CLICKS = "Mj-trackclick"; 46 | public static String HEADERS = "Headers"; 47 | public static String MESSAGE = "Message"; 48 | public static String MESSAGES = "Messages"; 49 | public static String MONITORING_CATEGORY = "MonitoringCategory"; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Emailv31.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author guillaume 15 | */ 16 | public class Emailv31 { 17 | 18 | public static Resource resource = new Resource("send", "", ApiVersion.V3_1, ApiAuthenticationType.Basic); 19 | 20 | public static String MESSAGES = "Messages"; 21 | public static String SANDBOX_MODE = "SandboxMode"; 22 | public static String ADVANCE_ERROR_HANDLING = "AdvanceErrorHandling"; 23 | public static String GLOBALS = "Globals"; 24 | 25 | public static class Message { 26 | public static String EMAIL = "Email"; 27 | public static String NAME = "Name"; 28 | public static String FROM = "From"; 29 | public static String SENDER = "Sender"; 30 | public static String REPLYTO = "ReplyTo"; 31 | public static String SUBJECT = "Subject"; 32 | public static String TEXTPART = "TextPart"; 33 | public static String HTMLPART = "HTMLPart"; 34 | public static String VARS = "Variables"; 35 | public static String TO = "To"; 36 | public static String CC = "Cc"; 37 | public static String BCC = "Bcc"; 38 | public static String TEMPLATEID = "TemplateID"; 39 | public static String TEMPLATELANGUAGE = "TemplateLanguage"; 40 | public static String TEMPLATEERROR_REPORTING = "TemplateErrorReporting"; 41 | public static String TEMPLATEERROR_DELIVERY = "TemplateErrorDeliver"; 42 | public static String ATTACHMENTS = "Attachments"; 43 | public static String INLINEDATTACHMENTS = "InlinedAttachments"; 44 | public static String PRIORITY = "Priority"; 45 | public static String CUSTOMID = "CustomID"; 46 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 47 | public static String DEDUPLICATECAMPAIGN = "DeduplicateCampaign"; 48 | public static String EVENTPAYLOAD = "EventPayload"; 49 | public static String HEADERS = "Headers"; 50 | public static String VARIABLES = "Variables"; 51 | public static String URLTAGS = "URLTags"; 52 | 53 | public static String TRACKOPENS = "TrackOpens"; 54 | public static String TRACKCLICKS = "TrackClicks"; 55 | public static String MONITORINGCATEGORY = "MonitoringCategory"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Eventcallbackurl.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Eventcallbackurl { 17 | 18 | public static Resource resource = new Resource("eventcallbackurl", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String APIKEY = "APIKey"; 21 | public static String EVENTTYPE = "EventType"; 22 | public static String ID = "ID"; 23 | public static String ISBACKUP = "IsBackup"; 24 | public static String STATUS = "Status"; 25 | public static String URL = "Url"; 26 | public static String VERSION = "Version"; 27 | public static String BACKUP = "Backup"; 28 | public static String LIMIT = "Limit"; 29 | public static String OFFSET = "Offset"; 30 | public static String COUNTONLY = "CountOnly"; 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Geostatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Geostatistics { 17 | 18 | public static Resource resource = new Resource("geostatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CLICKEDCOUNT = "ClickedCount"; 21 | public static String COUNTRY = "Country"; 22 | public static String OPENEDCOUNT = "OpenedCount"; 23 | public static String CAMPAIGNID = "CampaignID"; 24 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 25 | public static String CONTACTSLIST = "ContactsList"; 26 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 27 | public static String FROM = "From"; 28 | public static String FROMDOMAIN = "FromDomain"; 29 | public static String FROMID = "FromID"; 30 | public static String FROMTS = "FromTS"; 31 | public static String FROMTYPE = "FromType"; 32 | public static String ISDELETED = "IsDeleted"; 33 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 34 | public static String ISSTARRED = "IsStarred"; 35 | public static String MESSAGESTATUS = "MessageStatus"; 36 | public static String PERIOD = "Period"; 37 | public static String TOTS = "ToTS"; 38 | public static String LIMIT = "Limit"; 39 | public static String OFFSET = "Offset"; 40 | public static String COUNTONLY = "CountOnly"; 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Graphstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Graphstatistics { 17 | 18 | public static Resource resource = new Resource("graphstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BOUNCEDCOUNT = "BouncedCount"; 22 | public static String CLICKEDCOUNT = "ClickedCount"; 23 | public static String DELIVEREDCOUNT = "DeliveredCount"; 24 | public static String OPENEDCOUNT = "OpenedCount"; 25 | public static String PROCESSEDCOUNT = "ProcessedCount"; 26 | public static String QUEUEDCOUNT = "QueuedCount"; 27 | public static String REFTIMESTAMP = "RefTimestamp"; 28 | public static String SENDTIMESTART = "SendtimeStart"; 29 | public static String SPAMCOMPLAINTCOUNT = "SpamcomplaintCount"; 30 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 31 | public static String CAMPAIGNID = "CampaignID"; 32 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 33 | public static String CONTACT = "Contact"; 34 | public static String CONTACTSLIST = "ContactsList"; 35 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 36 | public static String FROM = "From"; 37 | public static String FROMDOMAIN = "FromDomain"; 38 | public static String FROMID = "FromID"; 39 | public static String FROMTS = "FromTS"; 40 | public static String FROMTYPE = "FromType"; 41 | public static String ISDELETED = "IsDeleted"; 42 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 43 | public static String ISSTARRED = "IsStarred"; 44 | public static String MESSAGESTATUS = "MessageStatus"; 45 | public static String PERIOD = "Period"; 46 | public static String SCALE = "Scale"; 47 | public static String TIMESHIFT = "TimeShift"; 48 | public static String TOTS = "ToTS"; 49 | public static String LIMIT = "Limit"; 50 | public static String OFFSET = "Offset"; 51 | public static String COUNTONLY = "CountOnly"; 52 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 53 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 54 | public static final String DEFERREDCOUNT = "DeferredCount"; 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Listrecipient.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Listrecipient { 17 | 18 | public static Resource resource = new Resource("listrecipient", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CONTACT = "Contact"; 21 | public static String ID = "ID"; 22 | public static String ISACTIVE = "IsActive"; 23 | public static String ISUNSUBSCRIBED = "IsUnsubscribed"; 24 | public static String LIST = "List"; 25 | public static String UNSUBSCRIBEDAT = "UnsubscribedAt"; 26 | public static String ACTIVE = "Active"; 27 | public static String BLOCKED = "Blocked"; 28 | public static String CONTACTEMAIL = "ContactEmail"; 29 | public static String CONTACTSLIST = "ContactsList"; 30 | public static String IGNOREDELETED = "IgnoreDeleted"; 31 | public static String LASTACTIVITYAT = "LastActivityAt"; 32 | public static String LISTNAME = "ListName"; 33 | public static String OPENED = "Opened"; 34 | public static String STATUS = "Status"; 35 | public static String UNSUB = "Unsub"; 36 | public static String LIMIT = "Limit"; 37 | public static String OFFSET = "Offset"; 38 | public static String COUNTONLY = "CountOnly"; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Listrecipientstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Listrecipientstatistics { 17 | 18 | public static Resource resource = new Resource("listrecipientstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BOUNCEDCOUNT = "BouncedCount"; 22 | public static String CLICKEDCOUNT = "ClickedCount"; 23 | public static String DATA = "Data"; 24 | public static String DELIVEREDCOUNT = "DeliveredCount"; 25 | public static String LASTACTIVITYAT = "LastActivityAt"; 26 | public static String LISTRECIPIENT = "ListRecipient"; 27 | public static String OPENEDCOUNT = "OpenedCount"; 28 | public static String PROCESSEDCOUNT = "ProcessedCount"; 29 | public static String QUEUEDCOUNT = "QueuedCount"; 30 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 31 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 32 | public static String BLOCKED = "Blocked"; 33 | public static String BOUNCED = "Bounced"; 34 | public static String CLICK = "Click"; 35 | public static String CONTACT = "Contact"; 36 | public static String CONTACTSLIST = "ContactsList"; 37 | public static String ISACTIVE = "IsActive"; 38 | public static String ISUNSUBSCRIBED = "IsUnsubscribed"; 39 | public static String MAXLASTACTIVITYAT = "MaxLastActivityAt"; 40 | public static String MAXUNSUBSCRIBEDAT = "MaxUnsubscribedAt"; 41 | public static String MINLASTACTIVITYAT = "MinLastActivityAt"; 42 | public static String MINUNSUBSCRIBEDAT = "MinUnsubscribedAt"; 43 | public static String OPEN = "Open"; 44 | public static String QUEUED = "Queued"; 45 | public static String SENT = "Sent"; 46 | public static String SHOWEXTRADATA = "ShowExtraData"; 47 | public static String SPAM = "Spam"; 48 | public static String UNSUBSCRIBED = "Unsubscribed"; 49 | public static String LIMIT = "Limit"; 50 | public static String OFFSET = "Offset"; 51 | public static String COUNTONLY = "CountOnly"; 52 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 53 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 54 | public static final String DEFERREDCOUNT = "DeferredCount"; 55 | public static final String WORKFLOWEXITEDCOUNT = "WorkflowExitedCount"; 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Message.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Message { 17 | 18 | public static Resource resource = new Resource("message", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ARRIVEDAT = "ArrivedAt"; 21 | public static String ATTACHMENTCOUNT = "AttachmentCount"; 22 | public static String ATTEMPTCOUNT = "AttemptCount"; 23 | public static String CAMPAIGN = "Campaign"; 24 | public static String CONTACT = "Contact"; 25 | public static String DELAY = "Delay"; 26 | public static String DESTINATION = "Destination"; 27 | public static String FILTERTIME = "FilterTime"; 28 | public static String FROM = "From"; 29 | public static String ID = "ID"; 30 | public static String ISCLICKTRACKED = "IsClickTracked"; 31 | public static String ISHTMLPARTINCLUDED = "IsHTMLPartIncluded"; 32 | public static String ISOPENTRACKED = "IsOpenTracked"; 33 | public static String ISTEXTPARTINCLUDED = "IsTextPartIncluded"; 34 | public static String ISUNSUBTRACKED = "IsUnsubTracked"; 35 | public static String MESSAGESIZE = "MessageSize"; 36 | public static String SPAMASSASSINSCORE = "SpamassassinScore"; 37 | public static String SPAMASSRULES = "SpamassRules"; 38 | public static String STATE = "State"; 39 | public static String STATEPERMANENT = "StatePermanent"; 40 | public static String STATUS = "Status"; 41 | public static String MESSAGESTATE = "MessageState"; 42 | public static String PLANSUBSCRIPTION = "PlanSubscription"; 43 | public static String SENDER = "Sender"; 44 | public static String LIMIT = "Limit"; 45 | public static String OFFSET = "Offset"; 46 | public static String COUNTONLY = "CountOnly"; 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Messagehistory.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Messagehistory { 17 | 18 | public static Resource resource = new Resource("messagehistory", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String COMMENT = "Comment"; 21 | public static String EVENTAT = "EventAt"; 22 | public static String EVENTTYPE = "EventType"; 23 | public static String STATE = "State"; 24 | public static String USERAGENT = "Useragent"; 25 | public static String MESSAGE = "Message"; 26 | public static String LIMIT = "Limit"; 27 | public static String OFFSET = "Offset"; 28 | public static String COUNTONLY = "CountOnly"; 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Messageinformation.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Messageinformation { 17 | 18 | public static Resource resource = new Resource("messageinformation", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CAMPAIGN = "Campaign"; 21 | public static String CLICKTRACKEDCOUNT = "ClickTrackedCount"; 22 | public static String CONTACT = "Contact"; 23 | public static String CREATEDAT = "CreatedAt"; 24 | public static String ID = "ID"; 25 | public static String MESSAGESIZE = "MessageSize"; 26 | public static String OPENTRACKEDCOUNT = "OpenTrackedCount"; 27 | public static String QUEUEDCOUNT = "QueuedCount"; 28 | public static String SENDENDAT = "SendEndAt"; 29 | public static String SENTCOUNT = "SentCount"; 30 | public static String SPAMASSASSINRULES = "SpamAssassinRules"; 31 | public static String SPAMASSASSINSCORE = "SpamAssassinScore"; 32 | public static String CAMPAIGNID = "CampaignID"; 33 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 34 | public static String CONTACTSLIST = "ContactsList"; 35 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 36 | public static String FROM = "From"; 37 | public static String FROMDOMAIN = "FromDomain"; 38 | public static String FROMID = "FromID"; 39 | public static String FROMTS = "FromTS"; 40 | public static String FROMTYPE = "FromType"; 41 | public static String ISDELETED = "IsDeleted"; 42 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 43 | public static String ISSTARRED = "IsStarred"; 44 | public static String MESSAGESTATUS = "MessageStatus"; 45 | public static String PERIOD = "Period"; 46 | public static String TOTS = "ToTS"; 47 | public static String LIMIT = "Limit"; 48 | public static String OFFSET = "Offset"; 49 | public static String COUNTONLY = "CountOnly"; 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Messagestate.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Messagestate { 17 | 18 | public static Resource resource = new Resource("messagestate", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ID = "ID"; 21 | public static String RELATEDTO = "RelatedTo"; 22 | public static String STATE = "State"; 23 | public static String LIMIT = "Limit"; 24 | public static String OFFSET = "Offset"; 25 | public static String COUNTONLY = "CountOnly"; 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Messagestatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Messagestatistics { 17 | 18 | public static Resource resource = new Resource("messagestatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String AVERAGECLICKDELAY = "AverageClickDelay"; 21 | public static String AVERAGECLICKEDCOUNT = "AverageClickedCount"; 22 | public static String AVERAGEOPENDELAY = "AverageOpenDelay"; 23 | public static String AVERAGEOPENEDCOUNT = "AverageOpenedCount"; 24 | public static String BLOCKEDCOUNT = "BlockedCount"; 25 | public static String BOUNCEDCOUNT = "BouncedCount"; 26 | public static String CAMPAIGNCOUNT = "CampaignCount"; 27 | public static String CLICKEDCOUNT = "ClickedCount"; 28 | public static String DELIVEREDCOUNT = "DeliveredCount"; 29 | public static String OPENEDCOUNT = "OpenedCount"; 30 | public static String PROCESSEDCOUNT = "ProcessedCount"; 31 | public static String QUEUEDCOUNT = "QueuedCount"; 32 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 33 | public static String TRANSACTIONALCOUNT = "TransactionalCount"; 34 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 35 | public static String CAMPAIGNID = "CampaignID"; 36 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 37 | public static String CONTACTEMAIL = "ContactEmail"; 38 | public static String CONTACTID = "ContactID"; 39 | public static String CONTACTLISTID = "ContactListID"; 40 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 41 | public static String FROM = "From"; 42 | public static String FROMDOMAIN = "FromDomain"; 43 | public static String FROMID = "FromID"; 44 | public static String FROMTS = "FromTS"; 45 | public static String FROMTYPE = "FromType"; 46 | public static String ISDELETED = "IsDeleted"; 47 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 48 | public static String ISSTARRED = "IsStarred"; 49 | public static String MESSAGESTATUS = "MessageStatus"; 50 | public static String PERIOD = "Period"; 51 | public static String TOTS = "ToTS"; 52 | public static String LIMIT = "Limit"; 53 | public static String OFFSET = "Offset"; 54 | public static String COUNTONLY = "CountOnly"; 55 | 56 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 57 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 58 | public static final String DEFERREDCOUNT = "DeferredCount"; 59 | 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Metadata.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Metadata { 17 | 18 | public static Resource resource = new Resource("metadata", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ACTIONS = "Actions"; 21 | public static String APIVERSION = "APIVersion"; 22 | public static String DESCRIPTION = "Description"; 23 | public static String FILTERS = "Filters"; 24 | public static String ISREADONLY = "IsReadOnly"; 25 | public static String NAME = "Name"; 26 | public static String PRIVATEOPERATIONS = "PrivateOperations"; 27 | public static String PROPERTIES = "Properties"; 28 | public static String PUBLICOPERATIONS = "PublicOperations"; 29 | public static String SORTINFO = "SortInfo"; 30 | public static String UNIQUEKEY = "UniqueKey"; 31 | public static String PUBLICRESOURCES = "PublicResources"; 32 | public static String READONLYRESOURCES = "ReadOnlyResources"; 33 | public static String RESOURCENAME = "ResourceName"; 34 | public static String LIMIT = "Limit"; 35 | public static String OFFSET = "Offset"; 36 | public static String COUNTONLY = "CountOnly"; 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Metasender.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Metasender { 17 | 18 | public static Resource resource = new Resource("metasender", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CREATEDAT = "CreatedAt"; 21 | public static String DESCRIPTION = "Description"; 22 | public static String EMAIL = "Email"; 23 | public static String FILENAME = "Filename"; 24 | public static String ID = "ID"; 25 | public static String ISENABLED = "IsEnabled"; 26 | public static String DNS = "DNS"; 27 | public static String USER = "User"; 28 | public static String LIMIT = "Limit"; 29 | public static String OFFSET = "Offset"; 30 | public static String COUNTONLY = "CountOnly"; 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Myprofile.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Myprofile { 17 | 18 | public static Resource resource = new Resource("myprofile", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ADDRESSCITY = "AddressCity"; 21 | public static String ADDRESSCOUNTRY = "AddressCountry"; 22 | public static String ADDRESSPOSTALCODE = "AddressPostalCode"; 23 | public static String ADDRESSSTATE = "AddressState"; 24 | public static String ADDRESSSTREET = "AddressStreet"; 25 | public static String BILLINGEMAIL = "BillingEmail"; 26 | public static String BIRTHDAYAT = "BirthdayAt"; 27 | public static String COMPANYNAME = "CompanyName"; 28 | public static String COMPANYNUMOFEMPLOYEES = "CompanyNumOfEmployees"; 29 | public static String CONTACTPHONE = "ContactPhone"; 30 | public static String ESTIMATEDVOLUME = "EstimatedVolume"; 31 | public static String FEATURES = "Features"; 32 | public static String FIRSTNAME = "Firstname"; 33 | public static String ID = "ID"; 34 | public static String INDUSTRY = "Industry"; 35 | public static String JOBTITLE = "JobTitle"; 36 | public static String LASTNAME = "Lastname"; 37 | public static String USER = "User"; 38 | public static String VAT = "VAT"; 39 | public static String VATNUMBER = "VATNumber"; 40 | public static String WEBSITE = "Website"; 41 | public static String LIMIT = "Limit"; 42 | public static String OFFSET = "Offset"; 43 | public static String COUNTONLY = "CountOnly"; 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Newsletter.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Newsletter { 17 | 18 | public static Resource resource = new Resource("newsletter", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String AXFRACTION = "AXFraction"; 21 | public static String AXFRACTIONNAME = "AXFractionName"; 22 | public static String AXTESTING = "AXTesting"; 23 | public static String CALLBACK = "Callback"; 24 | public static String CAMPAIGN = "Campaign"; 25 | public static String CONTACTSLIST = "ContactsList"; 26 | public static String CONTACTSLISTID = "ContactsListID"; 27 | public static String CREATEDAT = "CreatedAt"; 28 | public static String DELIVEREDAT = "DeliveredAt"; 29 | public static String EDITMODE = "EditMode"; 30 | public static String EDITTYPE = "EditType"; 31 | public static String FOOTER = "Footer"; 32 | public static String FOOTERADDRESS = "FooterAddress"; 33 | public static String FOOTERWYSIWYGTYPE = "FooterWYSIWYGType"; 34 | public static String HEADERFILENAME = "HeaderFilename"; 35 | public static String HEADERLINK = "HeaderLink"; 36 | public static String HEADERTEXT = "HeaderText"; 37 | public static String HEADERURL = "HeaderUrl"; 38 | public static String ID = "ID"; 39 | public static String IP = "Ip"; 40 | public static String ISHANDLED = "IsHandled"; 41 | public static String ISSTARRED = "IsStarred"; 42 | public static String ISTEXTPARTINCLUDED = "IsTextPartIncluded"; 43 | public static String LOCALE = "Locale"; 44 | public static String MODIFIEDAT = "ModifiedAt"; 45 | public static String PERMALINK = "Permalink"; 46 | public static String PERMALINKHOST = "PermalinkHost"; 47 | public static String PERMALINKWYSIWYGTYPE = "PermalinkWYSIWYGType"; 48 | public static String POLITENESSMODE = "PolitenessMode"; 49 | public static String REPLYEMAIL = "ReplyEmail"; 50 | public static String SEGMENTATION = "Segmentation"; 51 | public static String SENDER = "Sender"; 52 | public static String SENDEREMAIL = "SenderEmail"; 53 | public static String SENDERNAME = "SenderName"; 54 | public static String STATUS = "Status"; 55 | public static String SUBJECT = "Subject"; 56 | public static String TEMPLATE = "Template"; 57 | public static String TESTADDRESS = "TestAddress"; 58 | public static String TITLE = "Title"; 59 | public static String URL = "Url"; 60 | public static String ISARCHIVED = "IsArchived"; 61 | public static String ISCAMPAIGN = "IsCampaign"; 62 | public static String ISDELETED = "IsDeleted"; 63 | public static String MODIFIED = "Modified"; 64 | public static String NEWSLETTERTEMPLATE = "NewsLetterTemplate"; 65 | public static String LIMIT = "Limit"; 66 | public static String OFFSET = "Offset"; 67 | public static String COUNTONLY = "CountOnly"; 68 | 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/NewsletterDetailcontent.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class NewsletterDetailcontent { 17 | 18 | public static Resource resource = new Resource("newsletter", "detailcontent", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String TEXTPART = "Text-part"; 21 | public static String HTMLPART = "Html-part"; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/NewsletterSchedule.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class NewsletterSchedule { 17 | 18 | public static Resource resource = new Resource("newsletter", "schedule", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DATE = "Date"; 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/NewsletterSend.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class NewsletterSend { 17 | 18 | public static Resource resource = new Resource("newsletter", "send", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/NewsletterStatus.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class NewsletterStatus { 17 | 18 | public static Resource resource = new Resource("newsletter", "status", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/NewsletterTest.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class NewsletterTest { 17 | 18 | public static Resource resource = new Resource("newsletter", "test", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String RECIPIENTS = "Recipients"; 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Newslettertemplate.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Newslettertemplate { 17 | 18 | public static Resource resource = new Resource("newslettertemplate", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CATEGORY = "Category"; 21 | public static String CREATEDAT = "CreatedAt"; 22 | public static String FOOTER = "Footer"; 23 | public static String FOOTERADDRESS = "FooterAddress"; 24 | public static String FOOTERWYSIWYGTYPE = "FooterWYSIWYGType"; 25 | public static String HEADERFILENAME = "HeaderFilename"; 26 | public static String HEADERLINK = "HeaderLink"; 27 | public static String HEADERTEXT = "HeaderText"; 28 | public static String HEADERURL = "HeaderUrl"; 29 | public static String ID = "ID"; 30 | public static String LOCALE = "Locale"; 31 | public static String NAME = "Name"; 32 | public static String PERMALINK = "Permalink"; 33 | public static String PERMALINKWYSIWYGTYPE = "PermalinkWYSIWYGType"; 34 | public static String SOURCENEWSLETTERID = "SourceNewsLetterID"; 35 | public static String STATUS = "Status"; 36 | public static String ISPUBLIC = "IsPublic"; 37 | public static String NEWSLETTERTEMPLATECATEGORY = "NewsLetterTemplateCategory"; 38 | public static String LIMIT = "Limit"; 39 | public static String OFFSET = "Offset"; 40 | public static String COUNTONLY = "CountOnly"; 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Newslettertemplatecategory.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Newslettertemplatecategory { 17 | 18 | public static Resource resource = new Resource("newslettertemplatecategory", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String DESCRIPTION = "Description"; 21 | public static String ID = "ID"; 22 | public static String LOCALE = "Locale"; 23 | public static String PARENTCATEGORY = "ParentCategory"; 24 | public static String VALUE = "Value"; 25 | public static String LIMIT = "Limit"; 26 | public static String OFFSET = "Offset"; 27 | public static String COUNTONLY = "CountOnly"; 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Openinformation.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Openinformation { 17 | 18 | public static Resource resource = new Resource("openinformation", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ARRIVEDAT = "ArrivedAt"; 21 | public static String CAMPAIGN = "Campaign"; 22 | public static String CONTACT = "Contact"; 23 | public static String ID = "ID"; 24 | public static String MESSAGEID = "MessageID"; 25 | public static String OPENEDAT = "OpenedAt"; 26 | public static String USERAGENT = "UserAgent"; 27 | public static String USERAGENTFULL = "UserAgentFull"; 28 | public static String CAMPAIGNID = "CampaignID"; 29 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 30 | public static String CONTACTSLIST = "ContactsList"; 31 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 32 | public static String FROM = "From"; 33 | public static String FROMDOMAIN = "FromDomain"; 34 | public static String FROMID = "FromID"; 35 | public static String FROMTS = "FromTS"; 36 | public static String FROMTYPE = "FromType"; 37 | public static String ISDELETED = "IsDeleted"; 38 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 39 | public static String ISSTARRED = "IsStarred"; 40 | public static String MESSAGESTATUS = "MessageStatus"; 41 | public static String PERIOD = "Period"; 42 | public static String TOTS = "ToTS"; 43 | public static String LIMIT = "Limit"; 44 | public static String OFFSET = "Offset"; 45 | public static String COUNTONLY = "CountOnly"; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Openstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Openstatistics { 17 | 18 | public static Resource resource = new Resource("openstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String OPENEDCOUNT = "OpenedCount"; 21 | public static String OPENEDDELAY = "OpenedDelay"; 22 | public static String PROCESSEDCOUNT = "ProcessedCount"; 23 | public static String CAMPAIGNID = "CampaignID"; 24 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 25 | public static String CONTACTSLIST = "ContactsList"; 26 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 27 | public static String FROM = "From"; 28 | public static String FROMDOMAIN = "FromDomain"; 29 | public static String FROMID = "FromID"; 30 | public static String FROMTS = "FromTS"; 31 | public static String FROMTYPE = "FromType"; 32 | public static String ISDELETED = "IsDeleted"; 33 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 34 | public static String ISSTARRED = "IsStarred"; 35 | public static String MESSAGESTATUS = "MessageStatus"; 36 | public static String PERIOD = "Period"; 37 | public static String TOTS = "ToTS"; 38 | public static String LIMIT = "Limit"; 39 | public static String OFFSET = "Offset"; 40 | public static String COUNTONLY = "CountOnly"; 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Parseroute.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Parseroute { 17 | 18 | public static Resource resource = new Resource("parseroute", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String APIKEY = "APIKey"; 21 | public static String EMAIL = "Email"; 22 | public static String ID = "ID"; 23 | public static String URL = "Url"; 24 | public static String LIMIT = "Limit"; 25 | public static String OFFSET = "Offset"; 26 | public static String COUNTONLY = "CountOnly"; 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Preferences.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Preferences { 17 | 18 | public static Resource resource = new Resource("preferences", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ID = "ID"; 21 | public static String KEY = "Key"; 22 | public static String USER = "User"; 23 | public static String VALUE = "Value"; 24 | public static String SHOWALLUSERS = "ShowAllUsers"; 25 | public static String LIMIT = "Limit"; 26 | public static String OFFSET = "Offset"; 27 | public static String COUNTONLY = "CountOnly"; 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Preset.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Preset { 17 | 18 | public static Resource resource = new Resource("preset", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String AUTHOR = "Author"; 21 | public static String COPYRIGHT = "Copyright"; 22 | public static String DESCRIPTION = "Description"; 23 | public static String ID = "ID"; 24 | public static String NAME = "Name"; 25 | public static String OWNERID = "OwnerID"; 26 | public static String OWNERTYPE = "OwnerType"; 27 | public static String PRESET = "Preset"; 28 | public static String APIKEY = "APIKey"; 29 | public static String USER = "User"; 30 | public static String LIMIT = "Limit"; 31 | public static String OFFSET = "Offset"; 32 | public static String COUNTONLY = "CountOnly"; 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Sender.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Sender { 17 | 18 | public static Resource resource = new Resource("sender", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CREATEDAT = "CreatedAt"; 21 | public static String DNS = "DNS"; 22 | public static String EMAIL = "Email"; 23 | public static String EMAILTYPE = "EmailType"; 24 | public static String FILENAME = "Filename"; 25 | public static String ID = "ID"; 26 | public static String ISDEFAULTSENDER = "IsDefaultSender"; 27 | public static String NAME = "Name"; 28 | public static String STATUS = "Status"; 29 | public static String DNSID = "DnsID"; 30 | public static String DOMAIN = "Domain"; 31 | public static String LOCALPART = "LocalPart"; 32 | public static String SHOWDELETED = "ShowDeleted"; 33 | public static String LIMIT = "Limit"; 34 | public static String OFFSET = "Offset"; 35 | public static String COUNTONLY = "CountOnly"; 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/SenderValidate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a generated class. 3 | */ 4 | 5 | package com.mailjet.client.resource; 6 | 7 | import com.mailjet.client.Resource; 8 | import com.mailjet.client.enums.ApiAuthenticationType; 9 | import com.mailjet.client.enums.ApiVersion; 10 | 11 | /** 12 | * 13 | * @author Guillaume Badi 14 | */ 15 | public class SenderValidate { 16 | 17 | public static Resource resource = new Resource("sender", "validate", ApiVersion.V3, ApiAuthenticationType.Basic); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Senderstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Senderstatistics { 17 | 18 | public static Resource resource = new Resource("senderstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String BLOCKEDCOUNT = "BlockedCount"; 21 | public static String BOUNCEDCOUNT = "BouncedCount"; 22 | public static String CLICKEDCOUNT = "ClickedCount"; 23 | public static String DELIVEREDCOUNT = "DeliveredCount"; 24 | public static String LASTACTIVITYAT = "LastActivityAt"; 25 | public static String OPENEDCOUNT = "OpenedCount"; 26 | public static String PROCESSEDCOUNT = "ProcessedCount"; 27 | public static String QUEUEDCOUNT = "QueuedCount"; 28 | public static String SENDER = "Sender"; 29 | public static String SPAMCOMPLAINTCOUNT = "SpamComplaintCount"; 30 | public static String UNSUBSCRIBEDCOUNT = "UnsubscribedCount"; 31 | public static String DOMAIN = "domain"; 32 | public static String EMAIL = "Email"; 33 | public static String LIMIT = "Limit"; 34 | public static String OFFSET = "Offset"; 35 | public static String COUNTONLY = "CountOnly"; 36 | public static final String SOFTBOUNCEDCOUNT = "SoftbouncedCount"; 37 | public static final String HARDBOUNCEDCOUNT = "HardbouncedCount"; 38 | public static final String DEFERREDCOUNT = "DeferredCount"; 39 | public static final String WORKFLOWEXITEDCOUNT = "WorkflowExitedCount"; 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Statcounters.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | public class Statcounters { 8 | public static final Resource resource = new Resource("statcounters", "", ApiVersion.V3, ApiAuthenticationType.Basic); 9 | 10 | public static final String APIKEYID = "APIKeyID"; 11 | public static final String EVENTCLICKEDCOUNT = "EventClickedCount"; 12 | public static final String EVENTOPENEDCOUNT = "EventOpenedCount"; 13 | public static final String EVENTCLICKDELAY = "EventClickDelay"; 14 | public static final String EVENTOPENDELAY = "EventOpenDelay"; 15 | public static final String EVENTUNSUBSCRIBEDCOUNT = "EventUnsubscribedCount"; 16 | public static final String EVENTWORKFLOWEXITEDCOUNT = "EventWorkflowExitedCount"; 17 | public static final String EVENTSPAMCOUNT = "EventSpamCount"; 18 | public static final String MESSAGEBLOCKEDCOUNT = "MessageBlockedCount"; 19 | public static final String MESSAGECLICKEDCOUNT = "MessageClickedCount"; 20 | public static final String MESSAGEDEFERREDCOUNT = "MessageDeferredCount"; 21 | public static final String MESSAGEHARDBOUNCEDCOUNT = "MessageHardBouncedCount"; 22 | public static final String MESSAGEOPENEDCOUNT = "MessageOpenedCount"; 23 | public static final String MESSAGEQUEUEDCOUNT = "MessageQueuedCount"; 24 | public static final String MESSAGESENTCOUNT = "MessageSentCount"; 25 | public static final String MESSAGESOFTBOUNCEDCOUNT = "MessageSoftBouncedCount"; 26 | public static final String MESSAGESPAMCOUNT = "MessageSpamCount"; 27 | public static final String MESSAGEUNSUBSCRIBEDCOUNT = "MessageUnsubscribedCount"; 28 | public static final String MESSAGEWORKFLOWEXITEDCOUNT = "MessageWorkFlowExitedCount"; 29 | public static final String SOURCEID = "SourceID"; 30 | public static final String TOTAL = "Total"; 31 | public static final String TIMESLICE = "Timeslice"; 32 | 33 | public static final String COUNTERSOURCE = "CounterSource"; 34 | public static final String COUNTERRESOLUTION = "CounterResolution"; 35 | public static final String COUNTERTIMING = "CounterTiming"; 36 | public static final String FROMTS = "FromTS"; 37 | public static final String TOTS = "ToTS"; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/StatisticsLinkclick.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | public class StatisticsLinkclick { 8 | public static final Resource resource = new Resource("statistics/link-click", "", ApiVersion.V3, ApiAuthenticationType.Basic); 9 | 10 | public static final String APIKEYID = "APIKeyID"; 11 | public static final String CLICKEDMESSAGESCOUNT = "ClickedMessagesCount"; 12 | public static final String CLICKEDEVENTSCOUNT = "ClickedEventsCount"; 13 | public static final String POSITIONINDEX = "PositionIndex"; 14 | public static final String URL = "URL"; 15 | public static final String CAMPAIGNID = "CampaignID"; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/StatisticsRecepientesp.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | public class StatisticsRecepientesp { 8 | public static final Resource resource = new Resource("statistics/recipient-esp", "", ApiVersion.V3, ApiAuthenticationType.Basic); 9 | 10 | public static final String ATTEMPTEDMESSAGESCOUNT = "AttemptedMessagesCount"; 11 | public static final String CLICKEDMESSAGESCOUNT = "ClickedMessagesCount"; 12 | public static final String DEFERREDMESSAGESCOUNT = "DeferredMessagesCount"; 13 | public static final String DELIVEREDMESSAGESCOUNT = "DeliveredMessagesCount"; 14 | public static final String HARDBOUNCEDMESSAGESCOUNT = "HardBouncedMessagesCount"; 15 | public static final String ESPNAME = "ESPName"; 16 | public static final String OPENEDMESSAGESCOUNT = "OpenedMessagesCount"; 17 | public static final String SOFTBOUNCEDMESSAGESCOUNT = "SoftBouncedMessagesCount"; 18 | public static final String SPAMREPORTSCOUNT = "SpamReportsCount"; 19 | public static final String UNSUBSCRIBEDMESSAGESCOUNT = "UnsubscribedMessagesCount"; 20 | 21 | public static final String CAMPAIGNID = "CampaignID"; 22 | public static final String ESPNAMES = "EspNames"; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Template.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Template { 17 | 18 | public static Resource resource = new Resource("template", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String AUTHOR = "Author"; 21 | public static String CATEGORIES = "Categories"; 22 | public static String COPYRIGHT = "Copyright"; 23 | public static String DESCRIPTION = "Description"; 24 | public static String EDITMODE = "EditMode"; 25 | public static String ID = "ID"; 26 | public static String ISSTARRED = "IsStarred"; 27 | public static String NAME = "Name"; 28 | public static String OWNERID = "OwnerId"; 29 | public static String OWNERTYPE = "OwnerType"; 30 | public static String PRESETS = "Presets"; 31 | public static String PREVIEWS = "Previews"; 32 | public static String PURPOSES = "Purposes"; 33 | public static String APIKEY = "APIKey"; 34 | public static String CATEGORIESSELECTIONMETHOD = "CategoriesSelectionMethod"; 35 | public static String PURPOSESSELECTIONMETHOD = "PurposesSelectionMethod"; 36 | public static String USER = "User"; 37 | public static String LIMIT = "Limit"; 38 | public static String OFFSET = "Offset"; 39 | public static String COUNTONLY = "CountOnly"; 40 | public static String ISTEXTPARTGENERATIONENABLED = "IsTextPartGenerationEnabled"; 41 | public static String LOCALE = "Locale"; 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/TemplateDetailcontent.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class TemplateDetailcontent { 17 | 18 | public static Resource resource = new Resource("template", "detailcontent", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String TEXTPART = "Text-part"; 21 | public static String HTMLPART = "Html-part"; 22 | public static String MJMLCONTENT = "MJMLContent"; 23 | public static String HEADERS = "Headers"; 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/TemplateDetailpreviews.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class TemplateDetailpreviews { 17 | 18 | public static Resource resource = new Resource("template", "detailpreviews", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String MIME = "Mime"; 21 | public static String IMAGE = "Image"; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/TemplateDetailthumbnail.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class TemplateDetailthumbnail { 17 | 18 | public static Resource resource = new Resource("template", "detailthumbnail", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String MIME = "Mime"; 21 | public static String IMAGE = "Image"; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/TemplateDisplaypreview.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class TemplateDisplaypreview { 17 | 18 | public static Resource resource = new Resource("template", "displaypreview", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/TemplateDisplaythumbnail.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class TemplateDisplaythumbnail { 17 | 18 | public static Resource resource = new Resource("template", "displaythumbnail", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Toplinkclicked.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Toplinkclicked { 17 | 18 | public static Resource resource = new Resource("toplinkclicked", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CLICKEDCOUNT = "ClickedCount"; 21 | public static String ID = "ID"; 22 | public static String LINKID = "LinkId"; 23 | public static String URL = "Url"; 24 | public static String ACTUALCLICKS = "ActualClicks"; 25 | public static String CAMPAIGNID = "CampaignID"; 26 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 27 | public static String CONTACT = "Contact"; 28 | public static String CONTACTSLIST = "ContactsList"; 29 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 30 | public static String FROM = "From"; 31 | public static String FROMDOMAIN = "FromDomain"; 32 | public static String FROMID = "FromID"; 33 | public static String FROMTS = "FromTS"; 34 | public static String FROMTYPE = "FromType"; 35 | public static String ISDELETED = "IsDeleted"; 36 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 37 | public static String ISSTARRED = "IsStarred"; 38 | public static String MESSAGE = "Message"; 39 | public static String PERIOD = "Period"; 40 | public static String TOTS = "ToTS"; 41 | public static String LIMIT = "Limit"; 42 | public static String OFFSET = "Offset"; 43 | public static String COUNTONLY = "CountOnly"; 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Trigger.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Trigger { 17 | 18 | public static Resource resource = new Resource("trigger", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ADDEDTS = "AddedTs"; 21 | public static String APIKEY = "APIKey"; 22 | public static String DETAILS = "Details"; 23 | public static String EVENT = "Event"; 24 | public static String ID = "ID"; 25 | public static String USER = "User"; 26 | public static String MINADDEDTS = "MinAddedTS"; 27 | public static String LIMIT = "Limit"; 28 | public static String OFFSET = "Offset"; 29 | public static String COUNTONLY = "CountOnly"; 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/User.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class User { 17 | 18 | public static Resource resource = new Resource("user", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String ACL = "ACL"; 21 | public static String CREATEDAT = "CreatedAt"; 22 | public static String EMAIL = "Email"; 23 | public static String ID = "ID"; 24 | public static String LASTIP = "LastIp"; 25 | public static String LASTLOGINAT = "LastLoginAt"; 26 | public static String LOCALE = "Locale"; 27 | public static String MAXALLOWEDAPIKEYS = "MaxAllowedAPIKeys"; 28 | public static String TIMEZONE = "Timezone"; 29 | public static String USERNAME = "Username"; 30 | public static String WARNEDRATELIMITAT = "WarnedRatelimitAt"; 31 | public static String ISACTIVATED = "IsActivated"; 32 | public static String NEWEMAIL = "NewEmail"; 33 | public static String LIMIT = "Limit"; 34 | public static String OFFSET = "Offset"; 35 | public static String COUNTONLY = "CountOnly"; 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/UserActivate.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class UserActivate { 17 | 18 | public static Resource resource = new Resource("user", "activate", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Useragentstatistics.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Useragentstatistics { 17 | 18 | public static Resource resource = new Resource("useragentstatistics", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String COUNT = "Count"; 21 | public static String DISTINCTCOUNT = "DistinctCount"; 22 | public static String PLATFORM = "Platform"; 23 | public static String USERAGENT = "UserAgent"; 24 | public static String CAMPAIGNID = "CampaignID"; 25 | public static String CAMPAIGNSTATUS = "CampaignStatus"; 26 | public static String CONTACTSLIST = "ContactsList"; 27 | public static String CUSTOMCAMPAIGN = "CustomCampaign"; 28 | public static String EVENT = "Event"; 29 | public static String EXCLUDEPLATFORM = "ExcludePlatform"; 30 | public static String FROM = "From"; 31 | public static String FROMDOMAIN = "FromDomain"; 32 | public static String FROMID = "FromID"; 33 | public static String FROMTS = "FromTS"; 34 | public static String FROMTYPE = "FromType"; 35 | public static String ISDELETED = "IsDeleted"; 36 | public static String ISNEWSLETTERTOOL = "IsNewsletterTool"; 37 | public static String ISSTARRED = "IsStarred"; 38 | public static String PERIOD = "Period"; 39 | public static String TOTS = "ToTS"; 40 | public static String LIMIT = "Limit"; 41 | public static String OFFSET = "Offset"; 42 | public static String COUNTONLY = "CountOnly"; 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Widget.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Widget { 17 | 18 | public static Resource resource = new Resource("widget", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String CREATEDAT = "CreatedAt"; 21 | public static String FROM = "From"; 22 | public static String ID = "ID"; 23 | public static String ISACTIVE = "IsActive"; 24 | public static String LIST = "List"; 25 | public static String LOCALE = "Locale"; 26 | public static String NAME = "Name"; 27 | public static String REPLYTO = "Replyto"; 28 | public static String SENDERNAME = "Sendername"; 29 | public static String SUBJECT = "Subject"; 30 | public static String TEMPLATE = "Template"; 31 | public static String ACTIVE = "active"; 32 | public static String APIKEY = "APIKey"; 33 | public static String CONTACTSLIST = "ContactsList"; 34 | public static String MESSAGETEMPLATE = "MessageTemplate"; 35 | public static String SENDER = "Sender"; 36 | public static String LIMIT = "Limit"; 37 | public static String OFFSET = "Offset"; 38 | public static String COUNTONLY = "CountOnly"; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/Widgetcustomvalue.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This is a generated class. 4 | */ 5 | 6 | package com.mailjet.client.resource; 7 | 8 | import com.mailjet.client.Resource; 9 | import com.mailjet.client.enums.ApiAuthenticationType; 10 | import com.mailjet.client.enums.ApiVersion; 11 | 12 | /** 13 | * 14 | * @author Guillaume Badi 15 | */ 16 | public class Widgetcustomvalue { 17 | 18 | public static Resource resource = new Resource("widgetcustomvalue", "", ApiVersion.V3, ApiAuthenticationType.Basic); 19 | 20 | public static String APIKEY = "APIKey"; 21 | public static String DISPLAY = "Display"; 22 | public static String ID = "ID"; 23 | public static String NAME = "Name"; 24 | public static String VALUE = "Value"; 25 | public static String WIDGET = "Widget"; 26 | public static String LIMIT = "Limit"; 27 | public static String OFFSET = "Offset"; 28 | public static String COUNTONLY = "CountOnly"; 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/sms/Sms.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource.sms; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | /** 8 | * 9 | * @author Ivaylo Ivanov 10 | */ 11 | public class Sms { 12 | 13 | public static final Resource resource = new Resource("sms", "", ApiVersion.V4, ApiAuthenticationType.Bearer, true); 14 | 15 | public static final String FROM = "From"; 16 | public static final String TO = "To"; 17 | public static final String TEXT = "Text"; 18 | public static final String MESSAGEID = "MessageID"; 19 | public static final String SMSCOUNT = "SMSCount"; 20 | public static final String CREATIONTS = "CreationTS"; 21 | public static final String SENTTS = "SentTS"; 22 | public static final String COST = "Cost"; 23 | public static final String STATUS = "Status"; 24 | public static final String FROMTS = "FromTS"; 25 | public static final String TOTS = "ToTS"; 26 | public static final String STATUSCODE = "StatusCode"; 27 | public static final String OFFSET = "Offset"; 28 | public static final String LIMIT = "Limit"; 29 | 30 | } -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/sms/SmsCount.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource.sms; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | /** 8 | * 9 | * @author Ivaylo Ivanov 10 | */ 11 | public class SmsCount { 12 | 13 | public static final Resource resource = new Resource("sms/count", "", ApiVersion.V4, ApiAuthenticationType.Bearer, true); 14 | 15 | public static final String COUNT = "Count"; 16 | 17 | } -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/sms/SmsExport.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource.sms; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | /** 8 | * 9 | * @author Ivaylo Ivanov 10 | */ 11 | public class SmsExport { 12 | 13 | public static final Resource resource = new Resource("sms/export", "", ApiVersion.V4, ApiAuthenticationType.Bearer, true); 14 | 15 | public static final String FROMTS = "FromTS"; 16 | public static final String TOTS = "ToTS"; 17 | public static final String ID = "ID"; 18 | public static final String URL = "URL"; 19 | public static final String STATUS = "Status"; 20 | public static final String CREATIONTS = "CreationTS"; 21 | public static final String EXPIRATIONTS = "ExpirationTS"; 22 | 23 | } -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/resource/sms/SmsSend.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.resource.sms; 2 | 3 | import com.mailjet.client.Resource; 4 | import com.mailjet.client.enums.ApiAuthenticationType; 5 | import com.mailjet.client.enums.ApiVersion; 6 | 7 | /** 8 | * 9 | * @author Ivaylo Ivanov 10 | */ 11 | public class SmsSend { 12 | 13 | public static final Resource resource = new Resource("sms-send", "", ApiVersion.V4, ApiAuthenticationType.Bearer, true); 14 | 15 | public static final String FROM = "From"; 16 | public static final String TO = "To"; 17 | public static final String TEXT = "Text"; 18 | public static final String MESSAGEID = "MessageID"; 19 | public static final String SMSCOUNT = "SMSCount"; 20 | public static final String CREATIONTS = "CreationTS"; 21 | public static final String SENTTS = "SentTS"; 22 | public static final String COST = "Cost"; 23 | public static final String STATUS = "Status"; 24 | 25 | } -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/Attachment.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.io.ByteArrayOutputStream; 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | import java.nio.file.Files; 11 | import java.nio.file.Path; 12 | import java.util.Base64; 13 | 14 | @Data 15 | @Builder 16 | public class Attachment { 17 | /** 18 | * The full name of the file (including the file extension). 19 | */ 20 | private String filename; 21 | 22 | /** 23 | * Defines the type of content being sent out using a MIME type. 24 | * See the official MIME type list for additional information. https://www.iana.org/assignments/media-types/media-types.xhtml 25 | */ 26 | private String contentType; 27 | 28 | /** 29 | * Base64 encoded content of the attached file 30 | */ 31 | private String base64Content; 32 | 33 | /** 34 | * Name of the cid to be inserted in the HTML content of the message. 35 | * The value must be unique across all inline attachments in the message. 36 | * The value valid ONLY for InlinedAttachment 37 | */ 38 | private String contentID; 39 | 40 | /** 41 | * Creates an attachment from the file 42 | * @param pathToFile full path to the file 43 | * @return constructed Attachment object 44 | * @throws IOException if something wrong with reading file under the given path 45 | */ 46 | public static Attachment fromFile(String pathToFile) throws IOException { 47 | File file = new File(pathToFile); 48 | Path path = file.toPath(); 49 | 50 | String mimeType = Files.probeContentType(path); 51 | byte[] fileContent = Files.readAllBytes(path); 52 | String base64Content = Base64.getEncoder().encodeToString(fileContent); 53 | 54 | return new AttachmentBuilder() 55 | .base64Content(base64Content) 56 | .contentType(mimeType) 57 | .filename(path.getFileName().toString()) 58 | .build(); 59 | } 60 | 61 | /** 62 | * Creates an attachment from the input stream 63 | * @param inputStream input stream that will be read as byte array 64 | * @param attachmentFileName the name that will be given to the attachment in the email 65 | * @param contentType mime type of the attachment https://www.iana.org/assignments/media-types/media-types.xhtml 66 | * @return constructed Attachment object 67 | * @throws IOException if something wrong with reading from input stream 68 | */ 69 | public static Attachment fromInputStream(InputStream inputStream, String attachmentFileName, String contentType) throws IOException { 70 | 71 | // replace this with .readAllBytes when migrating to Java 9 72 | final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); 73 | int nRead; 74 | byte[] data = new byte[4000]; 75 | 76 | while ((nRead = inputStream.read(data, 0, data.length)) != -1) { 77 | buffer.write(data, 0, nRead); 78 | } 79 | 80 | final String base64Content = Base64.getEncoder().encodeToString(buffer.toByteArray()); 81 | 82 | return new AttachmentBuilder() 83 | .base64Content(base64Content) 84 | .contentType(contentType) 85 | .filename(attachmentFileName) 86 | .build(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/SendContact.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional; 2 | 3 | import lombok.EqualsAndHashCode; 4 | 5 | @EqualsAndHashCode 6 | public class SendContact { 7 | /** 8 | * Represents an object with email and name (optional) that can be used as To, Cc, Bcc, From etc 9 | * @param email email address 10 | * @param name the display name of the person (Will be displayed in email like {@code NAME } 11 | */ 12 | public SendContact(String email, String name) { 13 | this(email); 14 | Name = name; 15 | } 16 | 17 | /** 18 | * Represents an object with email that can be used as To, Cc, Bcc, From etc 19 | * @param email email address 20 | */ 21 | public SendContact(String email) { 22 | Email = email; 23 | } 24 | 25 | private String Name; 26 | private final String Email; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/SendEmailsRequest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional; 2 | 3 | import com.google.gson.*; 4 | import com.mailjet.client.MailjetClient; 5 | import com.mailjet.client.MailjetRequest; 6 | import com.mailjet.client.MailjetResponse; 7 | import com.mailjet.client.MailjetResponseUtil; 8 | import com.mailjet.client.errors.MailjetClientRequestException; 9 | import com.mailjet.client.errors.MailjetException; 10 | import com.mailjet.client.resource.Emailv31; 11 | import com.mailjet.client.transactional.response.SendEmailsResponse; 12 | import lombok.Builder; 13 | import lombok.Singular; 14 | 15 | import java.util.List; 16 | import java.util.concurrent.CompletableFuture; 17 | 18 | @Builder 19 | public class SendEmailsRequest { 20 | 21 | private final static Gson gson = new GsonBuilder() 22 | .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) 23 | .create(); 24 | 25 | /** 26 | * Adds message to sent to the request 27 | * You can send up to 50 messages per batch 28 | */ 29 | @Singular 30 | private List messages; 31 | 32 | /** 33 | * If set to true, messages will be send to the Mailjet API for verification 34 | * But the actual emails will not be send 35 | */ 36 | private Boolean sandboxMode; 37 | 38 | /** 39 | * When true, enables additional error checks relating to the Send API v3.1 payload. 40 | * Keep in mind that For a list of all error checks enabled by this, please see the Send API errors section in the Email API Guides. 41 | * https://dev.mailjet.com/email/guides/send-api-v31/#send-api-errors 42 | */ 43 | private Boolean advanceErrorHandling; 44 | 45 | /** 46 | * Represents a method to send multiple transactional emails 47 | * Note: Mailjet send API v3.1 will be used 48 | * Note: Max 50 emails per batch allowed 49 | * @param mailjetClient the Mailjet client that will be used to send messages 50 | * @return A response with sent messages information, or error information 51 | * @throws MailjetException in case of communication error in HTTP stack, 52 | * like, TLS connection couldn't be established to the Mailjet server 53 | * Or the Server returned 5xx error, 54 | * Or the Server returned the generic error response 55 | */ 56 | public SendEmailsResponse sendWith(MailjetClient mailjetClient) throws MailjetException { 57 | 58 | final MailjetResponse response = mailjetClient.post(getMailjetRequest()); 59 | 60 | return convertResponse(response); 61 | } 62 | 63 | /** 64 | * Represents a method to send multiple transactional emails asynchronously 65 | * Note: Mailjet send API v3.1 will be used 66 | * Note: Max 50 emails per batch allowed 67 | * @param mailjetClient the Mailjet client that will be used to send messages 68 | * @return A response future with sent messages information, or error information 69 | * The returned future will contain MailjetException in case of communication error in HTTP stack, 70 | * like, TLS connection couldn't be established to the Mailjet server 71 | * Or the Server returned 5xx error, 72 | * Or the Server returned the generic error response 73 | */ 74 | public CompletableFuture sendAsyncWith(MailjetClient mailjetClient) { 75 | 76 | final CompletableFuture responseCompletableFuture = new CompletableFuture<>(); 77 | 78 | try { 79 | CompletableFuture future = mailjetClient.postAsync(getMailjetRequest()); 80 | responseCompletableFuture.complete(convertResponse(future.get())); 81 | } catch (Exception e) { 82 | responseCompletableFuture.completeExceptionally(e); 83 | } 84 | 85 | return responseCompletableFuture; 86 | } 87 | 88 | private SendEmailsResponse convertResponse(MailjetResponse response) throws MailjetClientRequestException { 89 | final String responseContent = response.getRawResponseContent(); 90 | 91 | final SendEmailsResponse typedResponse = gson.fromJson(responseContent, SendEmailsResponse.class); 92 | 93 | // in some cases, Mailjet server returns generic error w/o parsing the real passed messages 94 | if (typedResponse.getMessages() == null && response.getStatus() != MailjetResponseUtil.CREATED_STATUS){ 95 | throw new MailjetClientRequestException(responseContent, response.getStatus()); 96 | } 97 | 98 | return typedResponse; 99 | } 100 | 101 | private MailjetRequest getMailjetRequest() { 102 | final MailjetRequest request = new MailjetRequest(Emailv31.resource); 103 | request.setBody(gson.toJson(this)); 104 | return request; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/TrackClicks.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Enable or disable clicks tracking on this message. 7 | * This property will overwrite the preferences selected in the Mailjet account. 8 | * Equivalent of using X-Mailjet-TrackClick header through SMTP. 9 | */ 10 | public enum TrackClicks { 11 | /** 12 | * use the values specified in the Mailjet account 13 | */ 14 | @SerializedName("account_default") 15 | ACCOUNT_DEFAULT, 16 | 17 | /** 18 | * disable tracking for this message 19 | */ 20 | @SerializedName("disabled") 21 | DISABLED, 22 | 23 | /** 24 | * enable tracking for this message 25 | */ 26 | @SerializedName("enabled") 27 | ENABLED 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/TrackOpens.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Enable or disable open tracking on this message. 7 | * This property will overwrite the preferences selected in the Mailjet account. 8 | * Equivalent of using X-Mailjet-TrackOpen header through SMTP. 9 | */ 10 | public enum TrackOpens { 11 | /** 12 | * use the values specified in the Mailjet account 13 | */ 14 | @SerializedName("account_default") 15 | ACCOUNT_DEFAULT, 16 | 17 | /** 18 | * disable tracking for this message 19 | */ 20 | @SerializedName("disabled") 21 | DISABLED, 22 | 23 | /** 24 | * enable tracking for this message 25 | */ 26 | @SerializedName("enabled") 27 | ENABLED 28 | } -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/response/EmailResult.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional.response; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class EmailResult { 7 | /** 8 | * The email address of this recipient. 9 | */ 10 | private String email; 11 | 12 | /** 13 | * A 128-bit universally unique identifier (UUID) for this message. 14 | */ 15 | private String messageUUID; 16 | 17 | /** 18 | * Unique numeric ID of this message. 19 | * With this ID, you can get the message information through /messages/ API endpoint 20 | */ 21 | private long messageID; 22 | 23 | /** 24 | * URL link that can be used for an API call to retrieve more information about this message. 25 | */ 26 | private String messageHref; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/response/MessageResult.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional.response; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | @Data 8 | public class MessageResult { 9 | 10 | /** 11 | * Indicates the sending status of the message. 12 | */ 13 | private SentMessageStatus status; 14 | 15 | /** 16 | * List containing information about any errors with the processing of this message. 17 | * Will be filled in only if processing errors occur. 18 | * Each error will generate a separate error object with the below properties. 19 | * null if the message sent successfully 20 | */ 21 | private SendEmailError[] errors; 22 | 23 | /** 24 | * A user-defined custom ID. 25 | */ 26 | private String customID; 27 | 28 | /** 29 | * List containing information about the messages sent to recipients in To. 30 | */ 31 | private List to; 32 | 33 | /** 34 | * List containing information about the messages sent to recipients in Cc. 35 | */ 36 | private List cc; 37 | 38 | /** 39 | * List containing information about the messages sent to recipients in Bcc. 40 | */ 41 | private List bcc; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/response/SendEmailError.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional.response; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SendEmailError { 7 | /** 8 | * A 128-bit universally unique identifier (UUID) for this error. 9 | */ 10 | private String errorIdentifier; 11 | 12 | /** 13 | * An internal Mailjet error code for this error. See Send API Errors for more information. 14 | * https://dev.mailjet.com/email/guides/send-api-v31/#send-api-errors 15 | */ 16 | private String errorCode; 17 | 18 | /** 19 | * The error status code. See Send API Errors for more information. 20 | * https://dev.mailjet.com/email/guides/send-api-v31/#send-api-errors 21 | */ 22 | private int statusCode; 23 | 24 | /** 25 | * Indicates which part of the payload this error is related to. 26 | */ 27 | private String errorMessage; 28 | 29 | /** 30 | * Indicates which part of the payload this error is related to. 31 | */ 32 | private String[] errorRelatedTo; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/response/SendEmailsResponse.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional.response; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SendEmailsResponse { 7 | /** 8 | * Array with information regarding each sent message 9 | */ 10 | private MessageResult[] messages; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/mailjet/client/transactional/response/SentMessageStatus.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public enum SentMessageStatus { 6 | @SerializedName("success") 7 | SUCCESS, 8 | 9 | @SerializedName("error") 10 | ERROR 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/Base64Test.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import junit.framework.TestCase; 4 | import org.junit.Assert; 5 | 6 | import java.nio.charset.StandardCharsets; 7 | 8 | import static java.nio.charset.StandardCharsets.UTF_8; 9 | 10 | public class Base64Test extends TestCase { 11 | public void test_should_base64_decode_provided_string() { 12 | // GIVEN 13 | String mock = "dGVzdDp0ZXN0w6lhJCTDoCk9Lyo="; 14 | 15 | // WHEN 16 | byte[] result = Base64.decode(mock); 17 | 18 | // THEN 19 | Assert.assertEquals("test:testéa$$à)=/*", new String(result, StandardCharsets.UTF_8)); 20 | } 21 | 22 | public void test_should_base64_encode_provided_bytes_array() { 23 | // GIVEN 24 | byte[] mock = "test:testéa$$à)=/*".getBytes(UTF_8); 25 | 26 | // WHEN 27 | String result = Base64.encode(mock); 28 | 29 | // THEN 30 | Assert.assertEquals("dGVzdDp0ZXN0w6lhJCTDoCk9Lyo=", result); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/ContactFlowIT.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetException; 4 | import com.mailjet.client.resource.Contact; 5 | import com.mailjet.client.resource.Contacts; 6 | import org.json.JSONObject; 7 | import org.junit.Assert; 8 | import org.junit.FixMethodOrder; 9 | import org.junit.Test; 10 | import org.junit.runners.MethodSorters; 11 | 12 | import java.util.UUID; 13 | 14 | // don't want to bring more complex test frameworks for now, so just workaround to have specific test order and have flow like create-read-delete 15 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) 16 | public class ContactFlowIT { 17 | 18 | private static final MailjetClient mailjetClient = TestHelper.getClient(); 19 | private static final String contactEmail = String.format("integrationtest%s@mailjet.com", UUID.randomUUID()); 20 | private static final String contactName = "Integration test Contact"; 21 | private static long createdContactId; 22 | 23 | @Test 24 | public void a_createContactTest() throws MailjetException { 25 | // arrange 26 | MailjetRequest mailjetRequest = new MailjetRequest(Contact.resource) 27 | .property(Contact.ISEXCLUDEDFROMCAMPAIGNS, "true") 28 | .property(Contact.NAME, contactName) 29 | .property(Contact.EMAIL, contactEmail); 30 | 31 | // act 32 | MailjetResponse mailjetResponse = mailjetClient.post(mailjetRequest); 33 | 34 | // assert 35 | Assert.assertEquals(201, mailjetResponse.getStatus()); 36 | } 37 | 38 | @Test 39 | public void b_getContactTest() throws MailjetException { 40 | 41 | // arrange 42 | MailjetRequest mailjetRequest = new MailjetRequest(Contact.resource, contactEmail); 43 | 44 | // act 45 | MailjetResponse mailjetResponse = mailjetClient.get(mailjetRequest); 46 | 47 | // assert 48 | Assert.assertEquals(200, mailjetResponse.getStatus()); 49 | Assert.assertEquals(1, mailjetResponse.getCount()); 50 | 51 | JSONObject contactData = mailjetResponse.getData().getJSONObject(0); 52 | Assert.assertEquals(contactEmail, contactData.getString("Email")); 53 | Assert.assertEquals(true, contactData.getBoolean("IsExcludedFromCampaigns")); 54 | Assert.assertEquals("Integration test Contact", contactData.getString("Name")); 55 | 56 | createdContactId = contactData.getLong("ID"); 57 | } 58 | 59 | @Test 60 | public void c_deleteContactTest() throws MailjetException { 61 | // arrange 62 | Assert.assertNotEquals(0, createdContactId); 63 | MailjetRequest mailjetRequest = new MailjetRequest(Contacts.resource, createdContactId); 64 | 65 | MailjetClient mailjetClientV4 = TestHelper.getClient(); 66 | 67 | // act 68 | MailjetResponse mailjetResponse = mailjetClientV4.delete(mailjetRequest); 69 | 70 | // assert 71 | Assert.assertEquals(200, mailjetResponse.getStatus()); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/MailjetClientExceptionTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.*; 4 | import com.mailjet.client.resource.Email; 5 | import okhttp3.mockwebserver.MockResponse; 6 | import okhttp3.mockwebserver.MockWebServer; 7 | import org.json.JSONArray; 8 | import org.json.JSONObject; 9 | import org.junit.*; 10 | 11 | import java.io.IOException; 12 | 13 | /** 14 | * @author Nikola-Andreev 15 | */ 16 | public class MailjetClientExceptionTest { 17 | 18 | private static final String FROM_EMAIL = "pilot@mailjet.com"; 19 | private static final String FROM_NAME = "Mailjet Pilot"; 20 | private static final String SUBJECT = "Your email flight plan!"; 21 | private static final String TEXT_PART = "Dear passenger, welcome to Mailjet! May the delivery force be with you!"; 22 | private static final String HTML_PART = "

Dear passenger, welcome to Mailjet


May the delivery force be with you!"; 23 | private static final String RECIPIENT = "passenger@mailjet.com"; 24 | 25 | private static MailjetClient client; 26 | private static MailjetRequest request; 27 | private static MockWebServer mockWebServer; 28 | 29 | @BeforeClass 30 | public static void initialize() throws IOException { 31 | request = new MailjetRequest(Email.resource) 32 | .property(Email.FROMEMAIL, FROM_EMAIL) 33 | .property(Email.FROMNAME, FROM_NAME) 34 | .property(Email.SUBJECT, SUBJECT) 35 | .property(Email.TEXTPART, TEXT_PART) 36 | .property(Email.HTMLPART, HTML_PART) 37 | .property(Email.RECIPIENTS, new JSONArray() 38 | .put(new JSONObject() 39 | .put(Email.EMAIL, RECIPIENT))); 40 | 41 | mockWebServer = new MockWebServer(); 42 | mockWebServer.start(); 43 | 44 | ClientOptions clientOptions = ClientOptions 45 | .builder() 46 | .baseUrl(mockWebServer.url("/").toString()) 47 | .apiSecretKey("secret-key") 48 | .apiKey("api-key") 49 | .build(); 50 | 51 | client = new MailjetClient(clientOptions); 52 | } 53 | 54 | @Test 55 | public void testTooManyRequestsResponse() { 56 | 57 | // arrange 58 | mockWebServer.enqueue(new MockResponse().setResponseCode(429)); 59 | 60 | // act 61 | MailjetRateLimitException exception = Assert.assertThrows(MailjetRateLimitException.class, () ->{ 62 | client.post(request); 63 | }); 64 | 65 | // assert 66 | Assert.assertEquals("Too Many Requests", exception.getMessage()); 67 | } 68 | 69 | @Test 70 | public void testInternalServerErrorResponse() { 71 | // arrange 72 | mockWebServer.enqueue(new MockResponse().setResponseCode(500).setBody("Error Description")); 73 | 74 | // act 75 | MailjetServerException exception = Assert.assertThrows(MailjetServerException.class, () ->{ 76 | client.post(request); 77 | }); 78 | 79 | // assert 80 | Assert.assertEquals("Error Description", exception.getMessage()); 81 | } 82 | 83 | @Test 84 | public void testBadRequestResponse() { 85 | // arrange 86 | mockWebServer.enqueue(new MockResponse().setResponseCode(400).setBody("Error Description")); 87 | 88 | // act 89 | MailjetClientRequestException exception = Assert.assertThrows(MailjetClientRequestException.class, () ->{ 90 | client.post(request); 91 | }); 92 | 93 | // assert 94 | Assert.assertEquals("Error Description", exception.getMessage()); 95 | } 96 | 97 | @Test 98 | public void testUnauthorizedResponse() { 99 | // arrange 100 | mockWebServer.enqueue(new MockResponse().setResponseCode(401)); 101 | 102 | // act 103 | MailjetUnauthorizedException exception = Assert.assertThrows(MailjetUnauthorizedException.class, () ->{ 104 | client.post(request); 105 | }); 106 | 107 | // assert 108 | Assert.assertEquals("Unauthorized. Please,verify your access key and access secret key or token for the given account", exception.getMessage()); 109 | } 110 | 111 | @Test 112 | public void testForbiddenResponse() { 113 | // arrange 114 | mockWebServer.enqueue(new MockResponse().setResponseCode(403).setBody("Error Description")); 115 | 116 | // act 117 | MailjetClientRequestException exception = Assert.assertThrows(MailjetClientRequestException.class, () ->{ 118 | client.post(request); 119 | }); 120 | 121 | // assert 122 | Assert.assertEquals("Error Description", exception.getMessage()); 123 | } 124 | 125 | @AfterClass 126 | public static void tearDown() throws IOException { 127 | mockWebServer.shutdown(); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/MailjetRequestUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import org.junit.Test; 4 | 5 | import java.math.BigDecimal; 6 | 7 | import static org.junit.Assert.*; 8 | 9 | public class MailjetRequestUtilTest { 10 | 11 | // encodeDecimal tests 12 | 13 | @Test 14 | public void encodeDecimal_nullReturnsNull() { 15 | assertNull(MailjetRequestUtil.encodeDecimal(null)); 16 | } 17 | 18 | @Test 19 | public void encodeDecimal_scaleZeroAppendsDecimalPoint() { 20 | BigDecimal v = new BigDecimal("123"); 21 | // scale == 0 → setScale(1) → "123.0" 22 | String encoded = MailjetRequestUtil.encodeDecimal(v); 23 | assertEquals("\f123.0\f", encoded); 24 | } 25 | 26 | @Test 27 | public void encodeDecimal_nonZeroScalePreservesScale() { 28 | BigDecimal v = new BigDecimal("45.67"); 29 | // scale != 0 → keep "45.67" 30 | String encoded = MailjetRequestUtil.encodeDecimal(v); 31 | assertEquals("\f45.67\f", encoded); 32 | } 33 | 34 | // decodeDecimals tests 35 | 36 | @Test 37 | public void decodeDecimals_nullReturnsNull() { 38 | assertNull(MailjetRequestUtil.decodeDecimals(null)); 39 | } 40 | 41 | @Test 42 | public void decodeDecimals_noEncodedSegmentsUnchanged() { 43 | String payload = "{\"value\":\"100\"}"; 44 | assertEquals(payload, MailjetRequestUtil.decodeDecimals(payload)); 45 | } 46 | 47 | @Test 48 | public void decodeDecimals_singleEncodedSegmentStripsMarkersAndQuotes() { 49 | String payload = "\"\\f123.0\\f\""; 50 | // matches the pattern "\"\\f(...)\f\"" → "$1" 51 | assertEquals("123.0", MailjetRequestUtil.decodeDecimals(payload)); 52 | } 53 | 54 | @Test 55 | public void decodeDecimals_multipleEncodedSegmentsInJson() { 56 | String payload = "{\"price\":\"\\f12.34\\f\",\"qty\":\"\\f5\\f\"}"; 57 | String decoded = MailjetRequestUtil.decodeDecimals(payload); 58 | // quotes around keys & values remain, only the \f markers & surrounding quotes are stripped 59 | assertEquals("{\"price\":12.34,\"qty\":5}", decoded); 60 | } 61 | 62 | @Test 63 | public void decodeDecimals_arrayOfEncodedNumbers() { 64 | String payload = "[\"\\f1\\f\",\"\\f2.2\\f\"]"; 65 | String decoded = MailjetRequestUtil.decodeDecimals(payload); 66 | assertEquals("[1,2.2]", decoded); 67 | } 68 | } -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/MailjetResponseTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetException; 4 | import org.json.JSONArray; 5 | import org.json.JSONException; 6 | import org.json.JSONObject; 7 | import org.junit.Test; 8 | 9 | import static org.junit.Assert.*; 10 | 11 | public class MailjetResponseTest { 12 | 13 | @Test 14 | public void testStatusAndRawResponse() { 15 | MailjetResponse resp = new MailjetResponse(201, "{\"foo\":1}"); 16 | assertEquals(201, resp.getStatus()); 17 | assertEquals("{\"foo\":1}", resp.getRawResponseContent()); 18 | } 19 | 20 | @Test 21 | public void testGetData_prefersDataField() { 22 | MailjetResponse resp = new MailjetResponse(200, "{\"Data\":[10,20]}"); 23 | JSONArray data = resp.getData(); 24 | assertEquals(2, data.length()); 25 | assertEquals(10, data.getInt(0)); 26 | assertEquals(20, data.getInt(1)); 27 | } 28 | 29 | @Test 30 | public void testGetData_prefersSentField() { 31 | MailjetResponse resp = new MailjetResponse(200, "{\"Sent\":[\"a\",\"b\"]}"); 32 | JSONArray data = resp.getData(); 33 | assertEquals(2, data.length()); 34 | assertEquals("a", data.getString(0)); 35 | assertEquals("b", data.getString(1)); 36 | } 37 | 38 | @Test 39 | public void testGetData_prefersMessagesField() { 40 | MailjetResponse resp = new MailjetResponse(200, "{\"Messages\":[true,false]}"); 41 | JSONArray data = resp.getData(); 42 | assertEquals(2, data.length()); 43 | assertTrue(data.getBoolean(0)); 44 | assertFalse(data.getBoolean(1)); 45 | } 46 | 47 | @Test 48 | public void testGetData_defaultWrapsObject() { 49 | MailjetResponse resp = new MailjetResponse(200, "{\"x\":42}"); 50 | JSONArray data = resp.getData(); 51 | assertEquals(1, data.length()); 52 | JSONObject obj = data.getJSONObject(0); 53 | assertEquals(42, obj.getInt("x")); 54 | } 55 | 56 | @Test 57 | public void testGetTotal_presentAndAbsent() { 58 | assertEquals(5, 59 | new MailjetResponse(200, "{\"Total\":5}").getTotal()); 60 | assertEquals(0, 61 | new MailjetResponse(200, "{}").getTotal()); 62 | } 63 | 64 | @Test 65 | public void testGetCount_presentAndAbsent() { 66 | assertEquals(3, 67 | new MailjetResponse(200, "{\"Count\":3}").getCount()); 68 | assertEquals(0, 69 | new MailjetResponse(200, "{}").getCount()); 70 | } 71 | 72 | @Test 73 | public void testGetString_existingKey() throws MailjetException { 74 | MailjetResponse resp = new MailjetResponse(200, "{\"greeting\":\"hello\"}"); 75 | assertEquals("hello", resp.getString("greeting")); 76 | } 77 | 78 | @Test 79 | public void testGetInt_existingKey() throws MailjetException { 80 | MailjetResponse resp = new MailjetResponse(200, "{\"n\":123}"); 81 | assertEquals(123, resp.getInt("n")); 82 | } 83 | 84 | @Test 85 | public void testGetJSONArray_existingKey() throws MailjetException { 86 | MailjetResponse resp = new MailjetResponse(200, "{\"arr\":[1,2,3]}"); 87 | JSONArray arr = resp.getJSONArray("arr"); 88 | assertEquals(3, arr.length()); 89 | assertEquals(2, arr.getInt(1)); 90 | } 91 | 92 | @Test(expected = JSONException.class) 93 | public void testGetString_missingKeyThrowsJSONException() throws MailjetException { 94 | MailjetResponse resp = new MailjetResponse(200, "{\"foo\":\"bar\"}"); 95 | resp.getString("missing"); 96 | } 97 | 98 | @Test(expected = JSONException.class) 99 | public void testGetInt_missingKeyThrowsJSONException() throws MailjetException { 100 | MailjetResponse resp = new MailjetResponse(200, "{\"foo\":1}"); 101 | resp.getInt("missing"); 102 | } 103 | 104 | @Test(expected = JSONException.class) 105 | public void testGetJSONArray_missingKeyThrowsJSONException() throws MailjetException { 106 | MailjetResponse resp = new MailjetResponse(200, "{\"foo\":[ ]}"); 107 | resp.getJSONArray("missing"); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/MailjetResponseUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.*; 4 | import com.mailjet.client.resource.Contact; 5 | import com.mailjet.client.resource.Emailv31; 6 | import org.junit.Test; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | public class MailjetResponseUtilTest { 11 | 12 | // -- validateMailjetResponse tests -- 13 | 14 | @Test(expected = MailjetRateLimitException.class) 15 | public void validateRateLimit_429ThrowsRateLimit() throws Exception { 16 | MailjetResponseUtil.validateMailjetResponse( 17 | new MailjetRequest(Contact.resource), 18 | 429, 19 | "{}" 20 | ); 21 | } 22 | 23 | @Test(expected = MailjetUnauthorizedException.class) 24 | public void validateUnauthorized_401ThrowsUnauthorized() throws Exception { 25 | MailjetResponseUtil.validateMailjetResponse( 26 | new MailjetRequest(Contact.resource), 27 | 401, 28 | "{\"foo\":1}" 29 | ); 30 | } 31 | 32 | @Test 33 | public void validateServerError_500WithBodyThrowsServerException() { 34 | try { 35 | MailjetResponseUtil.validateMailjetResponse( 36 | new MailjetRequest(Contact.resource), 37 | 500, 38 | "server went boom" 39 | ); 40 | fail("Expected MailjetServerException"); 41 | } catch (MailjetException e) { 42 | assertEquals("server went boom", e.getMessage()); 43 | } 44 | } 45 | 46 | @Test 47 | public void validateServerError_500NullBodyThrowsGeneralServerException() { 48 | try { 49 | MailjetResponseUtil.validateMailjetResponse( 50 | new MailjetRequest(Contact.resource), 51 | 500, 52 | null 53 | ); 54 | fail("Expected MailjetServerException"); 55 | } catch (MailjetException e) { 56 | assertTrue(e.getMessage().startsWith("Internal Server Error: ")); 57 | } 58 | } 59 | 60 | @Test(expected = MailjetClientRequestException.class) 61 | public void validateBadRequest_400NonPartialThrowsClientRequest() throws Exception { 62 | // Contact.resource is not Emailv31.resource, so partial-success doesn't apply 63 | MailjetResponseUtil.validateMailjetResponse( 64 | new MailjetRequest(Contact.resource), 65 | 400, 66 | "{\"anything\":true}" 67 | ); 68 | } 69 | 70 | @Test 71 | public void validateBadRequest_400Emailv31PartialSuccessDoesNotThrow() throws Exception { 72 | // Emailv31.resource with code 400 and valid JSON → partial success branch 73 | MailjetResponseUtil.validateMailjetResponse( 74 | new MailjetRequest(Emailv31.resource), 75 | 400, 76 | "{\"foo\":42}" 77 | ); 78 | // no exception means success 79 | } 80 | 81 | @Test(expected = MailjetClientRequestException.class) 82 | public void validateBadRequest_400Emailv31InvalidJsonThrowsClientRequest() throws Exception { 83 | // invalid JSON → fallback to throwing client request 84 | MailjetResponseUtil.validateMailjetResponse( 85 | new MailjetRequest(Emailv31.resource), 86 | 400, 87 | "not-json" 88 | ); 89 | } 90 | 91 | // -- isValidJSON tests -- 92 | 93 | @Test 94 | public void isValidJson_nullAndEmptyAndWhitespace() { 95 | assertFalse(MailjetResponseUtil.isValidJSON(null)); 96 | assertFalse(MailjetResponseUtil.isValidJSON("")); 97 | assertFalse(MailjetResponseUtil.isValidJSON(" ")); 98 | } 99 | 100 | @Test 101 | public void isValidJson_nonBracedStrings() { 102 | assertFalse(MailjetResponseUtil.isValidJSON("[]")); 103 | assertFalse(MailjetResponseUtil.isValidJSON("\"foo\"")); 104 | } 105 | 106 | @Test 107 | public void isValidJson_validObjects() { 108 | assertTrue(MailjetResponseUtil.isValidJSON("{}")); 109 | assertTrue(MailjetResponseUtil.isValidJSON(" { \"a\":1 } ")); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/MessageEndpointFilteringIT.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetClientRequestException; 4 | import com.mailjet.client.errors.MailjetException; 5 | import com.mailjet.client.resource.Message; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | public class MessageEndpointFilteringIT { 10 | 11 | @Test 12 | public void getMessagesWithFiltering_WrongFilter_Returns500() throws MailjetException { 13 | // arrange 14 | MailjetClient mailjetClient = TestHelper.getClient(); 15 | 16 | MailjetRequest mailjetRequest = new MailjetRequest(Message.resource) 17 | .filter("Sort", "id+DESC"); 18 | 19 | // act 20 | MailjetClientRequestException exception = Assert.assertThrows(MailjetClientRequestException.class, () -> { 21 | MailjetResponse mailjetResponse = mailjetClient.get(mailjetRequest); 22 | }); 23 | 24 | // assert 25 | Assert.assertEquals(400, exception.getStatusCode()); 26 | Assert.assertTrue(exception.getMessage() 27 | .contains("Unexpected error during GET: Invalid sort specification: Cannot sort on field id+desc")); 28 | } 29 | 30 | @Test 31 | public void getMessagesWithFiltering_ReturnsCorrectData() throws MailjetException { 32 | // arrange 33 | MailjetClient mailjetClient = TestHelper.getClient(); 34 | 35 | MailjetRequest mailjetRequestDesc = new MailjetRequest(Message.resource) 36 | .filter("Sort", "id DESC"); 37 | 38 | MailjetRequest mailjetRequestAsc = new MailjetRequest(Message.resource) 39 | .filter("Sort", "id ASC"); 40 | 41 | // act 42 | MailjetResponse responseWithDescSorting = mailjetClient.get(mailjetRequestDesc); 43 | MailjetResponse responseWithAscSorting = mailjetClient.get(mailjetRequestAsc); 44 | 45 | // assert 46 | Assert.assertEquals(200, responseWithDescSorting.getStatus()); 47 | Assert.assertEquals(200, responseWithAscSorting.getStatus()); 48 | 49 | Assert.assertEquals(10, responseWithAscSorting.getTotal()); 50 | 51 | long firstIdAsc = responseWithAscSorting.getData().getJSONObject(0).getLong("ID"); 52 | long firstIdDesc = responseWithDescSorting.getData().getJSONObject(0).getLong("ID"); 53 | Assert.assertTrue(firstIdAsc < firstIdDesc); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/SendIT.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetException; 4 | import com.mailjet.client.resource.Email; 5 | import org.json.JSONArray; 6 | import org.json.JSONObject; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | 10 | import java.util.concurrent.CompletableFuture; 11 | import java.util.concurrent.ExecutionException; 12 | import java.util.concurrent.Future; 13 | 14 | public class SendIT { 15 | 16 | @Test 17 | public void sendEmailV3() throws MailjetException { 18 | // arrange 19 | MailjetClient mailjetClient = TestHelper.getClient(); 20 | String senderEmail = TestHelper.getValidSenderEmail(mailjetClient); 21 | 22 | MailjetRequest mailjetRequest = new MailjetRequest(Email.resource) 23 | .property(Email.FROMEMAIL, senderEmail) 24 | .property(Email.FROMNAME, "Your Mailjet Pilot") 25 | .property(Email.RECIPIENTS, new JSONArray() 26 | .put(new JSONObject() 27 | .put("Email", senderEmail) 28 | .put("Name", "Passenger 1") 29 | ) 30 | ) 31 | .property(Email.SUBJECT, "Your email flight plan!") 32 | .property(Email.TEXTPART, "Dear passenger, welcome to Mailjet! May the delivery force be with you!") 33 | .property(Email.HTMLPART, "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!"); 34 | 35 | // act 36 | MailjetResponse mailjetResponse = mailjetClient.post(mailjetRequest); 37 | 38 | // assert 39 | Assert.assertEquals(200, mailjetResponse.getStatus()); 40 | Assert.assertEquals(senderEmail, mailjetResponse.getData().getJSONObject(0).getString("Email")); 41 | } 42 | 43 | @Test 44 | public void sendEmailV3Async() throws MailjetException, ExecutionException, InterruptedException { 45 | // arrange 46 | MailjetClient mailjetClient = TestHelper.getClient(); 47 | String senderEmail = TestHelper.getValidSenderEmail(mailjetClient); 48 | 49 | MailjetRequest mailjetRequest = new MailjetRequest(Email.resource) 50 | .property(Email.FROMEMAIL, senderEmail) 51 | .property(Email.FROMNAME, "Your Mailjet Pilot") 52 | .property(Email.RECIPIENTS, new JSONArray() 53 | .put(new JSONObject() 54 | .put("Email", senderEmail) 55 | .put("Name", "Passenger 1") 56 | ) 57 | ) 58 | .property(Email.SUBJECT, "Your email flight plan!") 59 | .property(Email.TEXTPART, "Dear passenger, welcome to Mailjet! May the delivery force be with you!") 60 | .property(Email.HTMLPART, "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!"); 61 | 62 | // act 63 | CompletableFuture responseFuture = mailjetClient.postAsync(mailjetRequest); 64 | MailjetResponse mailjetResponse = responseFuture.get(); 65 | 66 | // assert 67 | Assert.assertEquals(200, mailjetResponse.getStatus()); 68 | Assert.assertEquals(senderEmail, mailjetResponse.getData().getJSONObject(0).getString("Email")); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/SendSmsIT.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetClientRequestException; 4 | import com.mailjet.client.errors.MailjetException; 5 | import com.mailjet.client.resource.sms.Sms; 6 | import com.mailjet.client.resource.sms.SmsSend; 7 | import org.json.JSONObject; 8 | import org.junit.Assert; 9 | import org.junit.Ignore; 10 | import org.junit.Test; 11 | 12 | import java.sql.Timestamp; 13 | import java.time.LocalDateTime; 14 | 15 | public class SendSmsIT { 16 | 17 | // @Test 18 | public void sendSms_UnsupportedCountry_ThrowsMailjetException() { 19 | // arrange 20 | MailjetClient mailjetClient = new MailjetClient(ClientOptions 21 | .builder() 22 | .bearerAccessToken(System.getenv("MJ_APITOKEN")) 23 | .build()); 24 | 25 | String ukrainePhoneNumber = "+380507363100"; 26 | 27 | MailjetRequest mailjetRequest = new MailjetRequest(SmsSend.resource) 28 | .property(SmsSend.FROM, "MJPilot") 29 | .property(SmsSend.TO, ukrainePhoneNumber) 30 | .property(SmsSend.TEXT, "Have a nice SMS flight with Mailjet!"); 31 | 32 | // act 33 | MailjetClientRequestException requestException = Assert.assertThrows(MailjetClientRequestException.class, () -> mailjetClient.post(mailjetRequest)); 34 | 35 | // assert 36 | Assert.assertEquals(400, requestException.getStatusCode()); 37 | Assert.assertTrue(requestException.getMessage().endsWith("\"ErrorCode\":\"sms-0002\",\"StatusCode\":400,\"ErrorMessage\":\"Unsupported country code.\",\"ErrorRelatedTo\":[\"To\"]}")); 38 | } 39 | 40 | // @Test 41 | @Ignore("This test will send the real sms") 42 | public void sendSms_SupportedCountry_ReturnsSuccessResponse() throws MailjetException { 43 | // arrange 44 | MailjetClient mailjetClient = new MailjetClient(ClientOptions 45 | .builder() 46 | .bearerAccessToken(System.getenv("MJ_APITOKEN")) 47 | .build()); 48 | 49 | // to verify other countries, free services like https://receive-smss.com/ can be used 50 | String germanyPhoneNumber = "+4915207831169"; 51 | 52 | MailjetRequest mailjetRequest = new MailjetRequest(SmsSend.resource) 53 | .property(SmsSend.FROM, "MJPilot") 54 | .property(SmsSend.TO, germanyPhoneNumber) 55 | .property(SmsSend.TEXT, "Have a nice SMS flight with Mailjet!"); 56 | 57 | // act 58 | MailjetResponse response = mailjetClient.post(mailjetRequest); 59 | 60 | // assert 61 | Assert.assertEquals(200, response.getStatus()); 62 | Assert.assertEquals("Message is being sent", response.getData().getJSONObject(0).getJSONObject("Status").getString("Description")); 63 | Assert.assertEquals("Have a nice SMS flight with Mailjet!", response.getString("Text")); 64 | } 65 | 66 | // @Test 67 | public void getSms_AppliesTsFilter_ReturnsSmsData() throws MailjetException { 68 | // arrange 69 | MailjetClient mailjetClient = new MailjetClient(ClientOptions 70 | .builder() 71 | .bearerAccessToken(System.getenv("MJ_APITOKEN")) 72 | .build()); 73 | 74 | int startTs = 1607300300; 75 | int endTs = 1607300600; 76 | 77 | MailjetRequest request = new MailjetRequest(Sms.resource) 78 | .filter(Sms.FROMTS, startTs) 79 | .filter(Sms.TOTS, endTs); 80 | 81 | // act 82 | MailjetResponse response = mailjetClient.get(request); 83 | 84 | // assert 85 | Assert.assertEquals(200, response.getStatus()); 86 | Assert.assertEquals(1, response.getData().length()); 87 | 88 | JSONObject smsInfo = response.getData().getJSONObject(0); 89 | Assert.assertEquals("MJPilot", smsInfo.getString("From")); 90 | Assert.assertEquals("0eecaf20-b3d1-4a7f-9271-3f45a268b00c", smsInfo.getString("ID")); 91 | Assert.assertEquals(1607300397, smsInfo.getInt("CreationTS")); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/StatisticsIT.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import org.json.JSONArray; 4 | import org.junit.Assert; 5 | import org.junit.Before; 6 | import org.junit.Ignore; 7 | import org.junit.Test; 8 | 9 | import com.mailjet.client.errors.MailjetException; 10 | import com.mailjet.client.resource.StatisticsLinkclick; 11 | 12 | import static org.junit.Assert.assertNotNull; 13 | 14 | @Ignore 15 | public class StatisticsIT { 16 | private MailjetClient client; 17 | 18 | @Before 19 | public void setUp() { 20 | client = TestHelper.getClient(); 21 | } 22 | 23 | @Test 24 | public void statisticsLinkClickTest() throws MailjetException { 25 | MailjetRequest request = new MailjetRequest(StatisticsLinkclick.resource) 26 | .filter(StatisticsLinkclick.CAMPAIGNID, "$Campaign_ID"); 27 | 28 | MailjetResponse response = client.get(request); 29 | 30 | Assert.assertEquals(200, response.getStatus()); 31 | Integer count = response.getInt("Count"); 32 | assertNotNull(count); 33 | Integer total = response.getInt("Total"); 34 | assertNotNull(total); 35 | JSONArray data = response.getJSONArray("Data"); 36 | assertNotNull(data); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/TemplateIT.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetException; 4 | import com.mailjet.client.resource.Template; 5 | import com.mailjet.client.resource.TemplateDetailcontent; 6 | import org.json.JSONArray; 7 | import org.json.JSONObject; 8 | import org.junit.Assert; 9 | import org.junit.FixMethodOrder; 10 | import org.junit.Test; 11 | import org.junit.runners.MethodSorters; 12 | 13 | import java.util.UUID; 14 | 15 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) 16 | public class TemplateIT { 17 | 18 | private static long templateId; 19 | private static MailjetClient mailjetClient = TestHelper.getClient(); 20 | private static String utf8String = "ID_AÇÃO©℗®™"; 21 | private static String mjmlContent = 22 | "" + 23 | " " + 24 | " " + 25 | " " + 26 | " " + 27 | " " + 28 | " Hello World" + utf8String +"" + 29 | " " + 30 | " " + 31 | " " + 32 | ""; 33 | 34 | private static String htmlContent = "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" + utf8String; 35 | private static String textContent = "Dear passenger, welcome to Mailjet! May the delivery force be with you!" + utf8String; 36 | 37 | @Test 38 | public void a_createTemplate() throws MailjetException { 39 | // arrange 40 | MailjetRequest mailjetRequest = new MailjetRequest(Template.resource) 41 | .property(Template.AUTHOR, "John Doe") 42 | .property(Template.CATEGORIES, new JSONArray("[\"welcome\"]")) 43 | .property(Template.COPYRIGHT, "Mailjet") 44 | .property(Template.DESCRIPTION, "Used to send out promo codes.") 45 | .property(Template.EDITMODE, 1) 46 | .property(Template.ISSTARRED, false) 47 | .property(Template.ISTEXTPARTGENERATIONENABLED, true) 48 | //.property(Template.LOCALE, "en_US") 49 | .property(Template.NAME, "Promo Codes test template #" + UUID.randomUUID().toString()) 50 | .property(Template.OWNERTYPE, "user") 51 | .property(Template.PRESETS, "string") 52 | .property(Template.PURPOSES, new JSONArray("[\"transactional\"]")); 53 | 54 | // act 55 | MailjetResponse mailjetResponse = mailjetClient.post(mailjetRequest); 56 | 57 | // assert 58 | Assert.assertEquals(201, mailjetResponse.getStatus()); 59 | Assert.assertEquals(1, mailjetResponse.getCount()); 60 | 61 | templateId = mailjetResponse.getData().getJSONObject(0).getLong("ID"); 62 | Assert.assertTrue(templateId > 0); 63 | } 64 | 65 | @Test 66 | public void b_putTemplateContent() throws MailjetException { 67 | // arrange 68 | JSONObject templateHeaders = new JSONObject(); 69 | templateHeaders.put("From", "test@mailjet.com"); 70 | templateHeaders.put("Subject", "Test subject"); 71 | templateHeaders.put("Reply-to", "test@mailjet.com"); 72 | 73 | MailjetRequest mailjetRequest = new MailjetRequest(TemplateDetailcontent.resource, templateId) 74 | .property(TemplateDetailcontent.HEADERS, templateHeaders) 75 | .property(TemplateDetailcontent.HTMLPART, htmlContent) 76 | .property(TemplateDetailcontent.MJMLCONTENT, mjmlContent) 77 | .property(TemplateDetailcontent.TEXTPART, textContent); 78 | 79 | // act 80 | MailjetResponse mailjetResponse = mailjetClient.post(mailjetRequest); 81 | 82 | // assert 83 | Assert.assertEquals(201, mailjetResponse.getStatus()); 84 | Assert.assertEquals(1, mailjetResponse.getCount()); 85 | 86 | JSONObject templateData = mailjetResponse.getData().getJSONObject(0); 87 | Assert.assertEquals(htmlContent, templateData.getString(TemplateDetailcontent.HTMLPART)); 88 | Assert.assertEquals(textContent, templateData.getString(TemplateDetailcontent.TEXTPART)); 89 | Assert.assertEquals(mjmlContent, templateData.getString(TemplateDetailcontent.MJMLCONTENT)); 90 | } 91 | 92 | @Test 93 | public void c_getTemplateContent() throws MailjetException { 94 | // arrange 95 | MailjetRequest mailjetRequest = new MailjetRequest(TemplateDetailcontent.resource, templateId); 96 | 97 | // act 98 | MailjetResponse mailjetResponse = mailjetClient.get(mailjetRequest); 99 | 100 | // assert 101 | Assert.assertEquals(200, mailjetResponse.getStatus()); 102 | Assert.assertEquals(1, mailjetResponse.getCount()); 103 | 104 | JSONObject templateData = mailjetResponse.getData().getJSONObject(0); 105 | Assert.assertEquals(htmlContent, templateData.getString(TemplateDetailcontent.HTMLPART)); 106 | Assert.assertEquals(textContent, templateData.getString(TemplateDetailcontent.TEXTPART)); 107 | Assert.assertEquals(mjmlContent, templateData.getString(TemplateDetailcontent.MJMLCONTENT)); 108 | } 109 | 110 | @Test 111 | public void d_deleteTemplate() throws MailjetException { 112 | // arrange 113 | MailjetRequest mailjetRequest = new MailjetRequest(Template.resource, templateId); 114 | 115 | // act 116 | MailjetResponse mailjetResponse = mailjetClient.delete(mailjetRequest); 117 | 118 | // assert 119 | Assert.assertEquals(204, mailjetResponse.getStatus()); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/TestHelper.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetException; 4 | import com.mailjet.client.resource.Sender; 5 | import org.json.JSONObject; 6 | import org.junit.Assert; 7 | 8 | public class TestHelper { 9 | public static MailjetClient getClient() { 10 | final ClientOptions clientOptions = ClientOptions 11 | .builder() 12 | .apiKey(System.getenv("MJ_APIKEY_PUBLIC")) 13 | .apiSecretKey(System.getenv("MJ_APIKEY_PRIVATE")) 14 | .build(); 15 | 16 | final MailjetClient mailjetClient = new MailjetClient(clientOptions); 17 | 18 | return mailjetClient; 19 | } 20 | 21 | public static String getValidSenderEmail(MailjetClient v3Client) throws MailjetException { 22 | MailjetRequest request = new MailjetRequest(Sender.resource); 23 | MailjetResponse response = v3Client.get(request); 24 | 25 | Assert.assertEquals(200, response.getStatus()); 26 | 27 | for (int i = 0; i < response.getData().length(); i++) { 28 | JSONObject emailObject = response.getData().getJSONObject(i); 29 | 30 | if (emailObject.getString("Status").equals("Active")) 31 | return emailObject.getString("Email"); 32 | } 33 | 34 | throw new AssertionError("Cannot find Active sender address under given account"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/TransactionalEmailBuilderTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client; 2 | 3 | import com.mailjet.client.errors.MailjetException; 4 | import com.mailjet.client.resource.*; 5 | import com.mailjet.client.resource.sms.SmsSend; 6 | import com.mailjet.client.transactional.*; 7 | import com.mailjet.client.transactional.response.SendEmailsResponse; 8 | import okhttp3.mockwebserver.MockResponse; 9 | import okhttp3.mockwebserver.MockWebServer; 10 | import okhttp3.mockwebserver.RecordedRequest; 11 | import org.json.JSONArray; 12 | import org.json.JSONObject; 13 | import org.junit.AfterClass; 14 | import org.junit.BeforeClass; 15 | import org.junit.Test; 16 | 17 | import java.io.IOException; 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | import static org.junit.Assert.assertEquals; 22 | import static org.junit.Assert.assertTrue; 23 | 24 | public class TransactionalEmailBuilderTest { 25 | 26 | private static MailjetClient client; 27 | private static MockWebServer mockWebServer; 28 | 29 | @BeforeClass 30 | public static void initialize() throws IOException { 31 | mockWebServer = new MockWebServer(); 32 | mockWebServer.start(); 33 | 34 | final ClientOptions clientOptions = ClientOptions 35 | .builder() 36 | .baseUrl(mockWebServer.url("/").toString()) 37 | .apiSecretKey("secret-key") 38 | .apiKey("api-key") 39 | .bearerAccessToken("bearer-token") 40 | .build(); 41 | 42 | client = new MailjetClient(clientOptions); 43 | } 44 | 45 | @Test 46 | public void transactionalEmail_WithVariables_ShouldCorrectlyPassVariables() throws MailjetException, InterruptedException { 47 | 48 | // arrange 49 | String expectedBody = "{\"Messages\":[{\"Cc\":[],\"TrackClicks\":\"enabled\",\"Bcc\":[],\"Priority\":3,\"Headers\":{},\"From\":{\"Email\":\"xxxxxxxx@xxxxxxx.com\",\"Name\":\"xxxxxxxx xxxxxxxxxx\"},\"Attachments\":[],\"TemplateLanguage\":true,\"TrackOpens\":\"enabled\",\"Variables\":{\"E_DATE\":\"a string text\",\"E_ARRAY\":[\"val1\",\"val2\"],\"E_MAIL_ID\":123},\"CustomID\":\"8c0725fa-403c-496e-ac7e-xxxxxxxxx\",\"InlinedAttachments\":[],\"To\":[{\"Email\":\"xxxxxxxx@xxxxxxx.com\",\"Name\":\"xxxxxxxx xxxxxxxxxx\"}],\"TemplateID\":1234567}]}"; 50 | 51 | mockWebServer.enqueue(new MockResponse().setResponseCode(201).setBody("{}")); 52 | 53 | Map variables = new HashMap<>(); 54 | variables.put("E_DATE", "a string text"); 55 | variables.put("E_ARRAY", new String[]{"val1", "val2"}); 56 | variables.put("E_MAIL_ID", 123); 57 | 58 | TransactionalEmail message = TransactionalEmail 59 | .builder() 60 | .to(new SendContact("xxxxxxxx@xxxxxxx.com", "xxxxxxxx xxxxxxxxxx")) 61 | .from(new SendContact("xxxxxxxx@xxxxxxx.com", "xxxxxxxx xxxxxxxxxx")) 62 | .templateID(1234567L) 63 | .templateLanguage(true) 64 | .priority(3) 65 | .customID("8c0725fa-403c-496e-ac7e-xxxxxxxxx") 66 | .variables(variables) 67 | .trackOpens(TrackOpens.ENABLED) 68 | .trackClicks(TrackClicks.ENABLED) 69 | .build(); 70 | 71 | SendEmailsRequest request = SendEmailsRequest.builder() 72 | .message(message) 73 | .build(); 74 | 75 | // act 76 | SendEmailsResponse response = request.sendWith(client); 77 | 78 | // assert 79 | RecordedRequest recordedRequest = mockWebServer.takeRequest(); 80 | 81 | assertEquals(expectedBody, recordedRequest.getBody().readUtf8()); 82 | } 83 | 84 | @AfterClass 85 | public static void tearDown() throws IOException { 86 | mockWebServer.shutdown(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/easy/MJEasyClientTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.easy; 2 | 3 | import com.mailjet.client.MailjetClient; 4 | import com.mailjet.client.MailjetRequest; 5 | import com.mailjet.client.MailjetResponse; 6 | import com.mailjet.client.errors.MailjetException; 7 | import com.mailjet.client.resource.Email; 8 | 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import static org.junit.Assert.assertNotNull; 13 | import static org.junit.Assert.assertSame; 14 | import static org.junit.Assert.assertTrue; 15 | import static org.mockito.Mockito.mock; 16 | import static org.mockito.Mockito.verify; 17 | import static org.mockito.Mockito.when; 18 | 19 | public class MJEasyClientTest { 20 | 21 | private MailjetClient mockMailjetClient; 22 | private MJEasyClient easyClient; 23 | 24 | @Before 25 | public void setUp() { 26 | mockMailjetClient = mock(MailjetClient.class); 27 | easyClient = new MJEasyClient(mockMailjetClient); 28 | } 29 | 30 | @Test 31 | public void testConstructorWithApiKeys() { 32 | MJEasyClient client = new MJEasyClient("publicKey", "privateKey"); 33 | assertNotNull(client.getClient()); 34 | } 35 | 36 | @Test 37 | public void testConstructorWithToken() { 38 | MJEasyClient client = new MJEasyClient("token"); 39 | assertNotNull(client.getClient()); 40 | } 41 | 42 | @Test 43 | public void testConstructorWithEnvironmentVariables() { 44 | System.setProperty("MJ_APIKEY_PUBLIC", "publicKey"); 45 | System.setProperty("MJ_APIKEY_PRIVATE", "privateKey"); 46 | 47 | MJEasyClient client = new MJEasyClient(); 48 | assertNotNull(client.getClient()); 49 | } 50 | 51 | @Test 52 | public void testEmailMethodCreatesMJEasyEmail() { 53 | MJEasyEmail email = easyClient.email(); 54 | assertNotNull(email); 55 | assertTrue(email instanceof MJEasyEmail); 56 | } 57 | 58 | @Test 59 | public void testSmsMethodCreatesMJEasySms() { 60 | MJEasySms sms = easyClient.sms(); 61 | assertNotNull(sms); 62 | assertTrue(sms instanceof MJEasySms); 63 | } 64 | 65 | @Test 66 | public void testSendDelegatesToMailjetClient() throws Exception { 67 | MailjetRequest request = new MailjetRequest(Email.resource); 68 | MailjetResponse mockResponse = mock(MailjetResponse.class); 69 | 70 | when(mockMailjetClient.post(request)).thenReturn(mockResponse); 71 | 72 | MailjetResponse response = easyClient.getClient().post(request); 73 | assertSame(mockResponse, response); 74 | 75 | verify(mockMailjetClient).post(request); 76 | } 77 | 78 | @Test(expected = MailjetException.class) 79 | public void testSendThrowsMailjetException() throws Exception { 80 | MailjetRequest request = new MailjetRequest(Email.resource); 81 | 82 | when(mockMailjetClient.post(request)).thenThrow(new MailjetException("Error")); 83 | 84 | easyClient.getClient().post(request); 85 | } 86 | } -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/easy/MJEasyEmailTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.easy; 2 | 3 | import com.mailjet.client.MailjetClient; 4 | import com.mailjet.client.MailjetRequest; 5 | import com.mailjet.client.MailjetResponse; 6 | import com.mailjet.client.errors.MailjetException; 7 | import com.mailjet.client.resource.Contact; 8 | import com.mailjet.client.resource.Email; 9 | 10 | import org.json.JSONArray; 11 | import org.json.JSONObject; 12 | import org.junit.Before; 13 | import org.junit.Test; 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertFalse; 17 | import static org.junit.Assert.assertNotNull; 18 | import static org.junit.Assert.assertSame; 19 | import static org.mockito.Mockito.mock; 20 | import static org.mockito.Mockito.verify; 21 | import static org.mockito.Mockito.when; 22 | 23 | public class MJEasyEmailTest { 24 | 25 | private MJEasyClient mockEasyClient; 26 | private MailjetClient mockMjClient; 27 | private MailjetResponse mockResponse; 28 | private MailjetRequest request; 29 | private MJEasyEmail email; 30 | 31 | @Before 32 | public void setUp() { 33 | mockEasyClient = mock(MJEasyClient.class); 34 | mockMjClient = mock(MailjetClient.class); 35 | mockResponse = mock(MailjetResponse.class); 36 | 37 | when(mockEasyClient.getClient()).thenReturn(mockMjClient); 38 | 39 | request = new MailjetRequest(Email.resource); 40 | email = new MJEasyEmail(mockEasyClient, request); 41 | } 42 | 43 | @Test 44 | public void testFromWithNameSetsBothEmailAndName() { 45 | MJEasyEmail returned = email.from("me@example.com", "Me Myself"); 46 | assertSame(email, returned); 47 | 48 | JSONObject body = request.getBodyJSON(); 49 | assertEquals("me@example.com", body.getString(Email.FROMEMAIL)); 50 | assertEquals("Me Myself", body.getString(Email.FROMNAME)); 51 | } 52 | 53 | @Test 54 | public void testFromWithoutNameOnlySetsEmail() { 55 | MJEasyEmail returned = email.from("noreply@domain.com"); 56 | assertSame(email, returned); 57 | 58 | JSONObject body = request.getBodyJSON(); 59 | assertEquals("noreply@domain.com", body.getString(Email.FROMEMAIL)); 60 | assertFalse(body.has(Email.FROMNAME)); 61 | } 62 | 63 | @Test 64 | public void testToAddsOneRecipientAndUpdatesRequest() { 65 | MJEasyEmail returned = email.to("user@host.com"); 66 | assertSame(email, returned); 67 | 68 | JSONObject body = request.getBodyJSON(); 69 | JSONArray recipients = body.getJSONArray(Email.RECIPIENTS); 70 | assertNotNull(recipients); 71 | assertEquals(1, recipients.length()); 72 | 73 | JSONObject first = recipients.getJSONObject(0); 74 | assertEquals("user@host.com", first.getString(Contact.EMAIL)); 75 | } 76 | 77 | @Test 78 | public void testChainingAllSetters() { 79 | MJEasyEmail chain = email 80 | .from("a@b.c", "Name") 81 | .to("x@y.z") 82 | .subject("Hi") 83 | .text("body text") 84 | .html("

html

") 85 | .customId("cid-123"); 86 | 87 | assertSame(email, chain); 88 | 89 | JSONObject body = request.getBodyJSON(); 90 | assertEquals("a@b.c", body.getString(Email.FROMEMAIL)); 91 | assertEquals("Name", body.getString(Email.FROMNAME)); 92 | 93 | JSONArray recipients = body.getJSONArray(Email.RECIPIENTS); 94 | assertEquals(1, recipients.length()); 95 | assertEquals("x@y.z", recipients.getJSONObject(0).getString(Contact.EMAIL)); 96 | 97 | assertEquals("Hi", body.getString(Email.SUBJECT)); 98 | assertEquals("body text", body.getString(Email.TEXTPART)); 99 | assertEquals("

html

", body.getString(Email.HTMLPART)); 100 | assertEquals("cid-123", body.getString(Email.MJCUSTOMID)); 101 | } 102 | 103 | @Test 104 | public void testGetRequestReturnsUnderlyingRequest() { 105 | assertSame(request, email.getRequest()); 106 | } 107 | 108 | @Test 109 | public void testSendInvokesMailjetClientAndReturnsResponse() throws Exception { 110 | when(mockMjClient.post(request)).thenReturn(mockResponse); 111 | 112 | MailjetResponse result = email.send(); 113 | assertSame(mockResponse, result); 114 | 115 | verify(mockMjClient).post(request); 116 | } 117 | 118 | @Test(expected = MailjetException.class) 119 | public void testSendPropagatesMailjetException() throws Exception { 120 | when(mockMjClient.post(request)).thenThrow(new MailjetException("boom")); 121 | 122 | email.send(); 123 | } 124 | } -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/easy/MJEasySmsTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.easy; 2 | 3 | import com.mailjet.client.MailjetClient; 4 | import com.mailjet.client.MailjetRequest; 5 | import com.mailjet.client.MailjetResponse; 6 | import com.mailjet.client.errors.MailjetException; 7 | import com.mailjet.client.resource.sms.SmsSend; 8 | 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import static org.junit.Assert.assertSame; 13 | import static org.mockito.Mockito.mock; 14 | import static org.mockito.Mockito.verify; 15 | import static org.mockito.Mockito.when; 16 | 17 | public class MJEasySmsTest { 18 | 19 | private MJEasyClient mockEasyClient; 20 | private MailjetClient mockMailjetClient; 21 | private MailjetRequest mockRequest; 22 | private MailjetResponse mockResponse; 23 | private MJEasySms sms; 24 | 25 | @Before 26 | public void setUp() { 27 | mockEasyClient = mock(MJEasyClient.class); 28 | mockMailjetClient = mock(MailjetClient.class); 29 | mockRequest = mock(MailjetRequest.class); 30 | mockResponse = mock(MailjetResponse.class); 31 | 32 | when(mockEasyClient.getClient()).thenReturn(mockMailjetClient); 33 | 34 | sms = new MJEasySms(mockEasyClient, mockRequest); 35 | } 36 | 37 | @Test 38 | public void testFromSetsSender() { 39 | MJEasySms returned = sms.from("SenderNumber"); 40 | assertSame(sms, returned); 41 | 42 | verify(mockRequest).property(SmsSend.FROM, "SenderNumber"); 43 | } 44 | 45 | @Test 46 | public void testToSetsRecipient() { 47 | MJEasySms returned = sms.to("RecipientNumber"); 48 | assertSame(sms, returned); 49 | 50 | verify(mockRequest).property(SmsSend.TO, "RecipientNumber"); 51 | } 52 | 53 | @Test 54 | public void testTextSetsMessageContent() { 55 | MJEasySms returned = sms.text("Hello, this is a test message."); 56 | assertSame(sms, returned); 57 | 58 | verify(mockRequest).property(SmsSend.TEXT, "Hello, this is a test message."); 59 | } 60 | 61 | @Test 62 | public void testSendInvokesMailjetClientAndReturnsResponse() throws Exception { 63 | when(mockMailjetClient.post(mockRequest)).thenReturn(mockResponse); 64 | 65 | MailjetResponse response = sms.send(); 66 | assertSame(mockResponse, response); 67 | 68 | verify(mockMailjetClient).post(mockRequest); 69 | } 70 | 71 | @Test(expected = MailjetException.class) 72 | public void testSendPropagatesMailjetException() throws Exception { 73 | when(mockMailjetClient.post(mockRequest)).thenThrow(new MailjetException("Error")); 74 | 75 | sms.send(); 76 | } 77 | } -------------------------------------------------------------------------------- /src/test/java/com/mailjet/client/transactional/AttachmentTest.java: -------------------------------------------------------------------------------- 1 | package com.mailjet.client.transactional; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import java.io.ByteArrayInputStream; 7 | import java.io.IOException; 8 | import java.nio.charset.StandardCharsets; 9 | import java.nio.file.Files; 10 | import java.nio.file.Path; 11 | import java.util.Base64; 12 | 13 | public class AttachmentTest { 14 | 15 | @Test 16 | public void builder_setsAllFields_andEqualsHashCode() { 17 | Attachment a1 = Attachment.builder() 18 | .filename("file.txt") 19 | .contentType("text/plain") 20 | .base64Content("Zm9vYmFy") // "foobar" in Base64 21 | .contentID("cid123") 22 | .build(); 23 | 24 | // getters 25 | Assert.assertEquals("file.txt", a1.getFilename()); 26 | Assert.assertEquals("text/plain", a1.getContentType()); 27 | Assert.assertEquals("Zm9vYmFy", a1.getBase64Content()); 28 | Assert.assertEquals("cid123", a1.getContentID()); 29 | 30 | // equals & hashCode 31 | Attachment a2 = Attachment.builder() 32 | .filename("file.txt") 33 | .contentType("text/plain") 34 | .base64Content("Zm9vYmFy") 35 | .contentID("cid123") 36 | .build(); 37 | Assert.assertTrue(a1.equals(a2)); 38 | Assert.assertEquals(a1.hashCode(), a2.hashCode()); 39 | } 40 | 41 | @Test 42 | public void fromInputStream_encodesStreamCorrectly_andSetsFields() throws IOException { 43 | byte[] original = "Hello, World!".getBytes(StandardCharsets.UTF_8); 44 | ByteArrayInputStream in = new ByteArrayInputStream(original); 45 | 46 | String filename = "greeting.txt"; 47 | String mimeType = "text/plain"; 48 | Attachment att = Attachment.fromInputStream(in, filename, mimeType); 49 | 50 | // filename & content type as passed in 51 | Assert.assertEquals(filename, att.getFilename()); 52 | Assert.assertEquals(mimeType, att.getContentType()); 53 | 54 | // base64 content matches original bytes 55 | String expectedB64 = Base64.getEncoder().encodeToString(original); 56 | Assert.assertEquals(expectedB64, att.getBase64Content()); 57 | 58 | // contentID is never set by fromInputStream 59 | Assert.assertNull(att.getContentID()); 60 | } 61 | 62 | @Test 63 | public void fromFile_readsFileAndDetectsMime_andEncodes() throws IOException { 64 | // create a temp .txt file 65 | Path temp = Files.createTempFile("attach-test-", ".txt"); 66 | Files.write(temp, "Line1\nLine2".getBytes(StandardCharsets.UTF_8)); 67 | 68 | Attachment att = Attachment.fromFile(temp.toString()); 69 | 70 | // filename should be the file's name only 71 | Assert.assertEquals(temp.getFileName().toString(), att.getFilename()); 72 | 73 | // contentType should match Files.probeContentType 74 | String expectedType = Files.probeContentType(temp); 75 | Assert.assertEquals(expectedType, att.getContentType()); 76 | 77 | // content should be Base64 of file bytes 78 | byte[] fileBytes = Files.readAllBytes(temp); 79 | String expectedB64 = Base64.getEncoder().encodeToString(fileBytes); 80 | Assert.assertEquals(expectedB64, att.getBase64Content()); 81 | 82 | // contentID is not set by fromFile 83 | Assert.assertNull(att.getContentID()); 84 | 85 | // cleanup 86 | Files.deleteIfExists(temp); 87 | } 88 | 89 | @Test(expected = IOException.class) 90 | public void fromFile_throws_whenFileNotFound() throws IOException { 91 | // attempt to read a non-existent file 92 | Attachment.fromFile("/path/does/not/exist.bin"); 93 | } 94 | } -------------------------------------------------------------------------------- /src/test/resources/Test-attachment.txt: -------------------------------------------------------------------------------- 1 | Some content♠☄☕ --------------------------------------------------------------------------------