// Path: src/main/java/io/teknek/intravert/model/Request.java
// public class Request {
//   private List<Operation> operations;
//   
//   public Request(){
//     operations = new ArrayList<Operation>();
//   }
// 
//   public List<Operation> getOperations() {
//     return operations;
//   }
// 
//   public void setOperations(List<Operation> operations) {
//     this.operations = operations;
//   }
//   
// }
// 
// Path: src/main/java/io/teknek/intravert/model/Response.java
// public class Response {
//   private String exceptionMessage;
//   private String exceptionId;
//   private LinkedHashMap<String,Object> results;
//   private LinkedHashMap<String,Object> metaData;
//   
//   public Response(){
//     results = new LinkedHashMap<String,Object>();
//     metaData = new LinkedHashMap<String,Object>();
//   }
// 
//   public String getExceptionMessage() {
//     return exceptionMessage;
//   }
// 
//   public void setExceptionMessage(String exceptionMessage) {
//     this.exceptionMessage = exceptionMessage;
//   }
// 
//   public String getExceptionId() {
//     return exceptionId;
//   }
// 
//   public void setExceptionId(String exceptionId) {
//     this.exceptionId = exceptionId;
//   }
// 
//   public Map<String, Object> getResults() {
//     return results;
//   }
// 
//   public void setResults(LinkedHashMap<String, Object> results) {
//     this.results = results;
//   }
// 
//   public Map<String, Object> getMetaData() {
//     return metaData;
//   }
// 
//   public void setMetaData(LinkedHashMap<String, Object> metaData) {
//     this.metaData = metaData;
//   }
//   
// }


import io.teknek.intravert.model.Request;
import io.teknek.intravert.model.Response;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.codehaus.jackson.map.ObjectMapper;
package io.teknek.intravert.client;




public class Client {

  private ObjectMapper MAPPER = new ObjectMapper();
  private DefaultHttpClient httpClient = new DefaultHttpClient();
  
  @Deprecated
  public String postAsString(String url, String message)
          throws IOException, IllegalStateException, UnsupportedEncodingException, RuntimeException {

    HttpPost postRequest = new HttpPost(url);

    StringEntity input = new StringEntity(message);
    input.setContentType("application/json");
    postRequest.setEntity(input);

    HttpResponse response = httpClient.execute(postRequest);

    if (response.getStatusLine().getStatusCode() != 200) {
      throw new RuntimeException("Failed : HTTP error code : "
              + response.getStatusLine().getStatusCode());
    }

    BufferedReader br = new BufferedReader(new InputStreamReader(
            (response.getEntity().getContent())));

    String output;
    StringBuffer totalOutput = new StringBuffer();
    System.out.println("Output from Server .... \n");
    while ((output = br.readLine()) != null) {
      System.out.println(output);
      totalOutput.append(output);
    }
    return totalOutput.toString();
  }
  
// Path: src/main/java/io/teknek/intravert/model/Request.java
// public class Request {
//   private List<Operation> operations;
//   
//   public Request(){
//     operations = new ArrayList<Operation>();
//   }
// 
//   public List<Operation> getOperations() {
//     return operations;
//   }
// 
//   public void setOperations(List<Operation> operations) {
//     this.operations = operations;
//   }
//   
// }
// 
// Path: src/main/java/io/teknek/intravert/model/Response.java
// public class Response {
//   private String exceptionMessage;
//   private String exceptionId;
//   private LinkedHashMap<String,Object> results;
//   private LinkedHashMap<String,Object> metaData;
//   
//   public Response(){
//     results = new LinkedHashMap<String,Object>();
//     metaData = new LinkedHashMap<String,Object>();
//   }
// 
//   public String getExceptionMessage() {
//     return exceptionMessage;
//   }
// 
//   public void setExceptionMessage(String exceptionMessage) {
//     this.exceptionMessage = exceptionMessage;
//   }
// 
//   public String getExceptionId() {
//     return exceptionId;
//   }
// 
//   public void setExceptionId(String exceptionId) {
//     this.exceptionId = exceptionId;
//   }
// 
//   public Map<String, Object> getResults() {
//     return results;
//   }
// 
//   public void setResults(LinkedHashMap<String, Object> results) {
//     this.results = results;
//   }
// 
//   public Map<String, Object> getMetaData() {
//     return metaData;
//   }
// 
//   public void setMetaData(LinkedHashMap<String, Object> metaData) {
//     this.metaData = metaData;
//   }
//   
// }


// Path: src/main/java/io/teknek/intravert/client/Client.java
import io.teknek.intravert.model.Request;
import io.teknek.intravert.model.Response;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.codehaus.jackson.map.ObjectMapper;

package io.teknek.intravert.client;




public class Client {

  private ObjectMapper MAPPER = new ObjectMapper();
  private DefaultHttpClient httpClient = new DefaultHttpClient();
  
  @Deprecated
  public String postAsString(String url, String message)
          throws IOException, IllegalStateException, UnsupportedEncodingException, RuntimeException {

    HttpPost postRequest = new HttpPost(url);

    StringEntity input = new StringEntity(message);
    input.setContentType("application/json");
    postRequest.setEntity(input);

    HttpResponse response = httpClient.execute(postRequest);

    if (response.getStatusLine().getStatusCode() != 200) {
      throw new RuntimeException("Failed : HTTP error code : "
              + response.getStatusLine().getStatusCode());
    }

    BufferedReader br = new BufferedReader(new InputStreamReader(
            (response.getEntity().getContent())));

    String output;
    StringBuffer totalOutput = new StringBuffer();
    System.out.println("Output from Server .... \n");
    while ((output = br.readLine()) != null) {
      System.out.println(output);
      totalOutput.append(output);
    }
    return totalOutput.toString();
  }
  
  public Response post(String url, Request request)