=
+ CheckPathExistenceRemoteOperation(
+ remotePath = path,
+ isUserLogged = isUserLogged
+ ).execute(client)
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/ShareService.kt
similarity index 89%
rename from owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareService.kt
rename to owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/ShareService.kt
index c0047fa8..38980256 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/ShareService.kt
@@ -18,10 +18,12 @@
* along with this program. If not, see .
*/
-package com.owncloud.android.lib.resources.shares
+package com.owncloud.android.lib.resources.shares.services
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
+import com.owncloud.android.lib.resources.shares.ShareParserResult
+import com.owncloud.android.lib.resources.shares.ShareType
interface ShareService : Service {
fun getShares(
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareeService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/ShareeService.kt
similarity index 94%
rename from owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareeService.kt
rename to owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/ShareeService.kt
index 8e7c8964..ab6d9e83 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareeService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/ShareeService.kt
@@ -18,7 +18,7 @@
* along with this program. If not, see .
*/
-package com.owncloud.android.lib.resources.shares
+package com.owncloud.android.lib.resources.shares.services
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/implementation/OCShareService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/implementation/OCShareService.kt
new file mode 100644
index 00000000..a22919bf
--- /dev/null
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/implementation/OCShareService.kt
@@ -0,0 +1,91 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author David González Verdugo
+ *
+ * Copyright (C) 2020 ownCloud GmbH.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.owncloud.android.lib.resources.shares.services.implementation
+
+import com.owncloud.android.lib.common.OwnCloudClient
+import com.owncloud.android.lib.common.operations.RemoteOperationResult
+import com.owncloud.android.lib.resources.shares.CreateRemoteShareOperation
+import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation
+import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation
+import com.owncloud.android.lib.resources.shares.ShareParserResult
+import com.owncloud.android.lib.resources.shares.ShareType
+import com.owncloud.android.lib.resources.shares.UpdateRemoteShareOperation
+import com.owncloud.android.lib.resources.shares.services.ShareService
+
+class OCShareService(override val client: OwnCloudClient) :
+ ShareService {
+ override fun getShares(
+ remoteFilePath: String,
+ reshares: Boolean,
+ subfiles: Boolean
+ ): RemoteOperationResult = GetRemoteSharesForFileOperation(
+ remoteFilePath,
+ reshares,
+ subfiles
+ ).execute(client)
+
+ override fun insertShare(
+ remoteFilePath: String,
+ shareType: ShareType,
+ shareWith: String,
+ permissions: Int,
+ name: String,
+ password: String,
+ expirationDate: Long,
+ publicUpload: Boolean
+ ): RemoteOperationResult =
+ CreateRemoteShareOperation(
+ remoteFilePath,
+ shareType,
+ shareWith,
+ permissions
+ ).apply {
+ this.name = name
+ this.password = password
+ this.expirationDateInMillis = expirationDate
+ this.publicUpload = publicUpload
+ this.retrieveShareDetails = true
+ }.execute(client)
+
+ override fun updateShare(
+ remoteId: Long,
+ name: String,
+ password: String?,
+ expirationDate: Long,
+ permissions: Int,
+ publicUpload: Boolean
+ ): RemoteOperationResult =
+ UpdateRemoteShareOperation(
+ remoteId
+ ).apply {
+ this.name = name
+ this.password = password
+ this.expirationDateInMillis = expirationDate
+ this.permissions = permissions
+ this.publicUpload = publicUpload
+ this.retrieveShareDetails = true
+ }.execute(client)
+
+ override fun deleteShare(remoteId: Long): RemoteOperationResult =
+ RemoveRemoteShareOperation(
+ remoteId
+ ).execute(client)
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/implementation/OCShareeService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/implementation/OCShareeService.kt
new file mode 100644
index 00000000..370ef34b
--- /dev/null
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/services/implementation/OCShareeService.kt
@@ -0,0 +1,42 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author David González Verdugo
+ *
+ * Copyright (C) 2020 ownCloud GmbH.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.owncloud.android.lib.resources.shares.services.implementation
+
+import com.owncloud.android.lib.common.OwnCloudClient
+import com.owncloud.android.lib.common.operations.RemoteOperationResult
+import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation
+import com.owncloud.android.lib.resources.shares.services.ShareeService
+import org.json.JSONObject
+import java.util.ArrayList
+
+class OCShareeService(override val client: OwnCloudClient) :
+ ShareeService {
+ override fun getSharees(
+ searchString: String,
+ page: Int,
+ perPage: Int
+ ): RemoteOperationResult> =
+ GetRemoteShareesOperation(
+ searchString,
+ page,
+ perPage
+ ).execute(client)
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/CapabilityService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/CapabilityService.kt
similarity index 88%
rename from owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/CapabilityService.kt
rename to owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/CapabilityService.kt
index fab4f301..0ad809c8 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/CapabilityService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/CapabilityService.kt
@@ -18,10 +18,11 @@
* along with this program. If not, see .
*/
-package com.owncloud.android.lib.resources.status
+package com.owncloud.android.lib.resources.status.services
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
+import com.owncloud.android.lib.resources.status.RemoteCapability
interface CapabilityService: Service {
fun getCapabilities() : RemoteOperationResult
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/ServerInfoService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/ServerInfoService.kt
similarity index 96%
rename from owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/ServerInfoService.kt
rename to owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/ServerInfoService.kt
index c211c8ff..1efa7f1b 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/ServerInfoService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/ServerInfoService.kt
@@ -21,7 +21,7 @@
* THE SOFTWARE.
*
*/
-package com.owncloud.android.lib.resources.status
+package com.owncloud.android.lib.resources.status.services
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.status.OwnCloudVersion
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCCapabilityService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCCapabilityService.kt
new file mode 100644
index 00000000..d2161b05
--- /dev/null
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCCapabilityService.kt
@@ -0,0 +1,33 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author David González Verdugo
+ *
+ * Copyright (C) 2020 ownCloud GmbH.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.owncloud.android.lib.resources.status.services.implementation
+
+import com.owncloud.android.lib.common.OwnCloudClient
+import com.owncloud.android.lib.common.operations.RemoteOperationResult
+import com.owncloud.android.lib.resources.status.services.CapabilityService
+import com.owncloud.android.lib.resources.status.GetRemoteCapabilitiesOperation
+import com.owncloud.android.lib.resources.status.RemoteCapability
+
+class OCCapabilityService(override val client: OwnCloudClient) :
+ CapabilityService {
+ override fun getCapabilities(): RemoteOperationResult =
+ GetRemoteCapabilitiesOperation().execute(client)
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCServerInfoService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCServerInfoService.kt
new file mode 100644
index 00000000..8efd9def
--- /dev/null
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCServerInfoService.kt
@@ -0,0 +1,43 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author Abel García de Prada
+ * Copyright (C) 2020 ownCloud GmbH.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.owncloud.android.lib.resources.status.services.implementation
+
+import android.net.Uri
+import com.owncloud.android.lib.common.OwnCloudClient
+import com.owncloud.android.lib.common.operations.RemoteOperationResult
+import com.owncloud.android.lib.resources.status.services.ServerInfoService
+import com.owncloud.android.lib.resources.files.CheckPathExistenceRemoteOperation
+import com.owncloud.android.lib.resources.status.GetRemoteStatusOperation
+import com.owncloud.android.lib.resources.status.OwnCloudVersion
+
+class OCServerInfoService : ServerInfoService {
+ override fun checkPathExistence(path: String, isUserLogged: Boolean): RemoteOperationResult =
+ CheckPathExistenceRemoteOperation(
+ remotePath = path,
+ isUserLogged = true
+ ).execute(createClientFromPath(path))
+
+ override fun getRemoteStatus(path: String): RemoteOperationResult =
+ GetRemoteStatusOperation().execute(createClientFromPath(path))
+
+ private fun createClientFromPath(path: String): OwnCloudClient {
+ return OwnCloudClient(Uri.parse(path))
+ }
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/UserService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/services/UserService.kt
similarity index 92%
rename from owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/UserService.kt
rename to owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/services/UserService.kt
index b3a33d79..4ef2e1a7 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/UserService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/services/UserService.kt
@@ -22,10 +22,11 @@
*
*/
-package com.owncloud.android.lib.resources.users
+package com.owncloud.android.lib.resources.users.services
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
+import com.owncloud.android.lib.resources.users.RemoteUserInfo
interface UserService: Service {
fun getUserInfo() : RemoteOperationResult
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/services/implementation/OCUserService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/services/implementation/OCUserService.kt
new file mode 100644
index 00000000..6b07b25e
--- /dev/null
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/services/implementation/OCUserService.kt
@@ -0,0 +1,32 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author Abel García de Prada
+ * Copyright (C) 2020 ownCloud GmbH.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.owncloud.android.lib.resources.users.services.implementation
+
+import com.owncloud.android.lib.common.OwnCloudClient
+import com.owncloud.android.lib.common.operations.RemoteOperationResult
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation
+import com.owncloud.android.lib.resources.users.RemoteUserInfo
+import com.owncloud.android.lib.resources.users.services.UserService
+
+class OCUserService(override val client: OwnCloudClient) :
+ UserService {
+ override fun getUserInfo(): RemoteOperationResult =
+ GetRemoteUserInfoOperation().execute(client)
+}