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

Create some service interfaces as facade for remote operations

This commit is contained in:
davigonz 2019-10-07 15:22:20 +02:00
parent 8fa6cc648b
commit c05a11a7b4
4 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/**
* ownCloud Android client application
*
* @author David González Verdugo
*
* Copyright (C) 2019 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.lib.resources
import com.owncloud.android.lib.common.OwnCloudClient
/**
* Facade to perform network calls without the verbosity of remote operations
*/
interface Service {
val client: OwnCloudClient
}

View File

@ -0,0 +1,54 @@
/**
* ownCloud Android client application
*
* @author David González Verdugo
*
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.lib.resources.shares
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
interface ShareService : Service {
fun getShares(
remoteFilePath: String,
reshares: Boolean,
subfiles: Boolean
): RemoteOperationResult<ShareParserResult>
fun insertShare(
remoteFilePath: String,
shareType: ShareType,
shareWith: String,
permissions: Int,
name: String,
password: String,
expirationDate: Long,
publicUpload: Boolean
): RemoteOperationResult<ShareParserResult>
fun updateShare(
remoteId: Long,
name: String,
password: String?,
expirationDate: Long,
permissions: Int,
publicUpload: Boolean
): RemoteOperationResult<ShareParserResult>
fun deleteShare(remoteId: Long): RemoteOperationResult<ShareParserResult>
}

View File

@ -0,0 +1,34 @@
/**
* ownCloud Android client application
*
* @author David González Verdugo
*
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.lib.resources.shares
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
import org.json.JSONObject
import java.util.ArrayList
interface ShareeService : Service {
fun getSharees(
searchString: String,
page: Int,
perPage: Int
): RemoteOperationResult<ArrayList<JSONObject>>
}

View File

@ -0,0 +1,28 @@
/**
* ownCloud Android client application
*
* @author David González Verdugo
*
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.lib.resources.status
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.Service
interface CapabilityService: Service {
fun getCapabilities() : RemoteOperationResult<RemoteCapability>
}