RequestBuilder

open class RequestBuilder

Constructors

Link copied to clipboard
constructor(baseUrl: String)
constructor(baseUrl: URL)
constructor(baseUrl: HttpUrl)

Properties

Link copied to clipboard
private val okHttpClient: OkHttpClient
Link copied to clipboard
internal var retrofit: Retrofit

Functions

Link copied to clipboard
private fun Retrofit.Builder.configuration(): Retrofit.Builder

The configuration of the retrofit.

Link copied to clipboard
fun <T> RequestBuilder.create(serviceClass: Class<T>): T

Get api service.

Link copied to clipboard
fun <T, R> RequestBuilder.getApi(service: Class<T>, serviceScope: suspend T.() -> Request2<R>): Flow<Request2<R>>

Get api service and the scope.

Link copied to clipboard
open fun okHttpConfiguration(builder: OkHttpClient.Builder)

Customize the configuration of okHttpClient.

Link copied to clipboard
open fun retrofitConfiguration(builder: Retrofit.Builder)

Customize the configuration of retrofit. By default, retrofitConfiguration add RequestAdapterFactory for Request and Request2AdapterFactory for Request2 in order to support service method return types other than Call.

Link copied to clipboard
open fun setTimeOut(): Long

Set timeout. Default return 8L.