Search in sources :

Example 1 with ApolloMutationCall

use of com.apollographql.apollo.ApolloMutationCall 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");
    }
}
Also used : ApolloMutationCall(com.apollographql.apollo.ApolloMutationCall) Query(com.apollographql.apollo.api.Query) Operation(com.apollographql.apollo.api.Operation) Mutation(com.apollographql.apollo.api.Mutation)

Example 2 with ApolloMutationCall

use of com.apollographql.apollo.ApolloMutationCall 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");
    }
}
Also used : ApolloMutationCall(com.apollographql.apollo.ApolloMutationCall) Query(com.apollographql.apollo.api.Query) Operation(com.apollographql.apollo.api.Operation) Mutation(com.apollographql.apollo.api.Mutation)

Aggregations

ApolloMutationCall (com.apollographql.apollo.ApolloMutationCall)2 Mutation (com.apollographql.apollo.api.Mutation)2 Operation (com.apollographql.apollo.api.Operation)2 Query (com.apollographql.apollo.api.Query)2