T
- type of value, retrieved from that requestpublic final class RestRequest<T> extends Object
Constructor and Description |
---|
RestRequest(okhttp3.Request request,
okhttp3.OkHttpClient client,
Function<okhttp3.Response,T> finisher) |
Modifier and Type | Method and Description |
---|---|
void |
async(Consumer<T> onSuccess)
Calls this request asynchronously
|
void |
async(Consumer<T> onSuccess,
Consumer<Throwable> onFailure)
Calls this request asynchronously
|
T |
sync()
Calls this request synchronously.
|
T |
sync(Function<Throwable,T> onFailure)
Calls this request synchronously and provides a exception handler.
|
public T sync()
RequestException
- if exception caughtpublic T sync(Function<Throwable,T> onFailure)
onFailure
- exception handlerpublic void async(Consumer<T> onSuccess)
onSuccess
- callback with the value if no failure happenedCopyright © 2019. All rights reserved.