class Retrofit
Retrofit adapts a Java interface to HTTP calls by using annotations on the declared methods to define how requests are made. Create instances using the builder and pass your interface to #create to generate an implementation.
For example,
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.example.com/")
.addConverterFactory(GsonConverterFactory.create())
.build();
MyApi api = retrofit.create(MyApi.class);
Response<User> user = api.getUser().execute();
Author
Bob Lee (bob@squareup.com)
Author
Jake Wharton (jw@squareup.com)
class Builder
Build a new |
fun baseUrl(): HttpUrl!
The API base URL. |
|
fun callAdapter(returnType: Type!, annotations: Array<Annotation!>!): CallAdapter<*, *>!
Returns the |
|
fun callAdapterFactories(): MutableList<CallAdapter.Factory!>!
Returns a list of the factories tried when creating a #callAdapter(Type, * Annotation[]) call adapter}. |
|
fun callbackExecutor(): Executor?
The executor used for |
|
fun callFactory(): Factory!
The factory used to create OkHttp calls for sending a HTTP requests. Typically an instance of |
|
fun converterFactories(): MutableList<Converter.Factory!>!
Returns an unmodifiable list of the factories tried when creating a , a , or a . |
|
fun <T : Any!> create(service: Class<T>!): T
Create an implementation of the API endpoints defined by the |
|
fun newBuilder(): Retrofit.Builder! |
|
fun nextCallAdapter(skipPast: CallAdapter.Factory?, returnType: Type!, annotations: Array<Annotation!>!): CallAdapter<*, *>!
Returns the |
|
fun <T : Any!> nextRequestBodyConverter(skipPast: Converter.Factory?, type: Type!, parameterAnnotations: Array<Annotation!>!, methodAnnotations: Array<Annotation!>!): Converter<T, RequestBody!>!
Returns a |
|
fun <T : Any!> nextResponseBodyConverter(skipPast: Converter.Factory?, type: Type!, annotations: Array<Annotation!>!): Converter<ResponseBody!, T>!
Returns a |
|
fun <T : Any!> requestBodyConverter(type: Type!, parameterAnnotations: Array<Annotation!>!, methodAnnotations: Array<Annotation!>!): Converter<T, RequestBody!>!
Returns a |
|
fun <T : Any!> responseBodyConverter(type: Type!, annotations: Array<Annotation!>!): Converter<ResponseBody!, T>!
Returns a |
|
fun <T : Any!> stringConverter(type: Type!, annotations: Array<Annotation!>!): Converter<T, String!>!
|
fun <T> Retrofit.create(): T |