forked from loafle/openapi-generator-original
update kotlin samples
This commit is contained in:
parent
d78e91517e
commit
f1989cc70f
@ -19,7 +19,8 @@ import retrofit2.converter.moshi.MoshiConverterFactory
|
||||
class ApiClient(
|
||||
private var baseUrl: String = defaultBasePath,
|
||||
private val okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||
private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder
|
||||
private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
|
||||
private val okHttpClient : OkHttpClient? = null
|
||||
) {
|
||||
private val apiAuthorizations = mutableMapOf<String, Interceptor>()
|
||||
var logger: ((String) -> Unit)? = null
|
||||
@ -174,7 +175,9 @@ class ApiClient(
|
||||
}
|
||||
|
||||
fun <S> createService(serviceClass: Class<S>): S {
|
||||
return retrofitBuilder.client(clientBuilder.build()).build().create(serviceClass)
|
||||
var usedClient: OkHttpClient? = null
|
||||
this.okHttpClient?.let { usedClient = it } ?: run {usedClient = clientBuilder.build()}
|
||||
return retrofitBuilder.client(usedClient).build().create(serviceClass)
|
||||
}
|
||||
|
||||
private fun normalizeBaseUrl() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user