Chad Gregory
03/09/2023, 12:46 PMio.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel (Kotlin reflection is not available) -> interface java.util.List (Kotlin reflection is not available)Here is the JSON with information redacted
[
{
"item": "*Redacted*",
"description": "*Redacted*",
"style_code": "",
"job_number": "*Redacted*",
"job_quantity": "*Redacted Number*",
"pcs_hour": "*Redacted Number*",
"start_date": "2022-10-05 07:30:00.000",
"due_date": "2022-10-06 00:00:00.000",
"wo_num": "*Redacted*",
"wo_line": "*Redacted*",
"bom": [
{
"comp_item": "*Redacted*",
"comp_qty": "*Redacted Number*",
"comp_uom": "LB",
"operation": "10",
"type": "*Redacted*"
},
{
"comp_item": "*Redacted*",
"comp_qty": "1.000000",
"comp_uom": "EA",
"operation": "10",
"type": "*Redacted*"
},
{
"comp_item": "*Redacted*",
"comp_qty": "1.000000",
"comp_uom": "EA",
"operation": "10",
"type": "*Redacted*"
}
]
}
]
and here is the DataClass
@Serializable
data class Job (
val item: String = "",
val description: String = "",
@SerialName("style_code")
val styleCode: String = "",
@SerialName("job_number")
val jobNumber: Int = 0,
val machine: String = "",
@SerialName("job_quantity")
val jobQuantity: Int = 0,
@SerialName("pcs_hour")
val pcsHour: Double = 0.0,
@SerialName("start_date")
val startDate: String = "",
@SerialName("due_date")
val dueDate: String = "",
@SerialName("wo_num")
val woNum: String = "",
@SerialName("wo_line")
val woLine: String = "",
@SerialName("machine_state")
val machineState: Int = 0,
@SerialName("machine_state_timestamp")
val machineStateTimestamp: String = "",
@SerialName("first_five_good")
val firstFiveGood: Int = 0,
@SerialName("production_quantity")
val productionQuantity: Int = 0,
@SerialName("scrap_quantity")
val scrapQuantity: Int = 0,
val additional: AdditionalInformation = AdditionalInformation(),
val bom: List<BOM> = emptyList()
) {
val bomMutable: MutableList<BOM> = bom.toMutableList()
}
@Serializable
data class BOM(
@SerialName("comp_item")
val compItem: String = "",
@SerialName("comp_qty")
val compQty: String = "",
@SerialName("comp_uom")
val compUom: String = "",
val operation: String = "",
val type: String = ""
)
and here is the code that get the data for the api
client.get(GroovRoutes.GET_JOBS){
headers {
append("apiKey", apiKey)
}
}.body()
Can any one help me out here?private val client = HttpClient(Android) {
expectSuccess = true
install(Logging) {
level = LogLevel.ALL
}
install(ContentNegotiation) {
json(Json {
ignoreUnknownKeys = true
isLenient = true
encodeDefaults = false
})
}
install(HttpTimeout) {
requestTimeoutMillis = 15000L
connectTimeoutMillis = 15000L
socketTimeoutMillis = 15000L
}
defaultRequest {
url(this@GroovRepository.url)
contentType(ContentType.Application.Json)
accept(ContentType.Application.Json)
}
val response: String = client.get(GroovRoutes.GET_JOBS) {
headers {
append("apiKey", apiKey)
}
}.body()
Json.decodeFromString<List<Job>>(response)