From 22ab4650dd4ce9de2103193b50d83470aa41a74d Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Wed, 11 Dec 2024 17:55:02 +0100 Subject: [PATCH] feat (Mailgun/Email): Simplify some fields as Boolean --- .../v1/adapters/BooleanFormSerializer.java | 18 ++ .../adapters/BooleanFormSerializerTest.java | 42 ++++ .../v1/emails/request/SendEmailRequest.java | 206 +----------------- .../emails/request/SendEmailRequestImpl.java | 78 ++++--- .../emails/request/SendMimeEmailRequest.java | 206 +----------------- .../request/SendMimeEmailRequestImpl.java | 78 ++++--- .../emails/request/SendEmailRequestTest.java | 24 +- .../request/SendMimeEmailRequestTest.java | 21 +- .../sample/mailgun/messages/SendEmail.java | 3 +- 9 files changed, 189 insertions(+), 487 deletions(-) create mode 100644 client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializer.java create mode 100644 client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializerTest.java diff --git a/client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializer.java b/client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializer.java new file mode 100644 index 00000000..84d9df59 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializer.java @@ -0,0 +1,18 @@ +package com.sinch.sdk.domains.mailgun.api.v1.adapters; + +import com.sinch.sdk.core.databind.FormSerializer; +import java.util.Map; + +public class BooleanFormSerializer extends FormSerializer { + + @Override + public void serialize(Boolean in, String fieldName, Map out) { + if (null != in) { + out.put(fieldName, format(in)); + } + } + + private static String format(Boolean value) { + return String.format("%s", value); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializerTest.java b/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializerTest.java new file mode 100644 index 00000000..39772e3d --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/BooleanFormSerializerTest.java @@ -0,0 +1,42 @@ +package com.sinch.sdk.domains.mailgun.api.v1.adapters; + +import static org.junit.jupiter.api.Assertions.*; + +import com.sinch.sdk.core.TestHelpers; +import java.util.HashMap; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class BooleanFormSerializerTest { + BooleanFormSerializer serializer = new BooleanFormSerializer(); + + @Test + void serializeTrue() { + + HashMap map = new HashMap<>(); + + serializer.serialize(true, "key name", map); + + TestHelpers.recursiveEquals("true", map.get("key name")); + } + + @Test + void serializeFalse() { + + HashMap map = new HashMap<>(); + + serializer.serialize(false, "key name", map); + + TestHelpers.recursiveEquals("false", map.get("key name")); + } + + @Test + void serializeNull() { + + HashMap map = new HashMap<>(); + + serializer.serialize(null, "key name", map); + + Assertions.assertNull(map.get("key name")); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java index 45afb119..51449e61 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java @@ -114,36 +114,12 @@ public interface SendEmailRequest extends AdditionalProperties { */ String getTemplateVersion(); - /** Render template in case of template sending */ - public class TemplateTextEnum extends EnumDynamic { - public static final TemplateTextEnum YES = new TemplateTextEnum("yes"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(TemplateTextEnum.class, TemplateTextEnum::new, Arrays.asList(YES)); - - private TemplateTextEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TemplateTextEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TemplateTextEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Render template in case of template sending * * @return templateText */ - TemplateTextEnum getTemplateText(); + Boolean getTemplateText(); /** * A valid JSON-encoded dictionary used as the input for template variable expansion. See getTag(); - /** Enables/disables DKIM signatures on a per-message basis */ - public class DkimSignatureEnum extends EnumDynamic { - public static final DkimSignatureEnum YES = new DkimSignatureEnum("yes"); - public static final DkimSignatureEnum NO = new DkimSignatureEnum("no"); - public static final DkimSignatureEnum TRUE = new DkimSignatureEnum("true"); - public static final DkimSignatureEnum FALSE = new DkimSignatureEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DkimSignatureEnum.class, DkimSignatureEnum::new, Arrays.asList(YES, NO, TRUE, FALSE)); - - private DkimSignatureEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DkimSignatureEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DkimSignatureEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Enables/disables DKIM signatures on a per-message basis * * @return enableDkimSignature */ - DkimSignatureEnum getEnableDkimSignature(); + Boolean getEnableDkimSignature(); /** * Specify a second domain key to sign the email with. The value is formatted as @@ -253,34 +201,6 @@ public static String valueOf(DkimSignatureEnum e) { */ String getTimezoneLocalize(); - /** - * Enables sending in test mode. See Sending - * in Test Mode - */ - public class TestModeEnum extends EnumDynamic { - public static final TestModeEnum YES = new TestModeEnum("yes"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(TestModeEnum.class, TestModeEnum::new, Arrays.asList(YES)); - - private TestModeEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TestModeEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TestModeEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Enables sending in test mode. See Sending @@ -288,7 +208,7 @@ public static String valueOf(TestModeEnum e) { * * @return testMode */ - TestModeEnum getTestMode(); + Boolean getTestMode(); /** * Toggles both click and open tracking on a per-message basis, see Tracking - * Opens. Has higher priority than domain-level setting. - */ - public class TrackingOpensEnum extends EnumDynamic { - public static final TrackingOpensEnum YES = new TrackingOpensEnum("yes"); - public static final TrackingOpensEnum NO = new TrackingOpensEnum("no"); - public static final TrackingOpensEnum TRUE = new TrackingOpensEnum("true"); - public static final TrackingOpensEnum FALSE = new TrackingOpensEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - TrackingOpensEnum.class, TrackingOpensEnum::new, Arrays.asList(YES, NO, TRUE, FALSE)); - - private TrackingOpensEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TrackingOpensEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TrackingOpensEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Toggles opens tracking on a per-message basis, see Tracking @@ -415,42 +303,7 @@ public static String valueOf(TrackingOpensEnum e) { * * @return trackingOpens */ - TrackingOpensEnum getTrackingOpens(); - - /** - * Requires the message only be sent over a TLS connection, see TLS Sending - * Connection Settings. If a TLS connection can not be established, Mailgun will not deliver - * the message. If set to false or no, Mailgun will still try and - * upgrade the connection, but if Mailgun cannot, the message will be delivered over a plaintext - * SMTP connection. The default is false - */ - public class RequireTlsEnum extends EnumDynamic { - public static final RequireTlsEnum YES = new RequireTlsEnum("yes"); - public static final RequireTlsEnum NO = new RequireTlsEnum("no"); - public static final RequireTlsEnum TRUE = new RequireTlsEnum("true"); - public static final RequireTlsEnum FALSE = new RequireTlsEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - RequireTlsEnum.class, RequireTlsEnum::new, Arrays.asList(YES, NO, TRUE, FALSE)); - - private RequireTlsEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static RequireTlsEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(RequireTlsEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } + Boolean getTrackingOpens(); /** * Requires the message only be sent over a TLS connection, see skip activated, the certificate and hostname of the resolved MX Host will not - * be verified when trying to establish a TLS connection. If not, Mailgun will verify the - * certificate and hostname. If either one can not be verified, a TLS connection will not be - * established. The default is false - */ - public class SkipVerificationEnum extends EnumDynamic { - public static final SkipVerificationEnum YES = new SkipVerificationEnum("yes"); - public static final SkipVerificationEnum NO = new SkipVerificationEnum("no"); - public static final SkipVerificationEnum TRUE = new SkipVerificationEnum("true"); - public static final SkipVerificationEnum FALSE = new SkipVerificationEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - SkipVerificationEnum.class, - SkipVerificationEnum::new, - Arrays.asList(YES, NO, TRUE, FALSE)); - - private SkipVerificationEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static SkipVerificationEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(SkipVerificationEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } + Boolean getRequireTls(); /** * If skip activated, the certificate and hostname of the resolved MX Host will not @@ -507,7 +325,7 @@ public static String valueOf(SkipVerificationEnum e) { * * @return skipVerification */ - SkipVerificationEnum getSkipVerification(); + Boolean getSkipVerification(); /** * Used to specify an IP Address to send an email that is owned by your account @@ -668,7 +486,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getTemplateText */ - Builder setTemplateText(TemplateTextEnum templateText); + Builder setTemplateText(Boolean templateText); /** * see getter @@ -695,7 +513,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getEnableDkimSignature */ - Builder setEnableDkimSignature(DkimSignatureEnum enableDkimSignature); + Builder setEnableDkimSignature(Boolean enableDkimSignature); /** * see getter @@ -749,7 +567,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getTestMode */ - Builder setTestMode(TestModeEnum testMode); + Builder setTestMode(Boolean testMode); /** * see getter @@ -776,7 +594,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getTrackingOpens */ - Builder setTrackingOpens(TrackingOpensEnum trackingOpens); + Builder setTrackingOpens(Boolean trackingOpens); /** * see getter @@ -785,7 +603,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getRequireTls */ - Builder setRequireTls(RequireTlsEnum requireTls); + Builder setRequireTls(Boolean requireTls); /** * see getter @@ -794,7 +612,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getSkipVerification */ - Builder setSkipVerification(SkipVerificationEnum skipVerification); + Builder setSkipVerification(Boolean skipVerification); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestImpl.java index 6233c9e1..28f9167d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestImpl.java @@ -63,7 +63,7 @@ public class SendEmailRequestImpl implements SendEmailRequest { public static final String PROPERTY_T_COLON_TEXT = "t:text"; - private OptionalValue templateText; + private OptionalValue templateText; public static final String PROPERTY_T_COLON_VARIABLES = "t:variables"; @@ -75,7 +75,7 @@ public class SendEmailRequestImpl implements SendEmailRequest { public static final String PROPERTY_O_COLON_DKIM = "o:dkim"; - private OptionalValue enableDkimSignature; + private OptionalValue enableDkimSignature; public static final String PROPERTY_O_COLON_SECONDARY_DKIM = "o:secondary-dkim"; @@ -100,7 +100,7 @@ public class SendEmailRequestImpl implements SendEmailRequest { public static final String PROPERTY_O_COLON_TESTMODE = "o:testmode"; - private OptionalValue testMode; + private OptionalValue testMode; public static final String PROPERTY_O_COLON_TRACKING = "o:tracking"; @@ -112,15 +112,15 @@ public class SendEmailRequestImpl implements SendEmailRequest { public static final String PROPERTY_O_COLON_TRACKING_OPENS = "o:tracking-opens"; - private OptionalValue trackingOpens; + private OptionalValue trackingOpens; public static final String PROPERTY_O_COLON_REQUIRE_TLS = "o:require-tls"; - private OptionalValue requireTls; + private OptionalValue requireTls; public static final String PROPERTY_O_COLON_SKIP_VERIFICATION = "o:skip-verification"; - private OptionalValue skipVerification; + private OptionalValue skipVerification; public static final String PROPERTY_O_COLON_SENDING_IP = "o:sending-ip"; @@ -160,21 +160,21 @@ protected SendEmailRequestImpl( OptionalValue> inline, OptionalValue template, OptionalValue templateVersion, - OptionalValue templateText, + OptionalValue templateText, OptionalValue templateVariables, OptionalValue> tag, - OptionalValue enableDkimSignature, + OptionalValue enableDkimSignature, OptionalValue secondaryDkim, OptionalValue secondaryDkimPublic, OptionalValue deliveryTime, OptionalValue deliveryTimeOptimizePeriod, OptionalValue timezoneLocalize, - OptionalValue testMode, + OptionalValue testMode, OptionalValue tracking, OptionalValue trackingClicks, - OptionalValue trackingOpens, - OptionalValue requireTls, - OptionalValue skipVerification, + OptionalValue trackingOpens, + OptionalValue requireTls, + OptionalValue skipVerification, OptionalValue sendingIp, OptionalValue sendingIpPool, OptionalValue trackingPixelLocationTop, @@ -322,12 +322,13 @@ public OptionalValue templateVersion() { return templateVersion; } - public TemplateTextEnum getTemplateText() { + public Boolean getTemplateText() { return templateText.orElse(null); } @Property(PROPERTY_T_COLON_TEXT) - public OptionalValue templateText() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue templateText() { return templateText; } @@ -349,12 +350,13 @@ public OptionalValue> tag() { return tag; } - public DkimSignatureEnum getEnableDkimSignature() { + public Boolean getEnableDkimSignature() { return enableDkimSignature.orElse(null); } @Property(PROPERTY_O_COLON_DKIM) - public OptionalValue enableDkimSignature() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue enableDkimSignature() { return enableDkimSignature; } @@ -406,12 +408,13 @@ public OptionalValue timezoneLocalize() { return timezoneLocalize; } - public TestModeEnum getTestMode() { + public Boolean getTestMode() { return testMode.orElse(null); } @Property(PROPERTY_O_COLON_TESTMODE) - public OptionalValue testMode() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue testMode() { return testMode; } @@ -433,30 +436,33 @@ public OptionalValue trackingClicks() { return trackingClicks; } - public TrackingOpensEnum getTrackingOpens() { + public Boolean getTrackingOpens() { return trackingOpens.orElse(null); } @Property(PROPERTY_O_COLON_TRACKING_OPENS) - public OptionalValue trackingOpens() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue trackingOpens() { return trackingOpens; } - public RequireTlsEnum getRequireTls() { + public Boolean getRequireTls() { return requireTls.orElse(null); } @Property(PROPERTY_O_COLON_REQUIRE_TLS) - public OptionalValue requireTls() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue requireTls() { return requireTls; } - public SkipVerificationEnum getSkipVerification() { + public Boolean getSkipVerification() { return skipVerification.orElse(null); } @Property(PROPERTY_O_COLON_SKIP_VERIFICATION) - public OptionalValue skipVerification() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue skipVerification() { return skipVerification; } @@ -707,21 +713,21 @@ static class Builder implements SendEmailRequest.Builder { OptionalValue> inline = OptionalValue.empty(); OptionalValue template = OptionalValue.empty(); OptionalValue templateVersion = OptionalValue.empty(); - OptionalValue templateText = OptionalValue.empty(); + OptionalValue templateText = OptionalValue.empty(); OptionalValue templateVariables = OptionalValue.empty(); OptionalValue> tag = OptionalValue.empty(); - OptionalValue enableDkimSignature = OptionalValue.empty(); + OptionalValue enableDkimSignature = OptionalValue.empty(); OptionalValue secondaryDkim = OptionalValue.empty(); OptionalValue secondaryDkimPublic = OptionalValue.empty(); OptionalValue deliveryTime = OptionalValue.empty(); OptionalValue deliveryTimeOptimizePeriod = OptionalValue.empty(); OptionalValue timezoneLocalize = OptionalValue.empty(); - OptionalValue testMode = OptionalValue.empty(); + OptionalValue testMode = OptionalValue.empty(); OptionalValue tracking = OptionalValue.empty(); OptionalValue trackingClicks = OptionalValue.empty(); - OptionalValue trackingOpens = OptionalValue.empty(); - OptionalValue requireTls = OptionalValue.empty(); - OptionalValue skipVerification = OptionalValue.empty(); + OptionalValue trackingOpens = OptionalValue.empty(); + OptionalValue requireTls = OptionalValue.empty(); + OptionalValue skipVerification = OptionalValue.empty(); OptionalValue sendingIp = OptionalValue.empty(); OptionalValue sendingIpPool = OptionalValue.empty(); OptionalValue trackingPixelLocationTop = OptionalValue.empty(); @@ -801,7 +807,7 @@ public Builder setTemplateVersion(String templateVersion) { } @Property(value = PROPERTY_T_COLON_TEXT) - public Builder setTemplateText(TemplateTextEnum templateText) { + public Builder setTemplateText(Boolean templateText) { this.templateText = OptionalValue.of(templateText); return this; } @@ -819,7 +825,7 @@ public Builder setTag(List tag) { } @Property(value = PROPERTY_O_COLON_DKIM) - public Builder setEnableDkimSignature(DkimSignatureEnum enableDkimSignature) { + public Builder setEnableDkimSignature(Boolean enableDkimSignature) { this.enableDkimSignature = OptionalValue.of(enableDkimSignature); return this; } @@ -855,7 +861,7 @@ public Builder setTimezoneLocalize(String timezoneLocalize) { } @Property(value = PROPERTY_O_COLON_TESTMODE) - public Builder setTestMode(TestModeEnum testMode) { + public Builder setTestMode(Boolean testMode) { this.testMode = OptionalValue.of(testMode); return this; } @@ -873,19 +879,19 @@ public Builder setTrackingClicks(TrackingClicksEnum trackingClicks) { } @Property(value = PROPERTY_O_COLON_TRACKING_OPENS) - public Builder setTrackingOpens(TrackingOpensEnum trackingOpens) { + public Builder setTrackingOpens(Boolean trackingOpens) { this.trackingOpens = OptionalValue.of(trackingOpens); return this; } @Property(value = PROPERTY_O_COLON_REQUIRE_TLS) - public Builder setRequireTls(RequireTlsEnum requireTls) { + public Builder setRequireTls(Boolean requireTls) { this.requireTls = OptionalValue.of(requireTls); return this; } @Property(value = PROPERTY_O_COLON_SKIP_VERIFICATION) - public Builder setSkipVerification(SkipVerificationEnum skipVerification) { + public Builder setSkipVerification(Boolean skipVerification) { this.skipVerification = OptionalValue.of(skipVerification); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java index 9ab62142..503d16ba 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java @@ -56,36 +56,12 @@ public interface SendMimeEmailRequest extends AdditionalProperties { */ String getTemplateVersion(); - /** Render template in case of template sending */ - public class TemplateTextEnum extends EnumDynamic { - public static final TemplateTextEnum YES = new TemplateTextEnum("yes"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(TemplateTextEnum.class, TemplateTextEnum::new, Arrays.asList(YES)); - - private TemplateTextEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TemplateTextEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TemplateTextEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Render template in case of template sending * * @return templateText */ - TemplateTextEnum getTemplateText(); + Boolean getTemplateText(); /** * A valid JSON-encoded dictionary used as the input for template variable expansion. See @@ -102,40 +78,12 @@ public static String valueOf(TemplateTextEnum e) { */ List getTag(); - /** Enables/disables DKIM signatures on a per-message basis */ - public class DkimSignatureEnum extends EnumDynamic { - public static final DkimSignatureEnum YES = new DkimSignatureEnum("yes"); - public static final DkimSignatureEnum NO = new DkimSignatureEnum("no"); - public static final DkimSignatureEnum TRUE = new DkimSignatureEnum("true"); - public static final DkimSignatureEnum FALSE = new DkimSignatureEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DkimSignatureEnum.class, DkimSignatureEnum::new, Arrays.asList(YES, NO, TRUE, FALSE)); - - private DkimSignatureEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DkimSignatureEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DkimSignatureEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Enables/disables DKIM signatures on a per-message basis * * @return enableDkimSignature */ - DkimSignatureEnum getEnableDkimSignature(); + Boolean getEnableDkimSignature(); /** * Specify a second domain key to sign the email with. The value is formatted as @@ -191,34 +139,6 @@ public static String valueOf(DkimSignatureEnum e) { */ String getTimezoneLocalize(); - /** - * Enables sending in test mode. See Sending - * in Test Mode - */ - public class TestModeEnum extends EnumDynamic { - public static final TestModeEnum YES = new TestModeEnum("yes"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(TestModeEnum.class, TestModeEnum::new, Arrays.asList(YES)); - - private TestModeEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TestModeEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TestModeEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Enables sending in test mode. See Sending @@ -226,7 +146,7 @@ public static String valueOf(TestModeEnum e) { * * @return testMode */ - TestModeEnum getTestMode(); + Boolean getTestMode(); /** * Toggles both click and open tracking on a per-message basis, see Tracking - * Opens. Has higher priority than domain-level setting. - */ - public class TrackingOpensEnum extends EnumDynamic { - public static final TrackingOpensEnum YES = new TrackingOpensEnum("yes"); - public static final TrackingOpensEnum NO = new TrackingOpensEnum("no"); - public static final TrackingOpensEnum TRUE = new TrackingOpensEnum("true"); - public static final TrackingOpensEnum FALSE = new TrackingOpensEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - TrackingOpensEnum.class, TrackingOpensEnum::new, Arrays.asList(YES, NO, TRUE, FALSE)); - - private TrackingOpensEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TrackingOpensEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TrackingOpensEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** * Toggles opens tracking on a per-message basis, see Tracking @@ -353,42 +241,7 @@ public static String valueOf(TrackingOpensEnum e) { * * @return trackingOpens */ - TrackingOpensEnum getTrackingOpens(); - - /** - * Requires the message only be sent over a TLS connection, see TLS Sending - * Connection Settings. If a TLS connection can not be established, Mailgun will not deliver - * the message. If set to false or no, Mailgun will still try and - * upgrade the connection, but if Mailgun cannot, the message will be delivered over a plaintext - * SMTP connection. The default is false - */ - public class RequireTlsEnum extends EnumDynamic { - public static final RequireTlsEnum YES = new RequireTlsEnum("yes"); - public static final RequireTlsEnum NO = new RequireTlsEnum("no"); - public static final RequireTlsEnum TRUE = new RequireTlsEnum("true"); - public static final RequireTlsEnum FALSE = new RequireTlsEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - RequireTlsEnum.class, RequireTlsEnum::new, Arrays.asList(YES, NO, TRUE, FALSE)); - - private RequireTlsEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static RequireTlsEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(RequireTlsEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } + Boolean getTrackingOpens(); /** * Requires the message only be sent over a TLS connection, see skip activated, the certificate and hostname of the resolved MX Host will not - * be verified when trying to establish a TLS connection. If not, Mailgun will verify the - * certificate and hostname. If either one can not be verified, a TLS connection will not be - * established. The default is false - */ - public class SkipVerificationEnum extends EnumDynamic { - public static final SkipVerificationEnum YES = new SkipVerificationEnum("yes"); - public static final SkipVerificationEnum NO = new SkipVerificationEnum("no"); - public static final SkipVerificationEnum TRUE = new SkipVerificationEnum("true"); - public static final SkipVerificationEnum FALSE = new SkipVerificationEnum("false"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - SkipVerificationEnum.class, - SkipVerificationEnum::new, - Arrays.asList(YES, NO, TRUE, FALSE)); - - private SkipVerificationEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static SkipVerificationEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(SkipVerificationEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } + Boolean getRequireTls(); /** * If skip activated, the certificate and hostname of the resolved MX Host will not @@ -445,7 +263,7 @@ public static String valueOf(SkipVerificationEnum e) { * * @return skipVerification */ - SkipVerificationEnum getSkipVerification(); + Boolean getSkipVerification(); /** * Used to specify an IP Address to send an email that is owned by your account @@ -534,7 +352,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getTemplateText */ - Builder setTemplateText(TemplateTextEnum templateText); + Builder setTemplateText(Boolean templateText); /** * see getter @@ -561,7 +379,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getEnableDkimSignature */ - Builder setEnableDkimSignature(DkimSignatureEnum enableDkimSignature); + Builder setEnableDkimSignature(Boolean enableDkimSignature); /** * see getter @@ -615,7 +433,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getTestMode */ - Builder setTestMode(TestModeEnum testMode); + Builder setTestMode(Boolean testMode); /** * see getter @@ -642,7 +460,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getTrackingOpens */ - Builder setTrackingOpens(TrackingOpensEnum trackingOpens); + Builder setTrackingOpens(Boolean trackingOpens); /** * see getter @@ -651,7 +469,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getRequireTls */ - Builder setRequireTls(RequireTlsEnum requireTls); + Builder setRequireTls(Boolean requireTls); /** * see getter @@ -660,7 +478,7 @@ interface Builder extends AdditionalProperties.Builder { * @return Current builder * @see #getSkipVerification */ - Builder setSkipVerification(SkipVerificationEnum skipVerification); + Builder setSkipVerification(Boolean skipVerification); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestImpl.java index 05cd1024..11eeb8ac 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestImpl.java @@ -31,7 +31,7 @@ public class SendMimeEmailRequestImpl implements SendMimeEmailRequest { public static final String PROPERTY_T_COLON_TEXT = "t:text"; - private OptionalValue templateText; + private OptionalValue templateText; public static final String PROPERTY_T_COLON_VARIABLES = "t:variables"; @@ -43,7 +43,7 @@ public class SendMimeEmailRequestImpl implements SendMimeEmailRequest { public static final String PROPERTY_O_COLON_DKIM = "o:dkim"; - private OptionalValue enableDkimSignature; + private OptionalValue enableDkimSignature; public static final String PROPERTY_O_COLON_SECONDARY_DKIM = "o:secondary-dkim"; @@ -68,7 +68,7 @@ public class SendMimeEmailRequestImpl implements SendMimeEmailRequest { public static final String PROPERTY_O_COLON_TESTMODE = "o:testmode"; - private OptionalValue testMode; + private OptionalValue testMode; public static final String PROPERTY_O_COLON_TRACKING = "o:tracking"; @@ -80,15 +80,15 @@ public class SendMimeEmailRequestImpl implements SendMimeEmailRequest { public static final String PROPERTY_O_COLON_TRACKING_OPENS = "o:tracking-opens"; - private OptionalValue trackingOpens; + private OptionalValue trackingOpens; public static final String PROPERTY_O_COLON_REQUIRE_TLS = "o:require-tls"; - private OptionalValue requireTls; + private OptionalValue requireTls; public static final String PROPERTY_O_COLON_SKIP_VERIFICATION = "o:skip-verification"; - private OptionalValue skipVerification; + private OptionalValue skipVerification; public static final String PROPERTY_O_COLON_SENDING_IP = "o:sending-ip"; @@ -120,21 +120,21 @@ protected SendMimeEmailRequestImpl( OptionalValue message, OptionalValue template, OptionalValue templateVersion, - OptionalValue templateText, + OptionalValue templateText, OptionalValue templateVariables, OptionalValue> tag, - OptionalValue enableDkimSignature, + OptionalValue enableDkimSignature, OptionalValue secondaryDkim, OptionalValue secondaryDkimPublic, OptionalValue deliveryTime, OptionalValue deliveryTimeOptimizePeriod, OptionalValue timezoneLocalize, - OptionalValue testMode, + OptionalValue testMode, OptionalValue tracking, OptionalValue trackingClicks, - OptionalValue trackingOpens, - OptionalValue requireTls, - OptionalValue skipVerification, + OptionalValue trackingOpens, + OptionalValue requireTls, + OptionalValue skipVerification, OptionalValue sendingIp, OptionalValue sendingIpPool, OptionalValue trackingPixelLocationTop, @@ -202,12 +202,13 @@ public OptionalValue templateVersion() { return templateVersion; } - public TemplateTextEnum getTemplateText() { + public Boolean getTemplateText() { return templateText.orElse(null); } @Property(PROPERTY_T_COLON_TEXT) - public OptionalValue templateText() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue templateText() { return templateText; } @@ -229,12 +230,13 @@ public OptionalValue> tag() { return tag; } - public DkimSignatureEnum getEnableDkimSignature() { + public Boolean getEnableDkimSignature() { return enableDkimSignature.orElse(null); } @Property(PROPERTY_O_COLON_DKIM) - public OptionalValue enableDkimSignature() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue enableDkimSignature() { return enableDkimSignature; } @@ -286,12 +288,13 @@ public OptionalValue timezoneLocalize() { return timezoneLocalize; } - public TestModeEnum getTestMode() { + public Boolean getTestMode() { return testMode.orElse(null); } @Property(PROPERTY_O_COLON_TESTMODE) - public OptionalValue testMode() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue testMode() { return testMode; } @@ -313,30 +316,33 @@ public OptionalValue trackingClicks() { return trackingClicks; } - public TrackingOpensEnum getTrackingOpens() { + public Boolean getTrackingOpens() { return trackingOpens.orElse(null); } @Property(PROPERTY_O_COLON_TRACKING_OPENS) - public OptionalValue trackingOpens() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue trackingOpens() { return trackingOpens; } - public RequireTlsEnum getRequireTls() { + public Boolean getRequireTls() { return requireTls.orElse(null); } @Property(PROPERTY_O_COLON_REQUIRE_TLS) - public OptionalValue requireTls() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue requireTls() { return requireTls; } - public SkipVerificationEnum getSkipVerification() { + public Boolean getSkipVerification() { return skipVerification.orElse(null); } @Property(PROPERTY_O_COLON_SKIP_VERIFICATION) - public OptionalValue skipVerification() { + @FormSerialize(using = com.sinch.sdk.domains.mailgun.api.v1.adapters.BooleanFormSerializer.class) + public OptionalValue skipVerification() { return skipVerification; } @@ -558,21 +564,21 @@ static class Builder implements SendMimeEmailRequest.Builder { OptionalValue message = OptionalValue.empty(); OptionalValue template = OptionalValue.empty(); OptionalValue templateVersion = OptionalValue.empty(); - OptionalValue templateText = OptionalValue.empty(); + OptionalValue templateText = OptionalValue.empty(); OptionalValue templateVariables = OptionalValue.empty(); OptionalValue> tag = OptionalValue.empty(); - OptionalValue enableDkimSignature = OptionalValue.empty(); + OptionalValue enableDkimSignature = OptionalValue.empty(); OptionalValue secondaryDkim = OptionalValue.empty(); OptionalValue secondaryDkimPublic = OptionalValue.empty(); OptionalValue deliveryTime = OptionalValue.empty(); OptionalValue deliveryTimeOptimizePeriod = OptionalValue.empty(); OptionalValue timezoneLocalize = OptionalValue.empty(); - OptionalValue testMode = OptionalValue.empty(); + OptionalValue testMode = OptionalValue.empty(); OptionalValue tracking = OptionalValue.empty(); OptionalValue trackingClicks = OptionalValue.empty(); - OptionalValue trackingOpens = OptionalValue.empty(); - OptionalValue requireTls = OptionalValue.empty(); - OptionalValue skipVerification = OptionalValue.empty(); + OptionalValue trackingOpens = OptionalValue.empty(); + OptionalValue requireTls = OptionalValue.empty(); + OptionalValue skipVerification = OptionalValue.empty(); OptionalValue sendingIp = OptionalValue.empty(); OptionalValue sendingIpPool = OptionalValue.empty(); OptionalValue trackingPixelLocationTop = OptionalValue.empty(); @@ -604,7 +610,7 @@ public Builder setTemplateVersion(String templateVersion) { } @Property(value = PROPERTY_T_COLON_TEXT) - public Builder setTemplateText(TemplateTextEnum templateText) { + public Builder setTemplateText(Boolean templateText) { this.templateText = OptionalValue.of(templateText); return this; } @@ -622,7 +628,7 @@ public Builder setTag(List tag) { } @Property(value = PROPERTY_O_COLON_DKIM) - public Builder setEnableDkimSignature(DkimSignatureEnum enableDkimSignature) { + public Builder setEnableDkimSignature(Boolean enableDkimSignature) { this.enableDkimSignature = OptionalValue.of(enableDkimSignature); return this; } @@ -658,7 +664,7 @@ public Builder setTimezoneLocalize(String timezoneLocalize) { } @Property(value = PROPERTY_O_COLON_TESTMODE) - public Builder setTestMode(TestModeEnum testMode) { + public Builder setTestMode(Boolean testMode) { this.testMode = OptionalValue.of(testMode); return this; } @@ -676,19 +682,19 @@ public Builder setTrackingClicks(TrackingClicksEnum trackingClicks) { } @Property(value = PROPERTY_O_COLON_TRACKING_OPENS) - public Builder setTrackingOpens(TrackingOpensEnum trackingOpens) { + public Builder setTrackingOpens(Boolean trackingOpens) { this.trackingOpens = OptionalValue.of(trackingOpens); return this; } @Property(value = PROPERTY_O_COLON_REQUIRE_TLS) - public Builder setRequireTls(RequireTlsEnum requireTls) { + public Builder setRequireTls(Boolean requireTls) { this.requireTls = OptionalValue.of(requireTls); return this; } @Property(value = PROPERTY_O_COLON_SKIP_VERIFICATION) - public Builder setSkipVerification(SkipVerificationEnum skipVerification) { + public Builder setSkipVerification(Boolean skipVerification) { this.skipVerification = OptionalValue.of(skipVerification); return this; } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java index 69e8c267..153afd8f 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java @@ -5,14 +5,8 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.core.databind.multipart.ObjectMapperTest; import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.DkimSignatureEnum; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.RequireTlsEnum; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.SkipVerificationEnum; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.TemplateTextEnum; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.TestModeEnum; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.TrackingClicksEnum; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.TrackingEnum; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.TrackingOpensEnum; import java.io.File; import java.time.Instant; import java.util.Arrays; @@ -50,7 +44,7 @@ public class SendEmailRequestTest extends BaseTest { "inline",Arrays.asList( fileAttachment2), "template","template value", "t:version","2", - "t:text","yes", + "t:text","true", "t:variables","{\"key\": \"value\"}", "o:tag", Arrays.asList("tag1", "tag2"), "o:dkim","true", @@ -59,12 +53,12 @@ public class SendEmailRequestTest extends BaseTest { "o:deliverytime", "Sat, 22 Jan 2000 11:23:45 GMT", "o:deliverytime-optimize-period", "29h", "o:time-zone-localize","02:04PM", - "o:testmode", "no", + "o:testmode", "false", "o:tracking","htmlonly", "o:tracking-clicks","true", "o:tracking-opens","false", "o:require-tls","true", - "o:skip-verification","no", + "o:skip-verification","true", "o:sending-ip","192.168.0.10", "o:sending-ip-pool","sending pool ID", "o:tracking-pixel-location-top","foo", @@ -79,11 +73,11 @@ public class SendEmailRequestTest extends BaseTest { .setAttachment(Arrays.asList(fileAttachment1, fileAttachment2)) .setTag(Arrays.asList("tag1", "tag2")) .setDeliveryTime(Instant.parse("2000-01-22T11:23:45Z")) - .setTestMode(TestModeEnum.from("no")) + .setTestMode(false) .setTo(Arrays.asList("aRecipient@mailgun-by-sinch.com")) .setFrom("User ") .setText("Sent from Sinch SDK Java with 📧") - .setTemplateText(TemplateTextEnum.YES) + .setTemplateText(true) .setHtml("📧 HTML sent with Sinch SDK Java") .setSubject("📧 From Sinch SDK Java") .setCc(Arrays.asList("cc-dest@sinch.com")) @@ -91,16 +85,16 @@ public class SendEmailRequestTest extends BaseTest { .setAmpHtml("amp html value") .setTemplateVersion("2") .setTemplateVariables("{\"key\": \"value\"}") - .setEnableDkimSignature(DkimSignatureEnum.TRUE) + .setEnableDkimSignature(true) .setSecondaryDkim("example.com/s1") .setSecondaryDkimPublic("public.example.com/s1") .setDeliveryTimeOptimizePeriod(29) .setTimezoneLocalize("02:04PM") .setTracking(TrackingEnum.HTMLONLY) .setTrackingClicks(TrackingClicksEnum.TRUE) - .setTrackingOpens(TrackingOpensEnum.FALSE) - .setRequireTls(RequireTlsEnum.TRUE) - .setSkipVerification(SkipVerificationEnum.NO) + .setTrackingOpens(false) + .setRequireTls(true) + .setSkipVerification(true) .setSendingIp("192.168.0.10") .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop("foo") diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java index c37ca6c7..cc56a56c 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java @@ -5,6 +5,7 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.core.databind.multipart.ObjectMapperTest; import com.sinch.sdk.core.http.HttpMapper; +import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendMimeEmailRequest.TrackingClicksEnum; import java.io.File; import java.time.Instant; import java.util.Arrays; @@ -34,7 +35,7 @@ public class SendMimeEmailRequestTest extends BaseTest { "message", fileAttachment1, "template","template value", "t:version","2", - "t:text","yes", + "t:text","true", "t:variables","{\"key\": \"value\"}", "o:tag", Arrays.asList("tag1", "tag2"), "o:dkim","true", @@ -43,12 +44,12 @@ public class SendMimeEmailRequestTest extends BaseTest { "o:deliverytime", "Sat, 22 Jan 2000 11:23:45 GMT", "o:deliverytime-optimize-period", "29h", "o:time-zone-localize","02:04PM", - "o:testmode", "no", + "o:testmode", "false", "o:tracking","htmlonly", "o:tracking-clicks","true", "o:tracking-opens","false", "o:require-tls","true", - "o:skip-verification","no", + "o:skip-verification","false", "o:sending-ip","192.168.0.10", "o:sending-ip-pool","sending pool ID", "o:tracking-pixel-location-top","foo", @@ -62,21 +63,21 @@ public class SendMimeEmailRequestTest extends BaseTest { .setMessage(fileAttachment1) .setTag(Arrays.asList("tag1", "tag2")) .setDeliveryTime(Instant.parse("2000-01-22T11:23:45Z")) - .setTestMode(SendMimeEmailRequest.TestModeEnum.from("no")) + .setTestMode(false) .setTo(Arrays.asList("aRecipient@mailgun-by-sinch.com")) - .setTemplateText(SendMimeEmailRequest.TemplateTextEnum.YES) + .setTemplateText(true) .setTemplateVersion("2") .setTemplateVariables("{\"key\": \"value\"}") - .setEnableDkimSignature(SendMimeEmailRequest.DkimSignatureEnum.TRUE) + .setEnableDkimSignature(true) .setSecondaryDkim("example.com/s1") .setSecondaryDkimPublic("public.example.com/s1") .setDeliveryTimeOptimizePeriod(29) .setTimezoneLocalize("02:04PM") .setTracking(SendMimeEmailRequest.TrackingEnum.HTMLONLY) - .setTrackingClicks(SendMimeEmailRequest.TrackingClicksEnum.TRUE) - .setTrackingOpens(SendMimeEmailRequest.TrackingOpensEnum.FALSE) - .setRequireTls(SendMimeEmailRequest.RequireTlsEnum.TRUE) - .setSkipVerification(SendMimeEmailRequest.SkipVerificationEnum.NO) + .setTrackingClicks(TrackingClicksEnum.TRUE) + .setTrackingOpens(false) + .setRequireTls(true) + .setSkipVerification(false) .setSendingIp("192.168.0.10") .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop("foo") diff --git a/sample-app/src/main/java/com/sinch/sample/mailgun/messages/SendEmail.java b/sample-app/src/main/java/com/sinch/sample/mailgun/messages/SendEmail.java index 61f1637d..258d2237 100644 --- a/sample-app/src/main/java/com/sinch/sample/mailgun/messages/SendEmail.java +++ b/sample-app/src/main/java/com/sinch/sample/mailgun/messages/SendEmail.java @@ -3,7 +3,6 @@ import com.sinch.sample.BaseApplication; import com.sinch.sdk.domains.mailgun.api.v1.EmailsService; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest; -import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest.TrackingEnum; import com.sinch.sdk.domains.mailgun.models.v1.emails.response.SendEmailResponse; import java.io.BufferedWriter; import java.io.File; @@ -79,7 +78,7 @@ SendEmailRequest createTextEmail() { .setAttachment(Arrays.asList(tempFile, tempFile2)) .setSubject("\uD83D\uDCE7 Hello from Sinch SDK Java") .setTag(Arrays.asList("my tag 1", "my tag 2")) - .setTracking(TrackingEnum.YES) + .setTrackingOpens(true) .setDeliveryTime(Instant.now().plus(10, ChronoUnit.SECONDS)) .put("v:myvarkey", "myvar-value") .build();