Repository: sendgrid/sendgrid-java (java)

Issue:
Helpers do not have all properties
### Issue Summary
Checking the request body for `mail/send` (https://docs.sendgrid.com/api-reference/mail-send/mail-send), it was discovered that helper classes provided in this library are old and do not contain all info needed. 

Errors found: 

- In `mail_settings` object, there are some properties that are not in [MailSettings](https://github.com/sendgrid/sendgrid-java/blob/c46e5775ae058d7f9b12be5c8e170b97c32e05b9/src/main/java/com/sendgrid/helpers/mail/objects/MailSettings.java#L13) helper class: `bypass_spam_management`, `bypass_bounce_management` and `bypass_unsubscribe_management`

- In [MailSettings](https://github.com/sendgrid/sendgrid-java/blob/c46e5775ae058d7f9b12be5c8e170b97c32e05b9/src/main/java/com/sendgrid/helpers/mail/objects/MailSettings.java#L13) helper class there is a property `bcc` that it is not described anymore in the request body




Pull request:
fix: Add missing bypass settings to MailSettings
<!--
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines, then fill out the blanks below.

Please format the PR title appropriately based on the type of change:
  <type>[!]: <description>
Where <type> is one of: docs, chore, feat, fix, test.
Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature).

**All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.**

Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
e.g.
Fixes #1
Closes #2
-->

# Fixes part of #700

This PR adds missing bypass settings to MailSettings.java. See associated issue. Updated test.

### Checklist
- [x] I acknowledge that all my contributions will be made under the project's license
- [x] I have made a material change to the repo (functionality, testing, spelling, grammar)
- [x] I have read the [Contribution Guidelines](https://github.com/sendgrid/sendgrid-java/blob/main/CONTRIBUTING.md) and my PR follows them
- [x] I have titled the PR appropriately
- [x] I have updated my branch with the main branch
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have added the necessary documentation about the functionality in the appropriate .md file
- [x] I have added inline documentation to the code I modified

If you have questions, please file a [support ticket](https://support.sendgrid.com), or create a GitHub Issue in this repository.


Patch:
diff --git a/examples/helpers/mail/Example.java b/examples/helpers/mail/Example.java
index bffcdfd..174e38b 100644
--- a/examples/helpers/mail/Example.java
+++ b/examples/helpers/mail/Example.java
@@ -149,6 +149,17 @@ public class Example {
     Setting bypassListManagement = new Setting();
     bypassListManagement.setEnable(true);
     mailSettings.setBypassListManagement(bypassListManagement);
+    // Note: Bypass Spam, Bounce, and Unsubscribe management cannot
+    // be combined with Bypass List Management
+    Setting bypassSpamManagement = new Setting();
+    bypassSpamManagement.setEnable(true);
+    mailSettings.setBypassSpamManagement(bypassSpamManagement);
+    Setting bypassBounceManagement = new Setting();
+    bypassBounceManagement.setEnable(true);
+    mailSettings.setBypassBounceManagement(bypassBounceManagement);
+    Setting bypassUnsubscribeManagement = new Setting();
+    bypassUnsubscribeManagement.setEnable(true);
+    mailSettings.setBypassUnsubscribeManagement(bypassUnsubscribeManagement);
     FooterSetting footerSetting = new FooterSetting();
     footerSetting.setEnable(true);
     footerSetting.setText("Footer Text");
diff --git a/src/main/java/com/sendgrid/helpers/mail/objects/MailSettings.java b/src/main/java/com/sendgrid/helpers/mail/objects/MailSettings.java
index d83a56b..1bad6b0 100644
--- a/src/main/java/com/sendgrid/helpers/mail/objects/MailSettings.java
+++ b/src/main/java/com/sendgrid/helpers/mail/objects/MailSettings.java
@@ -18,6 +18,15 @@ public class MailSettings {
   @JsonProperty("bypass_list_management")
   private Setting bypassListManagement;
 
+  @JsonProperty("bypass_spam_management")
+  private Setting bypassSpamManagement;
+
+  @JsonProperty("bypass_bounce_management")
+  private Setting bypassBounceManagement;
+
+  @JsonProperty("bypass_unsubscribe_management")
+  private Setting bypassUnsubscribeManagement;
+
   @JsonProperty("footer")
   private FooterSetting footerSetting;
 
@@ -58,6 +67,58 @@ public class MailSettings {
     this.bypassListManagement = bypassListManagement;
   }
 
+  /**
+   * Allows you to bypass the spam report list to ensure that the email is delivered to recipients.
+   * Bounce and unsubscribe lists will still be checked; addresses on these other lists will not
+   * receive the message.
+   *
+   * This filter cannot be combined with the bypass_list_management filter.
+   * @return the bypass spam setting
+   */
+
+  @JsonProperty("bypass_spam_management")
+  public Setting getBypassSpamManagement() {
+    return bypassSpamManagement;
+  }
+
+  public void setBypassSpamManagement(Setting bypassSpamManagement) {
+    this.bypassSpamManagement = bypassSpamManagement;
+  }
+
+  /**
+   * Allows you to bypass the bounce list to ensure that the email is delivered to recipients.
+   * Spam report and unsubscribe lists will still be checked; addresses on these other lists
+   * will not receive the message.
+   *
+   * This filter cannot be combined with the bypass_list_management filter.
+   * @return the bypass bounce setting
+   */
+  @JsonProperty("bypass_bounce_management")
+  public Setting getBypassBounceManagement() {
+    return bypassBounceManagement;
+  }
+  public void setBypassBounceManagement(Setting bypassBounceManagement) {
+    this.bypassBounceManagement = bypassBounceManagement;
+  }
+
+  /**
+   * Allows you to bypass the global unsubscribe list to ensure that the email is delivered
+   * to recipients. Bounce and spam report lists will still be checked; addresses on these
+   * other lists will not receive the message. This filter applies only to global unsubscribes
+   * and will not bypass group unsubscribes.
+   *
+   * This filter cannot be combined with the bypass_list_management filter.
+   * @return the bypass unsubscribe setting
+   */
+  @JsonProperty("bypass_unsubscribe_management")
+  public Setting getBypassUnsubscribeManagement() {
+    return bypassUnsubscribeManagement;
+  }
+
+  public void setBypassUnsubscribeManagement(Setting bypassUnsubscribeManagement) {
+    this.bypassUnsubscribeManagement = bypassUnsubscribeManagement;
+  }
+
   /**
    * Get the footer settings that you would like included on every email.
    *
@@ -128,6 +189,12 @@ public class MailSettings {
     result = prime * result + ((bccSettings == null) ? 0 : bccSettings.hashCode());
     result =
         prime * result + ((bypassListManagement == null) ? 0 : bypassListManagement.hashCode());
+    result =
+        prime * result + ((bypassSpamManagement == null) ? 0 : bypassSpamManagement.hashCode());
+    result =
+        prime * result + ((bypassBounceManagement == null) ? 0 : bypassBounceManagement.hashCode());
+    result =
+        prime * result + ((bypassUnsubscribeManagement == null) ? 0 : bypassUnsubscribeManagement.hashCode());
     result = prime * result + ((footerSetting == null) ? 0 : footerSetting.hashCode());
     result = prime * result + ((sandBoxMode == null) ? 0 : sandBoxMode.hashCode());
     result = prime * result + ((spamCheckSetting == null) ? 0 : spamCheckSetting.hashCode());
@@ -160,6 +227,27 @@ public class MailSettings {
     } else if (!bypassListManagement.equals(other.bypassListManagement)) {
       return false;
     }
+    if (bypassSpamManagement == null) {
+      if (other.bypassSpamManagement != null) {
+        return false;
+      }
+    } else if (!bypassSpamManagement.equals(other.bypassSpamManagement)) {
+      return false;
+    }
+    if (bypassBounceManagement == null) {
+      if (other.bypassBounceManagement != null) {
+        return false;
+      }
+    } else if (!bypassBounceManagement.equals(other.bypassBounceManagement)) {
+      return false;
+    }
+    if (bypassUnsubscribeManagement == null) {
+      if (other.bypassUnsubscribeManagement != null) {
+        return false;
+      }
+    } else if (!bypassUnsubscribeManagement.equals(other.bypassUnsubscribeManagement)) {
+      return false;
+    }
     if (footerSetting == null) {
       if (other.footerSetting != null) {
         return false;


Test patch:
diff --git a/src/test/java/com/sendgrid/helpers/MailTest.java b/src/test/java/com/sendgrid/helpers/MailTest.java
index 9cdc194..22c7f8d 100644
--- a/src/test/java/com/sendgrid/helpers/MailTest.java
+++ b/src/test/java/com/sendgrid/helpers/MailTest.java
@@ -212,7 +212,16 @@ public class MailTest {
     mailSettings.setSandboxMode(sandBoxMode);
     Setting bypassListManagement = new Setting();
     bypassListManagement.setEnable(true);
+    Setting bypassSpamManagement = new Setting();
+    bypassSpamManagement.setEnable(true);
+    Setting bypassBounceManagement = new Setting();
+    bypassBounceManagement.setEnable(true);
+    Setting bypassUnsubscribeManagement = new Setting();
+    bypassUnsubscribeManagement.setEnable(true);
     mailSettings.setBypassListManagement(bypassListManagement);
+    mailSettings.setBypassSpamManagement(bypassSpamManagement);
+    mailSettings.setBypassBounceManagement(bypassBounceManagement);
+    mailSettings.setBypassUnsubscribeManagement(bypassUnsubscribeManagement);
     FooterSetting footerSetting = new FooterSetting();
     footerSetting.setEnable(true);
     footerSetting.setText("Footer Text");
@@ -255,7 +264,7 @@ public class MailTest {
     replyTo.setEmail("test@example.com");
     mail.setReplyTo(replyTo);
 
-    Assert.assertEquals(mail.build(), "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid Java Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Hello World from the Personalized SendGrid Java Library\",\"headers\":{\"X-Mock\":\"true\",\"X-Test\":\"test\"},\"substitutions\":{\"%city%\":\"Denver\",\"%name%\":\"Example User\"},\"custom_args\":{\"type\":\"marketing\",\"user_id\":\"343\"},\"send_at\":1443636843},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"from\":{\"name\":\"Example Sender\",\"email\":\"sender@example.com\"},\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Hello World from the Personalized SendGrid Java Library\",\"headers\":{\"X-Mock\":\"true\",\"X-Test\":\"test\"},\"substitutions\":{\"%city%\":\"Denver\",\"%name%\":\"Example User\"},\"custom_args\":{\"type\":\"marketing\",\"user_id\":\"343\"},\"send_at\":1443636843},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"from\":{\"name\":\"Example Sender2\",\"email\":\"sender2@example.com\"},\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Hello World from the Personalized SendGrid Java Library\",\"headers\":{\"X-Mock\":\"true\",\"X-Test\":\"test\"},\"custom_args\":{\"type\":\"marketing\",\"user_id\":\"343\"},\"dynamic_template_data\":{\"city\":\"Denver\",\"items\":[{\"price\":\"$ 59.95\",\"text\":\"New Line Sneakers\"},{\"text\":\"Old Line Sneakers\"}],\"name\":\"Example User\"},\"send_at\":1443636843}],\"content\":[{\"type\":\"text/plain\",\"value\":\"some text here\"},{\"type\":\"text/html\",\"value\":\"<html><body>some text here</body></html>\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"sections\":{\"%section1%\":\"Substitution Text for Section 1\",\"%section2%\":\"Substitution Text for Section 2\"},\"headers\":{\"X-Test1\":\"1\",\"X-Test2\":\"2\"},\"categories\":[\"May\",\"2016\"],\"custom_args\":{\"campaign\":\"welcome\",\"weekday\":\"morning\"},\"send_at\":1443636842,\"asm\":{\"group_id\":99,\"groups_to_display\":[4,5,6,7,8]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Footer Text\",\"html\":\"<html><body>Footer Text</body></html>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://spamcatcher.sendgrid.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true,\"enable_text\":false},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<html><body>html to insert into the text/html portion of the message</body></html>\",\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some name\",\"utm_medium\":\"some medium\"}},\"reply_to\":{\"name\":\"Example User\",\"email\":\"test@example.com\"}}");
+    Assert.assertEquals(mail.build(), "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid Java Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Hello World from the Personalized SendGrid Java Library\",\"headers\":{\"X-Mock\":\"true\",\"X-Test\":\"test\"},\"substitutions\":{\"%city%\":\"Denver\",\"%name%\":\"Example User\"},\"custom_args\":{\"type\":\"marketing\",\"user_id\":\"343\"},\"send_at\":1443636843},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"from\":{\"name\":\"Example Sender\",\"email\":\"sender@example.com\"},\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Hello World from the Personalized SendGrid Java Library\",\"headers\":{\"X-Mock\":\"true\",\"X-Test\":\"test\"},\"substitutions\":{\"%city%\":\"Denver\",\"%name%\":\"Example User\"},\"custom_args\":{\"type\":\"marketing\",\"user_id\":\"343\"},\"send_at\":1443636843},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"from\":{\"name\":\"Example Sender2\",\"email\":\"sender2@example.com\"},\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Hello World from the Personalized SendGrid Java Library\",\"headers\":{\"X-Mock\":\"true\",\"X-Test\":\"test\"},\"custom_args\":{\"type\":\"marketing\",\"user_id\":\"343\"},\"dynamic_template_data\":{\"city\":\"Denver\",\"items\":[{\"price\":\"$ 59.95\",\"text\":\"New Line Sneakers\"},{\"text\":\"Old Line Sneakers\"}],\"name\":\"Example User\"},\"send_at\":1443636843}],\"content\":[{\"type\":\"text/plain\",\"value\":\"some text here\"},{\"type\":\"text/html\",\"value\":\"<html><body>some text here</body></html>\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"sections\":{\"%section1%\":\"Substitution Text for Section 1\",\"%section2%\":\"Substitution Text for Section 2\"},\"headers\":{\"X-Test1\":\"1\",\"X-Test2\":\"2\"},\"categories\":[\"May\",\"2016\"],\"custom_args\":{\"campaign\":\"welcome\",\"weekday\":\"morning\"},\"send_at\":1443636842,\"asm\":{\"group_id\":99,\"groups_to_display\":[4,5,6,7,8]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"bypass_spam_management\":{\"enable\":true},\"bypass_bounce_management\":{\"enable\":true},\"bypass_unsubscribe_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Footer Text\",\"html\":\"<html><body>Footer Text</body></html>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://spamcatcher.sendgrid.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true,\"enable_text\":false},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<html><body>html to insert into the text/html portion of the message</body></html>\",\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some name\",\"utm_medium\":\"some medium\"}},\"reply_to\":{\"name\":\"Example User\",\"email\":\"test@example.com\"}}");
   }
 
   @Test