File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
src/main/kotlin/me/snoty/integration/contrib/willhaben/api Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- version = " 3.3.0 "
1+ version = " 3.3.1 "
Original file line number Diff line number Diff line change @@ -25,24 +25,24 @@ fun JsonObject.parseListing(json: Json): WillhabenListing {
2525 val id = this [" id" ]
2626 val attributes = getOrThrow(" attributes" ).jsonObject.getOrThrow(" attribute" ).jsonArray.associate {
2727 val key = it.jsonObject.getOrThrow(" name" ).jsonPrimitive.content
28- val value = it.jsonObject.getOrThrow(" values" ).jsonArray.toList()
28+ val value = it.jsonObject.getOrThrow(" values" ).jsonArray.map { item -> item.jsonPrimitive }
2929 key to value
3030 }
3131
3232 val title = getOrThrow(" description" ).jsonPrimitive.content
33- val description = attributes[" DESCRIPTION" ]
33+ val description = attributes[" DESCRIPTION" ]?.joinToString( " \n " ) { it.content }
3434 ? : throw IllegalArgumentException (" Description not found in listing" )
35- val price = attributes[" PRICE" ]?.firstOrNull()?.jsonPrimitive?. doubleOrNull
35+ val price = attributes[" PRICE" ]?.firstOrNull()?.doubleOrNull
3636 ? : throw IllegalArgumentException (" Price not found in listing" )
3737 val status: WillhabenStatus = json.decodeFromJsonElement(getOrThrow(" advertStatus" ))
3838
3939 return WillhabenListing (
4040 id = id!! .jsonPrimitive.content,
4141 title = title,
42- description = description.joinToString( " \n " ) ,
42+ description = description,
4343 price = price,
4444 attributes = attributes.mapValues { (_, values) ->
45- values.map { it.jsonPrimitive. content }
45+ values.map { it.content }
4646 },
4747 status = status,
4848 )
You can’t perform that action at this time.
0 commit comments