     }
 }
 
+public func ==(lhs: Client.Error, rhs: Client.Error) -> Bool {
+    switch (lhs, rhs) {
+    case let (.NetworkError(error1), .NetworkError(error2)):
+        return error1 == error2
+        
+    case let (.JSONDeserializationError(error1), .JSONDeserializationError(error2)):
+        return error1 == error2
+        
+    case let (.JSONDecodingError(error1), .JSONDecodingError(error2)):
+        return error1 == error2
+        
+    case let (.APIError(error1), .APIError(error2)):
+        return error1 == error2
+        
+    default:
+        return false
+    }
+}
+
 internal func ==(lhs: Client.Endpoint, rhs: Client.Endpoint) -> Bool {
     switch (lhs, rhs) {
     case let (.ReleaseByTagName(owner1, repo1, tag1), .ReleaseByTagName(owner2, repo2, tag2)):

/// A GitHub API Client
public final class Client {
    /// An error from the Client.
    public enum Error: ErrorType {
        /// An error occurred in a network operation.
        case NetworkError(NSError)
        

    }
}

extension DecodeError: Hashable {
    public var hashValue: Int {
        switch self {
        case let .TypeMismatch(expected: expected, actual: actual):
            return expected.hashValue ^ actual.hashValue
            
        case let .MissingKey(string):
            return string.hashValue
            
        case let .Custom(string):
            return string.hashValue
        }
    }
}

public func ==(lhs: DecodeError, rhs: DecodeError) -> Bool {
    switch (lhs, rhs) {
    case let (.TypeMismatch(expected: expected1, actual: actual1), .TypeMismatch(expected: expected2, actual: actual2)):
        return expected1 == expected2 && actual1 == actual2
        
    case let (.MissingKey(string1), .MissingKey(string2)):
        return string1 == string2
        
    case let (.Custom(string1), .Custom(string2)):
        return string1 == string2
        
    default:
        return false
    }
}

extension NSJSONSerialization {
    internal static func deserializeJSON(data: NSData) -> Result<NSDictionary, NSError> {
        return Result(try NSJSONSerialization.JSONObjectWithData(data, options: []) as! NSDictionary)
