Search in sources :

Example 6 with OperationName

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

the class ApolloCallTracker method registerQueryWatcher.

/**
 * <p>Adds provided {@link ApolloQueryWatcher} that is currently in progress.</p>
 *
 * <p><b>Note</b>: This method needs to be called right before
 * {@link ApolloQueryWatcher#enqueueAndWatch(ApolloCall.Callback)}.</p>
 */
void registerQueryWatcher(@Nonnull ApolloQueryWatcher queryWatcher) {
    checkNotNull(queryWatcher, "queryWatcher == null");
    OperationName operationName = queryWatcher.operation().name();
    registerCall(activeQueryWatchers, operationName, queryWatcher);
}
Also used : OperationName(com.apollographql.apollo.api.OperationName)

Example 7 with OperationName

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

the class ApolloCallTracker method unregisterQueryWatcher.

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

Example 8 with OperationName

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

the class ApolloCallTracker method unregisterQueryCall.

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

Example 9 with OperationName

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

the class ApolloCallTracker method registerPrefetchCall.

/**
 * <p>Adds provided {@link ApolloPrefetch} that is currently in progress.</p>
 *
 * <p><b>Note</b>: This method needs to be called right before a prefetch call is executed.</p>
 */
void registerPrefetchCall(@Nonnull ApolloPrefetch apolloPrefetch) {
    checkNotNull(apolloPrefetch, "apolloPrefetch == null");
    OperationName operationName = apolloPrefetch.operation().name();
    registerCall(activePrefetchCalls, operationName, apolloPrefetch);
}
Also used : OperationName(com.apollographql.apollo.api.OperationName)

Example 10 with OperationName

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

the class ApolloExceptionTest method setUp.

@Before
public void setUp() {
    apolloClient = ApolloClient.builder().serverUrl(server.url("/")).okHttpClient(new OkHttpClient.Builder().connectTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS).readTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS).build()).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)

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