 
     func parse(data: Data?, response: URLResponse?) -> JSONResult {
         guard let httpResponse = response as? HTTPURLResponse else {
-            return JSONResult.Failure(error: JSONError.NonHTTPResponse, response: nil, body: nil)
+            return JSONResult.failure(error: JSONError.nonHTTPResponse, response: nil, body: nil)
         }
         guard let data = data, data.count > 0 else {
-            return JSONResult.Success(data: nil, response: httpResponse)
+            return JSONResult.success(data: nil, response: httpResponse)
         }
         guard let json = JSONToObject(data: data) else {
-            return JSONResult.Failure(error: JSONError.ResponseDeserialization,
+            return JSONResult.failure(error: JSONError.responseDeserialization,
                                       response: httpResponse,
                                       body: dataToUTFString(data: data))
         }
-        return JSONResult.Success(data: json, response: httpResponse)
+        return JSONResult.success(data: json, response: httpResponse)
     }
 
     func body(fromData data: Data?) -> String? {

public typealias JSONObject = Dictionary<String, Any>

public enum JSONError: Error {
    case InvalidURL
    case PayloadSerialization

    case NoInternetConnection
    case RequestFailed(error: Error)

    case NonHTTPResponse
    case ResponseDeserialization

    case UnknownError
}

public enum JSONResult {
    case Success(data: Any?, response: HTTPURLResponse)
    case Failure(error: JSONError, response: HTTPURLResponse?, body: String?)
}

public extension JSONResult {

    public var data: Any? {
        switch self {
        case .Success(let data, _):
            return data
        case .Failure:
            return nil
        }
    }

                            queryParams: JSONObject? = nil, payload: Any? = nil,
                            headers: JSONObject? = nil, complete: @escaping (JSONResult) -> Void) {
        if isConnectedToNetwork() == false {
            let error = JSONError.noInternetConnection
            complete(.failure(error: error, response: nil, body: nil))
            return
        }

