Dropbox.authorizedClient!.files.listFolder(path: "").response { response, error in
print("*** List folder ***")
if let result = response {
print("Folder contents:")
for entry in result.entries {
print(entry.name)
if let file = entry as? Files.FileMetadata {
print("\tThis is a file with path: \(file.pathLower) and size: \(file.size)")
} else if let folder = entry as? Files.FolderMetadata {
print("\tThis is a folder with path: \(folder.pathLower)")
}
}
} else if let callError = error {
switch callError {
case .RouteError(let boxed, _):
switch boxed.unboxed {
case .Path(let lookupError):
print("lookupError:")
print(lookupError)
case .Other:
print("Other")
}
default:
print("default")
}
}
}
Note that the response may contain ListFolderResult.hasMore=true
, in which case your app should call back using listFolderContinue
to continue getting more entries.