@Test public void addContact() { AddContactResponse contact = mailjet.addContact(listId, "jenggot@naga.com"); log.debug("Contact Id {}", contact.getContact_id()); assertNotNull(contact.getContact_id()); }
@Deprecated public AddContactResponse addContact(long listId, String email) { ArrayList<NameValuePair> formParams = new ArrayList<NameValuePair>(); formParams.add(new BasicNameValuePair("contact", email)); formParams.add(new BasicNameValuePair("id", String.valueOf(listId))); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8"); HttpPost httpPost = new HttpPost(apiUri + "listsAddcontact/?output=json"); httpPost.setEntity(entity); log.info("sending request to add contact"); HttpResponse httpResponse = httpClient.execute(httpPost); log.debug("HttpResponse status code {}", httpResponse.getStatusLine().getStatusCode()); if (httpResponse.getStatusLine().getStatusCode() != 200 ){ throw new IOException(String.format("throw Http Error %s", httpResponse.getStatusLine().getReasonPhrase())); } final String responseContent = IOUtils.toString(httpResponse.getEntity().getContent()); return mapper.readValue(responseContent, AddContactResponse.class); } catch (Exception ex) { throw new RuntimeException("Cannot add contact "+ email, ex); } }
Mailjet implements Serializable { @Deprecated public AddContactResponse addContact(long listId, String email) { ArrayList<NameValuePair> formParams = new ArrayList<NameValuePair>(); formParams.add(new BasicNameValuePair("contact", email)); formParams.add(new BasicNameValuePair("id", String.valueOf(listId))); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8"); HttpPost httpPost = new HttpPost(apiUri + "listsAddcontact/?output=json"); httpPost.setEntity(entity); log.info("sending request to add contact"); HttpResponse httpResponse = httpClient.execute(httpPost); log.debug("HttpResponse status code {}", httpResponse.getStatusLine().getStatusCode()); if (httpResponse.getStatusLine().getStatusCode() != 200 ){ throw new IOException(String.format("throw Http Error %s", httpResponse.getStatusLine().getReasonPhrase())); } final String responseContent = IOUtils.toString(httpResponse.getEntity().getContent()); return mapper.readValue(responseContent, AddContactResponse.class); } catch (Exception ex) { throw new RuntimeException("Cannot add contact "+ email, ex); } } }
Mailjet implements Serializable { @Deprecated public AddContactResponse addContact(long listId, String email) { ArrayList<NameValuePair> formParams = new ArrayList<NameValuePair>(); formParams.add(new BasicNameValuePair("contact", email)); formParams.add(new BasicNameValuePair("id", String.valueOf(listId))); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8"); HttpPost httpPost = new HttpPost(apiUri + "listsAddcontact/?output=json"); httpPost.setEntity(entity); log.info("sending request to add contact"); HttpResponse httpResponse = httpClient.execute(httpPost); log.debug("HttpResponse status code {}", httpResponse.getStatusLine().getStatusCode()); if (httpResponse.getStatusLine().getStatusCode() != 200 ){ throw new IOException(String.format("throw Http Error %s", httpResponse.getStatusLine().getReasonPhrase())); } final String responseContent = IOUtils.toString(httpResponse.getEntity().getContent()); return mapper.readValue(responseContent, AddContactResponse.class); } catch (Exception ex) { throw new RuntimeException("Cannot add contact "+ email, ex); } } Mailjet(MailjetManager mailjetManager);  Mailjet(); }
Mailjet implements Serializable { @Deprecated public AddContactResponse addContact(long listId, String email) { ArrayList<NameValuePair> formParams = new ArrayList<NameValuePair>(); formParams.add(new BasicNameValuePair("contact", email)); formParams.add(new BasicNameValuePair("id", String.valueOf(listId))); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8"); HttpPost httpPost = new HttpPost(apiUri + "listsAddcontact/?output=json"); httpPost.setEntity(entity); log.info("sending request to add contact"); HttpResponse httpResponse = httpClient.execute(httpPost); log.debug("HttpResponse status code {}", httpResponse.getStatusLine().getStatusCode()); if (httpResponse.getStatusLine().getStatusCode() != 200 ){ throw new IOException(String.format("throw Http Error %s", httpResponse.getStatusLine().getReasonPhrase())); } final String responseContent = IOUtils.toString(httpResponse.getEntity().getContent()); return mapper.readValue(responseContent, AddContactResponse.class); } catch (Exception ex) { throw new RuntimeException("Cannot add contact "+ email, ex); } } Mailjet(MailjetManager mailjetManager);  Mailjet(); @Deprecated AddContactResponse addContact(long listId, String email); boolean insertContact(long listId, String email); AddContactResponse addContacts(String id, List<String> emails); ListContactsResponse showContacts(); String getErrorMessage(); void setErrorMessage(String errorMessage); AddContactResponse getAddContactRespone(); void setAddContactRespone(AddContactResponse addContactRespone); }
Mailjet implements Serializable { @Deprecated public AddContactResponse addContact(long listId, String email) { ArrayList<NameValuePair> formParams = new ArrayList<NameValuePair>(); formParams.add(new BasicNameValuePair("contact", email)); formParams.add(new BasicNameValuePair("id", String.valueOf(listId))); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8"); HttpPost httpPost = new HttpPost(apiUri + "listsAddcontact/?output=json"); httpPost.setEntity(entity); log.info("sending request to add contact"); HttpResponse httpResponse = httpClient.execute(httpPost); log.debug("HttpResponse status code {}", httpResponse.getStatusLine().getStatusCode()); if (httpResponse.getStatusLine().getStatusCode() != 200 ){ throw new IOException(String.format("throw Http Error %s", httpResponse.getStatusLine().getReasonPhrase())); } final String responseContent = IOUtils.toString(httpResponse.getEntity().getContent()); return mapper.readValue(responseContent, AddContactResponse.class); } catch (Exception ex) { throw new RuntimeException("Cannot add contact "+ email, ex); } } Mailjet(MailjetManager mailjetManager);  Mailjet(); @Deprecated AddContactResponse addContact(long listId, String email); boolean insertContact(long listId, String email); AddContactResponse addContacts(String id, List<String> emails); ListContactsResponse showContacts(); String getErrorMessage(); void setErrorMessage(String errorMessage); AddContactResponse getAddContactRespone(); void setAddContactRespone(AddContactResponse addContactRespone);  }