forked from loafle/openapi-generator-original
update kotline samples
This commit is contained in:
parent
8d6278bd4c
commit
a440396485
@ -60,7 +60,9 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
fun toJson(uuid: UUID) = uuid.toString()
|
fun toJson(uuid: UUID) = uuid.toString()
|
||||||
@FromJson
|
@FromJson
|
||||||
fun fromJson(s: String) = UUID.fromString(s)
|
fun fromJson(s: String) = UUID.fromString(s)
|
||||||
}).build().adapter(T::class.java).fromJson(body.source())
|
})
|
||||||
|
.add(ByteArrayAdapter())
|
||||||
|
.build().adapter(T::class.java).fromJson(body.source())
|
||||||
else -> TODO()
|
else -> TODO()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
|
||||||
|
class ByteArrayAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(data: ByteArray): String = String(data)
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(data: String): ByteArray = data.toByteArray()
|
||||||
|
}
|
@ -60,7 +60,9 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
fun toJson(uuid: UUID) = uuid.toString()
|
fun toJson(uuid: UUID) = uuid.toString()
|
||||||
@FromJson
|
@FromJson
|
||||||
fun fromJson(s: String) = UUID.fromString(s)
|
fun fromJson(s: String) = UUID.fromString(s)
|
||||||
}).build().adapter(T::class.java).fromJson(body.source())
|
})
|
||||||
|
.add(ByteArrayAdapter())
|
||||||
|
.build().adapter(T::class.java).fromJson(body.source())
|
||||||
else -> TODO()
|
else -> TODO()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
|
||||||
|
class ByteArrayAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(data: ByteArray): String = String(data)
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(data: String): ByteArray = data.toByteArray()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user