An invocation of a Retrofit method that sends a request to a webserver and returns a response. Each call yields its own HTTP request and response pair. Use #clone to make multiple calls with the same parameters to the same webserver; this may be used to implement polling or to retry a failed
| 33 | * @param <T> Successful response body type. |
| 34 | */ |
| 35 | public interface Call<T> extends Cloneable { |
| 36 | /** |
| 37 | * Synchronously send the request and return its response. |
| 38 | * |
| 39 | * @throws IOException if a problem occurred talking to the server. |
| 40 | * @throws RuntimeException (and subclasses) if an unexpected error occurs creating the request or |
| 41 | * decoding the response. |
| 42 | */ |
| 43 | Response<T> execute() throws IOException; |
| 44 | |
| 45 | /** |
| 46 | * Asynchronously send the request and notify {@code callback} of its response or if an error |
| 47 | * occurred talking to the server, creating the request, or processing the response. |
| 48 | */ |
| 49 | void enqueue(Callback<T> callback); |
| 50 | |
| 51 | /** |
| 52 | * Returns true if this call has been either {@linkplain #execute() executed} or {@linkplain |
| 53 | * #enqueue(Callback) enqueued}. It is an error to execute or enqueue a call more than once. |
| 54 | */ |
| 55 | boolean isExecuted(); |
| 56 | |
| 57 | /** |
| 58 | * Cancel this call. An attempt will be made to cancel in-flight calls, and if the call has not |
| 59 | * yet been executed it never will be. |
| 60 | */ |
| 61 | void cancel(); |
| 62 | |
| 63 | /** True if {@link #cancel()} was called. */ |
| 64 | boolean isCanceled(); |
| 65 | |
| 66 | /** |
| 67 | * Create a new, identical call to this one which can be enqueued or executed even if this call |
| 68 | * has already been. |
| 69 | */ |
| 70 | Call<T> clone(); |
| 71 | |
| 72 | /** The original HTTP request. */ |
| 73 | Request request(); |
| 74 | |
| 75 | /** |
| 76 | * Returns a timeout that spans the entire call: resolving DNS, connecting, writing the request |
| 77 | * body, server processing, and reading the response body. If the call requires redirects or |
| 78 | * retries all must complete within one timeout period. |
| 79 | */ |
| 80 | Timeout timeout(); |
| 81 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…