Skip to content

Commit c4452f4

Browse files
committed
Allow any response for Kotlin
1 parent 44439c2 commit c4452f4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class Client @JvmOverloads constructor(
189189
headers: Map<String, String> = mapOf(),
190190
params: Map<String, Any?> = mapOf(),
191191
responseType: Class<T>,
192-
converter: ((Map<String, Any,>) -> T)? = null
192+
converter: ((Any) -> T)? = null
193193
): T {
194194
val filteredParams = params.filterValues { it != null }
195195

@@ -280,7 +280,7 @@ class Client @JvmOverloads constructor(
280280
headers: MutableMap<String, String>,
281281
params: MutableMap<String, Any?>,
282282
responseType: Class<T>,
283-
converter: ((Map<String, Any,>) -> T),
283+
converter: ((Any) -> T),
284284
paramName: String,
285285
idParamName: String? = null,
286286
onProgress: ((UploadProgress) -> Unit)? = null,
@@ -403,7 +403,7 @@ class Client @JvmOverloads constructor(
403403
private suspend fun <T> awaitResponse(
404404
request: Request,
405405
responseType: Class<T>,
406-
converter: ((Map<String, Any,>) -> T)? = null
406+
converter: ((Any) -> T)? = null
407407
) = suspendCancellableCoroutine<T> {
408408
http.newCall(request).enqueue(object : Callback {
409409
override fun onFailure(call: Call, e: IOException) {

templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ class {{ service.name | caseUcfirst }} : Service {
100100
{{ method.headers|map((header, key) => " \"#{key}\" to \"#{header}\"")|join(',\n')|raw }}
101101
)
102102
{% if method.responseModel %}
103-
val converter: (Map<String, Any>) -> {{ utils.resultType(sdk.namespace, method) }} = {
103+
val converter: (Any) -> {{ utils.resultType(sdk.namespace, method) }} = {
104104
{% if method.responseModel == 'any' %}
105105
it
106106
{% else %}
107-
{{ utils.resultType(sdk.namespace, method) }}.from(map = it)
107+
{{ utils.resultType(sdk.namespace, method) }}.from(map = it as Map<String, Any>)
108108
{% endif %}
109109
}
110110
{% endif %}

0 commit comments

Comments
 (0)