Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Created August 1, 2019 18:55
Show Gist options
  • Save Lavanyagaur22/704baa0b7b098139249420d38681a926 to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/704baa0b7b098139249420d38681a926 to your computer and use it in GitHub Desktop.
//Create a mutation object
Mutation mutation = UpdateCurrentTaskMutation.builder().id(id).title(title).version(version).build();
//Create an object of apolloCall
ApolloMutationCall<UpdateCurrentTaskMutation.Data> client = apolloClient.mutate(mutation)
.refetchQueries(apolloQueryWatcher.operation().name());
//Create a callback object of type ResponseCallback
ResponseCallback customCallback = new ResponseCallback(){
@Override
public void onSuccess(@NotNull Response<Object> response) {
//Perform UI bindings accordingly.
}
/* Called when the request could not be executed due to cancellation, a connectivity problem or timeout.
*/
@Override
public void onSchedule(@NotNull ApolloException e, @NotNull Mutation<Operation.Data, Object, Operation.Variables> mutation) {
//Perform UI bindings accordingly.
}
};
/* Call the enqueue function present in the file Offix which takes in 3 parameters:
1. apollo client
2. mutation object
3. ResponseCallback object
*/
Offix.enqueue(apolloClient, mutation, customCallback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment