All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.cccev.f2.unit.client.DataUnitClient.kt Maven / Gradle / Ivy

There is a newer version: 0.20.0
Show newest version
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