.responseFetcher(fetchPolicy) .enqueue(cb);
/** * <p>Adds provided {@link AppSyncQueryCall} 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 AppSyncQueryCall appSyncQueryCall) { checkNotNull(appSyncQueryCall, "appSyncQueryCall == null"); OperationName operationName = appSyncQueryCall.operation().name(); registerCall(activeQueryCalls, operationName, appSyncQueryCall); }
.responseFetcher(AppSyncResponseFetchers.NETWORK_ONLY) .enqueue(dcb);
/** * <p>Adds provided {@link AppSyncQueryCall} 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 AppSyncQueryCall appSyncQueryCall) { checkNotNull(appSyncQueryCall, "appSyncQueryCall == null"); OperationName operationName = appSyncQueryCall.operation().name(); registerCall(activeQueryCalls, operationName, appSyncQueryCall); }
private void queryPosts(AWSAppSyncClient awsAppSyncClient, final ResponseFetcher responseFetcher) { final CountDownLatch queryCountDownLatch = new CountDownLatch(1); Log.d(TAG, "Calling Query AllPosts"); awsAppSyncClient.query(AllPostsQuery.builder().build()) .responseFetcher(responseFetcher) .enqueue(new GraphQLCall.Callback<AllPostsQuery.Data>() { @Override public void onResponse(@Nonnull final Response<AllPostsQuery.Data> response) { queryCountDownLatch.countDown(); } @Override public void onFailure(@Nonnull ApolloException e) { e.printStackTrace(); //Set to null to indicate failure queryCountDownLatch.countDown(); } }); try { queryCountDownLatch.await(); } catch (InterruptedException iex) { iex.printStackTrace(); } }
/** * <p>Removes provided {@link AppSyncQueryCall} 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 AppSyncQueryCall appSyncQueryCall) { checkNotNull(appSyncQueryCall, "appSyncQueryCall == null"); OperationName operationName = appSyncQueryCall.operation().name(); unregisterCall(activeQueryCalls, operationName, appSyncQueryCall); }
private void queryPost( AWSAppSyncClient awsAppSyncClient, final ResponseFetcher responseFetcher, final String id) { final CountDownLatch queryCountDownLatch = new CountDownLatch(1); Log.d(TAG, "Calling Query GetPost"); awsAppSyncClient.query(GetPostQuery.builder().id(id).build()) .responseFetcher(responseFetcher) .enqueue(new GraphQLCall.Callback<GetPostQuery.Data>() { @Override public void onResponse(@Nonnull Response<GetPostQuery.Data> response) { getPostQueryResponse = response; queryCountDownLatch.countDown(); } @Override public void onFailure(@Nonnull ApolloException e) { e.printStackTrace(); //Set to null to indicate failure getPostQueryResponse = null; queryCountDownLatch.countDown(); } }); try { queryCountDownLatch.await(); } catch (InterruptedException iex) { iex.printStackTrace(); } }
/** * <p>Removes provided {@link AppSyncQueryCall} 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 AppSyncQueryCall appSyncQueryCall) { checkNotNull(appSyncQueryCall, "appSyncQueryCall == null"); OperationName operationName = appSyncQueryCall.operation().name(); unregisterCall(activeQueryCalls, operationName, appSyncQueryCall); }