Class CallHttpApis.Builder
java.lang.Object
org.shakespeareframework.retrofit.CallHttpApis.Builder
- Enclosing class:
- CallHttpApis
Builder wrapping a
Retrofit.Builder
and a OkHttpClient.Builder
to allow setting
both with one class.-
Method Summary
Modifier and TypeMethodDescriptionaddConverterFactory
(retrofit2.Converter.Factory converterFactory) Adds the givenConverter.Factory
to theretrofitBuilder
.addInterceptor
(okhttp3.Interceptor interceptor) Adds the givenInterceptor
to theokHttpClientBuilder
.Adds aJacksonConverterFactory
to theretrofitBuilder
.Adds aScalarsConverterFactory
to theretrofitBuilder
.authenticator
(okhttp3.Authenticator authenticator) Sets the base URL to theretrofitBuilder
.<C> C
Finalizes the build and returns the client.
-
Method Details
-
baseUrl
Sets the base URL to theretrofitBuilder
.- Parameters:
baseUrl
- base URL of the API- Returns:
- the
CallHttpApis.Builder
- See Also:
-
Retrofit.Builder.baseUrl(String)
-
addConverterFactory
Adds the givenConverter.Factory
to theretrofitBuilder
.- Parameters:
converterFactory
- aConverter.Factory
to be added to theretrofitBuilder
- Returns:
- the
CallHttpApis.Builder
- See Also:
-
Retrofit.Builder.addConverterFactory(Converter.Factory)
-
addScalarsConverterFactory
Adds aScalarsConverterFactory
to theretrofitBuilder
.- Returns:
- the
CallHttpApis.Builder
- See Also:
-
addConverterFactory(Converter.Factory)
ScalarsConverterFactory
-
addJacksonConverterFactory
Adds aJacksonConverterFactory
to theretrofitBuilder
.- Returns:
- the
CallHttpApis.Builder
- See Also:
-
addConverterFactory(Converter.Factory)
JacksonConverterFactory
-
addInterceptor
Adds the givenInterceptor
to theokHttpClientBuilder
.- Parameters:
interceptor
- anInterceptor
to be added to theokHttpClientBuilder
- Returns:
- the
CallHttpApis.Builder
- See Also:
-
OkHttpClient.Builder.addInterceptor(Interceptor)
-
authenticator
-
build
Finalizes the build and returns the client.- Type Parameters:
C
- the type of the API client class- Parameters:
clientClass
- the API client class- Returns:
- an instance of clientClass to interact with the API
- See Also:
-
Retrofit.Builder.build()
OkHttpClient.Builder.build()
Retrofit.create(Class)
-