 
 	- parameter completion: handler that is provided with a list of supported cities and an optional error
 	*/
-	static func sendMetadataRequest(completion: (APIResult<[String: String], SCError>) -> Void) {
+	static func sendMetadataRequest(completion: (SCResult<[String: String], SCError>) -> Void) {
 		UIApplication.sharedApplication().networkActivityIndicatorVisible = true
 		let metadataURL = SCOptions.useStagingAPI ? URL.apiBaseURLStaging : URL.apibaseURL
 		Alamofire.request(.GET, metadataURL).responseJSON { (_, response, result) -> Void in

import Alamofire
import SwiftyJSON

enum APIResult<S,F> {
	case Success(S)
	case Failure(F)
}

		}
	}

	struct ParkinglotDataResult {
		let parkinglotList: [Parkinglot]
		let timeUpdated: NSDate?
		let timeDownloaded: NSDate?
		let dataURL: String?
	}

	/**
	Get the current data for all parkinglots

	- parameter completion: handler that is provided with a list of parkinglots and an optional error
	*/
	static func sendParkinglotDataRequest(city: String, completion: SCResult<ParkinglotDataResult,SCError> -> Void) {
		UIApplication.sharedApplication().networkActivityIndicatorVisible = true
		let parkinglotURL = SCOptions.useStagingAPI ? URL.apiBaseURLStaging + city : URL.apibaseURL + city
		Alamofire.request(.GET, parkinglotURL).responseJSON { (_, response, result) -> Void in
			defer { UIApplication.sharedApplication().networkActivityIndicatorVisible = false }
			guard let response = response else { completion(.Failure(SCError.Request)); return }
			guard response.statusCode == 200 else { completion(.Failure(SCError.Server)); return }
			guard let data = result.value else { completion(.Failure(SCError.Server)); return }
			let jsonData = JSON(data)

			let UTCdateFormatter = NSDateFormatter()
			UTCdateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
			UTCdateFormatter.timeZone = NSTimeZone(name: "UTC")

			let timeUpdated = UTCdateFormatter.dateFromString(jsonData["last_updated"].stringValue)
			let timeDownloaded = UTCdateFormatter.dateFromString(jsonData["last_downloaded"].stringValue)

			let dataURL = jsonData["url"].stringValue

			var parkinglotList = [Parkinglot]()
			for lot in jsonData["lots"].arrayValue {
				let parkinglot = Parkinglot(name: lot["name"].stringValue,
					total: lot["total"].intValue,
					free: lot["free"].intValue,
					state: lotstate(rawValue: lot["state"].stringValue)!,
					lat: lot["coords"]["lat"].doubleValue,
					lng: lot["coords"]["lng"].doubleValue,
					address: lot["address"].stringValue,
					region: lot["region"].stringValue,
					type: lot["lot_type"].stringValue,
					id: lot["id"].stringValue,
					distance: nil,
					isFavorite: false)

				parkinglotList.append(parkinglot)
			}

			let resultData = ParkinglotDataResult(parkinglotList: parkinglotList, timeUpdated: timeUpdated, timeDownloaded: timeDownloaded, dataURL: dataURL)
			completion(.Success(resultData))
		}
	}

