Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
// run with kotlin petstore.main.kts
import io.ktor.client.*
import io.ktor.client.features.json.*
import io.ktor.client.request.*
import kotlinx.coroutines.runBlocking
data class InventoryResponse(val sold: Int, val pending: Int, val available: Int)
val url = ""
HttpClient { install(JsonFeature) }.use { client ->
runBlocking {
val (sold, pending, available) = client.get<InventoryResponse>(url)
println("Result: Sold $sold, pending $pending, available $available")