forked from sendgrid/sendgrid-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified examples to use java-http-client version 4.0.0
- Loading branch information
Showing
26 changed files
with
1,407 additions
and
1,511 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -17,13 +17,13 @@ public static void main(String[] args) throws IOException { | |
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.method = Method.POST; | ||
request.endpoint = "alerts"; | ||
request.body = "{\"type\":\"stats_notification\",\"frequency\":\"daily\",\"email_to\":\"[email protected]\"}"; | ||
request.setMethod(Method.POST); | ||
request.setEndpoint("alerts"); | ||
request.setBody("{\"type\":\"stats_notification\",\"frequency\":\"daily\",\"email_to\":\"[email protected]\"}"); | ||
Response response = sg.api(request); | ||
System.out.println(response.statusCode); | ||
System.out.println(response.body); | ||
System.out.println(response.headers); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
|
@@ -40,12 +40,12 @@ public static void main(String[] args) throws IOException { | |
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.method = Method.GET; | ||
request.endpoint = "alerts"; | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("alerts"); | ||
Response response = sg.api(request); | ||
System.out.println(response.statusCode); | ||
System.out.println(response.body); | ||
System.out.println(response.headers); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
|
@@ -62,13 +62,13 @@ public static void main(String[] args) throws IOException { | |
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.method = Method.PATCH; | ||
request.endpoint = "alerts/{alert_id}"; | ||
request.body = "{\"email_to\":\"[email protected]\"}"; | ||
request.setMethod(Method.PATCH); | ||
request.setEndpoint("alerts/{alert_id}"); | ||
request.setBody("{\"email_to\":\"[email protected]\"}"); | ||
Response response = sg.api(request); | ||
System.out.println(response.statusCode); | ||
System.out.println(response.body); | ||
System.out.println(response.headers); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
|
@@ -85,12 +85,12 @@ public static void main(String[] args) throws IOException { | |
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.method = Method.GET; | ||
request.endpoint = "alerts/{alert_id}"; | ||
request.setMethod(Method.GET); | ||
request.setEndpoint("alerts/{alert_id}"); | ||
Response response = sg.api(request); | ||
System.out.println(response.statusCode); | ||
System.out.println(response.body); | ||
System.out.println(response.headers); | ||
System.out.println(response.getStatusCode()); | ||
System.out.println(response.getBody()); | ||
System.out.println(response.getHeaders()); | ||
} catch (IOException ex) { | ||
throw ex; | ||
} | ||
|
@@ -107,12 +107,12 @@ public static void main(String[] args) throws IOException { | |
try { | ||
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); | ||
Request request = new Request(); | ||
request.method = Method.DELETE; | ||
request.endpoint = "alerts/{alert_id}"; | ||
request.setMethod(Method.DELETE); | ||
request.setEndpoint("alerts/{alert_id}"); | ||
Response response = sg.api(request); | ||
System.out.println(response.statusCode); | ||
System.out.println(response.body); | ||
System.out.println(response.headers); | ||
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
Oops, something went wrong.