commonMain.com.paoapps.fifi.api.ClientApiImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fifi-framework Show documentation
Show all versions of fifi-framework Show documentation
Kotlin Multiplatform Mobile framework for optimal code sharing between iOS and Android.
package com.paoapps.fifi.api
import com.paoapps.fifi.log.ktor.logging.LogLevel
import com.paoapps.fifi.log.ktor.logging.Logger
import com.paoapps.fifi.log.ktor.logging.Logging
import com.paoapps.fifi.log.ktor.logging.SIMPLE
import com.paoapps.fifi.model.ModelEnvironment
import io.ktor.client.HttpClient
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.serialization.kotlinx.json.json
import org.koin.core.component.KoinComponent
open class ClientApiImpl(
final override val environment: Environment,
appVersion: String,
additionalHeaders: Map = emptyMap(),
isDebugMode: Boolean,
httpClient: HttpClient = HttpClient {
expectSuccess = true
install(Logging) {
logger = Logger.SIMPLE
level = if (isDebugMode) LogLevel.ALL else LogLevel.INFO
}
install(ContentNegotiation) {
json(jsonParser)
}
},
): KoinComponent, ClientApi {
protected val apiHelper = ClientApiHelper(httpClient, environment, appVersion, additionalHeaders)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy