diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/v1/AssistantITV1.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/v1/AssistantITV1.kt new file mode 100644 index 000000000..632cad2ce --- /dev/null +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/v1/AssistantITV1.kt @@ -0,0 +1,72 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v1 + +import com.owncloud.android.AbstractIT +import com.owncloud.android.lib.resources.status.NextcloudVersion +import junit.framework.TestCase.assertEquals +import junit.framework.TestCase.assertTrue +import org.junit.Before +import org.junit.Test + +class AssistantITV1 : AbstractIT() { + @Before + fun before() { + testOnlyOnServer(NextcloudVersion.nextcloud_28) + } + + @Test + fun testGetTaskTypes() { + val result = GetTaskTypesRemoteOperationV1().execute(nextcloudClient) + assertTrue(result.isSuccess) + + val taskTypes = result.resultData.types + assertTrue(taskTypes.isNotEmpty()) + } + + @Test + fun testGetTaskList() { + var result = GetTaskListRemoteOperationV1("assistant").execute(nextcloudClient) + assertTrue(result.isSuccess) + assertTrue(result.resultData.tasks.isEmpty()) + + // create one task + val input = "Give me some random output for test purpose" + val type = "OCP\\TextProcessing\\FreePromptTaskType" + assertTrue(CreateTaskRemoteOperationV1(input, type).execute(nextcloudClient).isSuccess) + + result = GetTaskListRemoteOperationV1("assistant").execute(nextcloudClient) + assertTrue(result.isSuccess) + + val taskList = result.resultData.tasks + assertTrue(taskList.isNotEmpty()) + } + + @Test + fun testDeleteTask() { + // create one task + val input = "Give me some random output for test purpose" + val type = "OCP\\TextProcessing\\FreePromptTaskType" + assertTrue(CreateTaskRemoteOperationV1(input, type).execute(nextcloudClient).isSuccess) + + var result = GetTaskListRemoteOperationV1("assistant").execute(nextcloudClient) + assertTrue(result.isSuccess) + + val tasks = result.resultData.tasks + val countBefore = tasks.size + + // delete + assertTrue(DeleteTaskRemoteOperationV1(tasks.first().id).execute(nextcloudClient).isSuccess) + + result = GetTaskListRemoteOperationV1("assistant").execute(nextcloudClient) + assertTrue(result.isSuccess) + + assertEquals(countBefore - 1, result.resultData.tasks.size) + } +} diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/AssistantIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/v2/AssistantITV2.kt similarity index 66% rename from library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/AssistantIT.kt rename to library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/v2/AssistantITV2.kt index 3b07ff750..a732ae616 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/AssistantIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/assistant/v2/AssistantITV2.kt @@ -2,23 +2,23 @@ * Nextcloud Android Library * * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2024 Tobias Kaminsky + * SPDX-FileCopyrightText: 2024 Alper Ozturk * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant +package com.owncloud.android.lib.resources.assistant.v2 import com.owncloud.android.AbstractIT -import com.owncloud.android.lib.resources.assistant.model.TaskInputShape -import com.owncloud.android.lib.resources.assistant.model.TaskOutputShape -import com.owncloud.android.lib.resources.assistant.model.TaskTypeData +import com.owncloud.android.lib.resources.assistant.v2.model.TaskInputShape +import com.owncloud.android.lib.resources.assistant.v2.model.TaskOutputShape +import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData import com.owncloud.android.lib.resources.status.NextcloudVersion import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertTrue import org.junit.Before import org.junit.Test -class AssistantIT : AbstractIT() { +class AssistantITV2 : AbstractIT() { @Before fun before() { testOnlyOnServer(NextcloudVersion.nextcloud_30) @@ -50,7 +50,7 @@ class AssistantIT : AbstractIT() { @Test fun testGetTaskTypes() { - val result = GetTaskTypesRemoteOperation().execute(nextcloudClient) + val result = GetTaskTypesRemoteOperationV2().execute(nextcloudClient) assertTrue(result.isSuccess) } @@ -59,15 +59,15 @@ class AssistantIT : AbstractIT() { val taskType = getTaskType() val selectedTaskType = getSelectedTaskType() - var result = GetTaskListRemoteOperation(selectedTaskType).execute(nextcloudClient) + var result = GetTaskListRemoteOperationV2(selectedTaskType).execute(nextcloudClient) assertTrue(result.isSuccess) assertTrue(result.resultData.tasks.isEmpty()) // create one task val input = "Give me some random output for test purpose" - assertTrue(CreateTaskRemoteOperation(input, taskType).execute(nextcloudClient).isSuccess) + assertTrue(CreateTaskRemoteOperationV2(input, taskType).execute(nextcloudClient).isSuccess) - result = GetTaskListRemoteOperation(selectedTaskType).execute(nextcloudClient) + result = GetTaskListRemoteOperationV2(selectedTaskType).execute(nextcloudClient) assertTrue(result.isSuccess) val taskList = result.resultData.tasks @@ -81,18 +81,18 @@ class AssistantIT : AbstractIT() { val taskType = getTaskType() val selectedTaskType = getSelectedTaskType() - assertTrue(CreateTaskRemoteOperation(input, taskType).execute(nextcloudClient).isSuccess) + assertTrue(CreateTaskRemoteOperationV2(input, taskType).execute(nextcloudClient).isSuccess) - var result = GetTaskListRemoteOperation(selectedTaskType).execute(nextcloudClient) + var result = GetTaskListRemoteOperationV2(selectedTaskType).execute(nextcloudClient) assertTrue(result.isSuccess) val tasks = result.resultData.tasks val countBefore = tasks.size // delete - assertTrue(DeleteTaskRemoteOperation(tasks.first().id).execute(nextcloudClient).isSuccess) + assertTrue(DeleteTaskRemoteOperationV2(tasks.first().id).execute(nextcloudClient).isSuccess) - result = GetTaskListRemoteOperation(selectedTaskType).execute(nextcloudClient) + result = GetTaskListRemoteOperationV2(selectedTaskType).execute(nextcloudClient) assertTrue(result.isSuccess) assertEquals(countBefore - 1, result.resultData.tasks.size) diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/CreateTaskRemoteOperationV1.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/CreateTaskRemoteOperationV1.kt new file mode 100644 index 000000000..cc4487c32 --- /dev/null +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/CreateTaskRemoteOperationV1.kt @@ -0,0 +1,48 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v1 + +import com.nextcloud.common.NextcloudClient +import com.nextcloud.operations.PostMethod +import com.owncloud.android.lib.common.operations.RemoteOperation +import com.owncloud.android.lib.common.operations.RemoteOperationResult +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.RequestBody.Companion.toRequestBody +import org.apache.commons.httpclient.HttpStatus + +class CreateTaskRemoteOperationV1(private val input: String, private val type: String) : + RemoteOperation() { + override fun run(client: NextcloudClient): RemoteOperationResult { + val requestBody = + hashMapOf( + "input" to input, + "type" to type, + "appId" to "assistant", + "identifier" to "" + ) + + val json = gson.toJson(requestBody) + + val request = json.toRequestBody("application/json".toMediaTypeOrNull()) + + val postMethod = PostMethod(client.baseUri.toString() + TAG_URL, true, request) + + val status = postMethod.execute(client) + + return if (status == HttpStatus.SC_OK) { + RemoteOperationResult(true, postMethod) + } else { + RemoteOperationResult(false, postMethod) + } + } + + companion object { + const val TAG_URL = "/ocs/v2.php/textprocessing/schedule" + } +} diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/DeleteTaskRemoteOperation.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/DeleteTaskRemoteOperationV1.kt similarity index 86% rename from library/src/main/java/com/owncloud/android/lib/resources/assistant/DeleteTaskRemoteOperation.kt rename to library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/DeleteTaskRemoteOperationV1.kt index 930989276..2f5ad083a 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/assistant/DeleteTaskRemoteOperation.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/DeleteTaskRemoteOperationV1.kt @@ -6,7 +6,7 @@ * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant +package com.owncloud.android.lib.resources.assistant.v1 import com.nextcloud.common.NextcloudClient import com.nextcloud.operations.DeleteMethod @@ -17,7 +17,7 @@ import com.owncloud.android.lib.resources.users.DeletePrivateKeyRemoteOperation import java.io.IOException import java.net.HttpURLConnection -class DeleteTaskRemoteOperation(private val appId: Long) : RemoteOperation() { +class DeleteTaskRemoteOperationV1(private val appId: Long) : RemoteOperation() { override fun run(client: NextcloudClient): RemoteOperationResult { var postMethod: DeleteMethod? = null var result: RemoteOperationResult @@ -41,6 +41,7 @@ class DeleteTaskRemoteOperation(private val appId: Long) : RemoteOperation companion object { private val TAG = DeletePrivateKeyRemoteOperation::class.java.simpleName - private const val DIRECT_ENDPOINT = "/ocs/v2.php/taskprocessing/task/" + private const val DIRECT_ENDPOINT = + "/ocs/v2.php/textprocessing/task/" } } diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/GetTaskListRemoteOperationV1.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/GetTaskListRemoteOperationV1.kt new file mode 100644 index 000000000..384c95e9b --- /dev/null +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/GetTaskListRemoteOperationV1.kt @@ -0,0 +1,58 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v1 + +import com.google.gson.reflect.TypeToken +import com.nextcloud.common.NextcloudClient +import com.nextcloud.operations.GetMethod +import com.owncloud.android.lib.common.operations.RemoteOperationResult +import com.owncloud.android.lib.common.utils.Log_OC +import com.owncloud.android.lib.ocs.ServerResponse +import com.owncloud.android.lib.resources.OCSRemoteOperation +import com.owncloud.android.lib.resources.assistant.v1.model.TaskList +import org.apache.commons.httpclient.HttpStatus + +class GetTaskListRemoteOperationV1(private val appId: String) : OCSRemoteOperation() { + @Suppress("TooGenericExceptionCaught") + override fun run(client: NextcloudClient): RemoteOperationResult { + var result: RemoteOperationResult + var getMethod: GetMethod? = null + try { + getMethod = + GetMethod(client.baseUri.toString() + DIRECT_ENDPOINT + appId + JSON_FORMAT, true) + val status = client.execute(getMethod) + if (status == HttpStatus.SC_OK) { + val taskTypes: TaskList? = + getServerResponse( + getMethod, + object : TypeToken>() {} + )?.ocs?.data + result = RemoteOperationResult(true, getMethod) + result.setResultData(taskTypes) + } else { + result = RemoteOperationResult(false, getMethod) + } + } catch (e: Exception) { + result = RemoteOperationResult(e) + Log_OC.e( + TAG, + "Get task list for user " + " failed: " + result.logMessage, + result.exception + ) + } finally { + getMethod?.releaseConnection() + } + return result + } + + companion object { + private val TAG = GetTaskListRemoteOperationV1::class.java.simpleName + private const val DIRECT_ENDPOINT = "/ocs/v2.php/textprocessing/tasks/app/" + } +} diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/GetTaskTypesRemoteOperationV1.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/GetTaskTypesRemoteOperationV1.kt new file mode 100644 index 000000000..7047022e2 --- /dev/null +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/GetTaskTypesRemoteOperationV1.kt @@ -0,0 +1,58 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v1 + +import com.google.gson.reflect.TypeToken +import com.nextcloud.common.NextcloudClient +import com.nextcloud.operations.GetMethod +import com.owncloud.android.lib.common.operations.RemoteOperationResult +import com.owncloud.android.lib.common.utils.Log_OC +import com.owncloud.android.lib.ocs.ServerResponse +import com.owncloud.android.lib.resources.OCSRemoteOperation +import com.owncloud.android.lib.resources.assistant.v1.model.TaskTypes +import org.apache.commons.httpclient.HttpStatus + +class GetTaskTypesRemoteOperationV1 : OCSRemoteOperation() { + @Suppress("TooGenericExceptionCaught") + override fun run(client: NextcloudClient): RemoteOperationResult { + var result: RemoteOperationResult + var getMethod: GetMethod? = null + try { + getMethod = + GetMethod(client.baseUri.toString() + DIRECT_ENDPOINT + JSON_FORMAT, true) + val status = client.execute(getMethod) + if (status == HttpStatus.SC_OK) { + val taskTypes: TaskTypes? = + getServerResponse( + getMethod, + object : TypeToken>() {} + )?.ocs?.data + result = RemoteOperationResult(true, getMethod) + result.setResultData(taskTypes) + } else { + result = RemoteOperationResult(false, getMethod) + } + } catch (e: Exception) { + result = RemoteOperationResult(e) + Log_OC.e( + TAG, + "Get task types for user " + " failed: " + result.logMessage, + result.exception + ) + } finally { + getMethod?.releaseConnection() + } + return result + } + + companion object { + private val TAG = GetTaskTypesRemoteOperationV1::class.java.simpleName + private const val DIRECT_ENDPOINT = "/ocs/v2.php/textprocessing/tasktypes" + } +} diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/model/TaskList.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/model/TaskList.kt new file mode 100644 index 000000000..d72d93a09 --- /dev/null +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/model/TaskList.kt @@ -0,0 +1,25 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v1.model + +data class TaskList( + var tasks: List +) + +data class Task( + val id: Long, + val type: String?, + val status: Long?, + val userId: String?, + val appId: String?, + val input: String?, + val output: String?, + val identifier: String?, + val completionExpectedAt: String? = null +) diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/model/TaskTypes.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/model/TaskTypes.kt new file mode 100644 index 000000000..a3ab9d342 --- /dev/null +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v1/model/TaskTypes.kt @@ -0,0 +1,19 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v1.model + +data class TaskTypes( + var types: List +) + +data class TaskType( + val id: String?, + val name: String?, + val description: String? +) diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/CreateTaskRemoteOperation.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/CreateTaskRemoteOperationV2.kt similarity index 87% rename from library/src/main/java/com/owncloud/android/lib/resources/assistant/CreateTaskRemoteOperation.kt rename to library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/CreateTaskRemoteOperationV2.kt index efb877227..49670f4a1 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/assistant/CreateTaskRemoteOperation.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/CreateTaskRemoteOperationV2.kt @@ -6,18 +6,18 @@ * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant +package com.owncloud.android.lib.resources.assistant.v2 import com.nextcloud.common.NextcloudClient import com.nextcloud.operations.PostMethod import com.owncloud.android.lib.common.operations.RemoteOperation import com.owncloud.android.lib.common.operations.RemoteOperationResult -import com.owncloud.android.lib.resources.assistant.model.TaskTypeData +import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody.Companion.toRequestBody import org.apache.commons.httpclient.HttpStatus -class CreateTaskRemoteOperation(private val input: String, private val taskType: TaskTypeData) : +class CreateTaskRemoteOperationV2(private val input: String, private val taskType: TaskTypeData) : RemoteOperation() { override fun run(client: NextcloudClient): RemoteOperationResult { val inputField = hashMapOf("input" to input) diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/DeleteTaskRemoteOperationV2.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/DeleteTaskRemoteOperationV2.kt new file mode 100644 index 000000000..302f9349a --- /dev/null +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/DeleteTaskRemoteOperationV2.kt @@ -0,0 +1,45 @@ +/* + * Nextcloud Android Library + * + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2024 Alper Ozturk + * SPDX-License-Identifier: MIT + */ + +package com.owncloud.android.lib.resources.assistant.v2 + +import com.nextcloud.common.NextcloudClient +import com.nextcloud.operations.DeleteMethod +import com.owncloud.android.lib.common.operations.RemoteOperation +import com.owncloud.android.lib.common.operations.RemoteOperationResult +import com.owncloud.android.lib.common.utils.Log_OC +import java.io.IOException +import java.net.HttpURLConnection + +class DeleteTaskRemoteOperationV2(private val appId: Long) : RemoteOperation() { + override fun run(client: NextcloudClient): RemoteOperationResult { + var postMethod: DeleteMethod? = null + var result: RemoteOperationResult + try { + postMethod = + DeleteMethod( + client.baseUri.toString() + DIRECT_ENDPOINT + appId, + true + ) + val status = client.execute(postMethod) + result = RemoteOperationResult(status == HttpURLConnection.HTTP_OK, postMethod) + } catch (e: IOException) { + result = RemoteOperationResult(e) + Log_OC.e(TAG, "Deletion of task failed: " + result.logMessage, result.exception) + } finally { + postMethod?.releaseConnection() + } + + return result + } + + companion object { + private val TAG = DeleteTaskRemoteOperationV2::class.java.simpleName + private const val DIRECT_ENDPOINT = "/ocs/v2.php/taskprocessing/task/" + } +} diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/GetTaskListRemoteOperation.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/GetTaskListRemoteOperationV2.kt similarity index 86% rename from library/src/main/java/com/owncloud/android/lib/resources/assistant/GetTaskListRemoteOperation.kt rename to library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/GetTaskListRemoteOperationV2.kt index d0ed14d2d..19dc6c83c 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/assistant/GetTaskListRemoteOperation.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/GetTaskListRemoteOperationV2.kt @@ -6,7 +6,7 @@ * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant +package com.owncloud.android.lib.resources.assistant.v2 import com.google.gson.reflect.TypeToken import com.nextcloud.common.NextcloudClient @@ -15,10 +15,10 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.ocs.ServerResponse import com.owncloud.android.lib.resources.OCSRemoteOperation -import com.owncloud.android.lib.resources.assistant.model.TaskList +import com.owncloud.android.lib.resources.assistant.v2.model.TaskList import org.apache.commons.httpclient.HttpStatus -class GetTaskListRemoteOperation(private val taskType: String) : OCSRemoteOperation() { +class GetTaskListRemoteOperationV2(private val taskType: String) : OCSRemoteOperation() { @Suppress("TooGenericExceptionCaught") override fun run(client: NextcloudClient): RemoteOperationResult { var result: RemoteOperationResult @@ -52,7 +52,7 @@ class GetTaskListRemoteOperation(private val taskType: String) : OCSRemoteOperat } companion object { - private val TAG = GetTaskTypesRemoteOperation::class.java.simpleName + private val TAG = GetTaskTypesRemoteOperationV2::class.java.simpleName private const val DIRECT_ENDPOINT = "/ocs/v2.php/taskprocessing/tasks?taskType=" } } diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/GetTaskTypesRemoteOperation.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/GetTaskTypesRemoteOperationV2.kt similarity index 88% rename from library/src/main/java/com/owncloud/android/lib/resources/assistant/GetTaskTypesRemoteOperation.kt rename to library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/GetTaskTypesRemoteOperationV2.kt index 916fc4b4a..b2f3822d0 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/assistant/GetTaskTypesRemoteOperation.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/GetTaskTypesRemoteOperationV2.kt @@ -6,7 +6,7 @@ * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant +package com.owncloud.android.lib.resources.assistant.v2 import com.google.gson.reflect.TypeToken import com.nextcloud.common.NextcloudClient @@ -15,11 +15,11 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.ocs.ServerResponse import com.owncloud.android.lib.resources.OCSRemoteOperation -import com.owncloud.android.lib.resources.assistant.model.TaskTypeData -import com.owncloud.android.lib.resources.assistant.model.TaskTypes +import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData +import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypes import org.apache.commons.httpclient.HttpStatus -class GetTaskTypesRemoteOperation : OCSRemoteOperation>() { +class GetTaskTypesRemoteOperationV2 : OCSRemoteOperation>() { private val supportedTaskType = "Text" @Suppress("TooGenericExceptionCaught") @@ -71,7 +71,7 @@ class GetTaskTypesRemoteOperation : OCSRemoteOperation>() { } companion object { - private val TAG = GetTaskTypesRemoteOperation::class.java.simpleName + private val TAG = GetTaskTypesRemoteOperationV2::class.java.simpleName private const val DIRECT_ENDPOINT = "/ocs/v2.php/taskprocessing/tasktypes" } } diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/model/TaskList.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/model/TaskList.kt similarity index 92% rename from library/src/main/java/com/owncloud/android/lib/resources/assistant/model/TaskList.kt rename to library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/model/TaskList.kt index 75594d032..a33dae69c 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/assistant/model/TaskList.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/model/TaskList.kt @@ -6,7 +6,7 @@ * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant.model +package com.owncloud.android.lib.resources.assistant.v2.model data class TaskList( var tasks: List diff --git a/library/src/main/java/com/owncloud/android/lib/resources/assistant/model/TaskTypes.kt b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/model/TaskTypes.kt similarity index 91% rename from library/src/main/java/com/owncloud/android/lib/resources/assistant/model/TaskTypes.kt rename to library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/model/TaskTypes.kt index f3356e0d4..616c6e919 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/assistant/model/TaskTypes.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/assistant/v2/model/TaskTypes.kt @@ -6,7 +6,7 @@ * SPDX-License-Identifier: MIT */ -package com.owncloud.android.lib.resources.assistant.model +package com.owncloud.android.lib.resources.assistant.v2.model data class TaskTypes(val types: Map)