     print(item["name"] as! String)
     let body = try! JSONEncoder().encode(["ids": [id]])
     return apiRequest("me/tracks", method: .PUT, body: body)
+  }
+
+  func saveToList() -> JSONResponse {
+    let body = try! JSONEncoder().encode(["name": "My Playlist"])
+    let createPlaylist = apiRequest("users/\(db.userId)/playlists", method: .POST, body: body)
+    let id = createPlaylist.json["id"] as! String
+
+    print(id)
+
+    return createPlaylist
   }
 }
 

  var clientSecret: String
}


struct DB: Codable {
  var credentials: Credentials
  var playlistIds: [String: String]

  static let file = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".sptf.json")

  } else {
    dump(result.response.statusCode)
  }
case "list":
  let result = spotify.saveToList()
  dump(result.json)
  dump(result.response.statusCode)
default:
  print("Unknown command: \(command)")
  exit(1)
