-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: breakup examples to their own files in examples/user/user.java (#…
…370)
- Loading branch information
Showing
27 changed files
with
591 additions
and
575 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Create a parse setting | ||
// POST /user/webhooks/parse/settings | ||
|
||
|
||
public class Example { | ||
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.POST); | ||
request.setEndpoint("user/webhooks/parse/settings"); | ||
request.setBody("{\"url\":\"http://email.myhosthame.com\",\"send_raw\":false,\"hostname\":\"myhostname.com\",\"spam_check\":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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Delete a cancellation or pause of a scheduled send | ||
// DELETE /user/scheduled_sends/{batch_id} | ||
|
||
|
||
public class Example { | ||
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.DELETE); | ||
request.setEndpoint("user/scheduled_sends/{batch_id}"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Delete a parse setting | ||
// DELETE /user/webhooks/parse/settings/{hostname} | ||
|
||
|
||
public class Example { | ||
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.DELETE); | ||
request.setEndpoint("user/webhooks/parse/settings/{hostname}"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve your credit balance | ||
// GET /user/credits | ||
|
||
|
||
public class Example { | ||
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("user/credits"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve your account email address | ||
// GET /user/email | ||
|
||
|
||
public class Example { | ||
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("user/email"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve current Enforced TLS settings. | ||
// GET /user/settings/enforced_tls | ||
|
||
|
||
public class Example { | ||
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("user/settings/enforced_tls"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Get a user's profile | ||
// GET /user/profile | ||
|
||
|
||
public class Example { | ||
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("user/profile"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve all scheduled sends | ||
// GET /user/scheduled_sends | ||
|
||
|
||
public class Example { | ||
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("user/scheduled_sends"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve scheduled send | ||
// GET /user/scheduled_sends/{batch_id} | ||
|
||
|
||
public class Example { | ||
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("user/scheduled_sends/{batch_id}"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Get a user's account information. | ||
// GET /user/account | ||
|
||
|
||
public class Example { | ||
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("user/account"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve your username | ||
// GET /user/username | ||
|
||
|
||
public class Example { | ||
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("user/username"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve Event Webhook settings | ||
// GET /user/webhooks/event/settings | ||
|
||
|
||
public class Example { | ||
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("user/webhooks/event/settings"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve a specific parse setting | ||
// GET /user/webhooks/parse/settings/{hostname} | ||
|
||
|
||
public class Example { | ||
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("user/webhooks/parse/settings/{hostname}"); | ||
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,21 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieve all parse settings | ||
// GET /user/webhooks/parse/settings | ||
|
||
|
||
public class Example { | ||
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("user/webhooks/parse/settings"); | ||
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,26 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Retrieves Inbound Parse Webhook statistics. | ||
// GET /user/webhooks/parse/stats | ||
|
||
|
||
public class Example { | ||
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("user/webhooks/parse/stats"); | ||
request.addQueryParam("aggregated_by", "day"); | ||
request.addQueryParam("limit", "test_string"); | ||
request.addQueryParam("start_date", "2016-01-01"); | ||
request.addQueryParam("end_date", "2016-04-01"); | ||
request.addQueryParam("offset", "test_string"); | ||
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,22 @@ | ||
////////////////////////////////////////////////////////////////// | ||
// Cancel or pause a scheduled send | ||
// POST /user/scheduled_sends | ||
|
||
|
||
public class Example { | ||
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.POST); | ||
request.setEndpoint("user/scheduled_sends"); | ||
request.setBody("{\"batch_id\":\"YOUR_BATCH_ID\",\"status\":\"pause\"}"); | ||
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.