Skip to content

Commit 9a25e07

Browse files
committed
Update documentation for java-http-client version 4.0.0
1 parent 91edbe6 commit 9a25e07

File tree

3 files changed

+1412
-1510
lines changed

3 files changed

+1412
-1510
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ public class Example {
112112
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
113113
Request request = new Request();
114114
try {
115-
request.method = Method.POST;
116-
request.endpoint = "mail/send";
117-
request.body = mail.build();
115+
request.setMethod(Method.POST);
116+
request.setEndpoint("mail/send");
117+
request.setBody(mail.build());
118118
Response response = sg.api(request);
119-
System.out.println(response.statusCode);
120-
System.out.println(response.body);
121-
System.out.println(response.headers);
119+
System.out.println(response.getStatusCode());
120+
System.out.println(response.getBody());
121+
System.out.println(response.getHeaders());
122122
} catch (IOException ex) {
123123
throw ex;
124124
}
@@ -141,13 +141,13 @@ public class Example {
141141
try {
142142
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
143143
Request request = new Request();
144-
request.method = Method.POST;
145-
request.endpoint = "mail/send";
146-
request.body = "{\"personalizations\":[{\"to\":[{\"email\":\"[email protected]\"}],\"subject\":\"Hello World from the SendGrid Java Library!\"}],\"from\":{\"email\":\"[email protected]\"},\"content\":[{\"type\":\"text/plain\",\"value\": \"Hello, Email!\"}]}";
144+
request.setMethod(Method.POST);
145+
request.setEndpoint("mail/send");
146+
request.setBody("{\"personalizations\":[{\"to\":[{\"email\":\"[email protected]\"}],\"subject\":\"Hello World from the SendGrid Java Library!\"}],\"from\":{\"email\":\"[email protected]\"},\"content\":[{\"type\":\"text/plain\",\"value\": \"Hello, Email!\"}]}");
147147
Response response = sg.api(request);
148-
System.out.println(response.statusCode);
149-
System.out.println(response.body);
150-
System.out.println(response.headers);
148+
System.out.println(response.getStatusCode());
149+
System.out.println(response.getBody());
150+
System.out.println(response.getHeaders());
151151
} catch (IOException ex) {
152152
throw ex;
153153
}
@@ -166,12 +166,12 @@ public class Example {
166166
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
167167
try {
168168
Request request = new Request();
169-
request.method = Method.GET;
170-
request.endpoint = "api_keys";
169+
request.setMethod(Method.GET);
170+
request.setEndpoint("api_keys");
171171
Response response = sg.api(request);
172-
System.out.println(response.statusCode);
173-
System.out.println(response.body);
174-
System.out.println(response.headers);
172+
System.out.println(response.getStatusCode());
173+
System.out.println(response.getBody());
174+
System.out.println(response.getHeaders());
175175
} catch (IOException ex) {
176176
throw ex;
177177
}

0 commit comments

Comments
 (0)