// Path: saltedge-library/src/main/java/com/saltedge/sdk/model/SEApiError.java
// public class SEApiError {
// 
//     @SerializedName(SEConstants.KEY_ERROR)
//     private ApiErrorContent error;
// 
//     public String getErrorMessage() {
//         return error.errorMessage;
//     }
// 
//     public String getErrorClass() {
//         return error.errorClass;
//     }
// 
//     public String getDocumentationUrl() {
//         return error.documentationUrl;
//     }
// 
//     private class ApiErrorContent {
//         @SerializedName(SEConstants.KEY_MESSAGE)
//         private String errorMessage;
// 
//         @SerializedName(SEConstants.KEY_CLASS)
//         private String errorClass;
// 
//         @SerializedName(SEConstants.KEY_DOCUMENTATION_URL)
//         private String documentationUrl;
//     }
// }


import com.google.gson.Gson;
import com.saltedge.sdk.model.SEApiError;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import okhttp3.ResponseBody;
        return (Double) parse(jsonObject, key, result);
    }

    public static JSONArray getJSONArray(JSONObject jsonObject, String key) {
        JSONArray result = new JSONArray();
        return (JSONArray) parse(jsonObject, key, result);
    }

    public static JSONObject getObject(JSONObject jsonObject, String key) {
        JSONObject result = new JSONObject();
        return (JSONObject) parse(jsonObject, key, result);
    }

    public static JSONObject stringToJSON(String string) {
        JSONObject result = new JSONObject();
        if (string == null || string.isEmpty()) return result;
        try {
            return new JSONObject(string);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return new JSONObject();
    }

    public static String getErrorMessage(ResponseBody error) {
        return getErrorMessage(error, SEConstants.REQUEST_ERROR);
    }

    public static String getErrorMessage(ResponseBody error, String defaultMessage) {
        try {
// Path: saltedge-library/src/main/java/com/saltedge/sdk/model/SEApiError.java
// public class SEApiError {
// 
//     @SerializedName(SEConstants.KEY_ERROR)
//     private ApiErrorContent error;
// 
//     public String getErrorMessage() {
//         return error.errorMessage;
//     }
// 
//     public String getErrorClass() {
//         return error.errorClass;
//     }
// 
//     public String getDocumentationUrl() {
//         return error.documentationUrl;
//     }
// 
//     private class ApiErrorContent {
//         @SerializedName(SEConstants.KEY_MESSAGE)
//         private String errorMessage;
// 
//         @SerializedName(SEConstants.KEY_CLASS)
//         private String errorClass;
// 
//         @SerializedName(SEConstants.KEY_DOCUMENTATION_URL)
//         private String documentationUrl;
//     }
// }


// Path: saltedge-library/src/main/java/com/saltedge/sdk/utils/SEJsonTools.java
import com.google.gson.Gson;
import com.saltedge.sdk.model.SEApiError;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import okhttp3.ResponseBody;

        return (Double) parse(jsonObject, key, result);
    }

    public static JSONArray getJSONArray(JSONObject jsonObject, String key) {
        JSONArray result = new JSONArray();
        return (JSONArray) parse(jsonObject, key, result);
    }

    public static JSONObject getObject(JSONObject jsonObject, String key) {
        JSONObject result = new JSONObject();
        return (JSONObject) parse(jsonObject, key, result);
    }

    public static JSONObject stringToJSON(String string) {
        JSONObject result = new JSONObject();
        if (string == null || string.isEmpty()) return result;
        try {
            return new JSONObject(string);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return new JSONObject();
    }

    public static String getErrorMessage(ResponseBody error) {
        return getErrorMessage(error, SEConstants.REQUEST_ERROR);
    }

    public static String getErrorMessage(ResponseBody error, String defaultMessage) {
        try {
            SEApiError apiError = new Gson().fromJson(error.string(), SEApiError.class);