Package com.apollographql.apollo
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 newApolloPrefetchobject.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classApolloPrefetch.CallbackCommunicates responses from the server.static interfaceApolloPrefetch.FactoryFactory for creating ApolloPrefetch object.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()Cancels thisApolloPrefetch.ApolloPrefetchclone()Creates a new, identical ApolloPrefetch to this one which can be enqueued or executed even if this one has already been executed.voidenqueue(ApolloPrefetch.Callback callback)Schedules the request to be executed at some point in the future.com.apollographql.apollo.api.Operationoperation()Returns GraphQL operation this call executes-
Methods inherited from interface com.apollographql.apollo.internal.util.Cancelable
isCanceled
-
-
-
-
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
-
cancel
void cancel()
Cancels thisApolloPrefetch. If the call has already completed, nothing will happen. If the call is outgoing, anApolloCanceledExceptionwill be thrown if the call was started with#execute(). If the call was started withenqueue(Callback)theApolloPrefetch.Callbackwill be disposed, and will receive no more events. The call will attempt to abort and release resources, if possible.- Specified by:
cancelin interfaceCancelable
-
-