 // }
 // 
 // }
-// taskTodos.resume()
-// 
-
-
- 
-//
+// task.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
+// var request = NSMutableURLRequest(URL: NSURL(string: "\(host)/todo-ios/todos/api/v1.0/todo/0")!)
+// 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 {

 
 var myTodos = Database<Todo>()
 
 myTodos.addItem(todo2)
 myTodos.addItem(todo1)

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


  curl -u dsoisson1:password -H "Accept: application/json" -i http://todo.eastus.cloudapp.azure.com/todo-ios/todos/api/v1.0/todo/0
 
  curl -u dsoisson1:password -H "Content-Type: application/json" -X POST -d '{"title":"Grade", "body":"Math quiz", "priority": 1}' -v http://todo.eastus.cloudapp.azure.com/todo-ios/todos/api/v1.0/todo/create
 
  curl -u dsoisson1:password -H "Content-Type: application/json" -X PUT -d '{"title":"Dinner", "body":"Having Dinner", "priority": 2}' -i http://todo.eastus.cloudapp.azure.com/todo-ios/todos/api/v1.0/todo/update/0

