@@ -93,18 +93,19 @@ import com.mailjet.client.MailjetClient;
9393import com.mailjet.client.MailjetRequest ;
9494import com.mailjet.client.MailjetResponse ;
9595import com.mailjet.client.ClientOptions ;
96+ import com.mailjet.client.resource.ApiVersion ;
9697import com.mailjet.client.resource.Emailv31 ;
9798import org.json.JSONArray ;
9899import org.json.JSONObject ;
99100public class MyClass {
100101 /**
101102 * Run:
102103 */
103- public static void main (String [] args ) throws MailjetException , MailjetSocketTimeoutException {
104+ public static void main (String [] args ) throws MailjetException {
104105 MailjetClient client;
105106 MailjetRequest request;
106107 MailjetResponse response;
107- client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (" v3.1 " ));
108+ client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (ApiVersion . V3 ));
108109 request = new MailjetRequest (Emailv31 . resource)
109110 .property(Emailv31 . MESSAGES , new JSONArray ()
110111 .put(new JSONObject ()
@@ -130,7 +131,7 @@ public class MyClass {
130131To instantiate the library you can use the following constructor:
131132
132133``` java
133- MailjetClient client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (" v3 " , " https://api.us.mailjet.com" ));
134+ MailjetClient client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (ApiVersion . V3 , " https://api.us.mailjet.com" ));
134135```
135136
136137 - ` $MJ_APIKEY_PUBLIC ` : public Mailjet API key
@@ -151,7 +152,7 @@ Since most Email API endpoints are located under `v3`, it is set as the default
151152
152153``` java
153154
154- MailjetClient client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (" v3.1 " ));
155+ MailjetClient client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (ApiVersion . V3_1 ));
155156
156157```
157158
@@ -162,7 +163,7 @@ For additional information refer to our [API Reference](https://dev.preprod.mail
162163The default base domain name for the Mailjet API is api.mailjet.com. You can modify this base URL by adding a different URL in ` ClientOptions ` :
163164
164165``` java
165- MailjetClient client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (" v3 " , " https://api.us.mailjet.com" ));
166+ MailjetClient client = new MailjetClient (System . getenv(" MJ_APIKEY_PUBLIC" ), System . getenv(" MJ_APIKEY_PRIVATE" ), new ClientOptions (ApiVersion . V3 , " https://api.us.mailjet.com" ));
166167```
167168
168169If your account has been moved to Mailjet's ** US architecture** , the URL you need to add is ` https://api.us.mailjet.com ` .
@@ -213,7 +214,7 @@ public class MyClass {
213214 /**
214215 * Create a contact
215216 */
216- public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
217+ public static void main(String[] args) throws MailjetException {
217218 MailjetClient client;
218219 MailjetRequest request;
219220 MailjetResponse response;
@@ -246,7 +247,7 @@ public class MyClass {
246247 /**
247248 * Create : Manage a contact subscription to a list
248249 */
249- public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
250+ public static void main(String[] args) throws MailjetException {
250251 MailjetClient client;
251252 MailjetRequest request;
252253 MailjetResponse response;
@@ -287,7 +288,7 @@ public class MyClass {
287288 /**
288289 * Run :
289290 */
290- public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
291+ public static void main(String[] args) throws MailjetException {
291292 MailjetClient client;
292293 MailjetRequest request;
293294 MailjetResponse response;
@@ -319,7 +320,7 @@ public class MyClass {
319320 /**
320321 * Run :
321322 */
322- public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
323+ public static void main(String[] args) throws MailjetException {
323324 MailjetClient client;
324325 MailjetRequest request;
325326 MailjetResponse response;
@@ -353,7 +354,7 @@ public class MyClass {
353354 /**
354355 * Run :
355356 */
356- public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
357+ public static void main(String[] args) throws MailjetException {
357358 MailjetClient client;
358359 MailjetRequest request;
359360 MailjetResponse response;
@@ -387,7 +388,7 @@ public class MyClass {
387388 /**
388389 * Modify : Modify the static custom contact data
389390 */
390- public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
391+ public static void main(String[] args) throws MailjetException {
391392 MailjetClient client;
392393 MailjetRequest request;
393394 MailjetResponse response;
@@ -427,7 +428,7 @@ public class MyClass {
427428 /**
428429 * Delete a Template
429430 */
430- public static void main (String [] args ) throws MailjetException , MailjetSocketTimeoutException {
431+ public static void main (String [] args ) throws MailjetException {
431432 MailjetClient client;
432433 MailjetRequest request;
433434 MailjetResponse response;
@@ -447,7 +448,7 @@ public class MyClass {
447448Authentication for the SMS API endpoints is done using a bearer token. The bearer token is generated in the [ SMS section] ( https://app.mailjet.com/sms ) of your Mailjet account.
448449
449450``` java
450- MailjetClient client = new MailjetClient (System . getenv(" MJ_TOKEN" ), new ClientOptions (" v4 " ));
451+ MailjetClient client = new MailjetClient (System . getenv(" MJ_TOKEN" ), new ClientOptions (ApiVersion . V4 ));
451452```
452453
453454### Example request
@@ -461,7 +462,7 @@ MailjetRequest request;
461462MailjetResponse response;
462463
463464// Note how we set the version to v4 using ClientOptions and use an already generated token
464- MailjetClient client = new MailjetClient (System . getenv(" MJ_TOKEN" ), new ClientOptions (" v4 " ));
465+ MailjetClient client = new MailjetClient (System . getenv(" MJ_TOKEN" ), new ClientOptions (ApiVersion . V4 ));
465466
466467request = new MailjetRequest (Send . resource)
467468 .property(Send . From , " MJPilot" )
@@ -484,11 +485,11 @@ public class MyClass {
484485 /**
485486 * Run:
486487 */
487- public static void main (String [] args ) throws MailjetException , MailjetSocketTimeoutException {
488+ public static void main (String [] args ) throws MailjetException {
488489 MailjetClient client;
489490 MailjetRequest request;
490491 MailjetResponse response;
491- client = new MailjetClient (System . getenv(" MJ_TOKEN" ), new ClientOptions (" v4 " ));
492+ client = new MailjetClient (System . getenv(" MJ_TOKEN" ), new ClientOptions (ApiVersion . V4 ));
492493 request = new MailjetRequest (SmsSend . resource)
493494 .property(SmsSend . FROM , " MJPilot" )
494495 .property(SmsSend . TO , " +33600000000" )
0 commit comments