OghamSendGridProperties.java

  1. package fr.sii.ogham.spring.email;

  2. import java.net.URL;

  3. import org.springframework.boot.context.properties.ConfigurationProperties;

  4. @ConfigurationProperties("ogham.email.sendgrid")
  5. public class OghamSendGridProperties {
  6.     /**
  7.      * Set SendGrid API key.<br />
  8.      * <br />
  9.      *
  10.      * /!\ In Spring Boot application: if you provide a value for
  11.      * spring.sendgrid.api-key, this property is not used. This is because
  12.      * Spring Boot provides its own SendGrid client.
  13.      */
  14.     private String apiKey;
  15.     /**
  16.      * Set SendGrid API base URL.<br />
  17.      * <br />
  18.      *
  19.      * Changing the URL may be useful in tests.<br />
  20.      * <br />
  21.      *
  22.      * /!\ In Spring Boot application: if you provide a value for
  23.      * spring.sendgrid.api-key, this property is not used. This is because
  24.      * Spring Boot provides its own SendGrid client.
  25.      */
  26.     private URL url;
  27.     /**
  28.      * Set username for SendGrid HTTP API.<br />
  29.      * <br />
  30.      *
  31.      * @deprecated since version 3 of SendGrid Java library. Use API key instead
  32.      */
  33.     @Deprecated
  34.     private String username;
  35.     /**
  36.      * Set password for SendGrid HTTP API.<br />
  37.      * <br />
  38.      *
  39.      * @deprecated since version 3 of SendGrid Java library. Use API key instead
  40.      */
  41.     @Deprecated
  42.     private String password;
  43.     /**
  44.      * Configure SendGrid Client to run in unit tests. Only available since
  45.      * version 3 of SendGrid Java library
  46.      */
  47.     private boolean unitTesting;

  48.     public String getApiKey() {
  49.         return apiKey;
  50.     }

  51.     public void setApiKey(String apiKey) {
  52.         this.apiKey = apiKey;
  53.     }

  54.     /**
  55.      * @deprecated Spring Boot uses SendGrid Java library v4 since Spring Boot
  56.      *             2. Use API keys instead.
  57.      *
  58.      * @return the username
  59.      */
  60.     @Deprecated
  61.     public String getUsername() {
  62.         return username;
  63.     }

  64.     /**
  65.      * @deprecated Spring Boot uses SendGrid Java library v4 since Spring Boot
  66.      *             2. Use API keys instead.
  67.      *
  68.      * @param username
  69.      *            the username
  70.      */
  71.     @Deprecated
  72.     public void setUsername(String username) {
  73.         this.username = username;
  74.     }

  75.     /**
  76.      * @deprecated Spring Boot uses SendGrid Java library v4 since Spring Boot
  77.      *             2. Use API keys instead.
  78.      *
  79.      * @return the password
  80.      */
  81.     @Deprecated
  82.     public String getPassword() {
  83.         return password;
  84.     }

  85.     /**
  86.      * @deprecated Spring Boot uses SendGrid Java library v4 since Spring Boot
  87.      *             2. Use API keys instead.
  88.      *
  89.      * @param password
  90.      *            the password
  91.      */
  92.     @Deprecated
  93.     public void setPassword(String password) {
  94.         this.password = password;
  95.     }

  96.     public URL getUrl() {
  97.         return url;
  98.     }

  99.     public void setUrl(URL url) {
  100.         this.url = url;
  101.     }

  102.     public boolean isUnitTesting() {
  103.         return unitTesting;
  104.     }

  105.     public void setUnitTesting(boolean unitTesting) {
  106.         this.unitTesting = unitTesting;
  107.     }

  108. }