commonMain.cccev.f2.unit.client.DataUnitClient.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cccev-unit-f2-client-jvm Show documentation
Show all versions of cccev-unit-f2-client-jvm Show documentation
Kotlin implementation of Core Criterion and Core Evidence Vocabulary
package cccev.f2.unit.client
import cccev.f2.unit.domain.DataUnitApi
import cccev.f2.unit.domain.command.DataUnitCreateFunction
import cccev.f2.unit.domain.command.DataUnitUpdateFunction
import cccev.f2.unit.domain.query.DataUnitGetByIdentifierFunction
import cccev.f2.unit.domain.query.DataUnitGetFunction
import f2.client.F2Client
import f2.client.function
import f2.client.ktor.F2ClientBuilder
import f2.dsl.fnc.F2SupplierSingle
import f2.dsl.fnc.f2SupplierSingle
import kotlin.js.JsExport
import kotlin.js.JsName
fun F2Client.dataUnitClient(): F2SupplierSingle = f2SupplierSingle {
DataUnitClient(this)
}
fun dataUnitClient(urlBase: String): F2SupplierSingle = f2SupplierSingle {
DataUnitClient(
F2ClientBuilder.get(urlBase)
)
}
@JsExport
@JsName("DataUnitClient")
open class DataUnitClient constructor(private val client: F2Client): DataUnitApi {
override fun dataUnitGet(): DataUnitGetFunction = client.function(this::dataUnitGet.name)
override fun dataUnitGetByIdentifier(): DataUnitGetByIdentifierFunction
= client.function(this::dataUnitGetByIdentifier.name)
override fun dataUnitCreate(): DataUnitCreateFunction = client.function(this::dataUnitCreate.name)
override fun dataUnitUpdate(): DataUnitUpdateFunction = client.function(this::dataUnitUpdate.name)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy