added images
This commit is contained in:
parent
c5f1fe6408
commit
745a4014a5
3 changed files with 45 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ dependencies {
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
|
||||||
implementation("de.thelooter:toml4j:0.8.1")
|
implementation("de.thelooter:toml4j:0.8.1")
|
||||||
implementation("io.github.cdimascio:dotenv-kotlin:6.5.1")
|
implementation("io.github.cdimascio:dotenv-kotlin:6.5.1")
|
||||||
|
implementation(files("../Utils-latest.jar"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,6 @@ fun main() {
|
||||||
}
|
}
|
||||||
str.append("| Geslacht | ${genderString.padEnd(18, ' ')} |\n")
|
str.append("| Geslacht | ${genderString.padEnd(18, ' ')} |\n")
|
||||||
|
|
||||||
|
|
||||||
str.append("| Roken | ${(if (it.floor.floorInfo.smokingAllowed ?: true) "✅ Mag" else "❌ Mag niet").padEnd(17, ' ')} |\n")
|
str.append("| Roken | ${(if (it.floor.floorInfo.smokingAllowed ?: true) "✅ Mag" else "❌ Mag niet").padEnd(17, ' ')} |\n")
|
||||||
str.append("| Huisdieren | ${(if (it.floor.floorInfo.petsAllowed) "✅ Mogen" else "❌ Mogen niet").padEnd(17, ' ')} |\n")
|
str.append("| Huisdieren | ${(if (it.floor.floorInfo.petsAllowed) "✅ Mogen" else "❌ Mogen niet").padEnd(17, ' ')} |\n")
|
||||||
val positionString = "${it.floor.potentialPosition} / ${it.floor.applicantCount}."
|
val positionString = "${it.floor.potentialPosition} / ${it.floor.applicantCount}."
|
||||||
|
|
@ -88,6 +87,10 @@ fun main() {
|
||||||
str.append("| Tijd over | $daysLeft dagen over. |\n")
|
str.append("| Tijd over | $daysLeft dagen over. |\n")
|
||||||
|
|
||||||
str.append("\n")
|
str.append("\n")
|
||||||
|
|
||||||
|
val etage = getEtage(it.offer.assSubjectPersk.first { it.pkHeeftAsp == 52.0 }.waarde!!)
|
||||||
|
|
||||||
|
str.append("\n\n")
|
||||||
str.append("### Message: \n\n${it.floor.floorInfo.description ?: "Deze pannekoeken hebben geen bericht achtergelaten"}\n")
|
str.append("### Message: \n\n${it.floor.floorInfo.description ?: "Deze pannekoeken hebben geen bericht achtergelaten"}\n")
|
||||||
|
|
||||||
str.append("\n\n")
|
str.append("\n\n")
|
||||||
|
|
|
||||||
40
src/main/kotlin/getEtage.kt
Normal file
40
src/main/kotlin/getEtage.kt
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
package me.koendev
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import me.koendev.utils.println
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Etages(
|
||||||
|
@SerialName("value") val offers: List<Etage>,
|
||||||
|
@SerialName("@odata.count") val count: Int,
|
||||||
|
@SerialName("isComplete") val isComplete: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Etage(
|
||||||
|
@SerialName("EtageWocasId") val etageWocasID: String,
|
||||||
|
@SerialName("Id") val etageID: Int,
|
||||||
|
@SerialName("Etage_EtagePhoto") val photos: List<EtagePhoto>
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class EtagePhoto(
|
||||||
|
@SerialName("Id") val id: Int,
|
||||||
|
@SerialName("EtageId") val etageID: Int,
|
||||||
|
@SerialName("EtagePhotoId") val etagePhotoID: Int,
|
||||||
|
@SerialName("EtagePhoto") val etagePhoto: List<EtagePhotoItem>,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class EtagePhotoItem(
|
||||||
|
@SerialName("Id") val id: Int,
|
||||||
|
@SerialName("Photo") val url: String
|
||||||
|
)
|
||||||
|
|
||||||
|
fun getEtage(id: String): Etage {
|
||||||
|
val response = getEndpoint("OData/Etage?\$filter=(EtageWocasId%20eq%20'$id')&\$expand=Etage_EtagePhoto!(\$select=Id,EtagePhotoId,EtageId;\$expand=EtagePhoto!(\$select=Id,Photo))&\$select=Id,EtageWocasId")
|
||||||
|
|
||||||
|
return Json.decodeFromString<Etages>(response).offers.first()
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue