File tree Expand file tree Collapse file tree
library/src/main/java/com/owncloud/android/lib/resources/assistant/v2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import com.nextcloud.common.NextcloudClient
1212import com.nextcloud.operations.PostMethod
1313import com.owncloud.android.lib.common.operations.RemoteOperation
1414import com.owncloud.android.lib.common.operations.RemoteOperationResult
15+ import com.owncloud.android.lib.resources.assistant.v2.model.CreateTaskRequest
16+ import com.owncloud.android.lib.resources.assistant.v2.model.InputField
1517import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData
1618import kotlinx.serialization.json.Json
1719import okhttp3.MediaType.Companion.toMediaTypeOrNull
@@ -23,17 +25,12 @@ open class CreateTaskRemoteOperationV2(
2325 private val taskType : TaskTypeData
2426) : RemoteOperation<Void>() {
2527 protected open fun buildRequestBody (): String {
26- val inputField = hashMapOf(" input" to input)
28+ val request = CreateTaskRequest (
29+ input = InputField (input),
30+ type = taskType.id
31+ )
2732
28- val body =
29- hashMapOf(
30- " input" to inputField,
31- " type" to taskType.id,
32- " appId" to " assistant" ,
33- " customId" to " "
34- )
35-
36- return Json .encodeToString(body)
33+ return Json .encodeToString(request)
3734 }
3835
3936 override fun run (client : NextcloudClient ): RemoteOperationResult <Void > {
Original file line number Diff line number Diff line change 1+ /*
2+ * Nextcloud Android Library
3+ *
4+ * SPDX-FileCopyrightText: 2026 Alper Ozturk <alper.ozturk@nextcloud.com>
5+ * SPDX-License-Identifier: MIT
6+ */
7+
8+ package com.owncloud.android.lib.resources.assistant.v2.model
9+
10+ import kotlinx.serialization.Serializable
11+
12+ @Serializable
13+ data class InputField (
14+ val input : String
15+ )
16+
17+ @Serializable
18+ data class CreateTaskRequest (
19+ val input : InputField ,
20+ val type : String? ,
21+ val appId : String = " assistant" ,
22+ val customId : String = " "
23+ )
You can’t perform that action at this time.
0 commit comments