1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Include createFolder as file service operation

This commit is contained in:
agarcia 2020-07-28 18:08:57 +02:00 committed by Abel García de Prada
parent 8047c257fd
commit 332a5ac1cb
2 changed files with 17 additions and 1 deletions

View File

@ -30,5 +30,6 @@ import com.owncloud.android.lib.resources.files.RemoteFile
interface FileService : Service {
fun checkPathExistence(path: String, isUserLogged: Boolean): RemoteOperationResult<Boolean>
fun getUrlToOpenInWeb(openWebEndpoint: String, fileId: String): RemoteOperationResult<String>
fun createFolder(remotePath: String, createFullPath: Boolean, isChunkFolder: Boolean = false): RemoteOperationResult<Unit>
fun refreshFolder(remotePath: String): RemoteOperationResult<ArrayList<RemoteFile>>
}

View File

@ -26,13 +26,17 @@ package com.owncloud.android.lib.resources.files.services.implementation
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.files.CheckPathExistenceRemoteOperation
import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation
import com.owncloud.android.lib.resources.files.GetUrlToOpenInWebRemoteOperation
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation
import com.owncloud.android.lib.resources.files.RemoteFile
import com.owncloud.android.lib.resources.files.services.FileService
class OCFileService(override val client: OwnCloudClient) : FileService {
override fun checkPathExistence(path: String, isUserLogged: Boolean): RemoteOperationResult<Boolean> =
override fun checkPathExistence(
path: String,
isUserLogged: Boolean
): RemoteOperationResult<Boolean> =
CheckPathExistenceRemoteOperation(
remotePath = path,
isUserLoggedIn = isUserLogged
@ -41,6 +45,17 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
override fun getUrlToOpenInWeb(openWebEndpoint: String, fileId: String): RemoteOperationResult<String> =
GetUrlToOpenInWebRemoteOperation(openWithWebEndpoint = openWebEndpoint, fileId = fileId).execute(client)
override fun createFolder(
remotePath: String,
createFullPath: Boolean,
isChunkFolder: Boolean
): RemoteOperationResult<Unit> =
CreateRemoteFolderOperation(
remotePath = remotePath,
createFullPath = createFullPath,
isChunksFolder = isChunkFolder
).execute(client)
override fun refreshFolder(remotePath: String): RemoteOperationResult<ArrayList<RemoteFile>> =
ReadRemoteFolderOperation(
remotePath = remotePath