upload :: RemoteFile -> FilePath -> ApiAction RemoteFile
upload (RemoteDir _ parentFolder) absoluteFilePath = do
    uploadLink <- liftIO $ linkOrException "upload_document" (DP.folderLinks parentFolder)
    (manager, aToken, csrf, _) <- ask
    doc <- liftResourceT $ uploadDocument aToken manager uploadLink csrf absoluteFilePath
    liftIO $ debugM "Sync.upload" ("Uploaded " ++ absoluteFilePath)
    return $ RemoteFile (fileFromFolderDoc parentFolder doc) parentFolder doc
upload :: RemoteFile -> FilePath -> ApiAction RemoteFile
upload (RemoteDir _ parentFolder) absoluteFilePath = do
    uploadLink <- liftIO $ linkOrException "upload_document" (DP.folderLinks parentFolder)
    (manager, aToken, csrf, _) <- ask
    doc <- liftResourceT $ uploadDocument aToken manager uploadLink csrf absoluteFilePath
    liftIO $ debugM "Sync.upload" ("Uploaded " ++ absoluteFilePath)
    return $ RemoteFile (fileFromFolderDoc parentFolder doc) parentFolder doc
upload (RemoteDir _ parentFolder) absoluteFilePath = do
    uploadLink <- liftIO $ linkOrException "upload_document" (DP.folderLinks parentFolder)
    (manager, aToken, csrf, _) <- ask
    doc <- liftResourceT $ uploadDocument aToken manager uploadLink csrf absoluteFilePath
    liftIO $ debugM "Sync.upload" ("Uploaded " ++ absoluteFilePath)
    return $ RemoteFile (fileFromFolderDoc parentFolder doc) parentFolder doc