public final class AppSyncCallback<T>
extends com.apollographql.apollo.GraphQLCall.Callback<T>
Android wrapper for GraphQLCall.Callback to be operated on specified Handler
onHttpError(ApolloHttpException) will be called on the background thread if provided handler is
attached to the main looper. This behaviour is intentional as ApolloHttpException internally has a reference
to raw Response that must be closed on the background, otherwise it throws NetworkOnMainThreadException exception.| Constructor and Description |
|---|
AppSyncCallback(com.apollographql.apollo.GraphQLCall.Callback<T> callback,
android.os.Handler handler) |
| Modifier and Type | Method and Description |
|---|---|
void |
onFailure(com.apollographql.apollo.exception.ApolloException e) |
void |
onHttpError(com.apollographql.apollo.exception.ApolloHttpException e) |
void |
onNetworkError(com.apollographql.apollo.exception.ApolloNetworkException e) |
void |
onParseError(com.apollographql.apollo.exception.ApolloParseException e) |
void |
onResponse(com.apollographql.apollo.api.Response<T> response) |
void |
onStatusEvent(com.apollographql.apollo.GraphQLCall.StatusEvent event) |
static <T> AppSyncCallback<T> |
wrap(com.apollographql.apollo.GraphQLCall.Callback<T> callback,
android.os.Handler handler)
Wraps
callback to be be operated on specified handler |
public AppSyncCallback(@Nonnull
com.apollographql.apollo.GraphQLCall.Callback<T> callback,
@Nonnull
android.os.Handler handler)
callback - original callback to delegates callshandler - the callback will be run on the thread to which this handler is attachedpublic static <T> AppSyncCallback<T> wrap(@Nonnull com.apollographql.apollo.GraphQLCall.Callback<T> callback, @Nonnull android.os.Handler handler)
callback to be be operated on specified handlercallback - original callback to delegates callshandler - the callback will be run on the thread to which this handler is attachedpublic void onResponse(@Nonnull
com.apollographql.apollo.api.Response<T> response)
onResponse in class com.apollographql.apollo.GraphQLCall.Callback<T>public void onStatusEvent(@Nonnull
com.apollographql.apollo.GraphQLCall.StatusEvent event)
onStatusEvent in class com.apollographql.apollo.GraphQLCall.Callback<T>public void onFailure(@Nonnull
com.apollographql.apollo.exception.ApolloException e)
onFailure in class com.apollographql.apollo.GraphQLCall.Callback<T>public void onHttpError(@Nonnull
com.apollographql.apollo.exception.ApolloHttpException e)
onHttpError in class com.apollographql.apollo.GraphQLCall.Callback<T>public void onNetworkError(@Nonnull
com.apollographql.apollo.exception.ApolloNetworkException e)
onNetworkError in class com.apollographql.apollo.GraphQLCall.Callback<T>public void onParseError(@Nonnull
com.apollographql.apollo.exception.ApolloParseException e)
onParseError in class com.apollographql.apollo.GraphQLCall.Callback<T>