 	public let maximum: Int
 	public let remaining: Int
 	
-	public init(name: String, maximum: Int, remaining: Int) {
+	public init(name: String, json: [String: Int]) throws {
+		guard let remaining = json["Remaining"], let maximum = json["Max"] else {
+			throw SalesforceError.jsonDeserializationFailure(elementName: name, json: json)
+		}
 		self.name = name
 		self.maximum = maximum
 		self.remaining = remaining

	
	/// Initializer
	init(json: [String: Any]) {
		self.dictionary = json
	}
}


/// Holds result of call to identity URL
/// See: https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_using_openid.htm
public struct UserInfo: JSONBacking {
	
	public let json: [String: Any]
	
	public var displayName: String? {
		return json["display_name"] as? String
	}
	
	public var mobilePhone: String? {
		return json["mobile_phone"] as? String
	}
	
	public var username: String? {
		return json["username"] as? String
	}
	
	public var userID: String? {
		return json["user_id"] as? String
	}
	
	public var orgID: String? {
		return json["organization_id"] as? String
	}
	
	public var userType: String? {
		return json["user_type"] as? String
	}
	
	public var language: String? {
		return json["language"] as? String
	}
	
	public var lastModifiedDate: Date? {
		return json.dateValue(forKey: "last_modified_date")
	}
	
	public var locale: String? {
		return json["locale"] as? String
	}
	
	public var photoURL: URL? {
		guard let photos = json["photos"] as? [String: String], let photoURL = URL(string: photos["picture"]) else {
			return nil
		}
		return photoURL
	}
	
	public var thumbnailURL: URL? {
		guard let photos = json["photos"] as? [String: String], let thumbnailURL = URL(string: photos["thumbnail"]) else {
			return nil
		}
		return thumbnailURL
	}
	
	public var profileURL: URL? {
		guard let urls = json["urls"] as? [String: String], let profileURL = URL(string: urls["profile"]) else {
			return nil
		}
		return profileURL
	}
	
	public var recentRecordsURL: URL? {
		guard let urls = json["urls"] as? [String: String], let recentRecordsURL = URL(string: urls["recent"]) else {
			return nil
		}
		return recentRecordsURL
