net.nemerosa.ontrack.kdsl.spec.settings.SettingsInterface.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-kdsl Show documentation
Show all versions of ontrack-kdsl Show documentation
Ontrack module: ontrack-kdsl
package net.nemerosa.ontrack.kdsl.spec.settings
import net.nemerosa.ontrack.json.parseInto
import net.nemerosa.ontrack.kdsl.connector.Connected
import net.nemerosa.ontrack.kdsl.connector.Connector
import kotlin.reflect.KClass
class SettingsInterface(
connector: Connector,
val id: String,
val type: KClass,
) : Connected(connector) {
fun get(): T = connector.get("/rest/settings/$id")
.body.asJson().parseInto(type)
fun set(value: T) {
connector.put("/rest/settings/$id", body = value)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy