retrofit / retrofit2 / Retrofit / Builder

Builder

class Builder

Build a new Retrofit.

Calling #baseUrl is required before calling #build(). All other methods are optional.

Constructors

<init>

Builder()

Functions

addCallAdapterFactory

fun addCallAdapterFactory(factory: CallAdapter.Factory!): Retrofit.Builder!

Add a call adapter factory for supporting service method return types other than .

addConverterFactory

fun addConverterFactory(factory: Converter.Factory!): Retrofit.Builder!

Add converter factory for serialization and deserialization of objects.

baseUrl

fun baseUrl(baseUrl: URL!): Retrofit.Builder!
fun baseUrl(baseUrl: String!): Retrofit.Builder!

Set the API base URL.

fun baseUrl(baseUrl: HttpUrl!): Retrofit.Builder!

Set the API base URL.

build

fun build(): Retrofit!

Create the Retrofit instance using the configured values.

callAdapterFactories

fun callAdapterFactories(): MutableList<CallAdapter.Factory!>!

Returns a modifiable list of call adapter factories.

callbackExecutor

fun callbackExecutor(executor: Executor!): Retrofit.Builder!

The executor on which Callback methods are invoked when returning Call from your service method.

callFactory

fun callFactory(factory: Factory!): Retrofit.Builder!

Specify a custom call factory for creating Call instances.

client

fun client(client: OkHttpClient!): Retrofit.Builder!

The HTTP client used for requests.

converterFactories

fun converterFactories(): MutableList<Converter.Factory!>!

Returns a modifiable list of converter factories.

validateEagerly

fun validateEagerly(validateEagerly: Boolean): Retrofit.Builder!

When calling #create on the resulting Retrofit instance, eagerly validate the configuration of all methods in the supplied interface.