use of com.apollographql.apollo.api.Operation in project apollo-android by apollographql.
the class ApolloCallTracker method registerCall.
/**
* <p>Adds provided {@link ApolloCall} that is currently in progress.</p>
*
* <p><b>Note</b>: This method needs to be called right before an apolloCall is executed.</p>
*/
void registerCall(@Nonnull ApolloCall call) {
checkNotNull(call, "call == null");
Operation operation = call.operation();
if (operation instanceof Query) {
registerQueryCall((ApolloQueryCall) call);
} else if (operation instanceof Mutation) {
registerMutationCall((ApolloMutationCall) call);
} else {
throw new IllegalArgumentException("Unknown call type");
}
}
use of com.apollographql.apollo.api.Operation in project apollo-android by apollographql.
the class ApolloCallTracker method unregisterCall.
/**
* <p>Removes provided {@link ApolloCall} that finished his execution, if it is found, else throws an
* {@link AssertionError}.</p>
*
* If the removal operation is successful and no active running calls are found, then the registered
* {@link ApolloCallTracker#idleResourceCallback} is invoked.
*
* <p><b>Note</b>: This method needs to be called right after an apolloCall is completed (whether successful or
* failed).</p>
*/
void unregisterCall(@Nonnull ApolloCall call) {
checkNotNull(call, "call == null");
Operation operation = call.operation();
if (operation instanceof Query) {
unregisterQueryCall((ApolloQueryCall) call);
} else if (operation instanceof Mutation) {
unregisterMutationCall((ApolloMutationCall) call);
} else {
throw new IllegalArgumentException("Unknown call type");
}
}
Aggregations