-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'test-license-date-range' of https://github.com/pushkyn/…
…sendgrid-java into test-license-date-range
- Loading branch information
Showing
30 changed files
with
666 additions
and
445 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
examples/mailsettings/GetAddressWhitelistMailSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
import java.io.IOException; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve address whitelist mail settings | ||
// GET /mail_settings/address_whitelist | ||
|
||
|
||
public class GetAddressWhitelistMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/address_whitelist"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve all mail settings | ||
// GET /mail_settings | ||
|
||
|
||
public class GetAllMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings"); | ||
request.addQueryParam("limit", "1"); | ||
request.addQueryParam("offset", "1"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve all BCC mail settings | ||
// GET /mail_settings/bcc | ||
|
||
|
||
public class GetBCCMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/bcc"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
import java.io.IOException; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve bounce purge mail settings | ||
// GET /mail_settings/bounce_purge | ||
|
||
|
||
public class GetBouncePurgeMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/bounce_purge"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
import java.io.IOException; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve footer mail settings | ||
// GET /mail_settings/footer | ||
|
||
|
||
public class GetFooterMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/footer"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
import java.io.IOException; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve forward bounce mail settings | ||
// GET /mail_settings/forward_bounce | ||
|
||
|
||
public class GetForwardBounceMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/forward_bounce"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
import java.io.IOException; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve forward spam mail settings | ||
// GET /mail_settings/forward_spam | ||
|
||
|
||
public class GetForwardSpamMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/forward_spam"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve plain content mail settings | ||
// GET /mail_settings/plain_content | ||
|
||
|
||
public class GetPlainContentMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/plain_content"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve spam check mail settings | ||
// GET /mail_settings/spam_check | ||
|
||
|
||
public class GetSpamCheckMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/spam_check"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Retrieve legacy template mail settings | ||
// GET /mail_settings/template | ||
|
||
|
||
public class GetTemplateMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("mail_settings/template"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) | ||
|
||
This folder contains various examples on using the Mail Settings endpoint of SendGrid with Java: | ||
|
||
* [Retrieve all mail settings (GET /mail_settings)](GetAllMailSettings.java) | ||
* [Retrieve address whitelist mail settings (GET /mail_settings/address_whitelist)](GetAddressWhitelistMailSettings.java) | ||
* [Retrieve all BCC mail settings (GET /mail_settings/bcc)](GetBCCMailSettings.java) | ||
* [Retrieve bounce purge mail settings (GET /mail_settings/bounce_purge)](GetBouncePurgeMailSettings.java) | ||
* [Retrieve footer mail settings (GET /mail_settings/footer)](GetFooterMailSettings.java) | ||
* [Retrieve forward bounce mail settings (GET /mail_settings/forward_bounce)](GetForwardBounceMailSettings.java) | ||
* [Retrieve forward spam mail settings (GET /mail_settings/forward_spam)](GetForwardSpamMailSettings.java) | ||
* [Retrieve plain content mail settings (GET /mail_settings/plain_content)](GetPlainContentMailSettings.java) | ||
* [Retrieve spam check mail settings (GET /mail_settings/spam_check)](GetSpamCheckMailSettings.java) | ||
* [Retrieve legacy template mail settings (GET /mail_settings/template)](GetTemplateMailSettings.java) | ||
* [Update address whitelist mail settings (PATCH /mail_settings/address_whitelist)](UpdateAddressWhitelist.java) | ||
* [Update BCC mail settings (PATCH /mail_settings/bcc)](UpdateBCCMailSettings.java) | ||
* [Update bounce purge mail settings (PATCH /mail_settings/bounce_purge)](UpdateBouncePurgeMailSettings.java) | ||
* [Update footer mail settings (PATCH /mail_settings/footer)](UpdateFooterMailSettings.java) | ||
* [Update forward bounce mail settings (PATCH /mail_settings/forward_bounce)](UpdateForwardBounceMailSettings.java) | ||
* [Update forward spam mail settings (PATCH /mail_settings/forward_spam)](UpdateForwardSpamMailSettings.java) | ||
* [Update plain content mail settings (PATCH /mail_settings/plain_content)](UpdatePlainContentMailSettings.java) | ||
* [Update spam check mail settings (PATCH /mail_settings/spam_check)](UpdateSpamCheckMailSettings.java) | ||
* [Update template mail settings (PATCH /mail_settings/template)](UpdateTemplateMailSettings.java) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Update address whitelist mail settings | ||
// PATCH /mail_settings/address_whitelist | ||
|
||
|
||
public class UpdateAddressWhitelist { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.PATCH); | ||
request.setEndpoint("mail_settings/address_whitelist"); | ||
request.setBody("{\"list\":[\"[email protected]\",\"example.com\"],\"enabled\":true}"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import java.io.IOException; | ||
|
||
import com.sendgrid.Method; | ||
import com.sendgrid.Request; | ||
import com.sendgrid.Response; | ||
import com.sendgrid.SendGrid; | ||
|
||
////////////////////////////////////////////////////////////////// | ||
// Update BCC mail settings | ||
// PATCH /mail_settings/bcc | ||
|
||
|
||
public class UpdateBCCMailSettings { | ||
public static void main(String[] args) throws IOException { | ||
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.setMethod(Method.PATCH); | ||
request.setEndpoint("mail_settings/bcc"); | ||
request.setBody("{\"enabled\":false,\"email\":\"[email protected]\"}"); | ||
Response response = sg.api(request); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
} | ||
} |
Oops, something went wrong.