Interface ApolloPrefetch

  • All Superinterfaces:
    Cancelable
    All Known Implementing Classes:
    RealApolloPrefetch

    public interface ApolloPrefetch
    extends Cancelable

    ApolloPrefetch is an abstraction for a request that has been prepared for execution. It represents a single request/response pair and cannot be executed twice, though it can be cancelled. It fetches the graph response from the server on successful completion but doesn't inflate the response into models. Instead it stores the raw response in the request/response cache and defers the parsing to a later time.

    Use this object for use cases when the data needs to be fetched, but is not required for immediate consumption. e.g.background update/syncing.

    Note: In order to execute the request again, call the clone() method which creates a new ApolloPrefetch object.

    • Method Detail

      • enqueue

        void enqueue​(@Nullable
                     ApolloPrefetch.Callback callback)
        Schedules the request to be executed at some point in the future.
        Parameters:
        callback - Callback which will handle the success response or a failure exception
        Throws:
        java.lang.IllegalStateException - when the call has already been executed
      • clone

        ApolloPrefetch clone()
        Creates a new, identical ApolloPrefetch to this one which can be enqueued or executed even if this one has already been executed.
        Returns:
        The cloned ApolloPrefetch object
      • operation

        @NotNull
        com.apollographql.apollo.api.Operation operation()
        Returns GraphQL operation this call executes
        Returns:
        Operation