Package com.apollographql.apollo
Class ApolloCall.Callback<T>
- java.lang.Object
-
- com.apollographql.apollo.ApolloCall.Callback<T>
-
- Enclosing interface:
- ApolloCall<T>
public abstract static class ApolloCall.Callback<T> extends java.lang.ObjectCommunicates responses from a server or offline requests.
-
-
Constructor Summary
Constructors Constructor Description Callback()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidonCanceledError(ApolloCanceledException e)Gets called whenApolloCallhas been canceled.abstract voidonFailure(com.apollographql.apollo.exception.ApolloException e)Gets called when an unexpected exception occurs while creating the request or processing the response.voidonHttpError(ApolloHttpException e)Gets called when an http request error takes place.voidonNetworkError(ApolloNetworkException e)Gets called when an http request error takes place due to network failures, timeouts etc.voidonParseError(ApolloParseException e)Gets called when the network request succeeds but there was an error parsing the response.abstract voidonResponse(com.apollographql.apollo.api.Response<T> response)Gets called when GraphQL response is received and parsed successfully.voidonStatusEvent(ApolloCall.StatusEvent event)Gets called whenever any action happen to thisApolloCall.
-
-
-
Method Detail
-
onResponse
public abstract void onResponse(@NotNull com.apollographql.apollo.api.Response<T> response)Gets called when GraphQL response is received and parsed successfully. Depending on theResponseFetcherused with the call, this may be called multiple times.#onCompleted()will be called after the final call to onResponse.- Parameters:
response- the GraphQL response
-
onFailure
public abstract void onFailure(@NotNull com.apollographql.apollo.exception.ApolloException e)Gets called when an unexpected exception occurs while creating the request or processing the response. Will be called at most one time. It is considered a terminal event. After called, neitheronResponse(Response)or#onCompleted()will be called again.
-
onStatusEvent
public void onStatusEvent(@NotNull ApolloCall.StatusEvent event)Gets called whenever any action happen to thisApolloCall.- Parameters:
event- status that corresponds to aApolloCallaction
-
onHttpError
public void onHttpError(@NotNull ApolloHttpException e)Gets called when an http request error takes place. This is the case when the returned http status code doesn't lie in the range 200 (inclusive) and 300 (exclusive).
NOTE: by overriding this callback you must callResponse.close()onApolloHttpException.rawResponseto close the network connection.
-
onNetworkError
public void onNetworkError(@NotNull ApolloNetworkException e)Gets called when an http request error takes place due to network failures, timeouts etc.
-
onParseError
public void onParseError(@NotNull ApolloParseException e)Gets called when the network request succeeds but there was an error parsing the response.
-
onCanceledError
public void onCanceledError(@NotNull ApolloCanceledException e)Gets called whenApolloCallhas been canceled.
-
-