Class ApolloCall.Callback<T>

  • Enclosing interface:
    ApolloCall<T>

    public abstract static class ApolloCall.Callback<T>
    extends java.lang.Object
    Communicates responses from a server or offline requests.
    • Constructor Detail

      • Callback

        public Callback()
    • 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 the ResponseFetcher used 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, neither onResponse(Response) or #onCompleted() will be called again.
      • onStatusEvent

        public void onStatusEvent​(@NotNull
                                  ApolloCall.StatusEvent event)
        Gets called whenever any action happen to this ApolloCall.
        Parameters:
        event - status that corresponds to a ApolloCall action
      • 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 call Response.close() on ApolloHttpException.rawResponse to 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.