@@ -213,6 +213,9 @@ public static Mail buildHelloEmail() throws IOException {
213
213
String subject = "Hello World from the SendGrid Java Library" ;
214
214
Email to =
new Email (
"[email protected] " );
215
215
Content content = new Content ("text/plain" , "some text here" );
216
+ // Note that when you use this constructor an initial personalization object
217
+ // is created for you. It can be accessed via
218
+ // mail.personalization.get(0) as it is a List object
216
219
Mail mail = new Mail (from , subject , to , content );
217
220
Email email =
new Email (
"[email protected] " );
218
221
mail .personalization .get (0 ).addTo (email );
@@ -229,11 +232,11 @@ public static void baselineExample() throws IOException {
229
232
try {
230
233
request .method = Method .POST ;
231
234
request .endpoint = "mail/send" ;
232
- request .requestBody = helloWorld .build ();
235
+ request .body = helloWorld .build ();
233
236
Response response = sg .api (request );
234
237
System .out .println (response .statusCode );
235
- System .out .println (response .responseBody );
236
- System .out .println (response .responseHeaders );
238
+ System .out .println (response .body );
239
+ System .out .println (response .headers );
237
240
} catch (IOException ex ) {
238
241
throw ex ;
239
242
}
@@ -248,11 +251,11 @@ public static void kitchenSinkExample() throws IOException {
248
251
try {
249
252
request .method = Method .POST ;
250
253
request .endpoint = "mail/send" ;
251
- request .requestBody = kitchenSink .build ();
254
+ request .body = kitchenSink .build ();
252
255
Response response = sg .api (request );
253
256
System .out .println (response .statusCode );
254
- System .out .println (response .responseBody );
255
- System .out .println (response .responseHeaders );
257
+ System .out .println (response .body );
258
+ System .out .println (response .headers );
256
259
} catch (IOException ex ) {
257
260
throw ex ;
258
261
}
0 commit comments