// Path: src/main/java/com/hyperwallet/clientsdk/HyperwalletException.java
// public class HyperwalletException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private Response response = null;
//     private String errorMessage;
//     private String errorCode;
//     private List<String> relatedResources;
//     private HyperwalletErrorList hyperwalletErrorList;
// 
//     public HyperwalletException(final Exception e) {
//         super(e);
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message) {
//         super(message);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message, final Exception e) {
//         super(e);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final HyperwalletErrorList hyperwalletErrorList) {
//         super(hyperwalletErrorList.getErrors().get(0).getMessage());
// 
//         this.response = response;
//         this.hyperwalletErrorList = hyperwalletErrorList;
//         HyperwalletError error = this.hyperwalletErrorList.getErrors().get(0);
//         errorCode = error.getCode();
//         errorMessage = error.getMessage();
//         relatedResources = error.getRelatedResources();
//     }
// 
//     public HyperwalletException(final String errorMessage) {
//         super(errorMessage);
// 
//         this.errorMessage = errorMessage;
//     }
// 
//     public Response getResponse() {
//         return response;
//     }
// 
//     public String getErrorMessage() {
//         return errorMessage;
//     }
// 
//     public String getErrorCode() {
//         return errorCode;
//     }
// 
//     public List<String> getRelatedResources() {
//         return relatedResources;
//     }
// 
//     public List<HyperwalletError> getHyperwalletErrors() {
//         return hyperwalletErrorList != null ? hyperwalletErrorList.getErrors() : null;
//     }
// }
// 
// Path: src/main/java/com/hyperwallet/clientsdk/model/HyperwalletErrorList.java
// @XmlRootElement
// public class HyperwalletErrorList {
// 
//     public List<HyperwalletError> errors = new ArrayList<HyperwalletError>();
// 
//     public HyperwalletErrorList() {
//     }
// 
//     public List<HyperwalletError> getErrors() {
//         return errors;
//     }
// 
//     public void setErrors(List<HyperwalletError> errors) {
//         this.errors = errors;
//     }
// }


import cc.protea.util.http.Response;
import com.fasterxml.jackson.core.type.TypeReference;
import com.hyperwallet.clientsdk.HyperwalletException;
import com.hyperwallet.clientsdk.model.HyperwalletErrorList;
import com.nimbusds.jose.JOSEException;
import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.text.ParseException;
import java.util.HashMap;
import java.util.UUID;
            response = request.postResource();
            return processResponse(response, type);
        } catch (IOException | JOSEException | ParseException e) {
            throw new HyperwalletException(e);
        }
    }

    protected <T> T processResponse(final Response response, final Class<T> type)
            throws ParseException, JOSEException, IOException {
        checkErrorResponse(response);
        checkResponseHeader(response);
        if (response.getResponseCode() == 204) {
            return convert("{}", type);
        } else {
            return convert(decryptResponse(response.getBody()), type);
        }
    }

    protected <T> T processResponse(final Response response, final TypeReference<T> type)
            throws ParseException, JOSEException, IOException {
        checkErrorResponse(response);
        checkResponseHeader(response);
        if (response.getResponseCode() == 204) {
            return convert("{}", type);
        } else {
            return convert(decryptResponse(response.getBody()), type);
        }
    }

    protected void checkErrorResponse(final Response response) throws ParseException, JOSEException, IOException {
// Path: src/main/java/com/hyperwallet/clientsdk/HyperwalletException.java
// public class HyperwalletException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private Response response = null;
//     private String errorMessage;
//     private String errorCode;
//     private List<String> relatedResources;
//     private HyperwalletErrorList hyperwalletErrorList;
// 
//     public HyperwalletException(final Exception e) {
//         super(e);
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message) {
//         super(message);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message, final Exception e) {
//         super(e);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final HyperwalletErrorList hyperwalletErrorList) {
//         super(hyperwalletErrorList.getErrors().get(0).getMessage());
// 
//         this.response = response;
//         this.hyperwalletErrorList = hyperwalletErrorList;
//         HyperwalletError error = this.hyperwalletErrorList.getErrors().get(0);
//         errorCode = error.getCode();
//         errorMessage = error.getMessage();
//         relatedResources = error.getRelatedResources();
//     }
// 
//     public HyperwalletException(final String errorMessage) {
//         super(errorMessage);
// 
//         this.errorMessage = errorMessage;
//     }
// 
//     public Response getResponse() {
//         return response;
//     }
// 
//     public String getErrorMessage() {
//         return errorMessage;
//     }
// 
//     public String getErrorCode() {
//         return errorCode;
//     }
// 
//     public List<String> getRelatedResources() {
//         return relatedResources;
//     }
// 
//     public List<HyperwalletError> getHyperwalletErrors() {
//         return hyperwalletErrorList != null ? hyperwalletErrorList.getErrors() : null;
//     }
// }
// 
// Path: src/main/java/com/hyperwallet/clientsdk/model/HyperwalletErrorList.java
// @XmlRootElement
// public class HyperwalletErrorList {
// 
//     public List<HyperwalletError> errors = new ArrayList<HyperwalletError>();
// 
//     public HyperwalletErrorList() {
//     }
// 
//     public List<HyperwalletError> getErrors() {
//         return errors;
//     }
// 
//     public void setErrors(List<HyperwalletError> errors) {
//         this.errors = errors;
//     }
// }


// Path: src/main/java/com/hyperwallet/clientsdk/util/HyperwalletApiClient.java
import cc.protea.util.http.Response;
import com.fasterxml.jackson.core.type.TypeReference;
import com.hyperwallet.clientsdk.HyperwalletException;
import com.hyperwallet.clientsdk.model.HyperwalletErrorList;
import com.nimbusds.jose.JOSEException;
import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.text.ParseException;
import java.util.HashMap;
import java.util.UUID;

            response = request.postResource();
            return processResponse(response, type);
        } catch (IOException | JOSEException | ParseException e) {
            throw new HyperwalletException(e);
        }
    }

    protected <T> T processResponse(final Response response, final Class<T> type)
            throws ParseException, JOSEException, IOException {
        checkErrorResponse(response);
        checkResponseHeader(response);
        if (response.getResponseCode() == 204) {
            return convert("{}", type);
        } else {
            return convert(decryptResponse(response.getBody()), type);
        }
    }

    protected <T> T processResponse(final Response response, final TypeReference<T> type)
            throws ParseException, JOSEException, IOException {
        checkErrorResponse(response);
        checkResponseHeader(response);
        if (response.getResponseCode() == 204) {
            return convert("{}", type);
        } else {
            return convert(decryptResponse(response.getBody()), type);
        }
    }

    protected void checkErrorResponse(final Response response) throws ParseException, JOSEException, IOException {
        HyperwalletErrorList errorList = null;