Search in sources :

Example 1 with AppSyncMutationCall

use of com.amazonaws.mobileconnectors.appsync.AppSyncMutationCall in project aws-mobile-appsync-sdk-android by awslabs.

the class ApolloCallTracker method registerCall.

/**
 * <p>Adds provided {@link GraphQLCall} 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 GraphQLCall call) {
    checkNotNull(call, "call == null");
    Operation operation = call.operation();
    if (operation instanceof Query) {
        registerQueryCall((AppSyncQueryCall) call);
    } else if (operation instanceof Mutation) {
        registerMutationCall((AppSyncMutationCall) call);
    } else if (operation instanceof Subscription) {
    } else {
        throw new IllegalArgumentException("Unknown call type");
    }
}
Also used : Query(com.apollographql.apollo.api.Query) AppSyncMutationCall(com.amazonaws.mobileconnectors.appsync.AppSyncMutationCall) Operation(com.apollographql.apollo.api.Operation) Mutation(com.apollographql.apollo.api.Mutation) Subscription(com.apollographql.apollo.api.Subscription)

Example 2 with AppSyncMutationCall

use of com.amazonaws.mobileconnectors.appsync.AppSyncMutationCall in project aws-mobile-appsync-sdk-android by awslabs.

the class ApolloCallTracker method unregisterCall.

/**
 * <p>Removes provided {@link GraphQLCall} 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 GraphQLCall call) {
    checkNotNull(call, "call == null");
    Operation operation = call.operation();
    if (operation instanceof Query) {
        unregisterQueryCall((AppSyncQueryCall) call);
    } else if (operation instanceof Mutation) {
        unregisterMutationCall((AppSyncMutationCall) call);
    } else if (operation instanceof Subscription) {
    } else {
        throw new IllegalArgumentException("Unknown call type");
    }
}
Also used : Query(com.apollographql.apollo.api.Query) AppSyncMutationCall(com.amazonaws.mobileconnectors.appsync.AppSyncMutationCall) Operation(com.apollographql.apollo.api.Operation) Mutation(com.apollographql.apollo.api.Mutation) Subscription(com.apollographql.apollo.api.Subscription)

Aggregations

AppSyncMutationCall (com.amazonaws.mobileconnectors.appsync.AppSyncMutationCall)2 Mutation (com.apollographql.apollo.api.Mutation)2 Operation (com.apollographql.apollo.api.Operation)2 Query (com.apollographql.apollo.api.Query)2 Subscription (com.apollographql.apollo.api.Subscription)2