 //        
 //    }
 // }
-// taskDeleteTodo.resume()
-//
-// 
-
- 
- 
-// 
-//
-//
-// XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
-//
-//
-
+// task.resume()
+// 
+ 
+
+ XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
+
+
+

// }
// 
// }
// taskTodos.resume()
// 


 
//
////print a todo
// var todo = NSMutableURLRequest(URL: NSURL(string: "\(host)/todo-ios/todos/api/v1.0/0")!)
// todo.HTTPMethod = "GET"
// todo.addValue("application/json", forHTTPHeaderField: "Content-Type")
// 
// var taskTodo = session.dataTaskWithRequest(todo){ (data, response, error) -> Void in
//    if error != nil {
//        print(error)
//    } else {

 
 var myTodos = Database<Todo>()
 
 
 myTodos.addItem(todo2)
myTodos.count
 
 myTodos[0].body
 
let todosJsonPayload =  myTodos.serialize { (items) -> AnyObject in
 return Array(items).asDictionary
 }
 
 print(todosJsonPayload)

// myTodos.deserialize("\(host)/todo-ios/todos/api/v1.0/todos"){ (items) -> AnyObject in
//    return Array(arrayLiteral: items as! Todo).asDictionary
// }

 myTodos.count
 myTodos[0].body
 
 
 
 

let username = "dsoisson1"
let password = "password"
 let loginString = NSString(format: "%@:%@", username, password)
 let loginData: NSData = loginString.dataUsingEncoding(NSUTF8StringEncoding)!
 let base64LoginString = loginData.base64EncodedStringWithOptions([])
 
//print all todos
// var request = NSMutableURLRequest(URL: NSURL(string: "\(host)/todo-ios/todos/api/v1.0/todos")!)
// request.HTTPMethod = "GET"
// request.setValue("Basic \(base64LoginString)", forHTTPHeaderField: "Authorization")
// request.addValue("application/json", forHTTPHeaderField: "Content-Type")
// 
// var task = session.dataTaskWithRequest(request){ (data, response, error) -> Void in
//    if error != nil {
//        print(error)
//    } else {
