Last active
August 1, 2019 18:54
-
-
Save Lavanyagaur22/85ee53795bd019444950fe5b24af8b23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a mutation object | |
val mutation = UpdateCurrentTaskMutation.builder().id(id).title(title).version(version).build() | |
//Create an object of apolloCall | |
val client = apolloClient.mutate(mutation)?.refetchQueries(apolloQueryWatcher?.operation()?.name()) | |
//Create a callback object of type ResponseCallback | |
val customCallback = object : ResponseCallback { | |
override fun onSuccess(response: Response<Any>) { | |
//Perform UI bindings accordingly. | |
} | |
/* Called when the request could not be executed due to cancellation, a connectivity problem or timeout. | |
*/ | |
override fun onSchedule(e: ApolloException, mutation: Mutation<Operation.Data, Any, Operation.Variables>) { | |
e.printStackTrace() | |
//Perferm local UI Bindings | |
} | |
} | |
/*Call the enqueue function on ApolloClient and pass in two parameters : | |
1. mutation object typecasted as mutation as | |
com.apollographql.apollo.api.Mutation<Operation.Data, Any, Operation.Variables> | |
2. customCallback | |
*/ | |
apolloClient.enqueue( | |
mutation as com.apollographql.apollo.api.Mutation<Operation.Data, Any, Operation.Variables>, | |
customCallback | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment