Search in sources :

Example 1 with OperationName

use of com.apollographql.apollo.api.OperationName in project apollo-android by apollographql.

the class ApolloCallTracker method unregisterPrefetchCall.

/**
 * <p>Removes provided {@link ApolloPrefetch} 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 a prefetch call is completed (whether successful or
 * failed).</p>
 */
void unregisterPrefetchCall(@Nonnull ApolloPrefetch apolloPrefetch) {
    checkNotNull(apolloPrefetch, "apolloPrefetch == null");
    OperationName operationName = apolloPrefetch.operation().name();
    unregisterCall(activePrefetchCalls, operationName, apolloPrefetch);
}
Also used : OperationName(com.apollographql.apollo.api.OperationName)

Example 2 with OperationName

use of com.apollographql.apollo.api.OperationName in project apollo-android by apollographql.

the class ApolloCallTracker method registerMutationCall.

/**
 * <p>Adds provided {@link ApolloMutationCall} that is currently in progress.</p>
 *
 * <p><b>Note</b>: This method needs to be called right before an apolloCall is executed.</p>
 */
void registerMutationCall(@Nonnull ApolloMutationCall apolloMutationCall) {
    checkNotNull(apolloMutationCall, "apolloMutationCall == null");
    OperationName operationName = apolloMutationCall.operation().name();
    registerCall(activeMutationCalls, operationName, apolloMutationCall);
}
Also used : OperationName(com.apollographql.apollo.api.OperationName)

Example 3 with OperationName

use of com.apollographql.apollo.api.OperationName in project apollo-android by apollographql.

the class ApolloCallTracker method unregisterMutationCall.

/**
 * <p>Removes provided {@link ApolloMutationCall} 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 unregisterMutationCall(@Nonnull ApolloMutationCall apolloMutationCall) {
    checkNotNull(apolloMutationCall, "apolloMutationCall == null");
    OperationName operationName = apolloMutationCall.operation().name();
    unregisterCall(activeMutationCalls, operationName, apolloMutationCall);
}
Also used : OperationName(com.apollographql.apollo.api.OperationName)

Example 4 with OperationName

use of com.apollographql.apollo.api.OperationName in project apollo-android by apollographql.

the class ResponseFetcherTest method setUp.

@Before
public void setUp() {
    okHttpClient = new OkHttpClient.Builder().build();
    emptyQuery = new Query() {

        OperationName operationName = new OperationName() {

            @Override
            public String name() {
                return "emptyQuery";
            }
        };

        @Override
        public String queryDocument() {
            return "";
        }

        @Override
        public Variables variables() {
            return EMPTY_VARIABLES;
        }

        @Override
        public ResponseFieldMapper<Data> responseFieldMapper() {
            return new ResponseFieldMapper<Data>() {

                @Override
                public Data map(ResponseReader responseReader) {
                    return null;
                }
            };
        }

        @Nonnull
        @Override
        public OperationName name() {
            return operationName;
        }

        @Nonnull
        @Override
        public String operationId() {
            return "";
        }

        @Override
        public Object wrapData(Data data) {
            return data;
        }
    };
}
Also used : ResponseFieldMapper(com.apollographql.apollo.api.ResponseFieldMapper) Query(com.apollographql.apollo.api.Query) OperationName(com.apollographql.apollo.api.OperationName) Nonnull(javax.annotation.Nonnull) ResponseReader(com.apollographql.apollo.api.ResponseReader) Before(org.junit.Before)

Example 5 with OperationName

use of com.apollographql.apollo.api.OperationName in project apollo-android by apollographql.

the class ApolloCallTracker method registerQueryCall.

/**
 * <p>Adds provided {@link ApolloQueryCall} that is currently in progress.</p>
 *
 * <p><b>Note</b>: This method needs to be called right before an apolloCall is executed.</p>
 */
void registerQueryCall(@Nonnull ApolloQueryCall apolloQueryCall) {
    checkNotNull(apolloQueryCall, "apolloQueryCall == null");
    OperationName operationName = apolloQueryCall.operation().name();
    registerCall(activeQueryCalls, operationName, apolloQueryCall);
}
Also used : OperationName(com.apollographql.apollo.api.OperationName)

Aggregations

OperationName (com.apollographql.apollo.api.OperationName)10 Query (com.apollographql.apollo.api.Query)2 ResponseFieldMapper (com.apollographql.apollo.api.ResponseFieldMapper)2 ResponseReader (com.apollographql.apollo.api.ResponseReader)2 Nonnull (javax.annotation.Nonnull)2 Before (org.junit.Before)2