me.obsilabor.pistonmetakt.PistonMetaClient.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of piston-meta-kt Show documentation
Show all versions of piston-meta-kt Show documentation
Kotlin library to interact with mojangs launchermeta and "piston-data" api
package me.obsilabor.pistonmetakt
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.serialization.json.Json
import me.obsilabor.pistonmetakt.annotations.NotWorkingPistonMetaApi
import me.obsilabor.pistonmetakt.data.launchermeta.LauncherMeta
object PistonMetaClient {
val ktor = HttpClient {
install(ContentNegotiation) {
json(Json {
isLenient = true
ignoreUnknownKeys = true
})
}
}
suspend fun getLauncherMeta(): LauncherMeta {
return ktor.get("https://launchermeta.mojang.com/mc/game/version_manifest_v2.json").body()
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy