Skip to content

Commit

Permalink
update BaseXapClient
Browse files Browse the repository at this point in the history
  • Loading branch information
dtayeh committed Nov 26, 2024
1 parent f16b78c commit d9c16a0
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationSt
import io.ktor.client.HttpClient
import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.engine.okhttp.*
import okhttp3.OkHttpClient

/**
* The integration point between the SDK Core and the product SDKs.
Expand Down Expand Up @@ -62,4 +63,20 @@ abstract class BaseXapClient(
/** A [BaseXapClient] builder. */
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
abstract class Builder<SELF : Builder<SELF>> : HttpConfigurableBuilder<SELF>()

/** A [BaseXapClient] builder with ability to pass a custom okhttp client. */
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
abstract class BuilderWithHttpClient<SELF : Client.Builder<SELF>> : Client.Builder<SELF>() {
protected var okHttpClient: OkHttpClient? = null

@Suppress("UNCHECKED_CAST")
override fun self(): SELF = this as SELF

/** Sets the [OkHttpClient] to use for the [BaseXapClient]. */
fun okHttpClient(okHttpClient: OkHttpClient): SELF {
this.okHttpClient = okHttpClient
return self()
}

}
}

0 comments on commit d9c16a0

Please sign in to comment.